예제 #1
0
 /**
  * convert remark to array if json encoded
  * 
  * @see Tinebase_Record_Abstract::setFromArray
  *
  * @param array $_data            the new data to set
  * 
  * @todo    always json::encode remarks? / add options field that is always json encoded
  */
 public function setFromArray(array $_data)
 {
     parent::setFromArray($_data);
     if ($this->remark && is_string($this->remark) && strpos($this->remark, '{') === 0) {
         $this->remark = Zend_Json::decode($this->remark);
     }
 }
예제 #2
0
 public function setFromArray(array $_data)
 {
     if (empty($_data['termination_date']) || $_data['termination_date'] == "") {
         unset($_data['termination_date']);
     }
     parent::setFromArray($_data);
 }
예제 #3
0
 public function setFromArray(array $_data)
 {
     if (empty($_data['job_id']) || $_data['job_id'] == "") {
         unset($_data['job_id']);
     }
     parent::setFromArray($_data);
 }
예제 #4
0
 /**
  * sets the record related properties from user generated input.
  * 
  * Input-filtering and validation by Zend_Filter_Input can enabled and disabled
  *
  * @param array $_data            the new data to set
  * @throws Tinebase_Exception_Record_Validation when content contains invalid or missing data
  */
 public function setFromArray(array $_data)
 {
     if (isset($_data['filters']) && !$_data['filters'] instanceof Tinebase_Model_Filter_FilterGroup) {
         $_data['filters'] = $this->getFilterGroup($_data['model'], $_data['filters']);
     }
     return parent::setFromArray($_data);
 }
 /**
  * (non-PHPdoc)
  * @see tine20/Tinebase/Record/Abstract::setFromArray()
  */
 public function setFromArray(array $_data)
 {
     if (isset($_data['records']) && is_array($_data['records'])) {
         $_data['records'] = new Tinebase_Record_RecordSet($this->_keyFieldRecordModel, $_data['records'], TRUE);
     }
     parent::setFromArray($_data);
 }
 /**
  * (non-PHPdoc)
  * @see Tinebase/Record/Tinebase_Record_Abstract#setFromArray($_data)
  */
 public function setFromArray(array $_data)
 {
     parent::setFromArray($_data);
     // always set url here (or is there a better place?)
     if ($this->getId()) {
         $this->url = $this->getDownloadUrl();
     }
 }
 /**
  * (non-PHPdoc)
  * @see Tinebase/Record/Tinebase_Record_Abstract#setFromArray($_data)
  */
 public function setFromArray(array $_data)
 {
     parent::setFromArray($_data);
     // always set url here (or is there a better place?)
     if ($this->getId()) {
         $this->url = Tinebase_Core::getHostname() . '/download/show/' . $this->getId();
     }
 }
 /**
  * sets the record related properties from user generated input.
  * 
  * Input-filtering and validation by Zend_Filter_Input can enabled and disabled
  *
  * @param array $_data            the new data to set
  */
 public function setFromArray(array $_data)
 {
     foreach (array('emailForwards', 'emailAliases') as $arrayField) {
         if (isset($_data[$arrayField]) && !is_array($_data[$arrayField])) {
             $_data[$arrayField] = explode(',', preg_replace('/ /', '', $_data[$arrayField]));
         }
     }
     parent::setFromArray($_data);
 }
예제 #9
0
 public function setFromArray(array $_data)
 {
     if (empty($_data['creditor_id']) || $_data['creditor_id'] == "") {
         unset($_data['creditor_id']);
     }
     if (empty($_data['debitor_id']) || $_data['debitor_id'] == "") {
         unset($_data['debitor_id']);
     }
     parent::setFromArray($_data);
 }
예제 #10
0
 public function setFromArray(array $_data)
 {
     if (empty($_data['receipt_id']) || $_data['receipt_id'] == "") {
         unset($_data['receipt_id']);
     }
     if (empty($_data['booking_receipt_date']) || $_data['booking_receipt_date'] == "") {
         unset($_data['booking_receipt_date']);
     }
     parent::setFromArray($_data);
 }
