Esempio n. 1
0
 /**
  * Set attributes
  *
  * @param array $attributes
  * @return null
  */
 function setAttributes($attributes)
 {
     if ($this->old_name === false) {
         $this->old_name = $this->getName();
     }
     // if
     if ($this->old_body === false) {
         $this->old_body = $this->getBody();
     }
     // if
     return parent::setAttributes($attributes);
 }
 /**
  * Set record properties based on form / API attributes array
  *
  * @param array $attributes
  * @return null
  */
 function setAttributes($attributes)
 {
     // Compatibility code: In activeCollab 1.1.5 is_billable and is_billed
     // were replaced with billable_status field. This code maintains API
     // compatibility with the old, activeCollab 1.1.4 behavior
     if ((isset($attributes['is_billable']) || isset($attributes['is_billed'])) && !isset($attributes['billable_status'])) {
         if (array_var($attributes, 'is_billable')) {
             $attributes['billable_status'] = array_var($attributes, 'is_billed') ? BILLABLE_STATUS_BILLED : BILLABLE_STATUS_BILLABLE;
         } else {
             $attributes['billable_status'] = BILLABLE_STATUS_NOT_BILLABLE;
         }
         // if
         if (isset($attributes['is_billable'])) {
             unset($attributes['is_billable']);
         }
         // if
         if (isset($attributes['is_billed'])) {
             unset($attributes['is_billed']);
         }
         // if
     }
     // if
     parent::setAttributes($attributes);
 }