Exemplo n.º 1
0
 protected function hook_preStore()
 {
     $this->company_id = (int) $this->company_id;
     $this->company_owner = (int) $this->company_owner ? $this->company_owner : $this->_AppUI->user_id;
     $this->company_primary_url = str_replace(array('"', '"', '<', '>'), '', $this->company_primary_url);
     parent::hook_preStore();
 }
 protected function hook_preStore()
 {
     $this->pd_option_user = $this->_AppUI->user_id;
     $pd_options = $this->loadAll(null, 'pd_option_user = '******'pd_option_id'];
         }
     }
     $this->pd_option_id = $pd_options_id;
     parent::hook_preStore();
 }
Exemplo n.º 3
0
 protected function hook_preStore()
 {
     if ($this->budget_start_date) {
         $date = new w2p_Utilities_Date($this->budget_start_date);
         $this->budget_start_date = $date->format(FMT_DATETIME_MYSQL);
     }
     if ($this->budget_end_date) {
         $date = new w2p_Utilities_Date($this->budget_end_date);
         $this->budget_end_date = $date->format(FMT_DATETIME_MYSQL);
     }
     parent::hook_preStore();
 }
Exemplo n.º 4
0
 protected function hook_preStore()
 {
     $this->contact_company = (int) $this->contact_company;
     $this->contact_department = (int) $this->contact_department;
     $this->contact_owner = (int) $this->contact_owner ? (int) $this->contact_owner : (int) $this->_AppUI->user_id;
     $this->contact_private = (int) $this->contact_private;
     $this->contact_first_name = $this->contact_first_name == null ? '' : $this->contact_first_name;
     $this->contact_last_name = $this->contact_last_name == null ? '' : $this->contact_last_name;
     $this->contact_display_name = $this->contact_display_name == null ? '' : $this->contact_display_name;
     $this->contact_birthday = $this->contact_birthday == '' ? null : $this->contact_birthday;
     /*
      *  This  validates that any Contact saved will have a Display Name as
      * required by various dropdowns, etc throughout the system.  This is
      * mostly required when Contacts are generated via programatic methods and
      * not through the add/edit UI.
      */
     if (mb_strlen($this->contact_display_name) <= 1) {
         $this->contact_display_name = mb_trim($this->contact_first_name . ' ' . $this->contact_last_name);
     }
     $q = $this->_getQuery();
     $this->contact_lastupdate = $q->dbfnNowWithTZ();
     parent::hook_preStore();
 }
Exemplo n.º 5
0
 protected function hook_preStore()
 {
     $this->file_folder_id = (int) $this->file_folder_id;
     $this->file_folder_parent = (int) $this->file_folder_parent;
     parent::hook_preStore();
 }
Exemplo n.º 6
0
 protected function hook_preStore()
 {
     $q = $this->_getQuery();
     $this->project_updated = $q->dbfnNowWithTZ();
     // ensure changes of state in checkboxes is captured
     $this->project_active = (int) $this->project_active;
     $this->project_private = (int) $this->project_private;
     $this->project_target_budget = filterCurrency($this->project_target_budget);
     $this->project_url = str_replace(array('"', '"', '<', '>'), '', $this->project_url);
     $this->project_demo_url = str_replace(array('"', '"', '<', '>'), '', $this->project_demo_url);
     $this->project_owner = (int) $this->project_owner ? $this->project_owner : $this->_AppUI->user_id;
     $this->project_creator = (int) $this->project_creator ? $this->project_creator : $this->_AppUI->user_id;
     $this->project_priority = (int) $this->project_priority;
     $this->project_type = (int) $this->project_type;
     $this->project_status = (int) $this->project_status;
     // Make sure project_short_name is the right size (issue for languages with encoded characters)
     if ('' == $this->project_short_name) {
         $this->project_short_name = mb_substr($this->project_name, 0, 10);
     }
     $this->project_short_name = mb_substr($this->project_short_name, 0, 10);
     if (empty($this->project_end_date)) {
         $this->project_end_date = null;
     }
     $this->project_id = (int) $this->project_id;
     // convert dates to SQL format first
     if ($this->project_start_date) {
         $date = new w2p_Utilities_Date($this->project_start_date);
         $this->project_start_date = $date->format(FMT_DATETIME_MYSQL);
     }
     if ($this->project_end_date) {
         $date = new w2p_Utilities_Date($this->project_end_date);
         $this->project_end_date = $date->format(FMT_DATETIME_MYSQL);
     }
     // check project parents and reset them to self if they do not exist
     if (!$this->project_parent) {
         $this->project_parent = $this->project_id;
         $this->project_original_parent = $this->project_id;
     } else {
         $parent_project = new CProject();
         $parent_project->overrideDatabase($this->_query);
         $parent_project->load($this->project_parent);
         $this->project_original_parent = $parent_project->project_original_parent;
     }
     if (!$this->project_original_parent) {
         $this->project_original_parent = $this->project_id;
     }
     parent::hook_preStore();
 }