예제 #11
0
 public function setFromArray(array $_data)
 {
     if (empty($_data['signature_date']) || $_data['signature_date'] == "") {
         $_data['signature_date'] = null;
     }
     if (empty($_data['last_usage_date']) || $_data['last_usage_date'] == "") {
         unset($_data['last_usage_date']);
     }
     parent::setFromArray($_data);
 }
예제 #12
0
 public function setFromArray(array $_data)
 {
     if (empty($_data['begin_date']) || $_data['begin_date'] == "") {
         unset($_data['begin_date']);
     }
     if (empty($_data['end_date']) || $_data['end_date'] == "") {
         unset($_data['end_date']);
     }
     parent::setFromArray($_data);
 }
예제 #13
0
 public function setFromArray(array $_data)
 {
     if (empty($_data['due_date']) || $_data['due_date'] == "") {
         unset($_data['due_date']);
     }
     if (empty($_data['payment_date']) || $_data['payment_date'] == "") {
         unset($_data['payment_date']);
     }
     parent::setFromArray($_data);
 }
 /**
  * (non-PHPdoc)
  * @see tine20/Tinebase/Record/Abstract.php::setFromArray()
  */
 public function setFromArray(array $_data)
 {
     if (isset($_data['definition']) || array_key_exists('definition', $_data)) {
         if (is_string($_data['definition'])) {
             $_data['definition'] = Zend_Json::decode($_data['definition']);
         }
         if (is_array($_data['definition'])) {
             $_data['definition'] = new Tinebase_Config_Struct($_data['definition']);
         }
     }
     return parent::setFromArray($_data);
 }
 /**
  * (non-PHPdoc)
  * @see Tinebase_Record_Abstract::setFromArray()
  */
 public function setFromArray(array $_data)
 {
     parent::setFromArray($_data);
     // sanitize members (could be an array of user arrays -> expecting to contain only ids)
     if (isset($this->members) && is_array($this->members) && count($this->members) > 0 && is_array($this->members[0])) {
         $memberIds = array();
         foreach ($this->members as $member) {
             $memberIds[] = $member['id'];
         }
         $this->members = $memberIds;
     }
 }
예제 #16
0
 public function setFromArray(array $_data)
 {
     if (empty($_data['fibu_exp_date']) || $_data['fibu_exp_date'] == "") {
         unset($_data['fibu_exp_date']);
     }
     if (empty($_data['banking_exp_date']) || $_data['banking_exp_date'] == "") {
         unset($_data['banking_exp_date']);
     }
     if (empty($_data['last_monition_date']) || $_data['last_monition_date'] == "") {
         unset($_data['last_monition_date']);
     }
     parent::setFromArray($_data);
 }
예제 #17
0
 public function setFromArray(array $_data)
 {
     if (empty($_data['fibu_exp_date']) || $_data['fibu_exp_date'] == "") {
         $_data['fibu_exp_date'] = null;
     }
     if (empty($_data['order_lock_date']) || $_data['order_lock_date'] == "") {
         $_data['order_lock_date'] = null;
     }
     if (empty($_data['monition_lock_date']) || $_data['monition_lock_date'] == "") {
         $_data['monition_lock_date'] = null;
     }
     parent::setFromArray($_data);
 }
 /**
  * sets the record related properties from user generated input.
  * 
  * Input-filtering and validation by Zend_Filter_Input can enabled and disabled
  *
  * @param array $_data            the new data to set
  */
 public function setFromArray(array $_data)
 {
     if (isset($_data['filters']) && !$_data['filters'] instanceof Tinebase_Model_Filter_FilterGroup) {
         try {
             $_data['filters'] = $this->getFilterGroup($_data['model'], $_data['filters']);
         } catch (Tinebase_Exception_NotFound $tenf) {
             if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
                 Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Sort out missing ' . $_data['model'] . ' filter: ' . $tenf->getMessage());
             }
         }
     }
     return parent::setFromArray($_data);
 }
