function save() { $this->import_parameters(); //convert is_archived into 1 or 0 $this->set('is_archived', intval($this->is_archived === 'true')); if ($this->is_new()) { //new projects won't have any tasks so the progress should be 100 $this->set('progress', 100); if (!isset($this->start_date)) { $this->set('start_date', strtotime('today')); } } else { //generate activity if the due date has changed if ($this->due_date_changed()) { ActivityManager::project_due_date_updated($this); } } $this->unset_param('client_name'); return parent::save(); }