public function store(CAppUI $AppUI)
 {
     $perms = $AppUI->acl();
     $stored = false;
     $errorMsgArray = $this->check();
     if (count($errorMsgArray) > 0) {
         return $errorMsgArray;
     }
     /*
      * TODO: I don't like the duplication on each of these two branches, but I
      *   don't have a good idea on how to fix it at the moment...
      */
     if ($this->field_id && canEdit('system')) {
         if ($msg = parent::store()) {
             return $msg;
         }
         $stored = true;
     }
     if (0 == $this->field_id && canEdit('system')) {
         if ($msg = parent::store()) {
             return $msg;
         }
         $stored = true;
     }
     return $stored;
 }
예제 #2
0
 public function store(CAppUI $AppUI)
 {
     $perms = $AppUI->acl();
     $stored = false;
     $this->file_folder_id = (int) $this->file_folder_id;
     $this->file_folder_parent = (int) $this->file_folder_parent;
     $this->_error = $this->check();
     if (count($this->_error)) {
         return $this->_error;
     }
     /*
      * TODO: I don't like the duplication on each of these two branches, but I
      *   don't have a good idea on how to fix it at the moment...
      */
     if ($this->file_folder_id && $perms->checkModuleItem('files', 'edit')) {
         if ($msg = parent::store()) {
             return $msg;
         }
         $stored = true;
     }
     if (0 == $this->file_folder_id && $perms->checkModuleItem('files', 'add')) {
         if ($msg = parent::store()) {
             return $msg;
         }
         $stored = true;
     }
     return $stored;
 }
 public function remove(CAppUI $AppUI, w2p_Utilities_Date $date)
 {
     $perms = $AppUI->acl();
     $removed = false;
     if ($this->holiday_id && $perms->checkModuleItem('holiday', 'edit', $this->holiday_id)) {
         $holiday_start_date = new w2p_Utilities_Date($this->holiday_start_date);
         $holiday_end_date = new w2p_Utilities_Date($this->holiday_end_date);
         if ($holiday_start_date->equals($date->duplicate())) {
             if ($holiday_end_date->equals($date->duplicate())) {
                 $removed = $this->delete($AppUI);
             } else {
                 $holiday_start_date = new w2p_Utilities_Date($this->holiday_start_date);
                 $this->holiday_start_date = $holiday_start_date->getNextDay()->getDate();
                 $removed = $this->store($AppUI);
             }
         } elseif ($holiday_end_date->equals($date->duplicate())) {
             $holiday_end_date = new w2p_Utilities_Date($this->holiday_end_date);
             $this->holiday_end_date = $holiday_end_date->getPrevDay()->getDate();
             $removed = $this->store($AppUI);
         } elseif ($holiday_start_date->before($date->duplicate()) && $holiday_end_date->after($date->duplicate())) {
             $holiday_end_date = $this->holiday_end_date;
             $this->holiday_end_date = $date->getPrevDay()->getDate();
             $removed = $this->store($AppUI);
             $this->holiday_id = 0;
             // create new record
             $this->holiday_start_date = $date->getNextDay()->getDate();
             $this->holiday_end_date = $holiday_end_date;
             $removed = $this->store($AppUI);
         }
     }
     return $removed;
 }
예제 #4
0
 public function remove(CAppUI $AppUI = null)
 {
     global $AppUI;
     $q = new w2p_Database_Query();
     $q->dropTable('history');
     $q->exec();
     $perms = $AppUI->acl();
     return $perms->unregisterModule('history');
 }
예제 #5
0
 public function delete(CAppUI $AppUI)
 {
     $perms = $AppUI->acl();
     $this->_error = array();
     if ($perms->checkModuleItem('resources', 'delete', $this->resource_id)) {
         if ($msg = parent::delete()) {
             return $msg;
         }
         return true;
     }
     return false;
 }