예제 #19
0
 public function setFromArray(array $_data)
 {
     if (empty($_data['job_id']) || $_data['job_id'] == "") {
         unset($_data['job_id']);
     }
     if (empty($_data['confirm_date']) || $_data['confirm_date'] == "") {
         unset($_data['confirm_date']);
     }
     if (empty($_data['payment_until_date']) || $_data['payment_until_date'] == "") {
         unset($_data['payment_until_date']);
     }
     parent::setFromArray($_data);
 }
예제 #20
0
 public function setFromArray(array $_data)
 {
     if (empty($_data['order_nr']) || $_data['order_nr'] == "") {
         unset($_data['order_nr']);
     }
     if (empty($_data['supplier_order_nr']) || $_data['supplier_order_nr'] == "") {
         unset($_data['supplier_order_nr']);
     }
     if (empty($_data['supply_request_nr']) || $_data['supply_request_nr'] == "") {
         unset($_data['supply_request_nr']);
     }
     if (empty($_data['supply_offer_nr']) || $_data['supply_offer_nr'] == "") {
         unset($_data['supply_offer_nr']);
     }
     if (empty($_data['supply_order_nr']) || $_data['supply_order_nr'] == "") {
         unset($_data['supply_order_nr']);
     }
     if (empty($_data['supply_inc_inv_nr']) || $_data['supply_inc_inv_nr'] == "") {
         unset($_data['supply_inc_inv_nr']);
     }
     if (empty($_data['request_date']) || $_data['request_date'] == "") {
         unset($_data['request_date']);
     }
     if (empty($_data['offer_date']) || $_data['offer_date'] == "") {
         unset($_data['offer_date']);
     }
     if (empty($_data['offer_shipping_date']) || $_data['offer_shipping_date'] == "") {
         unset($_data['offer_shipping_date']);
     }
     if (empty($_data['order_shipping_date']) || $_data['order_shipping_date'] == "") {
         unset($_data['order_shipping_date']);
     }
     if (empty($_data['shipping_date']) || $_data['shipping_date'] == "") {
         unset($_data['shipping_date']);
     }
     if (empty($_data['order_confirm_date']) || $_data['order_confirm_date'] == "") {
         unset($_data['order_confirm_date']);
     }
     if (empty($_data['order_date']) || $_data['order_date'] == "") {
         unset($_data['order_date']);
     }
     if (empty($_data['inc_invoice_date']) || $_data['inc_invoice_date'] == "") {
         unset($_data['inc_invoice_date']);
     }
     if (empty($_data['inc_invoice_postal_date']) || $_data['inc_invoice_postal_date'] == "") {
         unset($_data['inc_invoice_postal_date']);
     }
     parent::setFromArray($_data);
 }
예제 #21
0
 public function setFromArray(array $_data)
 {
     if (empty($_data['article_id']) || $_data['article_id'] == "") {
         unset($_data['article_id']);
     }
     if (empty($_data['order_id']) || $_data['order_id'] == "") {
         unset($_data['order_id']);
     }
     if (empty($_data['weight']) || $_data['weight'] == "") {
         $_data['weight'] = 0;
     }
     if (empty($_data['total_weight']) || $_data['total_weight'] == "") {
         $_data['total_weight'] = 0;
     }
     parent::setFromArray($_data);
 }
예제 #22
0
 public function setFromArray(array $_data)
 {
     if (empty($_data['weight']) || $_data['weight'] == "") {
         unset($_data['weight']);
     }
     if (empty($_data['article_series_id']) || $_data['article_series_id'] == "") {
         unset($_data['article_series_id']);
     }
     if (empty($_data['stock_amount_total']) || $_data['stock_amount_total'] == "") {
         unset($_data['stock_amount_total']);
     }
     if (empty($_data['stock_amount_min']) || $_data['stock_amount_min'] == "") {
         unset($_data['stock_amount_min']);
     }
     parent::setFromArray($_data);
 }