Exemplo n.º 7
0
 protected function hook_preStore()
 {
     parent::hook_preStore();
     if (!$this->event_recurs) {
         $this->event_times_recuring = 0;
     } else {
         //If the event recurs then set the end date day to be equal to the start date day and keep the hour:minute of the end date
         //so that the event starts recurring from the start day onwards n times after the start date for the period given
         //Meaning: The event end date day is useless as far as recurring events are concerned.
         $start_date = new w2p_Utilities_Date($this->event_start_date);
         $end_date = new w2p_Utilities_Date($this->event_end_date);
         $hour = $end_date->getHour();
         $minute = $end_date->getMinute();
         $end_date->setDate($start_date->getDate());
         $end_date->setHour($hour);
         $end_date->setMinute($minute);
         $this->event_end_date = $end_date->format(FMT_DATETIME_MYSQL);
     }
     // ensure changes to check boxes and select lists are honoured
     $this->event_private = (int) $this->event_private;
     $this->event_type = (int) $this->event_type;
     $this->event_cwd = (int) $this->event_cwd;
     $this->event_creator = (int) $this->event_creator ? $this->event_creator : $this->_AppUI->user_id;
     $this->event_owner = (int) $this->event_owner ? $this->event_owner : $this->_AppUI->user_id;
     $q = $this->_getQuery();
     $this->event_updated = $q->dbfnNowWithTZ();
 }
Exemplo n.º 8
0
 protected function hook_preStore()
 {
     $this->file_parent = (int) $this->file_parent;
     $this->file_owner = (int) $this->file_owner ? $this->file_owner : $this->_AppUI->user_id;
     parent::hook_preStore();
 }
Exemplo n.º 9
0
 protected function hook_preStore()
 {
     $this->importing_tasks = false;
     $this->w2PTrimAll();
     $q = $this->_getQuery();
     $this->task_updated = $q->dbfnNowWithTZ();
     $this->task_percent_complete = (int) $this->task_percent_complete;
     $this->task_owner = (int) $this->task_owner ? $this->task_owner : $this->_AppUI->user_id;
     $this->task_creator = (int) $this->task_creator ? $this->task_creator : $this->_AppUI->user_id;
     $this->task_contacts = is_array($this->task_contacts) ? $this->task_contacts : explode(',', $this->task_contacts);
     // ensure changes to checkboxes are honoured
     $this->task_milestone = (int) $this->task_milestone;
     $this->task_dynamic = (int) $this->task_dynamic;
     $this->task_notify = (int) $this->task_notify;
     $this->task_duration = $this->task_milestone ? 0 : $this->task_duration;
     $this->task_duration_type = (int) $this->task_duration_type ? $this->task_duration_type : 1;
     $this->task_priority = (int) $this->task_priority ? $this->task_priority : 0;
     parent::hook_preStore();
 }
Exemplo n.º 10
0
 protected function hook_preStore()
 {
     $q = $this->_getQuery();
     $this->task_log_updated = $q->dbfnNowWithTZ();
     $this->task_log_creator = (int) $this->task_log_creator ? $this->task_log_creator : $this->_AppUI->user_id;
     if ($this->task_log_date) {
         $date = new w2p_Utilities_Date($this->task_log_date);
         $this->task_log_date = $date->format(FMT_DATETIME_MYSQL);
     }
     $dot = strpos($this->task_log_hours, ':');
     if ($dot > 0) {
         $log_duration_minutes = sprintf('%.3f', substr($this->task_log_hours, $dot + 1) / 60.0);
         $this->task_log_hours = floor($this->task_log_hours) + $log_duration_minutes;
     }
     if (!(double) $this->task_log_hours) {
         // before evaluating a non-float work hour as 0 lets try to check if user is trying
         // to enter in hour:minute format and convert it to decimal. If that is not the format
         // then we consider that there was no time worked at all (i.e. 0 time worked)
         $log_time_hour = $log_time_minute = 0;
         list($log_time_hour, $log_time_minute) = explode(':', $this->task_log_hours);
         $this->task_log_hours = (int) $log_time_hour + (int) $log_time_minute / 60;
         if (!(double) $this->task_log_hours) {
             $this->task_log_hours = 0;
         }
     }
     parent::hook_preStore();
 }