Example #1
0
 public function update($pa_options = null)
 {
     if (!$this->get('displayname')) {
         $this->set('displayname', trim(preg_replace('![ ]+!', ' ', $this->get('forename') . ' ' . $this->get('middlename') . ' ' . $this->get('surname'))));
     }
     return parent::update($pa_options);
 }
Example #2
0
 public function update($pa_options = null)
 {
     if (!trim($this->get('surname')) && !trim($this->get('forename'))) {
         $this->postError(1100, _t('Surname or forename must be set'), 'ca_entity_labels->insert()');
         return false;
     }
     if (!$this->get('displayname')) {
         $this->set('displayname', trim(preg_replace('![ ]+!', ' ', $this->get('forename') . ' ' . $this->get('middlename') . ' ' . $this->get('surname'))));
     }
     return parent::update($pa_options);
 }
 public function update($pa_options = null)
 {
     if (!trim($this->get('surname')) && !trim($this->get('forename'))) {
         $this->postError(1100, _t('Surname or forename must be set'), 'ca_entity_labels->insert()');
         return false;
     }
     if (($t_entity = caGetOption('subject', $pa_options, null)) && $t_entity->getTypeSetting('entity_class') == 'ORG') {
         $this->set('displayname', $this->get('surname'));
     } elseif (!$this->get('displayname')) {
         $this->set('displayname', trim(preg_replace('![ ]+!', ' ', $this->get('forename') . ' ' . $this->get('middlename') . ' ' . $this->get('surname'))));
     }
     return parent::update($pa_options);
 }