Ejemplo n.º 1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Project $project, Task $task, Request $request)
 {
     $this->validate($request, $this->rules);
     $input = array_except(Input::all(), '_method');
     $task->update($input);
     return Redirect::route('projects.tasks.show', [$project->slug, $task->slug])->with('message', 'Task updated.');
 }
Ejemplo n.º 2
0
 protected function handleRequest(array $request)
 {
     $taskId = $request[self::FIELD_TASK_ID];
     $title = $request[self::FIELD_TITLE];
     $description = $request[self::FIELD_DESCRIPTION];
     Task::update($taskId, $title, $description);
 }
Ejemplo n.º 3
0
 function UpdateTask($data, $fields)
 {
     try {
         $task = new Task();
         $result = $task->update($fields);
         return $result;
     } catch (Exception $e) {
         return array('Exception!! ' => $e->getMessage());
     }
 }
Ejemplo n.º 4
0
 function test_Update()
 {
     //Arrange
     $id = 1;
     $description = "Wash the dog";
     $date_due = "1990-12-11";
     $time_due = "09:00:00";
     $test_task = new Task($id, $description, $date_due, $time_due);
     $test_task->save();
     $new_description = "Home stuff";
     //Act
     $test_task->update($new_description);
     //Assert
     $this->assertEquals("Home stuff", $test_task->getDescription());
 }
Ejemplo n.º 5
0
 public static function update($id)
 {
     parent::check_logged_in();
     $p = $_POST;
     // because i am a lazy piece of shit
     $task = Task::find($id);
     $task->name = $p['name'];
     $task->description = $p['description'];
     $task->priority = intval($p['priority']);
     $task->completed = isset($p['completed']) ? $p['completed'] : false;
     $errors = $task->validate();
     if (count($errors) > 0) {
         View::make('task/edit.html', array('errors' => $errors, 'attributes' => $p, 'title' => 'edit ' . $task->name, 'groups' => Group::all()));
     } else {
         //$task->update();
         Task::update($id);
         Redirect::to('/task/' . $task->id, array('message' => 'Task has been modified successfully.'));
     }
 }
Ejemplo n.º 6
0
 public static function update($id)
 {
     // push edits to DB
     self::check_logged_in();
     $params = $_POST;
     if (empty($_POST['projects'])) {
         $errors[] = 'Select at least one project!';
         $projects = '';
     } else {
         $projects = $_POST['projects'];
     }
     $attributes = array('id' => $id, 'description' => $params['description'], 'priority' => $params['priority'], 'status' => $params['status'], 'projectids' => $projects);
     $task = new Task($attributes);
     //$errors = $task->errors();
     $errors = $task->validateTask();
     if (count($errors) > 0) {
         View::make('task/edit.html', array('errors' => $errors, 'attributes' => $attributes));
     } else {
         self::updateProjectMembership($id, $projects);
         $task->update();
         Redirect::to('/task/' . $task->id, array('message' => 'Task edited successfully'));
     }
 }
Ejemplo n.º 7
0
 function testUpdate()
 {
     //Arrange
     $name = "School stuff";
     $id = null;
     $test_category = new Category($name, $id);
     $test_category->save();
     $description = "Wash the dog";
     $category_id = $test_category->getId();
     $test_task = new Task($description, $id, $category_id);
     $test_task->save();
     $new_description = "Clean the dog";
     //Act
     $test_task->update($new_description);
     //Assert
     $this->assertEquals("Clean the dog", $test_task->getDescription());
 }
Ejemplo n.º 8
0
 /**
  * updates row tasks from an Task Array
  * @param string $aTasks
  * @return array
  */
 public function updateTaskRows($aTask)
 {
     foreach ($aTask as $key => $row) {
         $oTask = new Task();
         if ($oTask->taskExists($row['TAS_UID'])) {
             $oTask->remove($row['TAS_UID']);
         } else {
             $res = $oTask->update($row);
         }
     }
     return;
 }
Ejemplo n.º 9
0
<?php