예제 #6
0
 public function store(CAppUI $AppUI = null)
 {
     global $AppUI;
     global $helpdesk_available;
     $perms = $AppUI->acl();
     $errorMsgArray = $this->check();
     if (count($errorMsgArray) > 0) {
         return $errorMsgArray;
     }
     if ($helpdesk_available && $this->file_helpdesk_item != 0) {
         $this->addHelpDeskTaskLog();
     }
     if ($msg = parent::store()) {
         return false;
     }
     addHistory('files', $this->file_id, 'store', $this->file_name, $this->file_id);
     return true;
 }
 public function delete(CAppUI $AppUI = null)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     $result = false;
     $this->_error = array();
     if ($perms->checkModuleItem('forums', 'delete', $this->project_id)) {
         $q = $this->_query;
         $q->setDelete('forum_visits');
         $q->addWhere('visit_message = ' . (int) $this->message_id);
         $q->exec();
         // No error if this fails, it is not important.
         $q->clear();
         $q->addTable('forum_messages');
         $q->addQuery('message_forum');
         $q->addWhere('message_id = ' . (int) $this->message_id);
         $forumId = $q->loadResult();
         $q->clear();
         $q->setDelete('forum_messages');
         $q->addWhere('message_id = ' . (int) $this->message_id);
         if (!$q->exec()) {
             $result = db_error();
         } else {
             $result = null;
         }
         $q->clear();
         $q->addTable('forum_messages');
         $q->addQuery('COUNT(message_id)');
         $q->addWhere('message_forum = ' . (int) $forumId);
         $messageCount = $q->loadResult();
         $q->clear();
         $q->addTable('forums');
         $q->addUpdate('forum_message_count', $messageCount);
         $q->addWhere('forum_id = ' . (int) $forumId);
         $q->exec();
         $result = true;
     }
     return $result;
 }
예제 #8
0
 public function store(CAppUI $AppUI)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     return true;
 }
예제 #9
0
 public function store(CAppUI $AppUI)
 {
     $perms = $AppUI->acl();
     $stored = false;
     $errorMsgArray = $this->check();
     if (count($errorMsgArray) > 0) {
         return $errorMsgArray;
     }
     $this->company_id = (int) $this->company_id;
     /*
      * TODO: I don't like the duplication on each of these two branches, but I
      *   don't have a good idea on how to fix it at the moment...
      */
     if ($this->company_id && $perms->checkModuleItem('companies', 'edit', $this->company_id)) {
         if ($msg = parent::store()) {
             return $msg;
         }
         addHistory('companies', $this->company_id, 'update', $this->company_name, $this->company_id);
         $stored = true;
     }
     if (0 == $this->company_id && $perms->checkModuleItem('companies', 'add')) {
         if ($msg = parent::store()) {
             return $msg;
         }
         addHistory('companies', $this->company_id, 'add', $this->company_name, $this->company_id);
         $stored = true;
     }
     if ($stored) {
         $custom_fields = new CustomFields('companies', 'addedit', $this->company_id, 'edit');
         $custom_fields->bind($_POST);
         $sql = $custom_fields->store($this->company_id);
         // Store Custom Fields
     }
     return $stored;
 }
예제 #10
0
 public function store(CAppUI $AppUI)
 {
     $perms = $AppUI->acl();
     $stored = false;
     $errorMsgArray = $this->check();
     if (count($errorMsgArray) > 0) {
         return $errorMsgArray;
     }
     if ($this->link_id && $perms->checkModuleItem('links', 'edit', $this->link_id)) {
         $q = new DBQuery();
         $this->link_date = $q->dbfnNow();
         if ($msg = parent::store()) {
             return $msg;
         }
         addHistory('links', $this->link_id, 'update', $this->link_name, $this->link_id);
         $stored = true;
     }
     if (0 == $this->link_id && $perms->checkModuleItem('links', 'add')) {
         $q = new DBQuery();
         $this->link_date = $q->dbfnNow();
         if ($msg = parent::store()) {
             return $msg;
         }
         addHistory('links', $this->link_id, 'add', $this->link_name, $this->link_id);
         $stored = true;
     }
     return $stored;
 }