예제 #23
0
 public function setFromArray(array $_data)
 {
     if (empty($_data['debitor_id']) || $_data['debitor_id'] == "") {
         unset($_data['debitor_id']);
     }
     if (empty($_data['job_id']) || $_data['job_id'] == "") {
         unset($_data['job_id']);
     }
     if (empty($_data['price_group_id']) || $_data['price_group_id'] == "") {
         unset($_data['price_group_id']);
     }
     if (empty($_data['account_id']) || $_data['account_id'] == "") {
         unset($_data['account_id']);
     }
     parent::setFromArray($_data);
 }
예제 #24
0
 /**
  * sets the record related properties from user generated input.
  *
  * @param   array $_data
  * @return void
  */
 public function setFromArray(array $_data)
 {
     //if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . print_r($_data, true));
     if (empty($_data['geo'])) {
         $_data['geo'] = NULL;
     }
     if (empty($_data['class'])) {
         $_data['class'] = self::CLASS_PUBLIC;
     }
     if (isset($_data['organizer']) && is_array($_data['organizer'])) {
         $_data['organizer'] = $_data['organizer']['accountId'];
     }
     if (isset($_data['alarms']) && is_array($_data['alarms'])) {
         $_data['alarms'] = new Tinebase_Record_RecordSet('Tinebase_Model_Alarm', $_data['alarms'], TRUE);
     }
     //if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . print_r($_data, true));
     parent::setFromArray($_data);
 }
예제 #25
0
 public function setFromArray(array $_data)
 {
     if (empty($_data['create_datetime']) || $_data['create_datetime'] == "" || $_data['create_datetime'] == 0) {
         unset($_data['create_datetime']);
     }
     if (empty($_data['schedule_datetime']) || $_data['schedule_datetime'] == "" || $_data['schedule_datetime'] == 0) {
         unset($_data['schedule_datetime']);
     }
     if (empty($_data['start_datetime']) || $_data['start_datetime'] == "" || $_data['start_datetime'] == 0) {
         $_data['start_datetime'] = null;
         unset($_data['start_datetime']);
     }
     if (empty($_data['end_datetime']) || $_data['end_datetime'] == "" || $_data['end_datetime'] == 0) {
         $_data['end_datetime'] = null;
         unset($_data['end_datetime']);
     }
     if (empty($_data['approved_datetime']) || $_data['approved_datetime'] == "" || $_data['approved_datetime'] == 0) {
         $_data['approved_datetime'] = null;
         unset($_data['approved_datetime']);
     }
     parent::setFromArray($_data);
 }
예제 #26
0
 public function setFromArray(array $_data)
 {
     if (empty($_data['open_item_id']) || $_data['open_item_id'] == "") {
         unset($_data['open_item_id']);
     }
     if (empty($_data['order_id']) || $_data['order_id'] == "") {
         unset($_data['order_id']);
     }
     if (empty($_data['receipt_id']) || $_data['receipt_id'] == "") {
         unset($_data['receipt_id']);
     }
     if (empty($_data['booking_id']) || $_data['booking_id'] == "") {
         unset($_data['booking_id']);
     }
     if (empty($_data['account_booking_id']) || $_data['account_booking_id'] == "") {
         unset($_data['account_booking_id']);
     }
     if (empty($_data['inquiry_print_date']) || $_data['inquiry_print_date'] == "") {
         $_data['inquiry_print_date'] = null;
     }
     if (empty($_data['return_debit_base_payment_id']) || $_data['return_debit_base_payment_id'] == "") {
         unset($_data['return_debit_base_payment_id']);
     }
     parent::setFromArray($_data);
 }
 /**
  * sets the record related properties from user generated input.
  *
  * Input-filtering and validation by Zend_Filter_Input can enabled and disabled
  *
  * @param array $_data            the new data to set
  * @throws Tinebase_Exception_Record_Validation when content contains invalid or missing data
  *
  * @todo remove custom fields handling (use Tinebase_Record_RecordSet for them)
  */
 public function setFromArray(array $_data)
 {
     parent::setFromArray($_data);
     $this->fulltext = $this->number . ' - ' . $this->name;
 }
