Skip to content

Commit

Permalink
Merge pull request #620 from nvidela/mesas_examen_graduada
Browse files Browse the repository at this point in the history
modificaciones en mesas de examen graduada
  • Loading branch information
nvidela authored Mar 3, 2020
2 parents d9f39a1 + 892587f commit c99f365
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.5.6
3.5.7
16 changes: 6 additions & 10 deletions lib/form/CourseSubjectStudentExaminationForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,14 @@ public function configure()
if(! $configuration->isNumericalMark())
{
$letter_mark = LetterMarkPeer::getLetterMarkByValue((Int)$this->getObject()->getMark());
$letter_list = LetterMarkPeer::doSelect(new Criteria());
$choices = array();
foreach( $letter_list as $l ){
$choices[$l->getValue()] = $l->getLetter();
}
$this->setWidget('mark', new sfWidgetFormSelect(array('choices' => $choices)));

$this->setWidget('mark', new sfWidgetFormPropelChoice(array('model' => 'LetterMark', 'key_method' => 'getValue', 'add_empty' => true)));

if(!is_null($letter_mark)) {
$this->setDefault('mark', $letter_mark->getValue());
}
$this->setDefault("mark", $letter_mark->getValue());
}

$this->setValidator('mark', new sfValidatorChoice(array('choices' => array_keys($choices))));
$this->setValidator('mark',new sfValidatorPropelChoice(array('model' => 'LetterMark','column' => 'value', 'required' => false)));
}
else
{
Expand All @@ -91,7 +87,7 @@ public function configure()

public function validateAbsence($validator, $values)
{
if ($values["is_absent"] && !is_null($values["mark"]))
if (($values["is_absent"] && $values["mark"] != '') || ($values["is_absent"] && !is_null($values["mark"])))
{
throw new sfValidatorError($validator, "The student can't be absent and have a mark.");
}
Expand Down

0 comments on commit c99f365

Please sign in to comment.