예제 #11
0
 public function deleteFile(CAppUI $AppUI = null)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     if ($perms->checkModuleItem('files', 'delete', $this->file_id)) {
         return @unlink(W2P_BASE_DIR . '/files/' . $this->file_project . '/' . $this->file_real_filename);
     }
 }
예제 #12
0
 public static function getDepartments(CAppUI $AppUI, $companyId)
 {
     $perms = $AppUI->acl();
     if ($AppUI->isActiveModule('departments') && canView('departments')) {
         $q = new w2p_Database_Query();
         $q->addTable('departments');
         $q->addQuery('departments.*, COUNT(contact_department) dept_users');
         $q->addJoin('contacts', 'c', 'c.contact_department = dept_id');
         $q->addWhere('dept_company = ' . (int) $companyId);
         $q->addGroup('dept_id');
         $q->addOrder('dept_parent, dept_name');
         $department = new CDepartment();
         $department->setAllowedSQL($AppUI->user_id, $q);
         return $q->loadList();
     }
 }
예제 #13
0
 /**
  * Updates the variable information on the task.
  *
  * @param int $task_log_task that task id of task this task log is for
  *
  * @return void
  *
  * @access private
  */
 private function updateTaskSummary(CAppUI $AppUI, $task_id)
 {
     $perms = $AppUI->acl();
     $q = $this->_query;
     if ($perms->checkModuleItem('tasks', 'edit', $task_id)) {
         if ($this->task_log_percent_complete < 100) {
             $q->addQuery('task_log_percent_complete, task_log_date, task_log_task_end_date');
             $q->addTable('task_log');
             $q->addWhere('task_log_task = ' . (int) $task_id);
             $q->addOrder('task_log_date DESC, task_log_id DESC');
             $q->setLimit(1);
             $results = $q->loadHash();
             $q->clear();
             $percentComplete = $results['task_log_percent_complete'];
             /*
              * TODO: In theory, we shouldn't just use the task_log_task_end_date, 
              *   because if we're after that date and someone is still adding 
              *   logs to a task, obviously the task isn't complete. We may want 
              *   to check to see if task_log_date > task_log_task_end_date and 
              *   use the later one as the end date.. not sure yet.
              */
             $taskEndDate = $results['task_log_task_end_date'];
         } else {
             $percentComplete = 100;
             $taskEndDate = $this->task_log_date;
         }
         $task = new CTask();
         $task->load($task_id);
         $task->task_percent_complete = $percentComplete;
         $task->task_end_date = $taskEndDate;
         $msg = $task->store($AppUI);
         if (is_array($msg)) {
             $AppUI->setMsg($msg, UI_MSG_ERROR, true);
         }
         $task->pushDependencies($task_id, $task->task_end_date);
     }
     $q->addQuery('SUM(task_log_hours)');
     $q->addTable('task_log');
     $q->addWhere('task_log_task = ' . (int) $task_log_task);
     $totalHours = $q->loadResult();
     CTask::updateHoursWorked($task_id, $totalHours);
 }
예제 #14
0
 public function delete(CAppUI $AppUI = null)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     $this->_error = array();
     if ($perms->checkModuleItem('departments', 'delete', $this->dept_id)) {
         $q = new w2p_Database_Query();
         $q->addTable('departments', 'dep');
         $q->addQuery('dep.dept_id');
         $q->addWhere('dep.dept_parent = ' . (int) $this->dept_id);
         $rows = $q->loadList();
         $q->clear();
         if (count($rows)) {
             //return 'deptWithSub';
             return false;
         }
         $q->addTable('project_departments', 'pd');
         $q->addQuery('pd.project_id');
         $q->addWhere('pd.department_id = ' . (int) $this->dept_id);
         $rows = $q->loadList();
         $q->clear();
         if (count($rows)) {
             //return 'deptWithProject';
             return false;
         }
         if ($msg = parent::delete()) {
             return $msg;
         }
         return true;
     }
     return false;
 }