예제 #28
0
 /**
  * sets the record related properties from user generated input.
  * 
  * Input-filtering and validation by Zend_Filter_Input can enabled and disabled
  *
  * @param array $_data            the new data to set
  * @throws Tinebase_Exception_Record_Validation when content contains invalid or missing data
  */
 public function setFromArray(array $_data)
 {
     if (isset($_data['displaycontainer_id']) && is_array($_data['displaycontainer_id'])) {
         $_data['displaycontainer_id'] = $_data['displaycontainer_id']['id'];
     }
     if (isset($_data['user_id']) && is_array($_data['user_id'])) {
         if (array_key_exists('accountId', $_data['user_id'])) {
             // NOTE: we need to support accounts, cause the client might not have the contact, e.g. when the attender is generated from a container owner
             $_data['user_id'] = Addressbook_Controller_Contact::getInstance()->getContactByUserId($_data['user_id']['accountId'], TRUE)->getId();
         } elseif (array_key_exists('group_id', $_data['user_id'])) {
             $_data['user_id'] = is_array($_data['user_id']['group_id']) ? $_data['user_id']['group_id'][0] : $_data['user_id']['group_id'];
         } else {
             if (array_key_exists('id', $_data['user_id'])) {
                 $_data['user_id'] = $_data['user_id']['id'];
             }
         }
     }
     parent::setFromArray($_data);
 }
 /**
  * sets the record related properties from user generated input.
  * 
  * Input-filtering and validation by Zend_Filter_Input can enabled and disabled
  *
  * @param array $_data            the new data to set
  * @throws Tinebase_Exception_Record_Validation when content contains invalid or missing data
  */
 public function setFromArray(array $_data)
 {
     if (empty($_data['geo'])) {
         $_data['geo'] = NULL;
     }
     if (empty($_data['class'])) {
         $_data['class'] = self::CLASS_PUBLIC;
     }
     if (empty($_data['priority'])) {
         $_data['priority'] = NULL;
     }
     if (empty($_data['status'])) {
         $_data['status'] = self::STATUS_CONFIRMED;
     }
     if (isset($_data['container_id']) && is_array($_data['container_id'])) {
         $_data['container_id'] = $_data['container_id']['id'];
     }
     if (isset($_data['organizer']) && is_array($_data['organizer'])) {
         $_data['organizer'] = $_data['organizer']['id'];
     }
     if (isset($_data['attendee']) && is_array($_data['attendee'])) {
         $_data['attendee'] = new Tinebase_Record_RecordSet('Calendar_Model_Attender', $_data['attendee'], $this->bypassFilters, $this->convertDates);
     }
     if (isset($_data['rrule']) && !empty($_data['rrule']) && !$_data['rrule'] instanceof Calendar_Model_Rrule) {
         // rrule can be array or string
         $_data['rrule'] = new Calendar_Model_Rrule($_data['rrule'], $this->bypassFilters, $this->convertDates);
     }
     if (isset($_data['rrule_constraints']) && !empty($_data['rrule_constraints']) && !$_data['rrule_constraints'] instanceof Calendar_Model_EventFilter) {
         // rrule can be array or string
         $_data['rrule_constraints'] = new Calendar_Model_EventFilter($_data['rrule_constraints']);
     }
     if (isset($_data['alarms']) && is_array($_data['alarms'])) {
         $_data['alarms'] = new Tinebase_Record_RecordSet('Tinebase_Model_Alarm', $_data['alarms'], TRUE, $this->convertDates);
     }
     parent::setFromArray($_data);
 }
 /**
  * (non-PHPdoc)
  * @see Tinebase/Record/Tinebase_Record_Abstract#setFromArray($_data)
  */
 public function setFromArray(array $_data)
 {
     parent::setFromArray($_data);
     switch ($this->type) {
         case Tinebase_Model_Container::TYPE_SHARED:
             $this->path = "/{$this->type}/{$this->getId()}";
             break;
         case Tinebase_Model_Container::TYPE_PERSONAL:
             if (!empty($this->owner_id)) {
                 $this->path = "/{$this->type}/{$this->owner_id}/{$this->getId()}";
             }
             break;
     }
 }