/**
 * 发送成功列表
 * @author 潘洪学 panliu888@gmail.com
 * @create_date	2011-10
 */
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'init.php';
Passport::RequireLogin();
$task = new Task();
switch (strtolower($_GET['action'])) {
    case 'del':
        $task->UpdateStatus(Task::DELETE_OK, intval($_GET['id']), '已取消');
        break;
    case 'clear':
        $task->update(array('status' => Task::DELETE_OK, 'msg' => '被清空'), array('uid' => Passport::GetLoginUid(), 'status' => Task::OK));
        redirect('?');
        break;
}
$pager = new Pager($task->GetCount(Task::OK), 20);
$TEMPLATE['list'] = $task->GetList(Task::OK, $pager->offset());
$TEMPLATE['pager'] = $pager->render();
$TEMPLATE['title'] = '已发送';
$TEMPLATE['login_name'] = Passport::GetLoginName();
$TEMPLATE['nav']['list_ok'] = 'current';
$smarty = new Template();
echo $smarty->r('list_ok');
Ejemplo n.º 10
0
 } else {
     if ($_POST['action'] === "updtask") {
         if ($admin === true) {
             try {
                 (new Teams())->login(htmlspecialchars_decode($team->name), $_POST['pass']);
                 $task = new Task($_POST['id']);
                 $task->name = $_POST['name'];
                 $task->desc = $_POST['desc'];
                 $task->cat = $_POST['cat'];
                 $task->status = $_POST['status'];
                 $task->author = $_POST['author'];
                 $task->solvers = explode(',', $_POST['solvers']);
                 $task->point = $_POST['point'];
                 //$task->flag = $_POST['flag'];
                 $task->link = $_POST['link'];
                 $task->update();
                 $success = "HELAL LA GUNCELLEDIN HAYIRLARA VESILE OLUR INS";
             } catch (Exception $e) {
                 $error .= $e->getMessage() . "\n";
             }
         }
     } else {
         if ($_POST['action'] === "addtask") {
             if ($admin === true) {
                 try {
                     (new Teams())->login(htmlspecialchars_decode($team->name), $_POST['pass']);
                     $task = new Task();
                     $task->name = $_POST['name'];
                     $task->desc = implode("<%#:#%>", $_POST['desc']);
                     $task->cat = $_POST['cat'];
                     $task->status = $_POST['status'];
Ejemplo n.º 11
0
        if (!validate()) {
        } else {
            $tableInfo = array('title' => $_POST['title'], 'content' => $_POST['content']);
            if ($data['cat'] == 'weibo') {
                if ($_FILES['image']['tmp_name']) {
                    @mkdir(UPLOAD_PATH, 0777, true);
                    $save_file = $upload_file = UPLOAD_PATH . microtime(true) . '_' . Pinyin::get($_FILES['image']['name']);
                    move_uploaded_file($_FILES['image']['tmp_name'], $save_file);
                    $tableInfo['pic'] = $save_file;
                }
            }
            if ($_POST['time'] == 'on') {
                $tableInfo['status'] = Task::TASK;
                $tableInfo['send_time'] = strtotime($_POST['send_time']);
            }
            $task->update($tableInfo, array('id' => $id));
            $item = $task->get($id);
            $TEMPLATE['report']['edit'] = array('status' => true, 'msg' => '修改成功,<a href="' . $_POST['return_url'] . '">&lt;返回</a>(<span id="countdown">5</span>)
<script>
var countd = 5;
var tt = setInterval(function(){
	if (--countd == 0) {
		clearInterval(tt);
		location = "' . $_POST['return_url'] . '";
		return;
	}
	$("#countdown").text(countd);
}, 1000);
</script>');
            if ($_POST['time'] != 'on') {
                $arr = explode('|', $item['type']);
Ejemplo n.º 12
0
 function test_update()
 {
     $description = "Wash the dog";
     $id = 1;
     $due_date = "2000-01-01";
     $test_task = new Task($description, $id, $due_date);
     $test_task->save();
     $new_description = "Clean the dog";
     $test_task->update($new_description, $due_date, 0);
     $this->assertEquals("Clean the dog", $test_task->getDescription());
 }
Ejemplo n.º 13
0
            if (isset($aData['SEND_EMAIL'])) {
                $aData['TAS_SEND_LAST_EMAIL'] = $aData['SEND_EMAIL'] == 'TRUE' ? 'TRUE' : 'FALSE';
            } else {
                $aData['TAS_SEND_LAST_EMAIL'] = 'FALSE';
            }
            //Additional configuration
            if (isset($aData['TAS_DEF_MESSAGE_TYPE']) && isset($aData['TAS_DEF_MESSAGE_TEMPLATE'])) {
                G::LoadClass('configuration');
                $oConf = new Configurations();
                $oConf->aConfig = array('TAS_DEF_MESSAGE_TYPE' => $aData['TAS_DEF_MESSAGE_TYPE'], 'TAS_DEF_MESSAGE_TEMPLATE' => $aData['TAS_DEF_MESSAGE_TEMPLATE']);
                $oConf->saveConfig('TAS_EXTRA_PROPERTIES', $aData['TAS_UID'], '', '');
                unset($aData['TAS_DEF_MESSAGE_TYPE']);
                unset($aData['TAS_DEF_MESSAGE_TEMPLATE']);
            }
            //Validating TAS_ASSIGN_VARIABLE value
            if ($aData['TAS_ASSIGN_TYPE'] == 'SELF_SERVICE_EVALUATE') {
                $aData['TAS_ASSIGN_TYPE'] = 'SELF_SERVICE';
            } else {
                $aData['TAS_GROUP_VARIABLE'] = '';
            }
            $result = $oTask->update($aData);
            $response["status"] = "OK";
            if ($result == 3) {
                $response["status"] = "CRONCL";
            }
            echo G::json_encode($response);
            break;
    }
} catch (Exception $oException) {
    die($oException->getMessage());
}
Ejemplo n.º 14
0
 public function saveProperties($param)
 {
     try {
         $result->sucess = true;
         $result->msg = '';
         switch ($param['type']) {
             case 'process':
                 require_once 'classes/model/ProcessCategory.php';
                 require_once 'classes/model/CalendarDefinition.php';
                 G::LoadClass('processMap');
                 $oProcessMap = new ProcessMap();
                 $process['PRO_UID'] = $param['UID'];
                 switch ($param['property']) {
                     case 'Title':
                         $fieldName = 'PRO_TITLE';
                         break;
                     case 'Description':
                         $fieldName = 'PRO_DESCRIPTION';
                         break;
                     case 'Debug':
                         $fieldName = 'PRO_DEBUG';
                         $param['value'] = $param['value'] == 'true' ? '1' : '0';
                         break;
                     case 'Category':
                         $fieldName = 'PRO_CATEGORY';
                         $category = ProcessCategory::loadByCategoryName($param['value']);
                         $param['value'] = $category[0]['CATEGORY_UID'];
                         break;
                     case 'Calendar':
                         $fieldName = 'PRO_CALENDAR';
                         $calendar = CalendarDefinition::loadByCalendarName($param['value']);
                         G::LoadClass("calendar");
                         $calendarObj = new Calendar();
                         $calendarObj->assignCalendarTo($process['PRO_UID'], $calendar['CALENDAR_UID'], 'PROCESS');
                         break;
                 }
                 if ($fieldName != 'PRO_CALENDAR') {
                     $process[$fieldName] = $param['value'];
                     $oProcessMap->updateProcess($process);
                 }
                 break;
             case 'task':
                 require_once 'classes/model/Task.php';
                 $oTask = new Task();
                 $task['TAS_UID'] = $param['UID'];
                 switch ($param['property']) {
                     case 'Title':
                         $fieldName = 'TAS_TITLE';
                         break;
                     case 'Description':
                         $fieldName = 'TAS_DESCRIPTION';
                         break;
                     case 'Variable for case priority':
                         $fieldName = 'TAS_PRIORITY_VARIABLE';
                         break;
                     case 'Starting Task':
                         $fieldName = 'TAS_START';
                         $param['value'] = strtoupper($param['value']);
                         break;
                 }
                 $task[$fieldName] = $param['value'];
                 print_r($task);
                 $oTask->update($task);
                 break;
         }
     } catch (Exception $e) {
         $result->sucess = false;
         $result->msg = $e->getMessage();
     }
     print G::json_encode($result);
 }
Ejemplo n.º 15
0
 /**
  * Save process and task propeties
  *
  * @param object $httpData{UID, type, property, value}
  */
 public function saveProperties($httpData)
 {
     switch ($httpData->type) {
         case 'process':
             require_once 'classes/model/ProcessCategory.php';
             require_once 'classes/model/CalendarDefinition.php';
             G::LoadClass('processMap');
             $oProcessMap = new ProcessMap();
             $process['PRO_UID'] = $httpData->UID;
             switch ($httpData->property) {
                 case 'Title':
                     $fieldName = 'PRO_TITLE';
                     break;
                 case 'Description':
                     $fieldName = 'PRO_DESCRIPTION';
                     break;
                 case 'Debug':
                     $fieldName = 'PRO_DEBUG';
                     $httpData->value = $httpData->value == 'true' ? '1' : '0';
                     break;
                 case 'Category':
                     $fieldName = 'PRO_CATEGORY';
                     $category = ProcessCategory::loadByCategoryName($httpData->value);
                     $httpData->value = $category['CATEGORY_UID'];
                     break;
                 case 'Calendar':
                     $fieldName = 'PRO_CALENDAR';
                     $calendar = CalendarDefinition::loadByCalendarName($httpData->value);
                     G::LoadClass("calendar");
                     $calendarObj = new Calendar();
                     $calendarObj->assignCalendarTo($process['PRO_UID'], $calendar['CALENDAR_UID'], 'PROCESS');
                     break;
             }
             if ($fieldName != 'PRO_CALENDAR') {
                 $process[$fieldName] = $httpData->value;
                 $oProcessMap->updateProcess($process);
             }
             break;
         case 'task':
             require_once 'classes/model/Task.php';
             $oTask = new Task();
             $task['TAS_UID'] = $httpData->UID;
             switch ($httpData->property) {
                 case 'Title':
                     $fieldName = 'TAS_TITLE';
                     break;
                 case 'Description':
                     $fieldName = 'TAS_DESCRIPTION';
                     break;
                 case 'Variable for case priority':
                     $fieldName = 'TAS_PRIORITY_VARIABLE';
                     break;
                 case 'Starting Task':
                     $fieldName = 'TAS_START';
                     $httpData->value = strtoupper($httpData->value);
                     break;
             }
             $task[$fieldName] = $httpData->value;
             $oTask->update($task);
             break;
     }
     $this->sucess = true;
 }
Ejemplo n.º 16
0
	{
		$task = new Task($db);
		$task->fetch($_POST["id"]);

		$tmparray=explode('_',$_POST['task_parent']);
		$task_parent=$tmparray[1];
		if (empty($task_parent)) $task_parent = 0;	// If task_parent is ''

		$task->label = $_POST["label"];
		$task->description = $_POST['description'];
		$task->fk_task_parent = $task_parent;
		$task->date_start = dol_mktime(12,0,0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear']);
		$task->date_end = dol_mktime(12,0,0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear']);
		$task->progress = $_POST['progress'];

		$result=$task->update($user);

		$taskid=$task->id;  // On retourne sur la fiche tache
	}
	else
	{
		$taskid=$_POST["id"];
		$_GET['action']='edit';
	}
}

if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->projet->supprimer)
{
	$task = new Task($db);
	if ($task->fetch($_GET["id"]) >= 0 )
	{
Ejemplo n.º 17
0
 /**
  *    Shift project task date from current date to delta
  *
  *    @param	timestamp		$old_project_dt_start	old project start date
  *    @return	int				1 if OK or < 0 if KO
  */
 function shiftTaskDate($old_project_dt_start)
 {
     global $user, $langs, $conf;
     $error = 0;
     $taskstatic = new Task($this->db);
     // Security check
     $socid = 0;
     if ($user->societe_id > 0) {
         $socid = $user->societe_id;
     }
     $tasksarray = $taskstatic->getTasksArray(0, 0, $this->id, $socid, 0);
     foreach ($tasksarray as $tasktoshiftdate) {
         $to_update = false;
         // Fetch only if update of date will be made
         if (!empty($tasktoshiftdate->date_start) || !empty($tasktoshiftdate->date_end)) {
             //dol_syslog(get_class($this)."::shiftTaskDate to_update", LOG_DEBUG);
             $to_update = true;
             $task = new Task($this->db);
             $result = $task->fetch($tasktoshiftdate->id);
             if (!$result) {
                 $error++;
                 $this->error .= $task->error;
             }
         }
         //print "$this->date_start + $tasktoshiftdate->date_start - $old_project_dt_start";exit;
         //Calcultate new task start date with difference between old proj start date and origin task start date
         if (!empty($tasktoshiftdate->date_start)) {
             $task->date_start = $this->date_start + ($tasktoshiftdate->date_start - $old_project_dt_start);
         }
         //Calcultate new task end date with difference between origin proj end date and origin task end date
         if (!empty($tasktoshiftdate->date_end)) {
             $task->date_end = $this->date_start + ($tasktoshiftdate->date_end - $old_project_dt_start);
         }
         if ($to_update) {
             $result = $task->update($user);
             if (!$result) {
                 $error++;
                 $this->error .= $task->error;
             }
         }
     }
     if ($error != 0) {
         return -1;
     }
     return $result;
 }
Ejemplo n.º 18
0
 function testUpdate()
 {
     //Arrange
     $task_name = "Wash the dog";
     $id = 1;
     $due_date = null;
     $test_task = new Task($task_name, $id, $due_date);
     $test_task->save();
     $new_task_name = "Clean the dog";
     //Act
     $test_task->update($new_task_name);
     //Assert
     $this->assertEquals("Clean the dog", $test_task->getTaskName());
 }
Ejemplo n.º 19
0
	if (! $error)
	{
		$object->fetch($id);

		$tmparray=explode('_',$_POST['task_parent']);
		$task_parent=$tmparray[1];
		if (empty($task_parent)) $task_parent = 0;	// If task_parent is ''

		$object->label = $_POST["label"];
		$object->description = $_POST['description'];
		$object->fk_task_parent = $task_parent;
		$object->date_start = dol_mktime(0,0,0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear']);
		$object->date_end = dol_mktime(0,0,0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear']);
		$object->progress = $_POST['progress'];

		$result=$object->update($user);
	}
	else
	{
		$action='edit';
	}
}

if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->supprimer)
{
	if ($object->fetch($id) >= 0 )
	{
		$result=$projectstatic->fetch($object->fk_projet);
		if (! empty($projectstatic->socid))
		{
			$projectstatic->societe->fetch($projectstatic->socid);
Ejemplo n.º 20
0
 /**
  * Function to change the Task Owner
  * @param Integer $idcoworker 
  * @param Integer $idtask
  */
 function changeTaskOwner($idcoworker, $idtask)
 {
     $do_task = new Task();
     $do_task->getId($idtask);
     $do_task->iduser = $idcoworker;
     $do_task->status = 'open';
     $do_task->update();
     $qobj = $this->getProjectTaskDetailsByTaskId($idtask);
     $this->sendEmailOnTaskOwnershipChange($idcoworker, $qobj);
     //sending ownership change alert
 }
Ejemplo n.º 21
0
 public function saveExtEvents($oData)
 {
     $oTask = new Task();
     $oEvent = new Event();
     $sEvn_uid = '';
     $sEvn_type = $oData->evn_type;
     $output = 0;
     $aDataEvent = array();
     $aDataTask = array();
     $aDataEvent['EVN_UID'] = $oData->evn_uid;
     $aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE';
     $aDataEvent['EVN_TYPE'] = $oData->evn_type;
     if (preg_match("/Start/", $sEvn_type)) {
         if (isset($oData->tas_uid) && $oData->tas_uid != '') {
             $aDataTask['TAS_UID'] = $oData->tas_uid;
             $aDataTask['TAS_START'] = $oData->tas_start;
             $aDataTask['EVN_TYPE'] = $oData->evn_type;
             $aDataTask['TAS_EVN_UID'] = $oData->evn_uid;
             $oTask->update($aDataTask);
             $aDataEvent['EVN_TAS_UID_TO'] = $oData->tas_uid;
             $output = $oEvent->update($aDataEvent);
         }
     } elseif (preg_match("/Inter/", $sEvn_type)) {
         $aDataEvent['EVN_TAS_UID_FROM'] = $oData->tas_from;
         $aDataEvent['EVN_TAS_UID_TO'] = $oData->tas_to;
         $output = $oEvent->update($aDataEvent);
     }
     return $output;
 }
function _split_task($taskid, $task1time, $task2time)
{
    global $db, $user, $conf;
    $task = new Task($db);
    $task->fetch($taskid);
    $task->fetch_optionals($task->id);
    // Nécessaire de préciser l'id jusqu'à la version 3.8
    $task->planned_workload = $task1time * 3600;
    $task->update($user);
    $task2 = new Task($db);
    foreach ($task as $k => $v) {
        if ($k != 'id' && $k != 'progress' & $k != 'duration_effective' && $k != 'ref') {
            $task2->{$k} = $v;
        }
    }
    $task2->planned_workload = $task2time * 3600;
    $defaultref = '';
    $obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON;
    if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . ".php")) {
        require_once DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . '.php';
        $modTask = new $obj();
        $defaultref = $modTask->getNextValue(0, $task2);
    }
    if (is_numeric($defaultref) && $defaultref <= 0) {
        $defaultref = '';
    }
    $task2->ref = $defaultref;
    $task2->create($user);
    return $task2->id;
}
 function doubleStart($oData)
 {
     //$oJSON  = new Services_JSON();
     $sProUid = $oData['PRO_UID'];
     $sTemplate = $oData['PRO_TEMPLATE'];
     $oProcessMap = $oData['PROCESSMAP'];
     $t1 = Bootstrap::json_decode($oProcessMap->addTask($sProUid, 200, 70));
     $t2 = Bootstrap::json_decode($oProcessMap->addTask($sProUid, 400, 70));
     $t3 = Bootstrap::json_decode($oProcessMap->addTask($sProUid, 300, 160));
     $task1 = $t1->uid;
     $task2 = $t2->uid;
     $task3 = $t3->uid;
     $aData = array("TAS_START" => "TRUE", "TAS_UID" => $task1);
     $oTask = new Task();
     $oTask->update($aData);
     $aData = array("TAS_START" => "TRUE", "TAS_UID" => $task2);
     $oTask = new Task();
     $oTask->update($aData);
     $oProcessMap->saveNewPattern($sProUid, $task1, $task3, 'SEQUENTIAL');
     $oProcessMap->saveNewPattern($sProUid, $task2, $task3, 'SEQUENTIAL');
     $oProcessMap->saveNewPattern($sProUid, $task3, -1, 'SEQUENTIAL');
 }
Ejemplo n.º 24
0
 function test_update()
 {
     //Arrange
     $description = "Wash the dog";
     $due_date = "1234-12-12";
     $id = 1;
     $task = new Task($description, $due_date, $id);
     $task->save();
     $new_description = "Clean the dog";
     //Act
     $task->update($new_description);
     //Assert
     $this->assertEquals("Clean the dog", $task->getDescription());
 }
Ejemplo n.º 25
0
 public function calculateDueDate($sNextTasParam)
 {
     //Get Task properties
     $task = TaskPeer::retrieveByPK($this->getTasUid());
     $aData['TAS_UID'] = $this->getTasUid();
     //Added to allow User defined Timing Control at Run time from Derivation screen
     if (isset($sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY']) && $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] == 'true') {
         $aData['TAS_DURATION'] = $sNextTasParam['NEXT_TASK']['TAS_DURATION'];
         $aData['TAS_TIMEUNIT'] = $sNextTasParam['NEXT_TASK']['TAS_TIMEUNIT'];
         $aData['TAS_TYPE_DAY'] = $sNextTasParam['NEXT_TASK']['TAS_TYPE_DAY'];
         if (isset($sNextTasParam['NEXT_TASK']['TAS_CALENDAR']) && $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'] != '') {
             $aCalendarUID = $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'];
         } else {
             $aCalendarUID = '';
         }
         //Updating the task Table , so that user will see updated values in the assign screen in consequent cases
         $oTask = new Task();
         $oTask->update($aData);
     } else {
         if (is_null($task)) {
             return 0;
         }
         $aData['TAS_DURATION'] = $task->getTasDuration();
         $aData['TAS_TIMEUNIT'] = $task->getTasTimeUnit();
         $aData['TAS_TYPE_DAY'] = $task->getTasTypeDay();
         $aCalendarUID = '';
     }
     //use the dates class to calculate dates
     $calendar = new calendar();
     if ($calendar->pmCalendarUid == '') {
         $calendar->getCalendar(null, $task->getProUid(), $aData['TAS_UID']);
         $calendar->getCalendarData();
     }
     $iDueDate = $calendar->calculateDate($this->getDelDelegateDate(), $aData['TAS_DURATION'], $aData['TAS_TIMEUNIT']);
     return $iDueDate;
 }
Ejemplo n.º 26
0
 function testUpdate()
 {
     // Arrange
     $due_date = "2015-10-12";
     $description = "Wash the dog";
     $test_task = new Task($description, $due_date, 1);
     $test_task->save();
     $new_description = "Clean the dog";
     //Act
     $test_task->update($new_description);
     //Assert
     $this->assertEquals("Clean the dog", $test_task->getDescription());
 }
Ejemplo n.º 27
0
$watch = new Stopwatch();
$watch->Start();
$task = new Task();
$tasks = $task->GetExecTasks();
$taskIds = array_keys($tasks);
$task->UpdateStatus(Task::EXECING, $taskIds);
$thirdAccount = new ThirdAccount();
foreach ($tasks as $id => $item) {
    $type_arr = explode('|', $item['type']);
    if (str_contains($item['msg'], '验证码') || str_contains($item['msg'], 'valCodeError') || $type_arr[0] == 'qzone_simula') {
        if (time() - $item['last_send'] < 10 * 60) {
            continue;
        }
    }
    if (str_contains($item['msg'], '重复发送') || str_contains($item['msg'], '用户调用次数超过限制')) {
        $task->update(array('retry_count' => Task::RETRY_COUNT), array('id' => $id));
        continue;
    }
    $third = $thirdAccount->getThird($item['uid'], $type_arr[0], $type_arr[1]);
    if ($third && $third['valid'] == 1) {
        $api = Factory::CreateAPI2($type_arr[0], $type_arr[1], $third);
        if ($item['cat'] == 'weibo') {
            $ret = $api->upload($item['content'], $item['pic']);
        } else {
            $ret = $api->publish($item['title'], $item['content']);
        }
    } else {
        $ret = $third ? '账号绑定过期,尚未重新绑定' : '账号绑定已取消';
    }
    if ($ret === true) {
        $task->UpdateStatus(Task::OK, $id);
Ejemplo n.º 28
0
 function testUpdate()
 {
     //Arrange
     $description = "Wash the dog";
     $id = 1;
     $due_date = null;
     $completed = 0;
     $test_task = new Task($description, $id, $completed, $due_date);
     $test_task->save();
     $new_description = "Clean the dog";
     //Act
     $test_task->update($new_description);
     //Assert
     $this->assertEquals("Clean the dog", $test_task->getDescription());
 }
Ejemplo n.º 29
0
 function testUpdate()
 {
     //Arrange
     $description = "Wash the dog";
     $id = 1;
     $due_date = '2015-01-01';
     $test_task = new Task($description, $due_date, $id);
     $test_task->save();
     $new_description = "Clean the dog";
     $new_due_date = '2015-02-01';
     //Act
     $test_task->update($new_description, $new_due_date);
     //Assert
     $this->assertEquals("Clean the dog", $test_task->getDescription());
 }
Ejemplo n.º 30
0
 case 'deleteTask':
     $sOutput = $oProcessMap->deleteTask($oData->tas_uid);
     echo $sOutput;
     break;
 case 'addGateway':
     $sOutput = $oProcessMap->addGateway($oData);
     echo $sOutput;
     break;
 case 'deleteGateway':
     $sOutput = $oProcessMap->deleteGateway($oData->pro_uid, $oData->gat_uid);
     echo $sOutput;
     break;
 case 'updateTaskName':
     $aTask['TAS_UID'] = $oData->uid;
     $aTask['TAS_TITLE'] = $oData->label;
     $oTask->update($aTask);
     break;
 case 'updateTask':
     $aTask['TAS_UID'] = $oData->uid;
     $aTask['TAS_BOUNDARY'] = $oData->boundary;
     $oTask->update($aTask);
     $sOutput = $oJSON->encode($oData);
     echo $sOutput;
     break;
 case 'addSubProcess':
     $sOutput = $oProcessMap->addSubProcess($oData->uid, $oData->position->x, $oData->position->y);
     echo $sOutput;
     break;
 case 'deleteSubProcess':
     $sOutput = $oProcessMap->deleteSubProcess($oData->pro_uid, $oData->tas_uid);
     break;