예제 #15
0
 public static function updateStatus(CAppUI $AppUI = null, $projectId, $statusId)
 {
     global $AppUI;
     trigger_error("CProject::updateStatus has been deprecated in v2.3 and will be removed by v4.0.", E_USER_NOTICE);
     $perms = $AppUI->acl();
     if ($perms->checkModuleItem('projects', 'edit', $projectId) && $projectId > 0 && $statusId >= 0) {
         $q = new w2p_Database_Query();
         $q->addTable('projects');
         $q->addUpdate('project_status', $statusId);
         $q->addWhere('project_id   = ' . (int) $projectId);
         $q->exec();
     }
 }
예제 #16
0
 public function delete(CAppUI $AppUI = null)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     $canDelete = (int) $this->canDelete();
     $this->_error = array();
     if ($perms->checkModuleItem('users', 'delete', $this->user_id) && $canDelete) {
         $perms->deleteLogin($this->user_id);
         $q = new w2p_Database_Query();
         $q->setDelete('user_preferences');
         $q->addWhere('pref_user = ' . $this->user_id);
         $q->exec();
         if ($msg = parent::delete()) {
             return $msg;
         }
         return true;
     }
     return false;
 }
예제 #17
0
 public static function updateStatus(CAppUI $AppUI = null, $projectId, $statusId)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     if ($perms->checkModuleItem('projects', 'edit', $projectId) && $projectId > 0 && $statusId > 0) {
         $q = new DBQuery();
         $q->addTable('projects');
         $q->addUpdate('project_status', $statusId);
         $q->addWhere('project_id   = ' . (int) $projectId);
         $q->exec();
     }
 }
예제 #18
0
 public function delete(CAppUI $AppUI = null)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     $this->_error = array();
     if ($perms->checkModuleItem('forums', 'delete', $this->forum_id)) {
         $q = $this->_query;
         $q->setDelete('forum_visits');
         $q->addWhere('visit_forum = ' . (int) $this->forum_id);
         $q->exec();
         // No error if this fails, it is not important.
         $q->clear();
         $q->setDelete('forum_messages');
         $q->addWhere('message_forum = ' . (int) $this->forum_id);
         if (!$q->exec()) {
             return db_error();
         }
         if ($msg = parent::delete()) {
             return $msg;
         }
         return true;
     }
     return false;
 }
예제 #19
0
 /**
  * Deletes the current task log from the database. Then updated total hours
  * worked cache on task.
  *
  * @return void
  *
  * @access public
  */
 public function delete(CAppUI $AppUI = null)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     $this->_error = array();
     $this->load($this->task_log_id);
     //$task_log_task = $this->task_log_task;
     if ($perms->checkModuleItem('task_log', 'delete', $this->task_log_id)) {
         if ($msg = parent::delete()) {
             return $msg;
         }
         $this->updateHoursWorked($this->task_log_task);
         return true;
     }
     return false;
 }
예제 #20
0
 public function getTaskContacts(CAppUI $AppUI = null, $taskId)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     if ($AppUI->isActiveModule('contacts') && $perms->checkModule('contacts', 'view')) {
         $q = new DBQuery();
         $q->addTable('contacts', 'c');
         $q->addJoin('task_contacts', 'tc', 'tc.contact_id = c.contact_id', 'inner');
         $q->leftJoin('departments', 'd', 'dept_id = contact_department');
         $q->addWhere('tc.task_id = ' . (int) $taskId);
         $q->addQuery('c.contact_id, contact_first_name, contact_last_name, contact_email');
         $q->addQuery('contact_phone, dept_name');
         $q->addWhere('(contact_owner = ' . (int) $AppUI->user_id . ' OR contact_private = 0)');
         $department = new CDepartment();
         $department->setAllowedSQL($AppUI->user_id, $q);
         return $q->loadHashList('contact_id');
     }
 }
