/**
  * Does this form hold valid data for this change?
  * @param CHANGE $obj
  * @access private
  */
 protected function _post_validate($obj)
 {
     parent::_post_validate($obj);
     if (!$this->value_for('title') && !$this->value_for('description')) {
         $this->record_error('title', 'Please provide a title or description.');
     }
 }
示例#2
0
 /**
  * Called after fields are validated.
  * @param JOB $obj Object being validated.
  * @access private
  */
 protected function _post_validate($obj)
 {
     parent::_post_validate($obj);
     foreach ($this->branches as $branch) {
         if ($this->value_for("branch_{$branch->id}_enabled")) {
             $branch_status = $this->value_for("branch_{$branch->id}_status");
             $branch_release_id = $this->value_for("branch_{$branch->id}_release_id");
             if ($branch_release_id) {
                 $release_query = $branch->release_query();
                 $release = $release_query->object_at_id($branch_release_id);
                 if (!$release->planned()) {
                     /** @var $options PROJECT_APPLICATION_DISPLAY_OPTIONS */
                     $options = $this->app->display_options;
                     $statuses = $options->job_statuses();
                     $status = $statuses[$branch_status];
                     if ($status->kind == Job_status_kind_open) {
                         $this->record_error("branch_{$branch->id}_release_id", 'Cannot assign open jobs to a shipped release.');
                     }
                 }
             }
         }
     }
 }