Example #1
0
File: time.php Project: MrJookie/pm
 /**
  * Overrides JTable::store to set modified data and user id.
  *
  * @param     boolean    True to update fields even if they are null.
  * @return    boolean    True on success.
  */
 public function store($updateNulls = false)
 {
     $db = JFactory::getDBO();
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     if ($this->id) {
         // Existing item
         $this->modified = $date->toSql();
         $this->modified_by = $user->get('id');
         //get rate/cost from pf_tasks
         $db->setQuery('SELECT rate, cost FROM #__pf_tasks WHERE id = ' . $db->quote($this->task_id));
         $result = $db->loadObject();
         $this->rate = $result->rate;
         $this->cost = $result->cost;
     } else {
         // New item
         $this->created = $date->toSql();
         if (empty($this->created_by)) {
             $this->created_by = $user->get('id');
         }
         //get rate/cost from pf_tasks
         $db->setQuery('SELECT rate, cost FROM #__pf_tasks WHERE id = ' . $db->quote($this->task_id));
         $result = $db->loadObject();
         $this->rate = $result->rate;
         $this->cost = $result->cost;
     }
     if (empty($this->log_date)) {
         $this->log_date = $this->created;
     }
     // Store the main record
     $success = parent::store($updateNulls);
     return $success;
 }
Example #2
0
 /**
  * Overrides JTable::store to set modified data and user id.
  *
  * @param     boolean    True to update fields even if they are null.
  * @return    boolean    True on success.
  */
 public function store($updateNulls = false)
 {
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     if ($this->id) {
         // Existing item
         $this->modified = $date->toSql();
         $this->modified_by = $user->get('id');
     } else {
         // New item
         $this->created = $date->toSql();
         if (empty($this->created_by)) {
             $this->created_by = $user->get('id');
         }
     }
     if (empty($this->log_date)) {
         $this->log_date = $this->created;
     }
     // Store the main record
     $success = parent::store($updateNulls);
     return $success;
 }