예제 #21
0
 public function store(CAppUI $AppUI)
 {
     $perms = $AppUI->acl();
     $stored = false;
     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->_error = $this->check();
     if (count($this->_error)) {
         return $this->_error;
     }
     $this->event_start_date = $AppUI->convertToSystemTZ($this->event_start_date);
     $this->event_end_date = $AppUI->convertToSystemTZ($this->event_end_date);
     /*
      * TODO: I don't like the duplication on each of these two branches, but I
      *   don't have a good idea on how to fix it at the moment...
      */
     if ($this->event_id && $perms->checkModuleItem('events', 'edit', $this->event_id)) {
         if ($msg = parent::store()) {
             return $msg;
         }
         $stored = true;
     }
     if (0 == $this->event_id && $perms->checkModuleItem('events', 'add')) {
         if ($msg = parent::store()) {
             return $msg;
         }
         $stored = true;
     }
     if ($stored) {
         // TODO:  I *really* don't like using the POST inside here..
         $this->updateAssigned(explode(',', $_POST['event_assigned']));
         $custom_fields = new w2p_Core_CustomFields('calendar', 'addedit', $this->event_id, 'edit');
         $custom_fields->bind($_POST);
         $sql = $custom_fields->store($this->event_id);
         // Store Custom Fields
     }
     return $stored;
 }
예제 #22
0
    dotProject is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    dotProject is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with dotProject; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

The full text of the GPL is in the COPYING file.
*/
// Function to scan the event queue and execute any functions required.
require_once 'base.php';
require_once DP_BASE_DIR . '/includes/config.php';
require_once DP_BASE_DIR . '/includes/main_functions.php';
require_once DP_BASE_DIR . '/includes/db_connect.php';
require_once DP_BASE_DIR . '/classes/ui.class.php';
require_once DP_BASE_DIR . '/classes/event_queue.class.php';
require_once DP_BASE_DIR . '/classes/query.class.php';
$AppUI = new CAppUI();
$AppUI->setUserLocale();
$perms =& $AppUI->acl();
echo "Scanning Queue ...\n";
$queue = new EventQueue();
$queue->scan();
echo 'Done, ' . $queue->event_count . ' events processed' . "\n";
예제 #23
0
 public function store(CAppUI $AppUI)
 {
     $perms = $AppUI->acl();
     $stored = false;
     if (strpos($this->link_url, ':') === false && strpos($this->link_url, "//") === false) {
         $this->link_url = 'http://' . $this->link_url;
     }
     $this->_error = $this->check();
     if (count($this->_error)) {
         return $this->_error;
     }
     /*
      * TODO: I don't like the duplication on each of these two branches, but I
      *   don't have a good idea on how to fix it at the moment...
      */
     $q = new w2p_Database_Query();
     $this->link_date = $q->dbfnNowWithTZ();
     if ($this->link_id && $perms->checkModuleItem('links', 'edit', $this->link_id)) {
         if ($msg = parent::store()) {
             return $msg;
         }
         $stored = true;
     }
     if (0 == $this->link_id && $perms->checkModuleItem('links', 'add')) {
         if ($msg = parent::store()) {
             return $msg;
         }
         $stored = true;
     }
     return $stored;
 }
예제 #24
0
 public function getContacts(CAppUI $AppUI = null, $task_id)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     if (canView('contacts')) {
         $q = new w2p_Database_Query();
         $q->addTable('contacts', 'c');
         $q->addQuery('c.contact_id, contact_first_name, contact_last_name');
         $q->leftJoin('departments', 'd', 'dept_id = contact_department');
         $q->addQuery('dept_name');
         $q->addJoin('task_contacts', 'tc', 'tc.contact_id = c.contact_id', 'inner');
         $q->addWhere('tc.task_id = ' . (int) $task_id);
         $q->addQuery('c.contact_id, contact_first_name, contact_last_name, contact_order_by, contact_email');
         $q->addWhere('(contact_owner = ' . (int) $AppUI->user_id . ' OR contact_private = 0)');
         $department = new CDepartment();
         $department->setAllowedSQL($AppUI->user_id, $q);
         return $q->loadHashList('contact_id');
     }
 }
