* Modify idvalue to objectID.

This commit is contained in:
lanzongjun
2023-04-27 19:52:55 +08:00
parent c0e56354ab
commit 3804931628
20 changed files with 151 additions and 97 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ $config->todo->editor->edit = array('id' => 'desc', 'tools' => 'simpleTools');
$config->todo->editor->view = array('id' => 'comment,lastComment', 'tools' => 'simpleTools');
$config->todo->list = new stdclass();
$config->todo->list->exportFields = 'id, account, date, begin, end, type, idvalue, pri, name, desc, status, private';
$config->todo->list->exportFields = 'id, account, date, begin, end, type, objectID, pri, name, desc, status, private';
$config->todo->list->customBatchCreateFields = 'type,pri,desc,beginAndEnd';
$config->todo->list->customBatchEditFields = 'pri,beginAndEnd,status';
+14 -14
View File
@@ -217,7 +217,7 @@ class todo extends control
if($todo->type != 'custom')
{
if(!isset($objectIDList[$todo->type])) $objectIDList[$todo->type] = array();
$objectIDList[$todo->type][$todo->idvalue] = $todo->idvalue;
$objectIDList[$todo->type][$todo->objectID] = $todo->objectID;
}
}
}
@@ -489,13 +489,13 @@ class todo extends control
{
$confirmNote = 'confirm' . ucfirst($todo->type);
$okTarget = isonlybody() ? 'parent' : 'window.parent.$.apps.open';
$confirmURL = $this->createLink($todo->type, 'view', "id=$todo->idvalue");
$confirmURL = $this->createLink($todo->type, 'view', "id=$todo->objectID");
if($todo->type == 'bug') $app = 'qa';
if($todo->type == 'task') $app = 'execution';
if($todo->type == 'story') $app = 'product';
$cancelURL = $this->server->HTTP_REFERER;
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success', 'message' => sprintf($this->lang->todo->$confirmNote, $todo->idvalue), 'locate' => $confirmURL));
return print(strpos($cancelURL, 'calendar') ? json_encode(array(sprintf($this->lang->todo->$confirmNote, $todo->idvalue), $confirmURL)) : js::confirm(sprintf($this->lang->todo->$confirmNote, $todo->idvalue), $confirmURL, $cancelURL, $okTarget, 'parent', $app));
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success', 'message' => sprintf($this->lang->todo->$confirmNote, $todo->objectID), 'locate' => $confirmURL));
return print(strpos($cancelURL, 'calendar') ? json_encode(array(sprintf($this->lang->todo->$confirmNote, $todo->objectID), $confirmURL)) : js::confirm(sprintf($this->lang->todo->$confirmNote, $todo->objectID), $confirmURL, $cancelURL, $okTarget, 'parent', $app));
}
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success'));
if(isonlybody()) return print(js::reload('parent.parent'));
@@ -581,7 +581,7 @@ class todo extends control
$fields[$fieldName] = isset($todoLang->$fieldName) ? $todoLang->$fieldName : $fieldName;
unset($fields[$key]);
}
unset($fields['idvalue']);
unset($fields['objectID']);
unset($fields['private']);
/* Get bugs. */
@@ -612,18 +612,18 @@ class todo extends control
$type = $todo->type;
if(isset($users[$todo->account])) $todo->account = $users[$todo->account];
if($type == 'bug') $todo->name = isset($bugs[$todo->idvalue]) ? $bugs[$todo->idvalue] . "(#$todo->idvalue)" : '';
if($type == 'story') $todo->name = isset($stories[$todo->idvalue]) ? $stories[$todo->idvalue] . "(#$todo->idvalue)" : '';
if($type == 'task') $todo->name = isset($tasks[$todo->idvalue]) ? $tasks[$todo->idvalue] . "(#$todo->idvalue)" : '';
if($type == 'bug') $todo->name = isset($bugs[$todo->objectID]) ? $bugs[$todo->objectID] . "(#$todo->objectID)" : '';
if($type == 'story') $todo->name = isset($stories[$todo->objectID]) ? $stories[$todo->objectID] . "(#$todo->objectID)" : '';
if($type == 'task') $todo->name = isset($tasks[$todo->objectID]) ? $tasks[$todo->objectID] . "(#$todo->objectID)" : '';
if($this->config->edition == 'max')
{
if($type == 'issue') $todo->name = isset($issues[$todo->idvalue]) ? $issues[$todo->idvalue] . "(#$todo->idvalue)" : '';
if($type == 'risk') $todo->name = isset($risks[$todo->idvalue]) ? $risks[$todo->idvalue] . "(#$todo->idvalue)" : '';
if($type == 'opportunity') $todo->name = isset($opportunities[$todo->idvalue]) ? $opportunities[$todo->idvalue] . "(#$todo->idvalue)" : '';
if($type == 'issue') $todo->name = isset($issues[$todo->objectID]) ? $issues[$todo->objectID] . "(#$todo->objectID)" : '';
if($type == 'risk') $todo->name = isset($risks[$todo->objectID]) ? $risks[$todo->objectID] . "(#$todo->objectID)" : '';
if($type == 'opportunity') $todo->name = isset($opportunities[$todo->objectID]) ? $opportunities[$todo->objectID] . "(#$todo->objectID)" : '';
}
if($type == 'testtask') $todo->name = isset($testTasks[$todo->idvalue]) ? $testTasks[$todo->idvalue] . "(#$todo->idvalue)" : '';
if($type == 'review' && isset($this->config->qcVersion)) $todo->name = isset($reviews[$todo->idvalue]) ? $reviews[$todo->idvalue] . "(#$todo->idvalue)" : '';
if($type == 'testtask') $todo->name = isset($testTasks[$todo->objectID]) ? $testTasks[$todo->objectID] . "(#$todo->objectID)" : '';
if($type == 'review' && isset($this->config->qcVersion)) $todo->name = isset($reviews[$todo->objectID]) ? $reviews[$todo->objectID] . "(#$todo->objectID)" : '';
if(isset($todoLang->typeList[$type])) $todo->type = $todoLang->typeList[$type];
if(isset($todoLang->priList[$todo->pri])) $todo->pri = $todoLang->priList[$todo->pri];
@@ -631,7 +631,7 @@ class todo extends control
if($todo->private == 1) $todo->desc = $this->lang->todo->thisIsPrivate;
/* drop some field that is not needed. */
unset($todo->idvalue);
unset($todo->objectID);
unset($todo->private);
}
if($this->config->edition != 'open') list($fields, $todos) = $this->loadModel('workflowfield')->appendDataFromFlow($fields, $todos);
+5 -5
View File
@@ -14,11 +14,11 @@ function switchDateTodo(switcher)
* @param type $type Type of selected todo.
* @param id $id ID of selected todo.
* @param defaultType $defaultType Default type of selected todo.
* @param idvalue $idvalue ID of the closed todo type.
* @param objectID $objectID ID of the closed todo type.
* @access public
* @return void
*/
function loadList(type, id, defaultType, idvalue)
function loadList(type, id, defaultType, objectID)
{
if(id)
{
@@ -34,7 +34,7 @@ function loadList(type, id, defaultType, idvalue)
id = id ? id : '';
var param = 'userID=' + userID + '&id=' + id;
if(type == "task") param += '&status=wait,doing';
if(type == defaultType && idvalue != 0) param += '&idvalue=' + idvalue;
if(type == defaultType && objectID != 0) param += '&objectID=' + objectID;
if(moduleList.indexOf(type) !== -1)
{
@@ -45,7 +45,7 @@ function loadList(type, id, defaultType, idvalue)
if(data.length != 0)
{
$(divClass).html(data).find('select').chosen();
if(config.currentMethod == 'edit' || type == 'feedback') $(divClass).find('select').val(idvalue).trigger('chosen:updated');
if(config.currentMethod == 'edit' || type == 'feedback') $(divClass).find('select').val(objectID).trigger('chosen:updated');
if($(divClass + " select").val() == null) $(divClass + " select").attr("data-placeholder", noOptions.replace("%s", chosenType[type])).trigger('chosen:updated');
}
else
@@ -68,7 +68,7 @@ function loadList(type, id, defaultType, idvalue)
}
else
{
$('#nameBoxLabel').text(nameBoxLabel.idvalue);
$('#nameBoxLabel').text(nameBoxLabel.objectID);
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
$(function()
{
loadList($('#type').val(), '', defaultType, idvalue);
loadList($('#type').val(), '', defaultType, objectID);
$('#pri').on('change', function()
{
+1 -1
View File
@@ -51,7 +51,7 @@ $lang->todo->end = 'Ende';
$lang->todo->beginAB = 'Start';
$lang->todo->endAB = 'Ende';
$lang->todo->beginAndEnd = 'Dauer';
$lang->todo->idvalue = 'Link ID';
$lang->todo->objectID = 'Link ID';
$lang->todo->type = 'Typ';
$lang->todo->pri = 'Priorität';
$lang->todo->name = 'Titel';
+1 -1
View File
@@ -51,7 +51,7 @@ $lang->todo->end = 'End';
$lang->todo->beginAB = 'Begin';
$lang->todo->endAB = 'End';
$lang->todo->beginAndEnd = 'Begin and End';
$lang->todo->idvalue = 'Link ID';
$lang->todo->objectID = 'Link ID';
$lang->todo->type = 'Type';
$lang->todo->pri = 'Priority';
$lang->todo->name = 'Title';
+1 -1
View File
@@ -51,7 +51,7 @@ $lang->todo->end = 'Fin';
$lang->todo->beginAB = 'Début';
$lang->todo->endAB = 'Fin';
$lang->todo->beginAndEnd = 'Début et Fin';
$lang->todo->idvalue = 'Link ID';
$lang->todo->objectID = 'Link ID';
$lang->todo->type = 'Type';
$lang->todo->pri = 'Priorité';
$lang->todo->name = 'Titre';
+1 -1
View File
@@ -49,7 +49,7 @@ $lang->todo->end = 'Kết thúc';
$lang->todo->beginAB = 'Bắt đầu';
$lang->todo->endAB = 'Kết thúc';
$lang->todo->beginAndEnd = 'Thời gian';
$lang->todo->idvalue = 'Liên kết ID';
$lang->todo->objectID = 'Liên kết ID';
$lang->todo->type = 'Loại';
$lang->todo->pri = 'Ưu tiên';
$lang->todo->name = 'Tiêu đề';
+1 -1
View File
@@ -51,7 +51,7 @@ $lang->todo->end = '结束';
$lang->todo->beginAB = '开始';
$lang->todo->endAB = '结束';
$lang->todo->beginAndEnd = '起止时间';
$lang->todo->idvalue = '关联编号';
$lang->todo->objectID = '关联编号';
$lang->todo->type = '类型';
$lang->todo->pri = '优先级';
$lang->todo->name = '待办名称';
+1 -1
View File
@@ -50,7 +50,7 @@ $lang->todo->end = '結束';
$lang->todo->beginAB = '開始';
$lang->todo->endAB = '結束';
$lang->todo->beginAndEnd = '起止時間';
$lang->todo->idvalue = '關聯編號';
$lang->todo->objectID = '關聯編號';
$lang->todo->type = '類型';
$lang->todo->pri = '優先順序';
$lang->todo->name = '待辦名稱';
+38 -38
View File
@@ -78,18 +78,18 @@ class todoModel extends model
$todo->end = isset($todos->ends[$i]) ? $todos->ends[$i] : 2400;
$todo->status = "wait";
$todo->private = 0;
$todo->idvalue = 0;
$todo->objectID = 0;
$todo->assignedTo = $assignedTo;
$todo->assignedBy = $this->app->user->account;
$todo->assignedDate = $now;
$todo->vision = $this->config->vision;
if(in_array($todo->type, $this->config->todo->moduleList)) $todo->idvalue = isset($todos->{$this->config->todo->objectList[$todo->type]}[$i + 1]) ? $todos->{$this->config->todo->objectList[$todo->type]}[$i + 1] : 0;
if(in_array($todo->type, $this->config->todo->moduleList)) $todo->objectID = isset($todos->{$this->config->todo->objectList[$todo->type]}[$i + 1]) ? $todos->{$this->config->todo->objectList[$todo->type]}[$i + 1] : 0;
if($todo->type != 'custom' and $todo->idvalue)
if($todo->type != 'custom' and $todo->objectID)
{
$type = $todo->type;
$object = $this->loadModel($type)->getByID($todo->idvalue);
$object = $this->loadModel($type)->getByID($todo->objectID);
if(isset($object->name)) $todo->name = $object->name;
if(isset($object->title)) $todo->name = $object->title;
}
@@ -144,7 +144,7 @@ class todoModel extends model
$this->loadModel('file')->updateObjectID($todo->uid, $todoID, 'todo');
if(!empty($oldTodo->cycle)) $this->createByCycle(array($todoID => $todo));
if(($this->config->edition == 'biz' || $this->config->edition == 'max') && $todo->type == 'feedback' && $todo->idvalue) $this->loadModel('feedback')->updateStatus('todo', $todo->idvalue, $todo->status);
if(($this->config->edition == 'biz' || $this->config->edition == 'max') && $todo->type == 'feedback' && $todo->objectID) $this->loadModel('feedback')->updateStatus('todo', $todo->objectID, $todo->status);
return common::createChanges($oldTodo, (array)$todo);
}
@@ -181,7 +181,7 @@ class todoModel extends model
if(in_array($todo->type, $this->config->todo->moduleList))
{
$todo->idvalue = isset($data->{$this->config->todo->objectList[$todo->type]}[$todoID]) ? $data->{$this->config->todo->objectList[$todo->type]}[$todoID] : 0;
$todo->objectID = isset($data->{$this->config->todo->objectList[$todo->type]}[$todoID]) ? $data->{$this->config->todo->objectList[$todo->type]}[$todoID] : 0;
}
if($todo->end < $todo->begin) return print(js::alert(sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin)));
@@ -195,15 +195,15 @@ class todoModel extends model
$this->dao->update(TABLE_TODO)->data($todo)
->autoCheck()
->checkIF(!in_array($todo->type, $this->config->todo->moduleList), $this->config->todo->edit->requiredFields, 'notempty')
->checkIF($todo->type == 'bug' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'task' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'story' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'issue' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'risk' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'opportunity' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'review' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'testtask' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'feedback' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'bug' and $todo->objectID == 0, 'objectID', 'notempty')
->checkIF($todo->type == 'task' and $todo->objectID == 0, 'objectID', 'notempty')
->checkIF($todo->type == 'story' and $todo->objectID == 0, 'objectID', 'notempty')
->checkIF($todo->type == 'issue' and $todo->objectID == 0, 'objectID', 'notempty')
->checkIF($todo->type == 'risk' and $todo->objectID == 0, 'objectID', 'notempty')
->checkIF($todo->type == 'opportunity' and $todo->objectID == 0, 'objectID', 'notempty')
->checkIF($todo->type == 'review' and $todo->objectID == 0, 'objectID', 'notempty')
->checkIF($todo->type == 'testtask' and $todo->objectID == 0, 'objectID', 'notempty')
->checkIF($todo->type == 'feedback' and $todo->objectID == 0, 'objectID', 'notempty')
->where('id')->eq($todoID)
->exec();
@@ -211,10 +211,10 @@ class todoModel extends model
if(!dao::isError())
{
if(($this->config->edition == 'biz' || $this->config->edition == 'max') && $todo->type == 'feedback' && $todo->idvalue && !isset($feedbacks[$todo->idvalue]))
if(($this->config->edition == 'biz' || $this->config->edition == 'max') && $todo->type == 'feedback' && $todo->objectID && !isset($feedbacks[$todo->objectID]))
{
$feedbacks[$todo->idvalue] = $todo->idvalue;
$this->loadModel('feedback')->updateStatus('todo', $todo->idvalue, $todo->status);
$feedbacks[$todo->objectID] = $todo->objectID;
$this->loadModel('feedback')->updateStatus('todo', $todo->objectID, $todo->status);
}
$allChanges[$todoID] = common::createChanges($oldTodo, $todo);
@@ -268,7 +268,7 @@ class todoModel extends model
if(($this->config->edition == 'biz' || $this->config->edition == 'max'))
{
$feedbackID = $this->dao->select('idvalue')->from(TABLE_TODO)->where('id')->eq($todoID)->andWhere('type')->eq('feedback')->fetch('idvalue');
$feedbackID = $this->dao->select('objectID')->from(TABLE_TODO)->where('id')->eq($todoID)->andWhere('type')->eq('feedback')->fetch('objectID');
if($feedbackID) $this->loadModel('feedback')->updateStatus('todo', $feedbackID, 'done');
}
return true;
@@ -290,15 +290,15 @@ class todoModel extends model
if(!$todo) return false;
$todo = $this->loadModel('file')->replaceImgURL($todo, 'desc');
if($setImgSize) $todo->desc = $this->file->setImgSize($todo->desc);
if($todo->type == 'story') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_STORY)->fetch('title');
if($todo->type == 'task') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TASK)->fetch('name');
if($todo->type == 'bug') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_BUG)->fetch('title');
if($todo->type == 'issue' and $this->config->edition == 'max') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_ISSUE)->fetch('title');
if($todo->type == 'risk' and $this->config->edition == 'max') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_RISK)->fetch('name');
if($todo->type == 'opportunity' and $this->config->edition == 'max') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_OPPORTUNITY)->fetch('name');
if($todo->type == 'review' and $this->config->edition == 'max') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_REVIEW)->fetch('title');
if($todo->type == 'testtask') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TESTTASK)->fetch('name');
if($todo->type == 'feedback') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_FEEDBACK)->fetch('title');
if($todo->type == 'story') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_STORY)->fetch('title');
if($todo->type == 'task') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_TASK)->fetch('name');
if($todo->type == 'bug') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_BUG)->fetch('title');
if($todo->type == 'issue' and $this->config->edition == 'max') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_ISSUE)->fetch('title');
if($todo->type == 'risk' and $this->config->edition == 'max') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_RISK)->fetch('name');
if($todo->type == 'opportunity' and $this->config->edition == 'max') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_OPPORTUNITY)->fetch('name');
if($todo->type == 'review' and $this->config->edition == 'max') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_REVIEW)->fetch('title');
if($todo->type == 'testtask') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_TESTTASK)->fetch('name');
if($todo->type == 'feedback') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_FEEDBACK)->fetch('title');
$todo->date = str_replace('-', '', $todo->date);
return $todo;
}
@@ -408,15 +408,15 @@ class todoModel extends model
while($todo = $stmt->fetch())
{
if($todo->type == 'story') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_STORY)->fetch('title');
if($todo->type == 'task') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TASK)->fetch('name');
if($todo->type == 'bug') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_BUG)->fetch('title');
if($todo->type == 'testtask') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TESTTASK)->fetch('name');
if($todo->type == 'issue' && $this->config->edition == 'max') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_ISSUE)->fetch('title');
if($todo->type == 'risk' && $this->config->edition == 'max') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_RISK)->fetch('name');
if($todo->type == 'opportunity' && $this->config->edition == 'max') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_OPPORTUNITY)->fetch('name');
if($todo->type == 'review' && $this->config->edition == 'max') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_REVIEW)->fetch('title');
if($todo->type == 'feedback' and $this->config->edition != 'open') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_FEEDBACK)->fetch('title');
if($todo->type == 'story') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_STORY)->fetch('title');
if($todo->type == 'task') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_TASK)->fetch('name');
if($todo->type == 'bug') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_BUG)->fetch('title');
if($todo->type == 'testtask') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_TESTTASK)->fetch('name');
if($todo->type == 'issue' && $this->config->edition == 'max') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_ISSUE)->fetch('title');
if($todo->type == 'risk' && $this->config->edition == 'max') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_RISK)->fetch('name');
if($todo->type == 'opportunity' && $this->config->edition == 'max') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_OPPORTUNITY)->fetch('name');
if($todo->type == 'review' && $this->config->edition == 'max') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_REVIEW)->fetch('title');
if($todo->type == 'feedback' and $this->config->edition != 'open') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_FEEDBACK)->fetch('title');
$todo->begin = date::formatTime($todo->begin);
$todo->end = date::formatTime($todo->end);
@@ -557,7 +557,7 @@ class todoModel extends model
if(($this->config->edition == 'biz' || $this->config->edition == 'max'))
{
$feedbackID = $this->dao->select('idvalue')->from(TABLE_TODO)->where('id')->eq($todoID)->andWhere('type')->eq('feedback')->fetch('idvalue');
$feedbackID = $this->dao->select('objectID')->from(TABLE_TODO)->where('id')->eq($todoID)->andWhere('type')->eq('feedback')->fetch('objectID');
if($feedbackID) $this->loadModel('feedback')->updateStatus('todo', $feedbackID, 'closed');
}
return true;
+2 -2
View File
@@ -15,7 +15,7 @@ class todoTao extends todoModel
$this->dao->insert(TABLE_TODO)->data($todo)
->autoCheck()
->checkIF(!in_array($todo->type, $this->config->todo->moduleList), $this->config->todo->create->requiredFields, 'notempty')
->checkIF(in_array($todo->type, $this->config->todo->moduleList) && $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF(in_array($todo->type, $this->config->todo->moduleList) && $todo->objectID == 0, 'objectID', 'notempty')
->exec();
return (int)$this->dao->lastInsertID();
@@ -34,7 +34,7 @@ class todoTao extends todoModel
$this->dao->update(TABLE_TODO)->data($todo)
->autoCheck()
->checkIF(in_array($todo->type, array('custom', 'feedback')), $this->config->todo->edit->requiredFields, 'notempty')
->checkIF(in_array($todo->type, $this->config->todo->moduleList) && $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF(in_array($todo->type, $this->config->todo->moduleList) && $todo->objectID == 0, 'objectID', 'notempty')
->where('id')->eq($todoID)
->exec();
+2 -2
View File
@@ -36,5 +36,5 @@ $except_create = array('types' => $types, 'pris' => $pris, 'names' => $names, 'd
$todo = new todoTest();
r($todo->batchCreateTest($noname_create)) && p('2006:name,desc,pri,type,idvalue;2007:name,desc,pri,type,idvalue;2008:name,desc,pri,type,idvalue') && e('批量创建待办1,desc1,1,custom,0;批量创建待办2,desc2,2,custom,0;批量创建待办3,desc4,4,custom,0'); // 批量创建有个没有名字的待办
r($todo->batchCreateTest($except_create)) && p('2009:name,desc,pri,type,idvalue;2010:name,desc,pri,type,idvalue;2011:name,desc,pri,type,idvalue;2012:name,desc,pri,type,idvalue') && e('测试单转Bug13,desc1,1,bug,313;软件需求版本一551,desc2,2,story,1;开发任务11,desc3,3,task,1;测试单1,desc4,4,testtask,1'); // 批量创建的待办
r($todo->batchCreateTest($noname_create)) && p('2006:name,desc,pri,type,objectID;2007:name,desc,pri,type,objectID;2008:name,desc,pri,type,objectID') && e('批量创建待办1,desc1,1,custom,0;批量创建待办2,desc2,2,custom,0;批量创建待办3,desc4,4,custom,0'); // 批量创建有个没有名字的待办
r($todo->batchCreateTest($except_create)) && p('2009:name,desc,pri,type,objectID;2010:name,desc,pri,type,objectID;2011:name,desc,pri,type,objectID;2012:name,desc,pri,type,objectID') && e('测试单转Bug13,desc1,1,bug,313;软件需求版本一551,desc2,2,story,1;开发任务11,desc3,3,task,1;测试单1,desc4,4,testtask,1'); // 批量创建的待办
+1 -1
View File
@@ -46,7 +46,7 @@ $tester->loadModel('todo');
initData();
$t_upname = array('name' => 'john');
$t_uptype = array('type' => 'bug', 'idvalue' => '1');
$t_uptype = array('type' => 'bug', 'objectID' => '1');
$t_unname = array('name' => 'john');
$todo = new todoTest();
+2 -2
View File
@@ -270,7 +270,7 @@ class todoTest
$todo->begin = '0830';
$todo->end = '0900';
$todo->account = 'admin';
$todo->idvalue = '0';
$todo->objectID = '0';
$todo->vision = 'rnd';
$todo->assignedTo = 'admin';
$todo->assignedBy = 'admin';
@@ -285,7 +285,7 @@ class todoTest
$this->objectModel->createByCycle(array($todoID => $todo));
$objects = $tester->dao->select('id')->from(TABLE_TODO)->where('idvalue')->eq($todoID)->andWhere('deleted')->eq('0')->fetchAll();
$objects = $tester->dao->select('id')->from(TABLE_TODO)->where('objectID')->eq($todoID)->andWhere('deleted')->eq('0')->fetchAll();
if(dao::isError()) return dao::getError();
+10 -10
View File
@@ -62,7 +62,7 @@
}
else
{
echo html::select("types[$todo->id]", $lang->todo->typeList, $todo->type, "onchange='loadList(this.value, {$todo->id}, \"{$todo->type}\", {$todo->idvalue})' class='form-control'");
echo html::select("types[$todo->id]", $lang->todo->typeList, $todo->type, "onchange='loadList(this.value, {$todo->id}, \"{$todo->type}\", {$todo->objectID})' class='form-control'");
}
?>
</td>
@@ -77,39 +77,39 @@
}
elseif($todo->type == 'task')
{
echo html::select("tasks[$todo->id]", $tasks, $todo->idvalue, 'class="form-control chosen"');
echo html::select("tasks[$todo->id]", $tasks, $todo->objectID, 'class="form-control chosen"');
}
elseif($todo->type == 'bug')
{
echo html::select("bugs[$todo->id]", $bugs, $todo->idvalue, 'class="form-control chosen"');
echo html::select("bugs[$todo->id]", $bugs, $todo->objectID, 'class="form-control chosen"');
}
elseif($todo->type == 'story')
{
echo html::select("stories[$todo->id]", $storys, $todo->idvalue, 'class="form-control chosen"');
echo html::select("stories[$todo->id]", $storys, $todo->objectID, 'class="form-control chosen"');
}
elseif($todo->type == 'issue')
{
echo html::select("issues[$todo->id]", $issues, $todo->idvalue, 'class="form-control chosen"');
echo html::select("issues[$todo->id]", $issues, $todo->objectID, 'class="form-control chosen"');
}
elseif($todo->type == 'risk')
{
echo html::select("risks[$todo->id]", $risks, $todo->idvalue, 'class="form-control chosen"');
echo html::select("risks[$todo->id]", $risks, $todo->objectID, 'class="form-control chosen"');
}
elseif($todo->type == 'review')
{
echo html::select("reviews[$todo->id]", $reviews, $todo->idvalue, 'class="form-control chosen"');
echo html::select("reviews[$todo->id]", $reviews, $todo->objectID, 'class="form-control chosen"');
}
elseif($todo->type == 'testtask')
{
echo html::select("testtasks[$todo->id]", $testtasks, $todo->idvalue, 'class="form-control chosen"');
echo html::select("testtasks[$todo->id]", $testtasks, $todo->objectID, 'class="form-control chosen"');
}
elseif($todo->type == 'opportunity')
{
echo html::select("opportunities[$todo->id]", $opportunities, $todo->idvalue, 'class="form-control chosen"');
echo html::select("opportunities[$todo->id]", $opportunities, $todo->objectID, 'class="form-control chosen"');
}
elseif($todo->type == 'feedback')
{
echo html::select("feedbacks[$todo->id]", $feedbacks, $todo->idvalue, 'class="form-control chosen"');
echo html::select("feedbacks[$todo->id]", $feedbacks, $todo->objectID, 'class="form-control chosen"');
}
?>
</div>
+1 -1
View File
@@ -16,7 +16,7 @@
<?php js::set('noTodo', $lang->todo->noTodo);?>
<?php js::set('moduleList', $config->todo->moduleList)?>
<?php js::set('objectsMethod', $config->todo->getUserObjectsMethod)?>
<?php js::set('nameBoxLabel', array('custom' => $lang->todo->name, 'idvalue' => $lang->todo->idvalue));?>
<?php js::set('nameBoxLabel', array('custom' => $lang->todo->name, 'objectID' => $lang->todo->objectID));?>
<?php js::set('vision', $config->vision);?>
<?php js::set('noOptions', $lang->todo->noOptions);?>
<?php js::set('chosenType', $lang->todo->typeList);?>
+4 -4
View File
@@ -15,9 +15,9 @@
<?php include '../../common/view/kindeditor.html.php';?>
<?php js::set('moduleList', $config->todo->moduleList)?>
<?php js::set('objectsMethod', $config->todo->getUserObjectsMethod)?>
<?php js::set('idvalue', $todo->idvalue);?>
<?php js::set('objectID', $todo->objectID);?>
<?php js::set('defaultType', $todo->type);?>
<?php js::set('nameBoxLabel', array('custom' => $lang->todo->name, 'idvalue' => $lang->todo->idvalue));?>
<?php js::set('nameBoxLabel', array('custom' => $lang->todo->name, 'objectID' => $lang->todo->objectID));?>
<?php js::set('vision', $config->vision);?>
<?php js::set('noOptions', $lang->todo->noOptions);?>
<?php js::set('chosenType', $lang->todo->typeList);?>
@@ -127,7 +127,7 @@
<div class="row form-group">
<label class="col-sm-1"><?php echo $lang->todo->type;?></label>
<div class="col-sm-4 dateWidth">
<?php echo html::select('type', $lang->todo->typeList, $todo->type, "onchange='loadList(this.value, \"\", \"{$todo->type}\", {$todo->idvalue})' class='form-control'");?>
<?php echo html::select('type', $lang->todo->typeList, $todo->type, "onchange='loadList(this.value, \"\", \"{$todo->type}\", {$todo->objectID})' class='form-control'");?>
</div>
</div>
<?php endif;?>
@@ -138,7 +138,7 @@
</div>
</div>
<div class="row form-group">
<label id='nameBoxLabel' class="col-sm-1"><?php echo ($todo->type == 'custom' or $config->vision == 'rnd') ? $lang->todo->name : $lang->todo->idvalue;?></label>
<label id='nameBoxLabel' class="col-sm-1"><?php echo ($todo->type == 'custom' or $config->vision == 'rnd') ? $lang->todo->name : $lang->todo->objectID;?></label>
<div class="col-sm-10">
<div id='nameBox' class='hidden'><?php echo html::input('name', $todo->name, "class='form-control'");?></div>
<div class='input-group title-group required'>
+3 -3
View File
@@ -31,9 +31,9 @@
<div class='detail-title'>
<?php
echo $lang->todo->desc;
if($todo->type == 'bug') common::printLink('bug', 'view', "id={$todo->idvalue}", ' BUG#' . $todo->idvalue);
if($todo->type == 'task') common::printLink('task', 'view', "id={$todo->idvalue}", ' TASK#' . $todo->idvalue);
if($todo->type == 'story') common::printLink('story', 'view', "id={$todo->idvalue}", ' STORY#' . $todo->idvalue);
if($todo->type == 'bug') common::printLink('bug', 'view', "id={$todo->objectID}", ' BUG#' . $todo->objectID);
if($todo->type == 'task') common::printLink('task', 'view', "id={$todo->objectID}", ' TASK#' . $todo->objectID);
if($todo->type == 'story') common::printLink('story', 'view', "id={$todo->objectID}", ' STORY#' . $todo->objectID);
?>
</div>
<div class='detail-content article-content'><?php echo $todo->desc;?></div>
+61 -7
View File
@@ -3,6 +3,60 @@ declare(strict_types=1);
class todoZen extends todo
{
/**
* 处理请求数据
* Processing request data.
*
* @param object $formData
* @return object|false
*/
protected function beforeCreate(object $formData): object|bool
{
$formData = $formData->remove(implode(',', $this->config->todo->moduleList) . ',uid')->stripTags($this->config->todo->editor->create['id'], $this->config->allowedTags)->get();
$objectID = 0;
$hasObject = in_array($formData->type, $this->config->todo->moduleList);
if($hasObject && $formData->type) $objectID = $formData->uid ? $formData->type : $formData->objectID;
$formData->account = $this->app->user->account;
$formData->assignedTo = zget($formData, 'assignedTo', $this->app->user->account);
$formData->assignedBy = zget($formData, 'assignedBy', $this->app->user->account);
if($hasObject && $formData->type) $formData->objectID = $objectID;
if($formData->status == 'done') $formData->finishedBy = $this->app->user->account;
if($formData->status == 'done') $formData->finishedDate = helper::now();
if(!isset($formData->pri) and in_array($formData->type, $this->config->todo->moduleList) and $formData->type !== 'review' and $formData->type !== 'feedback')
{
// TODO
$formData->pri = $this->dao->select('pri')->from($this->config->objectTables[$formData->type])->where('id')->eq($formData->objectID)->fetch('pri');
if($formData->pri == 'high') $formData->pri = 1;
if($formData->pri == 'middle') $formData->pri = 2;
if($formData->pri == 'low') $formData->pri = 3;
}
if($formData->type != 'custom' and $formData->objectID)
{
$type = $formData->type;
$object = $this->loadModel($type)->getByID($formData->$type);
if(isset($object->name)) $formData->name = $object->name;
if(isset($object->title)) $formData->name = $object->title;
}
if($formData->end < $formData->begin)
{
dao::$errors[] = sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin);
return false;
}
if(!empty($formData->cycle)) $formData = $this->setCycle($formData);
else unset($formData->config);
$formData = $this->loadModel('file')->processImgURL($formData, $this->config->todo->editor->create['id'], $this->post->uid);
return $formData;
}
/**
* 创建待办
* Create a todo.
@@ -47,20 +101,20 @@ class todoZen extends todo
* @param object $formData
* @return object|false
*/
protected function beforeEdit(int $todoID, object $formData)
protected function beforeEdit(int $todoID, object $formData): object|false
{
$oldTodo = $this->dao->findById($todoID)->from(TABLE_TODO)->fetch();
$idvalue = 0;
$objectID = 0;
$rowData = $formData->rawdata;
$objectType = $rowData->type;
$hasObject = in_array($objectType, $this->config->todo->moduleList);
if($hasObject && $objectType) $idvalue = $rowData->uid ? $rowData->$objectType : $rowData->idvalue;
if($hasObject && $objectType) $objectID = $rowData->uid ? $rowData->$objectType : $rowData->objectID;
$todo = $formData->add('account', $oldTodo->account)
->cleanInt('pri, begin, end, private')
->setIF(in_array($rowData->type, array('bug', 'task', 'story')), 'name', '')
->setIF($hasObject && $objectType, 'idvalue', $idvalue)
->setIF($hasObject && $objectType, 'objectID', $objectID)
->setIF($rowData->date == false, 'date', '2030-01-01')
->setIF($rowData->begin == false, 'begin', '2400')
->setIF($rowData->end == false, 'end', '2400')
@@ -70,7 +124,7 @@ class todoZen extends todo
->remove(implode(',', $this->config->todo->moduleList) . ',uid')
->get();
$todo = (object) array_merge((array) $todo, (array) $rowData);
$todo = (object) array_merge((array) $rowData, (array) $todo);
if(in_array($todo->type, $this->config->todo->moduleList))
{
@@ -196,12 +250,12 @@ class todoZen extends todo
protected function printConfirm(object $todo): int
{
$confirmNote = 'confirm' . ucfirst($todo->type);
$confirmURL = $this->createLink($todo->type, 'view', "id=$todo->idvalue");
$confirmURL = $this->createLink($todo->type, 'view', "id=$todo->objectID");
$okTarget = isonlybody() ? 'parent' : 'window.parent.$.apps.open';
if($todo->type == 'bug') $app = 'qa';
if($todo->type == 'task') $app = 'execution';
if($todo->type == 'story') $app = 'product';
$cancelURL = $this->server->HTTP_REFERER;
return print(js::confirm(sprintf($this->lang->todo->$confirmNote, $todo->idvalue), $confirmURL, $cancelURL, $okTarget, 'parent', $app));
return print(js::confirm(sprintf($this->lang->todo->$confirmNote, $todo->objectID), $confirmURL, $cancelURL, $okTarget, 'parent', $app));
}
}