Fix negative value rule see BT#12133

remotes/angel/1.11.x
jmontoyaa 8 years ago
parent 088769224c
commit dcac4b43d2
  1. 11
      main/gradebook/lib/fe/evalform.class.php
  2. 11
      main/gradebook/lib/fe/linkaddeditform.class.php

@ -555,7 +555,16 @@ class EvalForm extends FormValidator
$this->addRule('hid_category_id', get_lang('ThisFieldIsRequired'), 'required');
$this->addElement('checkbox', 'visible', null, get_lang('Visible'));
$this->addRule('max', get_lang('OnlyNumbers'), 'numeric');
$this->addRule('max', get_lang('NegativeValue'), 'compare', '>=');
$this->addRule(
'max',
get_lang('NegativeValue'),
'compare',
'>=',
'server',
false,
false,
0
);
$setting = api_get_setting('tool_visible_by_default_at_creation');
$visibility_default = 1;
if (isset($setting['gradebook']) && $setting['gradebook'] == 'false') {

@ -152,7 +152,16 @@ class LinkAddEditForm extends FormValidator
} else {
$this->addText('max', get_lang('QualificationNumeric'), true, array('size' => '4', 'maxlength' => '5'));
$this->addRule('max', get_lang('OnlyNumbers'), 'numeric');
$this->addRule('max', get_lang('NegativeValue'), 'compare', '>=');
$this->addRule(
'max',
get_lang('NegativeValue'),
'compare',
'>=',
'server',
false,
false,
0
);
}
if ($form_type == self::TYPE_EDIT) {
$defaults['max'] = $link->get_max();

Loading…
Cancel
Save