Exemplo n.º 1
0
 $hditem = new CHelpDeskItem();
 $hditem->load($item_id);
 $new_status = dPgetParam($_POST, 'item_status', 0);
 if ($new_status != $hditem->item_status) {
     $status_log_id = $hditem->log_status(11, $AppUI->_('changed from') . " \"" . $AppUI->_($ist[$hditem->item_status]) . "\" " . $AppUI->_('to') . " \"" . $AppUI->_($ist[$new_status]) . "\"");
     $hditem->item_status = $new_status;
     if ($msg = $hditem->store()) {
         $AppUI->setMsg($msg, UI_MSG_ERROR);
         $AppUI->redirect();
     } else {
         $hditem->notify(STATUS_LOG, $status_log_id);
     }
 }
 //then create/update the task log
 $obj = new CHDTaskLog();
 if (!$obj->bind($_POST)) {
     $AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
     $AppUI->redirect();
 }
 if ($obj->task_log_date) {
     $date = new CDate($obj->task_log_date);
     $obj->task_log_date = $date->format(FMT_DATETIME_MYSQL);
 }
 $AppUI->setMsg('Task Log');
 $obj->task_log_costcode = $obj->task_log_costcode;
 if ($msg = $obj->store()) {
     $AppUI->setMsg($msg, UI_MSG_ERROR);
     $AppUI->redirect();
 } else {
     $hditem->notify(TASK_LOG, $obj->task_log_id);
     $AppUI->setMsg(@$_POST['task_log_id'] ? 'updated' : 'added', UI_MSG_OK, true);
Exemplo n.º 2
0
            $item_date = new CDate();
            $idate = $item_date->format(FMT_DATETIME_MYSQL);
            $hditem->item_created = $idate;
            $hditem->item_updated = $udate;
        } else {
            $hditem->item_updated = $udate;
        }
        if ($msg = $hditem->store()) {
            $AppUI->setMsg($msg, UI_MSG_ERROR);
        } else {
            if ($new_item) {
                $status_log_id = $hditem->log_status(0, $AppUI->_('Created'), $new_item);
                // Lets create a log for the item creation:
                $obj = new CHDTaskLog();
                $new_item_log = array('task_log_id' => 0, 'task_log_help_desk_id' => $hditem->item_id, 'task_log_creator' => $AppUI->user_id, 'task_log_name' => 'Item Created: ' . $_POST['item_title'], 'task_log_date' => $hditem->item_created, 'task_log_description' => $_POST['item_title'], 'task_log_hours' => $_POST['task_log_hours'], 'task_log_costcode' => $_POST['task_log_costcode']);
                if (!$obj->bind($new_item_log)) {
                    $AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
                    $AppUI->redirect();
                }
                if ($msg = $obj->store()) {
                    $AppUI->setMsg($msg, UI_MSG_ERROR);
                    $AppUI->redirect();
                }
            }
            doWatchers(dPgetParam($_POST, 'watchers', 0), $hditem);
            $AppUI->setMsg($new_item ? $AppUI->_('Help Desk Item') . ' ' . $AppUI->_('added') : $AppUI->_('Help Desk Item') . ' ' . $AppUI->_('updated'), UI_MSG_OK, true);
            $AppUI->redirect('m=helpdesk&a=view&item_id=' . $hditem->item_id);
        }
    }
}
/**