/** * postsave functions are only called after a succesful save. They are * used to perform database operations after the event. */ function resource_postsave() { global $other_resources; global $obj; $task_id = $obj->task_id; dprint(__FILE__, __LINE__, 5, "saving resources, {$other_resources}"); if (isset($other_resources)) { $value = array(); $reslist = explode(';', $other_resources); foreach ($reslist as $res) { if ($res) { list($resource, $perc) = explode('=', $res); $value[] = array($task_id, $resource, $perc); } } // first delete any elements already there, then replace with this // list. $q = new DBQuery(); $q->setDelete('resource_tasks'); $q->addWhere('task_id = ' . $obj->task_id); $q->exec(); $q->clear(); if (count($value)) { foreach ($value as $v) { $q->addTable('resource_tasks'); $q->addInsert('task_id,resource_id,percent_allocated', $v, true); $q->exec(); $q->clear(); } } } }
function upgrade($old_version) { $q = new DBQuery(); switch ($old_version) { case '0.1': $q->alterTable('history'); $q->addField('history_table', 'varchar(15) NOT NULL default \'\''); $q->addField('history_action', 'varchar(10) NOT NULL default \'modify\''); $q->dropField('history_module'); $q->exec(); $q->clear(); case '0.2': $q->alterTable('history'); $q->addField('history_item', 'int(10) NOT NULL'); $q->exec(); $q->clear(); case '0.3': $q->alterTable('history'); $q->addIndex('index_history_item', '(history_item)'); $q->exec(); $q->clear(); $q->alterTable('history'); $q->addIndex('index_history_module', '(history_table, history_item)'); $q->exec(); $q->clear(); case '0.31': break; } return db_error(); }
function install() { $q = new DBQuery(); $q->createTable('links'); $q->createDefinition("(\n`link_id` int(11) NOT NULL AUTO_INCREMENT ,\n`link_url` varchar(255) NOT NULL default '',\n`link_project` int(11) NOT NULL default '0',\n`link_task` int(11) NOT NULL default '0',\n`link_name` varchar(255) NOT NULL default '',\n`link_parent` int(11) default '0',\n`link_description` text,\n`link_owner` int(11) default '0',\n`link_date` datetime default NULL ,\n`link_icon` varchar(20) default 'obj/',\n`link_category` int(11) NOT NULL default '0',\nPRIMARY KEY (`link_id`) ,\nKEY `idx_link_task` (`link_task`) ,\nKEY `idx_link_project` (`link_project`) ,\nKEY `idx_link_parent` (`link_parent`) \n) DEFAULT CHARSET utf8"); $q->exec($sql); $q->clear(); $q->addTable('sysvals'); $q->addInsert('sysval_key_id', 1); $q->addInsert('sysval_title', 'LinkType'); $q->addInsert('sysval_value', "0|Unknown\n1|Document\n2|Application"); $q->exec(); return NULL; }
function setComplete($id) { global $AppUI; $task = new CTask(); if ($task->load($id)) { $q = new DBQuery(); $q->addTable('user_tasks'); $q->addQuery('user_id'); $q->addWhere('task_id = ' . $id); $q->addWhere('user_id = ' . $AppUI->user_id); $r = $q->loadResult(); if ($r != $AppUI->user_id) { $p = new CProject($task->task_project); if (!$p->project_id || $p->getManager() != $AppUI->user_id) { return 'Error'; } } $q->addTable('tasks'); $q->addUpdate('task_percent_complete', '100'); $q->addWhere('task_id = ' . $id); $q->exec(); return 'OK'; } return 'Error'; }
function delete() { $q = new DBQuery(); $q->addTable('departments', 'dep'); $q->addQuery('dep.*'); $q->addWhere('dep.dept_parent = ' . $this->dept_id); $res = $q->exec(); if (db_num_rows($res)) { $q->clear(); return "deptWithSub"; } $q->clear(); $q->addTable('projects', 'p'); $q->addQuery('p.*'); $q->addWhere('p.project_department = ' . $this->dept_id); $res = $q->exec(); if (db_num_rows($res)) { $q->clear(); return "deptWithProject"; } // $sql = "DELETE FROM departments WHERE dept_id = $this->dept_id"; $q->clear(); $q->addQuery('*'); $q->setDelete('departments'); $q->addWhere('dept_id = ' . $this->dept_id); if (!$q->exec()) { $result = db_error(); } else { $result = NULL; } $q->clear(); return $result; }
public function remove() { $q = new DBQuery(); $q->setDelete('modules'); $q->addWhere("mod_directory = 'importers'"); $q->exec(); return true; }
function remove() { $q = new DBQuery(); $q->dropTable('projects_statistics'); $q->exec(); $q->clear(); return null; }
function testUpdateBD() { $q = new DBQuery(); $q->addTable('eap'); $q->addQuery("id,nome,linha,coluna"); $q->addUpdate(nome, 'Dot Project'); $q->addWhere("id = 1"); $q->prepareUpdate(); $this->assertEqual($q->exec(), true); $q->clear(); }
function delete() { global $dPconfig; $this->_message = "deleted"; // delete the main table reference $q = new DBQuery(); $q->setDelete('links'); $q->addWhere('link_id = ' . $this->link_id); if (!$q->exec()) { return db_error(); } return NULL; }
function remove() { $q = new DBQuery(); $q->dropTable('activity'); $q->exec(); $q->clear(); $q->dropTable('timesheet'); $q->exec(); $q->clear(); $q->dropTable('task_timesheet'); $q->exec(); $q->clear(); return db_error(); }
function store() { $q = new DBQuery(); $q->addTable('project_designer_options'); $q->addReplace('pd_option_user', $this->pd_option_user); $q->addReplace('pd_option_view_project', $this->pd_option_view_project); $q->addReplace('pd_option_view_gantt', $this->pd_option_view_gantt); $q->addReplace('pd_option_view_tasks', $this->pd_option_view_tasks); $q->addReplace('pd_option_view_actions', $this->pd_option_view_actions); $q->addReplace('pd_option_view_addtasks', $this->pd_option_view_addtasks); $q->addReplace('pd_option_view_files', $this->pd_option_view_files); $q->addWhere('pd_option_user = ' . $this->pd_option_user); $q->exec(); }
function saveNote($riskId, $userId, $riskDescription) { $q = new DBQuery(); $q->addTable('risk_notes'); $q->addInsert('risk_note_risk', $riskId); $q->addInsert('risk_note_creator', $userId); $q->addInsert('risk_note_date', 'NOW()', false, true); $q->addInsert('risk_note_description', $riskDescription); if (!$q->exec()) { return db_error(); } else { return true; } }
protected function _deDynamicLeafNodes($projectId) { $q = new DBQuery(); $q->addUpdate('task_dynamic', 0); $q->addWhere("task_project = {$projectId}"); $q->addTable('tasks'); $q->exec(); $q->addQuery('distinct(task_parent)'); $q->addTable('tasks'); $q->addWhere("task_project = {$projectId}"); $q->addWhere("task_id <> task_parent"); $taskList = $q->loadHashList(); foreach ($taskList as $id => $nothing) { $dynamicTasks .= $id . ','; } $dynamicTasks .= '0'; $q->clear(); $q->addUpdate('task_dynamic', 1); $q->addWhere("task_project = {$projectId}"); $q->addWhere("task_id IN ({$dynamicTasks})"); $q->addTable('tasks'); $q->exec(); }
public function store(CAppUI $AppUI = null) { global $AppUI; $q = new DBQuery(); $q->addTable('project_designer_options'); $q->addReplace('pd_option_user', $this->pd_option_user); $q->addReplace('pd_option_view_project', $this->pd_option_view_project); $q->addReplace('pd_option_view_gantt', $this->pd_option_view_gantt); $q->addReplace('pd_option_view_tasks', $this->pd_option_view_tasks); $q->addReplace('pd_option_view_actions', $this->pd_option_view_actions); $q->addReplace('pd_option_view_addtasks', $this->pd_option_view_addtasks); $q->addReplace('pd_option_view_files', $this->pd_option_view_files); $q->addWhere('pd_option_user = ' . (int) $this->pd_option_user); $q->exec(); }
function delete($oid = NULL) { $id = $this->user_id; $result = parent::delete($oid); if (!$result) { $acl =& $GLOBALS['AppUI']->acl(); $acl->deleteLogin($id); $q = new DBQuery(); $q->setDelete('user_preferences'); $q->addWhere('pref_user = ' . $this->user_id); $q->exec(); $q->clear(); } return $result; }
public function upgrade($old_version) { $q = new DBQuery(); switch ($old_version) { case '0.3': $q->alterTable('history'); $q->addIndex('index_history_item', '(history_item)'); $q->exec(); $q->clear(); $q->alterTable('history'); $q->addIndex('index_history_module', '(history_table, history_item)'); $q->exec(); $q->clear(); case '0.31': $q->alterTable('history'); $q->alterField('history_table', 'varchar(20) NOT NULL default ""'); $q->alterField('history_action', 'varchar(20) NOT NULL default "modify"'); $q->exec(); $q->clear(); case '0.32': break; } return db_error() ? false : true; }
public function install() { $q = new DBQuery(); $q->createTable('links'); $q->createDefinition('( link_id int( 11 ) NOT NULL AUTO_INCREMENT , link_url varchar( 255 ) NOT NULL default "", link_project int( 11 ) NOT NULL default "0", link_task int( 11 ) NOT NULL default "0", link_name varchar( 255 ) NOT NULL default "", link_parent int( 11 ) default "0", link_description text, link_owner int( 11 ) default "0", link_date datetime default NULL , link_icon varchar( 20 ) default "obj/", link_category int( 11 ) NOT NULL default "0", PRIMARY KEY ( link_id ) , KEY idx_link_task ( link_task ) , KEY idx_link_project ( link_project ) , KEY idx_link_parent ( link_parent ) ) TYPE = MYISAM '); $q->exec($sql); $q->clear(); $q->addTable('sysvals'); $q->addInsert('sysval_key_id', 1); $q->addInsert('sysval_title', 'LinkType'); $q->addInsert('sysval_value', 'Unknown'); $q->addInsert('sysval_value_id', '0'); $q->exec(); $q->clear(); $q->addTable('sysvals'); $q->addInsert('sysval_key_id', 1); $q->addInsert('sysval_title', 'LinkType'); $q->addInsert('sysval_value', 'Document'); $q->addInsert('sysval_value_id', '1'); $q->exec(); $q->clear(); $q->addTable('sysvals'); $q->addInsert('sysval_key_id', 1); $q->addInsert('sysval_title', 'LinkType'); $q->addInsert('sysval_value', 'Application'); $q->addInsert('sysval_value_id', '2'); $q->exec(); return null; }
function upgrade($old_version) { switch ($old_version) { case "1.0": $q = new DBQuery(); $q->addTable('resources'); $q->addField('resource_key', "varchar(64) not null default ''"); $q->exec(); if (db_error()) { return false; } // FALLTHROUGH // FALLTHROUGH case "1.0.1": break; } return true; }
function sendNewPass() { global $AppUI; $_live_site = dPgetConfig('base_url'); $_sitename = dPgetConfig('company_name'); // ensure no malicous sql gets past $checkusername = trim(dPgetParam($_POST, 'checkusername', '')); $checkusername = db_escape($checkusername); $confirmEmail = trim(dPgetParam($_POST, 'checkemail', '')); $confirmEmail = mb_strtolower(db_escape($confirmEmail)); $q = new DBQuery(); $q->addTable('users', 'u'); $q->addQuery('u.user_id'); $q->addWhere('user_username=\'' . $checkusername . '\' AND LOWER(contact_email)=\'' . $confirmEmail . '\''); $q->leftJoin('contacts', 'c', 'u.user_contact = c.contact_id'); if (!($user_id = $q->loadResult()) || !$checkusername || !$confirmEmail) { $AppUI->setMsg('Invalid username or email.', UI_MSG_ERROR); $AppUI->redirect(); } $newpass = makePass(); $message = $AppUI->_('sendpass0', UI_OUTPUT_RAW) . ' ' . $checkusername . ' ' . $AppUI->_('sendpass1', UI_OUTPUT_RAW) . ' ' . $_live_site . ' ' . $AppUI->_('sendpass2', UI_OUTPUT_RAW) . ' ' . $newpass . ' ' . $AppUI->_('sendpass3', UI_OUTPUT_RAW); $subject = "{$_sitename} :: " . $AppUI->_('sendpass4', UI_OUTPUT_RAW) . " - {$checkusername}"; $m = new Mail(); // create the mail $m->From("dotProject@" . dPgetConfig('site_domain')); $m->To($confirmEmail); $m->Subject($subject); $m->Body($message, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : ""); // set the body $m->Send(); // send the mail $newpass = md5($newpass); $q->clear(); $q->addTable('users'); $q->addUpdate('user_password', $newpass, true); $q->addWhere('user_id=\'' . $user_id . '\''); $cur = $q->exec(); if (!$cur) { die('SQL error' . $database->stderr(true)); } else { $AppUI->setMsg('New User Password created and emailed to you'); $AppUI->redirect(); } }
function getAllUsersGroupByDept() { $q = new DBQuery(); $q->addTable('users'); $q->addQuery('user_id, contact_department, concat_ws(", ", contact_last_name, contact_first_name) as contact_name'); $q->addJoin('contacts', 'con', 'contact_id = user_contact'); $q->addOrder('contact_last_name'); $res = $q->exec(); $userlist = array(); while ($row = $q->fetchRow()) { if ($row['contact_department'] == null) { $row['contact_department'] = 0; } if (!isset($userlist[$row['contact_department']])) { $userlist[$row['contact_department']] = array(); } $userlist[$row['contact_department']][$row['user_id']] = $row['contact_name']; } $q->clear(); return $userlist; }
function dPgetSysVal($title) { $q = new DBQuery(); $q->addTable('sysvals'); $q->leftJoin('syskeys', 'sk', 'syskey_id = sysval_key_id'); $q->addQuery('syskey_type, syskey_sep1, syskey_sep2, sysval_value'); $q->addWhere("sysval_title = '{$title}'"); $q->exec(); $row = $q->fetchRow(); $q->clear(); // type 0 = list $sep1 = $row['syskey_sep1']; // item separator $sep2 = $row['syskey_sep2']; // alias separator // A bit of magic to handle newlines and returns as separators // Missing sep1 is treated as a newline. if (!isset($sep1) || empty($sep1)) { $sep1 = "\n"; } if ($sep1 == "\\n") { $sep1 = "\n"; } if ($sep1 == "\\r") { $sep1 = "\r"; } $temp = explode($sep1, $row['sysval_value']); $arr = array(); // We use trim() to make sure a numeric that has spaces // is properly treated as a numeric foreach ($temp as $item) { if ($item) { $sep2 = empty($sep2) ? "\n" : $sep2; $temp2 = explode($sep2, $item); if (isset($temp2[1])) { $arr[trim($temp2[0])] = trim($temp2[1]); } else { $arr[trim($temp2[0])] = trim($temp2[0]); } } } return $arr; }
$q = new DBQuery(); $pinned_only = intval(w2PgetParam($_GET, 'pinned', 0)); if (isset($_GET['pin'])) { $pin = intval(w2PgetParam($_GET, 'pin', 0)); $msg = ''; // load the record data if ($pin) { $q->addTable('user_task_pin'); $q->addInsert('user_id', $AppUI->user_id); $q->addInsert('task_id', $task_id); } else { $q->setDelete('user_task_pin'); $q->addWhere('user_id = ' . (int) $AppUI->user_id); $q->addWhere('task_id = ' . (int) $task_id); } if (!$q->exec()) { $AppUI->setMsg('ins/del err', UI_MSG_ERROR, true); } else { $q->clear(); } $AppUI->redirect('', -1); } $AppUI->savePlace(); $durnTypes = w2PgetSysVal('TaskDurationType'); $taskPriority = w2PgetSysVal('TaskPriority'); $task_project = $project_id; $task_sort_item1 = w2PgetParam($_GET, 'task_sort_item1', ''); $task_sort_type1 = w2PgetParam($_GET, 'task_sort_type1', ''); $task_sort_item2 = w2PgetParam($_GET, 'task_sort_item2', ''); $task_sort_type2 = w2PgetParam($_GET, 'task_sort_type2', ''); $task_sort_order1 = intval(w2PgetParam($_GET, 'task_sort_order1', 0));
<?php // deny all but system admins $canEdit = !getDenyEdit('system'); if (!$canEdit) { $AppUI->redirect("m=public&a=access_denied"); } $AppUI->savePlace(); $q = new DBQuery(); if (isset($_POST['forcewatch']) && isset($_POST['forcesubmit'])) { // insert row into forum_watch for forcing Watch $q->addTable('forum_watch'); $q->addInsert('watch_user', 0); $q->addInsert('watch_forum', 0); $q->addInsert('watch_topic', 0); if (!$q->exec()) { $AppUI->setMsg(db_error(), UI_MSG_ERROR); } else { $AppUI->setMsg("Watch Forced", UI_MSG_OK); } $q->clear(); $AppUI->redirect('m=forums&a=configure'); } elseif (isset($_POST['forcesubmit']) && !isset($_POST['forcewatch'])) { // delete row from forum_watch for unorcing Watch $q->setDelete('forum_watch'); $q->addWhere('watch_user = 0'); $q->addWhere('watch_forum = 0'); $q->addWhere('watch_topic = 0'); if (!$q->exec()) { $AppUI->setMsg(db_error(), UI_MSG_ERROR); } else {
function getEventsInWindow($start_date, $end_date, $start_time, $end_time, $users = null) { global $AppUI; if (!isset($users)) { return false; } if (!count($users)) { return false; } // Now build a query to find matching events. $q = new DBQuery(); $q->addTable('events', 'e'); $q->addQuery('e.event_owner, ue.user_id, e.event_cwd, e.event_id, e.event_start_date, e.event_end_date'); $q->addJoin('user_events', 'ue', 'ue.event_id = e.event_id'); $q->addWhere("event_start_date >= '{$start_date}'" . " AND event_end_date <= '{$end_date}'" . " AND EXTRACT(HOUR_MINUTE FROM e.event_end_date) >= '{$start_time}'" . " AND EXTRACT(HOUR_MINUTE FROM e.event_start_date) <= '{$end_time}'" . ' AND (e.event_owner IN (' . implode(',', $users) . ')' . ' OR ue.user_id IN (' . implode(',', $users) . '))'); $result = $q->exec(); if (!$result) { return false; } $eventlist = array(); while ($row = db_fetch_assoc($result)) { $eventlist[] = $row; } $q->clear(); return $eventlist; }
$type = dPgetsysval('TaskType'); $stype = array('' => '(' . $AppUI->_('Type') . ')') + $type; $priority = dPgetsysval('TaskPriority'); $spriority = array('' => '(' . $AppUI->_('Priority') . ')') + $priority; $stask_access = array('' => '(' . $AppUI->_('Access') . ')') + $task_access; $durntype = dPgetSysval('TaskDurationType'); $sdurntype = array('' => '(' . $AppUI->_('Priority') . 'Duration Type)') + $durntype; $sother = array('' => '(' . $AppUI->_('Other Operations') . ')', '1' => '' . $AppUI->_('Mark Tasks as Finished') . '', '8' => '' . $AppUI->_('Mark Tasks as Active') . '', '9' => '' . $AppUI->_('Mark Tasks as Inactive') . '', '2' => '' . $AppUI->_('Mark Tasks as Milestones') . '', '3' => '' . $AppUI->_('Mark Tasks as Non Milestone') . '', '4' => '' . $AppUI->_('Mark Tasks as Dynamic') . '', '5' => '' . $AppUI->_('Mark Tasks as Non Dynamic') . '', '6' => '' . $AppUI->_('Add Task Reminder') . '', '7' => '' . $AppUI->_('Remove Task Reminder') . '', '99' => '' . $AppUI->_('Delete Tasks') . ''); //Pull all users $q = new DBQuery(); $q->addQuery('user_id, contact_first_name, contact_last_name'); $q->addTable('users'); $q->addTable('contacts'); $q->addWhere('user_contact = contact_id'); $q->addOrder('contact_first_name, contact_last_name'); $q->exec(); $users = array(); while ($row = $q->fetchRow()) { $users[$row['user_id']] = $row['contact_first_name'] . ' ' . $row['contact_last_name']; } $q->clear(); $sowners = array('' => '(' . $AppUI->_('Task Owner') . ')') + $users; $sassign = array('' => '(' . $AppUI->_('Assign User') . ')') + $users; $sunassign = array('' => '(' . $AppUI->_('Unassign User') . ')') + $users; $obj =& new CTask(); $allowedTasks = $obj->getAllowedSQL($AppUI->user_id, 'tasks.task_id'); $obj->load($task_id); $task_project = $project_id ? $project_id : ($obj->task_project ? $obj->task_project : 0); // let's get root tasks $q = new DBQuery(); $q->addQuery('task_id, task_name, task_end_date, task_start_date, task_milestone, task_parent, task_dynamic');
// Add / Edit forum $forum_id = intval(dPgetParam($_GET, 'forum_id', 0)); $forum_project = intval(dPgetParam($_GET, 'forum_project', 0)); // check permissions for this record $canEdit = getPermission($m, 'edit', $forum_id); if (!$canEdit || !$canAuthor) { $AppUI->redirect("m=public&a=access_denied"); } // load the companies class to retrieved denied projects require_once $AppUI->getModuleClass('projects'); $forum_id = intval(dPgetParam($_GET, 'forum_id', 0)); //Pull forum information $q = new DBQuery(); $q->addTable('forums'); $q->addWhere("forums.forum_id = {$forum_id}"); $res = $q->exec(); echo db_error(); $forum_info = db_fetch_assoc($res); $status = isset($forum_info["forum_status"]) ? $forum_info["forum_status"] : -1; // get any project records denied from viewing $projObj = new CProject(); //Pull project Information $q = new DBQuery(); $q->addTable('projects'); $q->addQuery('project_id, project_name'); $q->addWhere('project_status <> 7'); $q->addOrder('project_name'); $projObj->setAllowedSQL($AppUI->user_id, $q); if (isset($company_id)) { $q->addWhere("project_company = {$company_id}"); }
/** * Called by the Event Queue processor to process a reminder * on a task. * @access public * @param string $module Module name (not used) * @param string $type Type of event (not used) * @param integer $id ID of task being reminded * @param integer $owner Originator of event * @param mixed $args event-specific arguments. * @return mixed true, dequeue event, false, event stays in queue. -1, event is destroyed. */ function remind($module, $type, $id, $owner, &$args) { global $locale_char_set, $AppUI; $q = new DBQuery(); $df = $AppUI->getPref('SHDATEFORMAT'); $tf = $AppUI->getPref('TIMEFORMAT'); // If we don't have preferences set for these, use ISO defaults. if (!$df) { $df = '%Y-%m-%d'; } if (!$tf) { $tf = '%H:%m'; } $df .= ' ' . $tf; // At this stage we won't have an object yet if (!$this->load($id)) { return -1; // No point it trying again later. } $this->htmlDecode(); // Only remind on working days. $today = new CDate(); if (!$today->isWorkingDay()) { return true; } // Check if the task is completed if ($this->task_percent_complete == 100) { return -1; } // Grab the assignee list $q->addTable('user_tasks', 'ut'); $q->leftJoin('users', 'u', 'u.user_id = ut.user_id'); $q->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact'); $q->addQuery('c.contact_id, contact_first_name, contact_last_name, contact_email'); $q->addWhere('ut.task_id = ' . $id); $contacts = $q->loadHashList('contact_id'); $q->clear(); // Now we also check the owner of the task, as we will need // to notify them as well. $owner_is_not_assignee = false; $q->addTable('users', 'u'); $q->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact'); $q->addQuery('c.contact_id, contact_first_name, contact_last_name, contact_email'); $q->addWhere('u.user_id = ' . $this->task_owner); if ($q->exec(ADODB_FETCH_NUM)) { list($owner_contact, $owner_first_name, $owner_last_name, $owner_email) = $q->fetchRow(); if (!isset($contacts[$owner_contact])) { $owner_is_not_assignee = true; $contacts[$owner_contact] = array('contact_id' => $owner_contact, 'contact_first_name' => $owner_first_name, 'contact_last_name' => $owner_last_name, 'contact_email' => $owner_email); } } $q->clear(); // build the subject line, based on how soon the // task will be overdue. $starts = new CDate($this->task_start_date); $expires = new CDate($this->task_end_date); $now = new CDate(); $diff = $expires->dateDiff($now); $prefix = $AppUI->_('Task Due', UI_OUTPUT_RAW); if ($diff == 0) { $msg = $AppUI->_('TODAY', UI_OUTPUT_RAW); } else { if ($diff == 1) { $msg = $AppUI->_('TOMORROW', UI_OUTPUT_RAW); } else { if ($diff < 0) { $msg = $AppUI->_(array('OVERDUE', abs($diff), 'DAYS')); $prefix = $AppUI->_('Task', UI_OUTPUT_RAW); } else { $msg = $AppUI->_(array($diff, 'DAYS')); } } } $q->addTable('projects'); $q->addQuery('project_name'); $q->addWhere('project_id = ' . $this->task_project); $project_name = htmlspecialchars_decode($q->loadResult()); $q->clear(); $subject = $prefix . ' ' . $msg . ' ' . $this->task_name . '::' . $project_name; $body = $AppUI->_('Task Due', UI_OUTPUT_RAW) . ': ' . $msg . "\n" . $AppUI->_('Project', UI_OUTPUT_RAW) . ': ' . $project_name . "\n" . $AppUI->_('Task', UI_OUTPUT_RAW) . ': ' . $this->task_name . "\n" . $AppUI->_('Start Date', UI_OUTPUT_RAW) . ': ' . $starts->format($df) . "\n" . $AppUI->_('Finish Date', UI_OUTPUT_RAW) . ': ' . $expires->format($df) . "\n" . $AppUI->_('URL', UI_OUTPUT_RAW) . ': ' . DP_BASE_URL . '/index.php?m=tasks&a=view&task_id=' . $this->task_id . '&reminded=1' . "\n\n" . $AppUI->_('Resources', UI_OUTPUT_RAW) . ":\n"; foreach ($contacts as $contact) { if ($owner_is_not_assignee || $contact['contact_id'] != $owner_contact) { $body .= $contact['contact_first_name'] . ' ' . $contact['contact_last_name'] . ' <' . $contact['contact_email'] . ">\n"; } } $body .= "\n" . $AppUI->_('Description', UI_OUTPUT_RAW) . ":\n" . $this->task_description . "\n"; $mail = new Mail(); foreach ($contacts as $contact) { if ($mail->ValidEmail($contact['contact_email'])) { $mail->To($contact['contact_email']); } } $mail->From('"' . $owner_first_name . ' ' . $owner_last_name . '" <' . $owner_email . '>'); $mail->Subject($subject, $locale_char_set); $mail->Body($body, $locale_char_set); return $mail->Send(); }
function delete() { $q = new DBQuery(); $q->setDelete('custom_fields_lists'); $q->addWhere("field_id = {$this->field_id}"); $q->exec(); $q->clear(); }
public function delete($oid = null) { global $AppUI; $k = $this->_tbl_key; if ($oid) { $this->{$k} = intval($oid); } if (!$this->canDelete($msg, $oid ? $oid : $this->file_folder_id)) { return $msg; } $this->{$k} = $this->{$k} ? $this->{$k} : intval($oid ? $oid : $this->file_folder_id); $q = new DBQuery(); $q->setDelete($this->_tbl); $q->addWhere($this->_tbl_key . ' = ' . $this->{$k}); if (!$q->exec()) { $q->clear(); return db_error(); } else { $q->clear(); return null; } }
} $departments_count = 0; $department_selection_list = getDepartmentSelectionList($company_id, $selected_departments); if ($department_selection_list != '' || $project_id) { $department_selection_list = $AppUI->_('Departments') . "<br />\n" . '<select name="dept_ids[]" class="text">' . "\n" . '<option value="0"></option>' . "\n" . $department_selection_list . "\n" . '</select>'; } else { $department_selection_list = '<input type="button" class="button" value="' . $AppUI->_('Select department...') . '" onclick="javascript:popDepartment();" />' . '<input type="hidden" name="project_departments"'; } // Get contacts list $selected_contacts = array(); if ($project_id) { $q =& new DBQuery(); $q->addTable('project_contacts'); $q->addQuery('contact_id'); $q->addWhere('project_id = ' . $project_id); $res =& $q->exec(); for ($res; !$res->EOF; $res->MoveNext()) { $selected_contacts[] = $res->fields['contact_id']; } $q->clear(); } if ($project_id == 0 && $contact_id > 0) { $selected_contacts[] = $contact_id; } ?> <link rel="stylesheet" type="text/css" media="all" href="<?php echo DP_BASE_URL; ?> /lib/calendar/calendar-dp.css" title="blue" /> <!-- import the calendar script --> <script type="text/javascript" src="<?php