示例#1
0
 $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);
 }