コード例 #1
0
 protected function preSubmit()
 {
     if (array_key_exists('verified_status', $this->submission['fields'])) {
         $rs = $this->submission['fields']['verified_status']['value'];
         // If we are making it verified in the submitted data, but we don't already have a verifier in
         // the database
         if ($rs == 'V' && !$this->verified_by_id) {
             $defaultUserId = Kohana::config('indicia.defaultPersonId');
             // Set the verifier to the logged in user, or the default user ID from config if not logged
             // into Warehouse, if it is not in the submission
             if (!array_key_exists('verified_by_id', $this->submission['fields'])) {
                 $this->submission['fields']['verified_by_id']['value'] = isset($_SESSION['auth_user']) ? $_SESSION['auth_user'] : $defaultUserId;
             }
             // and store the date of the verification event if not specified.
             if (!array_key_exists('verified_on', $this->submission['fields'])) {
                 $this->submission['fields']['verified_on']['value'] = date("Ymd H:i:s");
             }
         } else {
             // Completed or in progress data not verified
             $this->submission['fields']['verified_by_id']['value'] = '';
             $this->submission['fields']['verified_on']['value'] = '';
         }
     }
     parent::preSubmit();
 }
コード例 #2
0
ファイル: taxon.php プロジェクト: BirenRathod/indicia-code
 protected function preSubmit()
 {
     // Call the parent preSubmit function
     parent::preSubmit();
     // Set scientific if latin
     $l = ORM::factory('language');
     $sci = 'f';
     /*if ($l->find($this->submission['fields']['language_id']['value'])->iso == "lat") {
         $sci = 't';
       }*/
     $this->submission['fields']['scientific'] = array('value' => $sci);
 }
コード例 #3
0
ファイル: person.php プロジェクト: BirenRathod/indicia-code
 public function preSubmit()
 {
     if (isset($this->submission['fields']['email_address'])) {
         if ($this->submission['fields']['email_address']['value'] == '') {
             $this->submission['fields']['email_address']['value'] = NULL;
         }
     }
     if (isset($this->submission['fields']['title_id'])) {
         if (!is_numeric($this->submission['fields']['title_id']['value'])) {
             $this->submission['fields']['title_id']['value'] = NULL;
         }
     }
     return parent::preSubmit();
 }
コード例 #4
0
ファイル: user.php プロジェクト: BirenRathod/indicia-code
 public function preSubmit()
 {
     if (isset($this->submission['fields']['core_role_id'])) {
         if (!is_numeric($this->submission['fields']['core_role_id']['value'])) {
             $this->submission['fields']['core_role_id']['value'] = NULL;
         }
     }
     // Set boolean field defaults as not in form submission if not checked. This is not required if the view is
     // switched to the data_entry_helper controls.
     $this->submission['fields']['email_visible'] = array('value' => isset($this->submission['fields']['email_visible']) ? 't' : 'f');
     $this->submission['fields']['view_common_names'] = array('value' => isset($this->submission['fields']['view_common_names']) ? 't' : 'f');
     $this->submission['fields']['allow_share_for_reporting'] = array('value' => isset($this->submission['fields']['allow_share_for_reporting']) ? 't' : 'f');
     $this->submission['fields']['allow_share_for_peer_review'] = array('value' => isset($this->submission['fields']['allow_share_for_peer_review']) ? 't' : 'f');
     $this->submission['fields']['allow_share_for_verification'] = array('value' => isset($this->submission['fields']['allow_share_for_verification']) ? 't' : 'f');
     $this->submission['fields']['allow_share_for_data_flow'] = array('value' => isset($this->submission['fields']['allow_share_for_data_flow']) ? 't' : 'f');
     $this->submission['fields']['allow_share_for_moderation'] = array('value' => isset($this->submission['fields']['allow_share_for_moderation']) ? 't' : 'f');
     // Ensure that the website fields remain available (as they are not proper model columns so get
     // stripped from the model).
     $this->droppedFields = array_diff_key($this->submission['fields'], $this->table_columns);
     return parent::preSubmit();
 }
コード例 #5
0
 protected function preSubmit()
 {
     //If determination logging is on and the occurrence species has changed ($logDetermination is true), we can
     //set the determiner_id on the occurrence to the current user providing easy login is on ($currentUserId!==1).
     if ($this->logDetermination) {
         $currentUserId = $this->get_current_user_id();
         if ($currentUserId !== 1) {
             $this->submission['fields']['determiner_id']['value'] = $currentUserId;
         }
     }
     if (array_key_exists('record_status', $this->submission['fields'])) {
         $rs = $this->submission['fields']['record_status']['value'];
         // If we are making it verified in the submitted data, but we don't already have a verifier in
         // the database
         if (($rs == 'V' || $rs == 'R') && !$this->verified_by_id) {
             $defaultUserId = Kohana::config('indicia.defaultPersonId');
             // Set the verifier to the logged in user, or the default user ID from config if not logged
             // into Warehouse, if it is not in the submission
             if (!array_key_exists('verified_by_id', $this->submission['fields'])) {
                 $this->submission['fields']['verified_by_id']['value'] = isset($_SESSION['auth_user']) ? $_SESSION['auth_user'] : $defaultUserId;
             }
             // and store the date of the verification event if not specified.
             if (!array_key_exists('verified_on', $this->submission['fields'])) {
                 $this->submission['fields']['verified_on']['value'] = date("Ymd H:i:s");
             }
         } elseif ($rs == 'C' || $rs == 'I') {
             // Completed or in progress data not verified
             $this->submission['fields']['verified_by_id']['value'] = '';
             $this->submission['fields']['verified_on']['value'] = '';
         }
     }
     parent::preSubmit();
 }