Пример #1
0
    $AppUI->redirect();
}
if ($obj->task_log_date) {
    $date = new CDate($obj->task_log_date);
    $obj->task_log_date = $date->format(FMT_DATETIME_MYSQL);
}
$dot = mb_strpos($obj->task_log_hours, ':');
if ($dot > 0) {
    $log_duration_minutes = sprintf('%.3f', mb_substr($obj->task_log_hours, $dot + 1) / 60.0);
    $obj->task_log_hours = floor($obj->task_log_hours) + $log_duration_minutes;
}
$obj->task_log_hours = round($obj->task_log_hours, 3);
// prepare (and translate) the module name ready for the suffix
$AppUI->setMsg('Task Log');
if ($del) {
    if ($msg = $obj->delete()) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
    } else {
        $AppUI->setMsg('deleted', UI_MSG_ALERT);
    }
    $AppUI->redirect();
} else {
    $obj->task_log_costcode = cleanText($obj->task_log_costcode);
    if ($msg = $obj->store()) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
        $AppUI->redirect();
    } else {
        $AppUI->setMsg(@$_POST['task_log_id'] ? 'updated' : 'inserted', UI_MSG_OK, true);
    }
}
$task = new CTask();
Пример #2
0
<?php

/* $Id: do_updatetask.php 2016 2011-08-07 07:08:46Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/tasks/do_updatetask.php $ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
$del = (int) w2PgetParam($_POST, 'del', 0);
$notify_owner = w2PgetParam($_POST, 'task_log_notify_owner', 'off');
$isNotNew = (int) w2PgetParam($_POST, 'task_log_id', 0);
$obj = new CTaskLog();
if (!$obj->bind($_POST)) {
    $AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
    $AppUI->redirect();
}
$action = $del ? 'deleted' : 'stored';
$result = $del ? $obj->delete($AppUI) : $obj->store($AppUI);
if (is_array($result)) {
    $AppUI->setMsg($result, UI_MSG_ERROR, true);
    $AppUI->holdObject($obj);
    $AppUI->redirect('m=tasks&a=view&task_id=' . $obj->task_log_task);
}
if ($result) {
    $AppUI->setMsg('Task Log ' . $action, UI_MSG_OK, true);
    $task = new CTask();
    $task->load($obj->task_log_task);
    if ('on' == $notify_owner) {
        if ($msg = $task->notifyOwner()) {
            $AppUI->setMsg($msg, UI_MSG_ERROR);
        }
    }
    // Check if we need to email the task log to anyone.