예제 #25
0
 public function store(CAppUI $AppUI = null)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     $stored = false;
     $this->_error = array();
     $q = $this->_query;
     $q->addQuery('billingcode_id');
     $q->addTable('billingcode');
     $q->addWhere('billingcode_name = \'' . $this->billingcode_name . '\'');
     $q->addWhere('company_id = ' . (int) $this->company_id);
     $found_id = $q->loadResult();
     $q->clear();
     if ($found_id && $found_id != $this->_billingcode_id) {
         return 'Billing Code::code already exists';
     } else {
         if ($perms->checkModuleItem('system', 'edit')) {
             if ($msg = parent::store()) {
                 return $msg;
             }
             $stored = true;
         }
     }
     return $stored;
 }
예제 #26
0
 public function store(CAppUI $AppUI = null)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     $this->contact_company = (int) $this->contact_company;
     $this->contact_department = (int) $this->contact_department;
     $this->contact_owner = (int) $this->contact_owner;
     $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_order_by = $this->contact_order_by == null ? '' : $this->contact_order_by;
     $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_order_by) <= 1) {
         $this->contact_order_by = mb_trim($this->contact_first_name . ' ' . $this->contact_last_name);
     }
     if (mb_strlen($this->contact_display_name) <= 1) {
         $this->contact_display_name = mb_trim($this->contact_first_name . ' ' . $this->contact_last_name);
     }
     $this->_error = $this->check();
     if (count($this->_error)) {
         return $this->_error;
     }
     $q = $this->_query;
     $this->contact_lastupdate = $q->dbfnNowWithTZ();
     /*
      * TODO: I don't like the duplication on each of these two branches, but I
      *   don't have a good idea on how to fix it at the moment...
      */
     if ($this->contact_id) {
         // && $perms->checkModuleItem('contacts', 'edit', $this->contact_id)) {
         if ($msg = parent::store()) {
             return $msg;
         }
         $stored = true;
     }
     if (0 == $this->contact_id) {
         // && $perms->checkModuleItem('contacts', 'add')) {
         if ($msg = parent::store()) {
             return $msg;
         }
         $stored = true;
     }
     if ($stored) {
         $custom_fields = new w2p_Core_CustomFields('contacts', 'addedit', $this->contact_id, 'edit');
         $custom_fields->bind($_POST);
         $sql = $custom_fields->store($this->contact_id);
         // Store Custom Fields
     }
     if ($stored) {
         $foto = W2P_BASE_DIR . '/fotos/' . $this->contact_id . '.jpg';
         $foto_temp = W2P_BASE_DIR . '/fotos/temp.jpg';
         if (file_exists($foto) && file_exists($foto_temp)) {
             unlink($foto);
         }
         if (file_exists($foto_temp)) {
             rename($foto_temp, $foto);
             if (file_exists($foto_temp)) {
                 unlink($foto_temp);
             }
         }
     }
     /*
      *  TODO: I don't like using the $_POST in here..
      */
     if ($stored) {
         $methods = array();
         if (!empty($_POST['contact_methods'])) {
             foreach ($_POST['contact_methods']['field'] as $key => $field) {
                 $methods[$field] = $_POST['contact_methods']['value'][$key];
             }
         }
         $this->setContactMethods($methods);
     }
     return $stored;
 }
예제 #27
0
 public function store(CAppUI $AppUI = null)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     $stored = false;
     $errorMsgArray = $this->check();
     if (count($errorMsgArray) > 0) {
         return $errorMsgArray;
     }
     if ($this->dept_id) {
         $q = new DBQuery();
         $ret = $q->updateObject('departments', $this, 'dept_id', false);
         addHistory('departments', $this->dept_id, 'update', $this->dept_name, $this->dept_id);
         $stored = true;
     } else {
         $q = new DBQuery();
         $ret = $q->insertObject('departments', $this, 'dept_id');
         addHistory('departments', $this->dept_id, 'add', $this->dept_name, $this->dept_id);
         $stored = true;
     }
     return $stored;
 }