Merge branch 'master' of https://gitlab.zcorp.cc/easycorp/zentaopms into sprint/master_fixbug

This commit is contained in:
tanghucheng
2022-03-31 11:21:50 +08:00
47 changed files with 1336 additions and 104 deletions
@@ -0,0 +1,10 @@
<?php
helper::importControl('install');
class myinstall extends install
{
public function index()
{
$this->view->versionName = $this->config->liteVersion;
return parent::index();
}
}
@@ -13,7 +13,7 @@ $lang->install->links = <<<EOT
新浪微博:<a href='https://weibo.com/easysoft' target='_blank'>https://weibo.com/easysoft</a>
您现在正在安装的版本是 <strong class='text-danger'>%s</strong>。
EOT;
$lang->install->successLabel = "<p>您已经成功安装禅道迅捷版%s。</p>";
+12 -11
View File
@@ -2148,20 +2148,28 @@ class execution extends control
$this->app->loadLang('story');
$this->app->loadLang('task');
$this->app->loadLang('bug');
$this->loadModel('kanban');
/* Compatibility IE8. */
if(strpos($this->server->http_user_agent, 'MSIE 8.0') !== false) header("X-UA-Compatible: IE=EmulateIE7");
$kanbanGroup = $this->loadModel('kanban')->getExecutionKanban($executionID, $browseType, $groupBy);
$this->execution->setMenu($executionID);
$execution = $this->execution->getById($executionID);
if($execution->lifetime == 'ops')
{
$browseType = 'task';
unset($this->lang->kanban->type['story']);
unset($this->lang->kanban->type['bug']);
unset($this->lang->kanban->type['all']);
}
$kanbanGroup = $this->kanban->getExecutionKanban($executionID, $browseType, $groupBy);
if(empty($kanbanGroup))
{
$this->kanban->createExecutionLane($executionID, $browseType, $groupBy);
$kanbanGroup = $this->kanban->getExecutionKanban($executionID, $browseType, $groupBy);
}
$this->execution->setMenu($executionID);
$execution = $this->loadModel('execution')->getById($executionID);
/* Determines whether an object is editable. */
$canBeChanged = common::canModify('execution', $execution);
@@ -2553,13 +2561,6 @@ class execution extends control
if(!empty($_POST))
{
/* Get executionType and determine whether a product is linked with the stage. */
$executionType = $this->dao->findById($executionID)->from(TABLE_EXECUTION)->fetch('type');
if($executionType == 'stage')
{
if(!isset($_POST['products'])) return print(js::alert($this->lang->execution->noLinkProduct) . js::locate($this->createLink('execution', 'manageProducts', "executionID=$executionID&from=$from")));
}
$oldProducts = $this->product->getProducts($executionID);
if($from == 'buildCreate' && $this->session->buildCreate) $browseExecutionLink = $this->session->buildCreate;
+1 -15
View File
@@ -305,14 +305,6 @@ class executionModel extends model
$type = 'sprint';
if($project) $type = zget($this->config->execution->modelList, $project->model, 'sprint');
/* If the execution model is a stage, determine whether the product is linked. */
$products = array_filter($this->post->products);
if(empty($products))
{
dao::$errors['message'][] = $this->lang->execution->noLinkProduct;
return false;
}
$this->config->execution->create->requiredFields .= ',project';
}
@@ -468,13 +460,7 @@ class executionModel extends model
dao::$errors['days'] = sprintf($this->lang->project->workdaysExceed, $workdays);
return false;
}
$products = array_filter($this->post->products);
$noLinkTip = $oldExecution->type != 'kanban' ? $this->lang->execution->noLinkProduct : $this->lang->execution->kanbanNoLinkProduct;
if(empty($products))
{
dao::$errors['message'][] = $noLinkTip;
return false;
}
/* Get the data from the post. */
$execution = fixer::input('post')
->setDefault('lastEditedBy', $this->app->user->account)
+2 -2
View File
@@ -144,8 +144,8 @@
<?php endforeach;?>
<?php endforeach;?>
<div class='col-sm-4'>
<div class="input-group <?php if(in_array($project->model, array('kanban', 'waterfall'))) echo 'required';?>">
<?php echo html::select("products[$i]", $allProducts, '', "class='form-control chosen' required onchange='loadBranches(this)'");?>
<div class="input-group">
<?php echo html::select("products[$i]", $allProducts, '', "class='form-control chosen' onchange='loadBranches(this)'");?>
<span class='input-group-addon fix-border'></span>
</div>
</div>
+2 -2
View File
@@ -141,7 +141,7 @@
<?php $hasBranch = $product->type != 'normal' and isset($branchGroups[$product->id]);?>
<?php foreach($linkedBranches[$product->id] as $branchID => $branch):?>
<div class='col-sm-4'>
<div class="input-group<?php if(in_array($project->model, array('kanban', 'waterfall')) and $i == 0) echo " required";if($hasBranch) echo ' has-branch';?>">
<div class="input-group<?php if($hasBranch) echo ' has-branch';?>">
<?php echo html::select("products[$i]", $allProducts, $product->id, "class='form-control chosen' $class onchange='loadBranches(this)' data-last='" . $product->id . "' data-type='". $product->type ."'");?>
<span class='input-group-addon fix-border'></span>
<?php if($hasBranch) echo html::select("branch[$i]", $branchGroups[$product->id], $branchID, "class='form-control chosen' $class onchange=\"loadPlans('#products{$i}', this.value)\" data-last='" . $branchID . "'");?>
@@ -159,7 +159,7 @@
<?php endforeach;?>
<div class='col-sm-4'>
<div class="input-group">
<?php echo html::select("products[$i]", $allProducts, '', "class='form-control chosen' required onchange='loadBranches(this)'");?>
<?php echo html::select("products[$i]", $allProducts, '', "class='form-control chosen' onchange='loadBranches(this)'");?>
<span class='input-group-addon fix-border'></span>
</div>
</div>
+7 -4
View File
@@ -133,10 +133,13 @@ body {margin-bottom: 25px;}
$link = common::hasPriv('execution', 'importTask') ? $this->createLink('execution', 'importTask', "execution=$execution->id") : '#';
echo "<li $class>" . html::a($link, $lang->execution->importTask, '', $misc) . "</li>";
$class = common::hasPriv('execution', 'importBug') ? '' : "class=disabled";
$misc = common::hasPriv('execution', 'importBug') ? "class='import'" : "class=disabled";
$link = common::hasPriv('execution', 'importBug') ? $this->createLink('execution', 'importBug', "execution=$execution->id") : '#';
echo "<li $class>" . html::a($link, $lang->execution->importBug, '', $misc) . "</li>";
if($execution->lifetime != 'ops')
{
$class = common::hasPriv('execution', 'importBug') ? '' : "class=disabled";
$misc = common::hasPriv('execution', 'importBug') ? "class='import'" : "class=disabled";
$link = common::hasPriv('execution', 'importBug') ? $this->createLink('execution', 'importBug', "execution=$execution->id") : '#';
echo "<li $class>" . html::a($link, $lang->execution->importBug, '', $misc) . "</li>";
}
?>
</ul>
</div>
+9 -4
View File
@@ -49,9 +49,12 @@
$link = common::hasPriv('execution', 'importTask') ? $this->createLink('execution', 'importTask', "execution=$execution->id") : '#';
echo "<li $misc>" . html::a($link, $lang->execution->importTask, '', $misc) . "</li>";
$misc = common::hasPriv('execution', 'importBug') ? '' : "class=disabled";
$link = common::hasPriv('execution', 'importBug') ? $this->createLink('execution', 'importBug', "execution=$execution->id") : '#';
echo "<li $misc>" . html::a($link, $lang->execution->importBug, '', $misc) . "</li>";
if($execution->lifetime != 'ops')
{
$misc = common::hasPriv('execution', 'importBug') ? '' : "class=disabled";
$link = common::hasPriv('execution', 'importBug') ? $this->createLink('execution', 'importBug', "execution=$execution->id") : '#';
echo "<li $misc>" . html::a($link, $lang->execution->importBug, '', $misc) . "</li>";
}
?>
</ul>
</div>
@@ -90,6 +93,7 @@
<div class='dropdown' id='createDropdown'>
<button class='btn btn-primary' type='button' data-toggle='dropdown'><i class='icon icon-plus'></i> <?php echo $this->lang->create;?> <span class='caret'></span></button>
<ul class='dropdown-menu pull-right'>
<?php if($execution->lifetime != 'ops'):?>
<?php if($canCreateStory) echo '<li>' . html::a(helper::createLink('story', 'create', "productID=$productID&branch=0&moduleID=0&story=0&execution=$execution->id", '', true), $lang->execution->createStory, '', "class='iframe'") . '</li>';?>
<?php if($canBatchCreateStory) echo '<li>' . html::a(helper::createLink('story', 'batchCreate', "productID=$productID&branch=0&moduleID=0&story=0&execution=$execution->id", '', true), $lang->execution->batchCreateStory, '', "class='iframe' data-width='90%'") . '</li>';?>
<?php if($canLinkStory) echo '<li>' . html::a(helper::createLink('execution', 'linkStory', "execution=$execution->id", '', true), $lang->execution->linkStory, '', "class='iframe' data-width='90%'") . '</li>';?>
@@ -103,9 +107,10 @@
echo $batchCreateBugLink;
}?>
<?php if(($hasStoryButton or $hasBugButton) and $hasTaskButton) echo '<li class="divider"></li>';?>
<?php if($canImportBug) echo '<li>' . html::a(helper::createLink('execution', 'importBug', "execution=$execution->id", '', true), $lang->execution->importBug, '', "class='iframe'") . '</li>';?>
<?php endif;?>
<?php if($canCreateTask) echo '<li>' . html::a(helper::createLink('task', 'create', "execution=$execution->id", '', true), $lang->task->create, '', "class='iframe'") . '</li>';?>
<?php if($canBatchCreateTask) echo '<li>' . html::a(helper::createLink('task', 'batchCreate', "execution=$execution->id", '', true), $lang->execution->batchCreateTask, '', "class='iframe'") . '</li>';?>
<?php if($canImportBug) echo '<li>' . html::a(helper::createLink('execution', 'importBug', "execution=$execution->id", '', true), $lang->execution->importBug, '', "class='iframe'") . '</li>';?>
</ul>
</div>
<?php endif;?>
+1 -1
View File
@@ -1 +1 @@
.table-form>tbody>tr>th {width: 150px;}
.table-form>tbody>tr>th {width: 160px;}
+6 -1
View File
@@ -2526,6 +2526,7 @@ class kanbanModel extends model
->fetchPairs();
if(empty($cardPairs)) return;
$sourceCards = $cardPairs;
if($laneType == 'story')
{
@@ -2624,13 +2625,17 @@ class kanbanModel extends model
->andWhere('t1.lane')->eq($lane->id)
->fetchPairs();
$updated = false;
foreach($cardPairs as $colType => $cards)
{
if(!isset($colPairs[$colType])) continue;
if($sourceCards[$colType] == $cards) continue;
$this->dao->update(TABLE_KANBANCELL)->set('cards')->eq($cards)->where('lane')->eq($lane->id)->andWhere('`column`')->eq($colPairs[$colType])->exec();
if(!$updated) $updated = true;
}
$this->dao->update(TABLE_KANBANLANE)->set('lastEditedTime')->eq(helper::now())->where('id')->eq($lane->id)->exec();
if($updated) $this->dao->update(TABLE_KANBANLANE)->set('lastEditedTime')->eq(helper::now())->where('id')->eq($lane->id)->exec();
}
/**
+2 -2
View File
@@ -16,7 +16,7 @@
<?php js::set('regionID', $regionID);?>
<?php js::set('lanes', $lanes);?>
<style>
.table-form>tbody>tr>th {width: 150px;}
.table-form>tbody>tr>th {width: 160px;}
#otherLane_chosen {top: -8px;}
.margin-bottom {margin-bottom: -6px;}
</style>
@@ -38,7 +38,7 @@
</tr>
<tr>
<th><?php echo $lang->kanbanlane->WIPType;?></th>
<td id='laneTypeBox'><?php echo html::radio('laneType', $lang->kanban->laneTypeList, 'story');?></td>
<td id='laneTypeBox' colspan='3'><?php echo html::radio('laneType', $lang->kanban->laneTypeList, 'story');?></td>
</tr>
<tr>
<th><?php echo $lang->kanbanlane->column;?></th>
+2 -1
View File
@@ -16,7 +16,8 @@
<?php echo html::a(inlink("project", "status=$key&productID=$productID"), "<span class='text'>{$label}</span>" . ($status == $key ? " <span class='label label-light label-badge'>" . count($projectStats) . "</span>" : ''), '', "class='btn btn-link" . ($status == $key ? ' btn-active-text' : '') . "' id='{$key}Tab'");?>
<?php endforeach;?>
<?php echo html::checkbox('involved', array('1' => $lang->project->mine), '', $this->cookie->involved ? 'checked=checked' : '');?>
<div class="tip"><icon class='icon icon-help' data-toggle='popover' data-trigger='focus hover' data-placement='right' data-tip-class='text-muted popover-sm' data-content=<?php echo $lang->product->projectInfo;?>></icon></div>
<div class="tip"><a data-toggle='tooltip' title='<?php echo $lang->product->projectInfo;?>'><i class='icon-help'></i></a></div>
</div>
<?php if($config->systemMode == 'new' and $branchStatus != 'closed'):?>
<div class="btn-toolbar pull-right">
+1 -1
View File
@@ -562,7 +562,7 @@ class task extends control
if($this->post->names)
{
$allChanges = $this->task->batchUpdate();
if(dao::isError()) return print(js::error(dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if(!empty($allChanges))
{
+2
View File
@@ -246,6 +246,8 @@ $lang->task->error->finishedDateEmpty = '"Finished Date" should not be empty.';
$lang->task->error->finishedDateSmall = '"Finished Date" should be > "Real Started"';
$lang->task->error->alreadyConsumed = 'The currently selected parent task has been consumed.';
$lang->task->error->date = 'The date should be >= today.';
$lang->task->error->leftEmptyAB = 'When the task status is %s, "Hours Left" cannot be 0';
$lang->task->error->leftEmpty = 'Task#%sWhen the task status is %s, "Left" cannot be 0';
/* Report. */
$lang->task->report = new stdclass();
+2
View File
@@ -246,6 +246,8 @@ $lang->task->error->finishedDateEmpty = '实际完成不能为空';
$lang->task->error->finishedDateSmall = '实际完成不能小于实际开始';
$lang->task->error->alreadyConsumed = '当前选中的父任务已有消耗。';
$lang->task->error->date = '日期不能大于今天';
$lang->task->error->leftEmptyAB = '任务状态为%s时,预计剩余不能为0';
$lang->task->error->leftEmpty = 'Task#%s任务状态为%s时,剩余不能为0';
/* Report. */
$lang->task->report = new stdclass();
+57 -13
View File
@@ -35,6 +35,30 @@ class taskModel extends model
if($this->post->selectTestStory)
{
/* Check required fields when create test task. */
foreach($this->post->testStory as $i => $storyID)
{
if(empty($storyID)) continue;
$task = new stdclass();
$task->pri = $this->post->testPri[$i];
$task->estStarted = $this->post->testEstStarted[$i];
$task->deadline = $this->post->testDeadline[$i];
$task->assignedTo = $this->post->testAssignedTo[$i];
$task->estimate = $this->post->testEstimate[$i];
$task->left = $this->post->testEstimate[$i];
$this->dao->insert(TABLE_TASK)->data($task)->batchCheck($requiredFields, 'notempty');
if(dao::isError())
{
foreach(dao::getError() as $field => $error)
{
dao::$errors[] = $error;
return false;
}
}
}
$requiredFields = str_replace(",estimate,", ',', "$requiredFields");
$requiredFields = str_replace(",story,", ',', "$requiredFields");
$requiredFields = str_replace(",estStarted,", ',', "$requiredFields");
@@ -998,6 +1022,12 @@ class taskModel extends model
$requiredFields = str_replace(',estimate,', ',', $requiredFields);
}
if(strpos(',doing,pause,', $task->status) && empty($teams) && empty($task->left))
{
dao::$errors[] = sprintf($this->lang->task->error->leftEmptyAB, $this->lang->task->statusList[$task->status]);
return false;
}
$requiredFields = trim($requiredFields, ',');
$this->dao->update(TABLE_TASK)->data($task)
@@ -1008,7 +1038,6 @@ class taskModel extends model
->checkIF($task->estimate != false, 'estimate', 'float')
->checkIF($task->left != false, 'left', 'float')
->checkIF($task->consumed != false, 'consumed', 'float')
->checkIF($task->status != 'wait' and empty($teams) and $task->left == 0 and $task->status != 'cancel' and $task->status != 'closed', 'status', 'equal', 'done')
->batchCheckIF($task->status == 'wait' or $task->status == 'doing', 'finishedBy, finishedDate,canceledBy, canceledDate, closedBy, closedDate, closedReason', 'empty')
@@ -1113,7 +1142,6 @@ class taskModel extends model
{
if(isset($data->modules[$taskID]) and ($data->modules[$taskID] == 'ditto')) $data->modules[$taskID] = isset($prev['module']) ? $prev['module'] : 0;
if($data->types[$taskID] == 'ditto') $data->types[$taskID] = isset($prev['type']) ? $prev['type'] : '';
if($data->statuses[$taskID] == 'ditto') $data->statuses[$taskID] = isset($prev['status']) ? $prev['status'] : '';
if($data->assignedTos[$taskID] == 'ditto') $data->assignedTos[$taskID] = isset($prev['assignedTo']) ? $prev['assignedTo'] : '';
if($data->pris[$taskID] == 'ditto') $data->pris[$taskID] = isset($prev['pri']) ? $prev['pri'] : 0;
if($data->finishedBys[$taskID] == 'ditto') $data->finishedBys[$taskID] = isset($prev['finishedBy']) ? $prev['finishedBy'] : '';
@@ -1124,7 +1152,6 @@ class taskModel extends model
$prev['module'] = $data->modules[$taskID];
$prev['type'] = $data->types[$taskID];
$prev['status'] = $data->statuses[$taskID];
$prev['assignedTo'] = $data->assignedTos[$taskID];
$prev['pri'] = $data->pris[$taskID];
$prev['finishedBy'] = $data->finishedBys[$taskID];
@@ -1145,7 +1172,7 @@ class taskModel extends model
$task->name = $data->names[$taskID];
$task->module = isset($data->modules[$taskID]) ? $data->modules[$taskID] : 0;
$task->type = $data->types[$taskID];
$task->status = $data->statuses[$taskID];
$task->status = isset($data->statuses[$taskID]) ? $data->statuses[$taskID] : $oldTask->status;
$task->assignedTo = $task->status == 'closed' ? 'closed' : $data->assignedTos[$taskID];
$task->pri = $data->pris[$taskID];
$task->estimate = isset($data->estimates[$taskID]) ? $data->estimates[$taskID] : $oldTask->estimate;
@@ -1180,11 +1207,12 @@ class taskModel extends model
if($message) return print(js::alert($message));
}
if($data->consumeds[$taskID])
if(isset($data->consumeds[$taskID]))
{
if($data->consumeds[$taskID] < 0)
{
echo js::alert(sprintf($this->lang->task->error->consumed, $taskID));
dao::$errors[] = sprintf($this->lang->task->error->consumed, $taskID);
return false;
}
else
{
@@ -1256,9 +1284,19 @@ class taskModel extends model
/* Check field not empty. */
foreach($tasks as $taskID => $task)
{
if($task->status == 'done' and $task->consumed == false) return print(js::error('task#' . $taskID . sprintf($this->lang->error->notempty, $this->lang->task->consumedThisTime)));
if($task->status == 'cancel') continue;
if(!empty($task->deadline) and $task->estStarted > $task->deadline) return print(js::error('task#' . $taskID . $this->lang->task->error->deadlineSmall));
if($task->status == 'done' and $task->consumed == false)
{
dao::$errors[] = 'Task#' . $taskID . sprintf($this->lang->error->notempty, $this->lang->task->consumedThisTime);
return false;
}
if(!empty($task->deadline) and $task->estStarted > $task->deadline)
{
dao::$errors[] = 'Task#' . $taskID . $this->lang->task->error->deadlineSmall;
return false;
}
foreach(explode(',', $this->config->task->edit->requiredFields) as $field)
{
$field = trim($field);
@@ -1275,6 +1313,12 @@ class taskModel extends model
foreach($tasks as $taskID => $task)
{
if(strpos(',doing,pause,', $task->status) && empty($teams) && $task->parent >= 0 && empty($task->left))
{
dao::$errors[] = sprintf($this->lang->task->error->leftEmpty, $taskID, $this->lang->task->statusList[$task->status]);
return false;
}
$oldTask = $oldTasks[$taskID];
$this->dao->update(TABLE_TASK)->data($task)
->autoCheck()
@@ -1282,7 +1326,6 @@ class taskModel extends model
->checkIF($task->estimate != false, 'estimate', 'float')
->checkIF($task->consumed != false, 'consumed', 'float')
->checkIF($task->left != false, 'left', 'float')
->checkIF($task->parent > 0 and $task->left == 0 and $task->status != 'cancel' and $task->status != 'closed' and $task->status != 'wait' and $task->consumed != 0, 'status', 'equal', 'done')
->batchCheckIF($task->status == 'wait' or $task->status == 'doing', 'finishedBy, finishedDate,canceledBy, canceledDate, closedBy, closedDate, closedReason', 'empty')
@@ -1294,6 +1337,11 @@ class taskModel extends model
->batchCheckIF($task->closedReason == 'cancel', 'finishedBy, finishedDate', 'empty')
->where('id')->eq((int)$taskID)
->exec();
if(dao::isError())
{
dao::$errors[] = 'Task#' . $taskID . dao::getError(true);
return false;
}
if($task->status == 'done' and $task->closedReason) $this->dao->update(TABLE_TASK)->set('status')->eq('closed')->where('id')->eq($taskID)->exec();
@@ -1324,10 +1372,6 @@ class taskModel extends model
if($task->status != $oldTask->status) $this->loadModel('kanban')->updateLane($oldTask->execution, 'task', $oldTask->id);
$allChanges[$taskID] = common::createChanges($oldTask, $task);
}
else
{
return print(js::error('task#' . $taskID . dao::getError(true)));
}
}
if(!dao::isError()) $this->loadModel('score')->create('ajax', 'batchEdit');
return $allChanges;
+1 -1
View File
@@ -127,7 +127,7 @@ js::set('dittoNotice', $dittoNotice);
<td class='text-left<?php echo zget($visibleFields, 'module', ' hidden')?>' style='overflow:visible'><?php echo html::select("modules[$taskID]", $modules, $tasks[$taskID]->module, "class='form-control chosen'")?></td>
<td class='text-left<?php echo zget($visibleFields, 'assignedTo', ' hidden')?>' style='overflow:visible'><?php echo html::select("assignedTos[$taskID]", $taskMembers, $tasks[$taskID]->assignedTo, "class='form-control chosen' {$disableAssignedTo}");?></td>
<td><?php echo html::select("types[$taskID]", $typeList, $tasks[$taskID]->type, "class='form-control'");?></td>
<td <?php echo zget($visibleFields, 'status', "class='hidden'")?>><?php echo html::select("statuses[$taskID]", $statusList, $tasks[$taskID]->status, "class='form-control'");?></td>
<td <?php echo zget($visibleFields, 'status', "class='hidden'")?>><?php echo html::select("statuses[$taskID]", $statusList, $tasks[$taskID]->status, "class='form-control' {$disableHour}");?></td>
<td <?php echo zget($visibleFields, 'estStarted', "class='hidden'")?>><?php echo html::input("estStarteds[$taskID]", helper::isZeroDate($tasks[$taskID]->estStarted) ? '' : $tasks[$taskID]->estStarted, "class='form-control text-center form-date'");?></td>
<td <?php echo zget($visibleFields, 'deadline', "class='hidden'")?>><?php echo html::input("deadlines[$taskID]", helper::isZeroDate($tasks[$taskID]->deadline) ? '' : $tasks[$taskID]->deadline, "class='form-control text-center form-date'");?></td>
<td <?php echo zget($visibleFields, 'pri', "class='hidden'")?>><?php echo html::select("pris[$taskID]", $priList, $tasks[$taskID]->pri, "class='form-control'");?></td>
+375 -15
View File
@@ -1,5 +1,5 @@
<?php
class Productplan
class productPlan
{
public function __construct($user)
{
@@ -9,49 +9,52 @@ class Productplan
}
/**
* getByIDPlan
* Get by ID plan
*
* @param int mixed $planID
* @param bool mixed $setImgSize
* @access public
* @return void
* @return array
*/
public function getByIDPlan($planID, $setImgSize = false)
{
$productplans = $this->productplan->getByID($planID, $setImgSize = false);
if(dao::isError()) return dao::getError();
return $productplans;
}
/**
* getByIDList
* Get by ID list
*
* @param array(int) mixed $planIDList
* @access public
* @return void
* @return array
*/
public function getByIDList($planIDList)
{
$productplans = $this->productplan->getByIDList($planIDList);
if(dao::isError()) return dao::getError();
return $productplans;
}
/**
* getLast
* Get last
*
* @param int mixed $productID
* @param int $branch
* @param int $parent
* @access public
* @return void
* @return array
*/
public function getLast($productID, $branch = 0, $parent = 0)
{
$productplans = $this->productplan->getLast($productID, $branch = 0, $parent = 0);
$productplans = $this->productplan->getLast($productID, $parent);
if(dao::isError()) return dao::getError();
return $productplans;
}
/**
* getList
* Get list
*
* @param int $product
* @param int $branch
@@ -60,20 +63,377 @@ class Productplan
* @param string $orderBy
* @param string $param
* @access public
* @return void
* @return array
*/
public function getList($product = 0, $branch = 0, $browseType = 'doing', $pager = null, $orderBy = 'begin_desc', $param = '')
public function getList($product, $branch, $browseType, $pager, $orderBy, $param)
{
$productplans = $this->productplan->getList($product = 0, $branch = 0, $browseType = 'doing', $pager = null, $orderBy = 'begin_desc', $param = '');
$productplans = $this->productplan->getList($product, $branch, $browseType, $pager, $orderBy, $param);
if(dao::isError()) return dao::getError();
return $productplans;
}
public function getPairs($product = 0, $branch = '', $expired = '', $skipParent = false)
/**
* Get pairs
*
* @param int $product
* @param string $branch
* @param string $expired
* @param bool mixed $skipParent
* @access public
* @return array
*/
public function getPairs($product, $branch = '', $expired = '', $skipParent = false)
{
$productplans = $this->productplan->getPairs($product = 0, $branch = '', $expired = '', $skipParent = false);
$productplans = $this->productplan->getPairs($product, $branch = '', $expired = '', $skipParent = false);
if(dao::isError()) return dao::getError();
return $productplans;
}
/**
* Get pairs for story
*
* @param mrray|int mixed $product
* @param int mixed $branch
* @param string mixed $param
* @access public
* @return count
*/
public function getPairsForStory($product, $branch, $param)
{
$productplans = $this->productplan->getPairsForStory($product, $branch, $param);
if(dao::isError()) return dao::getError();
return count($productplans) - 1;
}
/**
* Get for products
*
* @param array(int) mixed $products
* @access public
* @return count
*/
public function getForProducts($products)
{
$productplans = $this->productplan->getForProducts($products);
if(dao::isError()) return dao::getError();
return $productplans;
}
/**
* Get group by product
*
* @param array(int) mixed $products
* @param string mixed $param
* @param string $field
* @param string $orderBy
* @access public
* @return count
*/
public function getGroupByProduct($products, $param, $field = 'name', $orderBy = 'id_desc')
{
$productplans = $this->productplan->getGroupByProduct($products, $param, $field, $orderBy);
if(dao::isError()) return dao::getError();
return count($productplans);
}
/**
* Get children
*
* @param int mixed $planID
* @access public
* @return count
*/
public function getChildren($planID)
{
$productplans = $this->productplan->getChildren($planID);
if(dao::isError()) return dao::getError();
return count($productplans);
}
/**
* Get plans by stories
*
* @param array(int) mixed $storyIdList
* @access public
* @return count
*/
public function getPlansByStories($storyIdList)
{
$productplans = $this->productplan->getPlansByStories($storyIdList);
if(dao::isError()) return dao::getError();
return count($productplans);
}
/**
* Get branch plan pairs
*
* @param int mixed $productID
* @param int mixed $branches
* @access public
* @return array
*/
public function getBranchPlanPairs($productID, $branches)
{
$productplans = $this->productplan->getBranchPlanPairs($productID, $branches);
if(dao::isError()) return dao::getError();
return $productplans;
}
/**
* Create
*
* @param array mixed $param
* @access public
* @return array
*/
public function create($param)
{
//初始化传的参数,这里可以设置默认值
$createPlan = array('title' => '', 'begin' => '', 'end' => '', 'delta' => '', 'desc' => '', 'uid' => '', 'product' => '', 'parent' => '');
//设置foreach循环,将初始化参数传给全局变量$_POST中,通过此方式将传的参数提供给源码create方法
foreach($createPlan as $field => $defaultvalue) $_POST[$field] = $defaultvalue;
//二次遍历数组将此方法的形参传入$_POST中,这行可以替换掉初始化参数,做到以传入参数为最终结果的目的。同时不传参数的话取默认值
foreach($param as $key => $value) $_POST[$key] = $value;
//这行代码的作用是调用源码中的方法(参数通过$_POST直接取,具体原理可以不知道)
$productPlans = $this->productplan->create();
//将方法返回内容返回
if(dao::isError()) return dao::getError();
return $productPlans;
}
/**
* Update
*
* @param int mixed $planID
* @param array mixed $values
* @access public
* @return array
*/
public function update($planID, $values)
{
$updatePlan = array('title' => '', 'status' => '', 'begin' => '', 'end' => '', 'desc' => '', 'uid' => '', 'product' => '');
foreach($updatePlan as $field => $defaultvalue) $_POST[$field] = $defaultvalue;
foreach($values as $key =>$value) $_POST[$key] = $value;
$productplans = $this->productplan->update($planID);
if(dao::isError()) return dao::getError();
return $productplans;
}
/**
* Update status
*
* @param int mixed $planID
* @param string $status
* @param string $action
* @access public
* @return array
*/
public function updateStatus($planID, $status = '', $action = '')
{
$productplans = $this->productplan->updateStatus($planID, $status, $action);
if(dao::isError()) return dao::getError();
return $productplans;
}
/**
* Update parent status
*
* @param int mixed $parentId
* @access public
* @return bool
*/
public function updateParentStatus($parentId)
{
$productplans = $this->productplan->updateParentStatus($parentId);
if(dao::isError()) return dao::getError();
return $productplans;
}
/**
* Batch update
*
* @param int mixed $productId
* @access public
* @return array(array)
*/
public function batchUpdate($productId, $bratch)
{
$batch = array('id' => array(), 'title' => array(), 'begin' => array(), 'end' => array());
foreach($batch as $field => $defaultvalue) $_POST[$field] = $defaultvalue;
foreach($bratch as $key => $value) $_POST[$key] = $value;
$productplans = $this->productplan->batchUpdate($productId);
if(dao::isError()) return dao::getError();
return $productplans;
}
/**
* Batch change status
*
* @param string mixed $status
* @access public
* @return array
*/
public function batchChangeStatus($status, $planIDList = array('planIDList' => array(4, 5)))
{
$planID = $planIDList;
foreach($planID as $field => $defaultvalue) $_POST[$field] = $defaultvalue;
$productplans = $this->productplan->batchChangeStatus($status);
if(dao::isError()) return dao::getError();
return $productplans;
}
/**
* Change parent field
*
* @param int mixed $planID
* @access public
* @return true
*/
public function changeParentField($planID)
{
$productplans = $this->productplan->changeParentField($planID);
if(dao::isError()) return dao::getError();
return $productplans;
}
/**
* Link story
*
* @param int mixed $planID
* @param array(stories => array())mixed $storyID
* @access public
* @return void
*/
public function linkStory($planID, $storyID)
{
foreach($storyID as $key => $value) $_POST[$key] = $value;
$productplans = $this->productplan->linkStory($planID);
if(dao::isError()) return dao::getError();
return $productplans;
}
/**
* Unlink story
*
* @param int mixed $storyID
* @param int mixed $planID
* @access public
* @return void
*/
public function unlinkStory($storyID, $planID)
{
$productPlans = $this->productplan->unlinkStory($storyID, $planID);
if(dao::isError()) return dao::getError();
return $productPlans;
}
/**
* Link bug
*
* @param int mixed $planID
* @param array mixed $bugID
* @access public
* @return void
*/
public function linkBug($planID, $bugID)
{
foreach($bugID as $key => $value) $_POST[$key] = $value;
$productPlans = $this->productplan->linkBug($planID);
if(dao::isError()) return dao::getError();
return $productPlans;
}
/**
* Unlink bug
*
* @param int mixed $bugID
* @access public
* @return void
*/
public function unlinkBug($bugID)
{
$productplans = $this->productplan->unlinkBug($bugID);
if(dao::isError()) return dao::getError();
return $productplans;
}
/**
* Link project
*
* @param $projectID mixed $projectID
* @param $newPlans mixed $newPlans
* @access public
* @return void
*/
public function linkProject($projectID, $newPlans)
{
$productplans = $this->productplan->linkProject($projectID, $newPlans);
if(dao::isError()) return dao::getError();
return $productplans;
}
/**
* Reorder 4 children
*
* @param array mixed $plans
* @access public
* @return array
*/
public function reorder4Children($plans)
{
$plan = $this->productplan->dao->select('*')->from(TABLE_PRODUCTPLAN)
->where('id')->in($plans)
->andWhere('deleted')->eq(0)
->fetchAll('id');
$productplans = $this->productplan->reorder4Children($plan);
if(dao::isError()) return dao::getError();
return $productplans;
}
/**
* Is clickable
*
* @param int mixed $planID
* @param string mixed $action
* @access public
* @return void
*/
public function isClickable($planID, $action)
{
$plan = $this->productplan->dao->select('*')->from(TABLE_PRODUCTPLAN)
->where('id')->eq($planID)
->andWhere('deleted')->eq(0)
->fetchAll('id');
$plans = $plan[$planID];
$productplans = $this->productplan->isClickable($plans, $action);
if(dao::isError()) return dao::getError();
return $productplans;
}
}
?>
+1
View File
@@ -61,6 +61,7 @@ fields:
range: "0"
- field: object
range: ""
prefix: "plans,releases,builds,executions,cards"
- field: createdBy
range: "admin"
- field: createdDate
+9 -6
View File
@@ -10,18 +10,21 @@ fields:
- field: group
range: 1-100{8}
- field: fromID
range: "0"
range: 0{800},1-70,1-10,101-200,1-20
- field: fromType
range: ""
range: []{800},productplan{70},release{10},execution{100},build{20}
- field: name
range: 1-1000000
prefix: "卡片"
fields:
- field: name1
range: 卡片{800},[]{200}
- field: name2
range: 1-800,[]{200}
- field: status
range: doing,doing,done
- field: pri
range: "3"
range: 3{800},0{200}
- field: assignedTo
range: "admin"
range: admin{800},[]{200}
- field: desc
range: ""
- field: begin
+5 -2
View File
@@ -16,7 +16,10 @@ fields:
- field: card1
prefix: ","
postfix: ","
range: 1-800:2
range: 1-1000:2
- field: card2
postfix: ","
range: 2-800:2
range: 2-1000:2
- field: card3
postfix: ","
range: 801-1000:2
+48
View File
@@ -0,0 +1,48 @@
title: table zt_productplan
desc: "产品子计划"
author: sgm
version: "1.0"
fields:
- field: id
note: "ID"
range: 100-10000
- field: product
note: "所属产品"
range: 1-10
- field: branch
note: "所属分支"
range: 41-50
- field: parent
note: "父计划"
range: 1-10
- field: title
note: "名称"
range: [1.0,1.1,长名称好长好长好长好长好长好长好长好长好长好长好长好好长好长好长好长好长好好长好长好长好长好长好好长好长好长好长好长好的名字啊!@ase!!@#%@^&#!]
- field: status
note: "状态"
range: wait,doing,closed,done
- field: desc
note: "描述"
range: <div>
<p>asdxxxfa阿萨德开机as家世界发卡机发设计费啥登记卡设计费卡加斯加附件阿峰</p>
<p>123a阿士大夫姐姐姐经历过反对派呸呸呸史蒂夫接收到付款纪委第三方乐山大佛量减少地方</p>
<p>IU风格就叫阿萨德奥斯丁哦IG是DAU发加速度快哦哦阿萨德几年内发,,,奥斯丁,,,切,,,请问加十多年你</p>
<p>IUIG是DAU发加速度快哦哦阿萨德几年内发,,,奥斯丁,,,切,,,请问加十多年你</p>
<p>IU风格就叫阿萨德奥斯丁哦IG是DAU,,,奥斯丁,,,切,,,请问加十多年你</p>
</div>
- field: begin
note: "开始日期"
range: "(-10M)-(-7M):7D"
type: timestamp
format: "YYYY-MM-DD"
- field: end
note: "结束日期"
range: "(-6M)-(+6M):7D"
type: timestamp
format: "YYYY-MM-DD"
- field: order
note: "排序"
value: "$id * 5"
- field: deleted
note: "是否删除"
range: 0{359},1
+1 -1
View File
@@ -60,7 +60,7 @@ $builder->kanbanregion = array('rows' => 100, 'extends' => array('kanbanregion',
$builder->kanbangroup = array('rows' => 100, 'extends' => array('kanbangroup','kanbangroup'));
$builder->kanbanlane = array('rows' => 100, 'extends' => array('kanbanlane','kanbanlane'));
$builder->kanbancolumn = array('rows' => 400, 'extends' => array('kanbancolumn','kanbancolumn'));
$builder->kanbancard = array('rows' => 800, 'extends' => array('kanbancard','kanbancard'));
$builder->kanbancard = array('rows' => 1000, 'extends' => array('kanbancard','kanbancard'));
$builder->kanbancell = array('rows' => 400, 'extends' => array('kanbancell','kanbancell'));
$builder->kanbanregionproject = array('rows' => 180, 'extends' => array('kanbanregion','kanbanregionproject'));
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=productpanModel->batchChangeStatus();
cid=1
pid=1
将planiID=45的计划状态修改为doing,打印4旧状态 >> wait
将planiID=4, 5的计划状态修改为doing,打印4新状态 >> doing
将planiID=4, 5的计划状态修改为doing,打印5旧状态 >> wait
将planiID=4, 5的计划状态修改为doing,打印5新状态 >> doing
将planiID=4, 5的计划状态修改回wait 打印4的当前状态 >> doing
将planiID=4, 5的计划状态修改回wait 打印4的修改后的状态 >> wait
将planiID=4, 5的计划状态修改回wait 打印5的当前状态 >> doing
将planiID=4, 5的计划状态修改回wait 打印5的修改后的状态 >> wait
*/
$plan = new productPlan('admin');
$postID = array('planIDList' => array(4, 5));
$status = $plan->batchChangeStatus('doing', $postID);
$status4 = $status[4];
$status5 = $status[5];
$status = $plan->batchChangeStatus('wait', $postID);
$status6 = $status[4];
$status7 = $status[5];
r($status4) && p('0:old') && e('wait'); //将planiID=45的计划状态修改为doing,打印4旧状态
r($status4) && p('0:new') && e('doing'); //将planiID=4, 5的计划状态修改为doing,打印4新状态
r($status5) && p('0:old') && e('wait'); //将planiID=4, 5的计划状态修改为doing,打印5旧状态
r($status5) && p('0:new') && e('doing'); //将planiID=4, 5的计划状态修改为doing,打印5新状态
r($status6) && p('0:old') && e('doing'); //将planiID=4, 5的计划状态修改回wait, 打印4的当前状态
r($status6) && p('0:new') && e('wait'); //将planiID=4, 5的计划状态修改回wait, 打印4的修改后的状态
r($status7) && p('0:old') && e('doing'); //将planiID=4, 5的计划状态修改回wait, 打印5的当前状态
r($status6) && p('0:new') && e('wait'); //将planiID=4, 5的计划状态修改回wait, 打印5的修改后的状态
system("./ztest init");
?>
+101
View File
@@ -0,0 +1,101 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=productpanModel->batchUpdate();
cid=1
pid=1
当product=1时,传入正常参数批量修改id=1,2,3的计划,打印id=1修改后的名字new >> list-1
当product=1时,传入正常参数批量修改id=1,2,3的计划,打印id=2修改后的名字new >> list-2
当product=1时,传入正常参数批量修改id=1,2,3的计划,打印id=3修改后的名字new >> list-3
当product=2时,传入正常参数批量修改id=4,5,6的计划,打印id=4修改后的名字new >> list-4
当product=2时,传入正常参数批量修改id=4,5,6的计划,打印id=5修改后的名字new >> list-5
当product=2时,传入正常参数批量修改id=4,5,6的计划,打印id=6修改后的名字new >> list-6
*/
$plan = new productPlan('admin');
$product = array();
$product[0] = 1;
$product[1] = 2;
$id = array();
$title = array();
$begin = array();
$end = array();
$id1 = $id;
$id1[1] = 1;
$id1[2] = 2;
$id1[3] = 3;
$title1 = $title;
$title1[1] = 'list-1';
$title1[2] = 'list-2';
$title1[3] = 'list-3';
$begin1 = $begin;
$begin1[1] = '2021-05-10';
$begin1[2] = '2021-04-12';
$begin1[3] = '2021-04-01';
$end1 = $end;
$end1[1] = '2021-11-30';
$end1[2] = '2021-10-25';
$end1[3] = '2021-10-23';
$id2 = $id;
$id2[4] = 4;
$id2[5] = 5;
$id2[6] = 6;
$title2 = $title;
$title2[6] = 'list-6';
$title2[5] = 'list-5';
$title2[4] = 'list-4';
$begin2 = $begin;
$begin2[6] = '2021-05-10';
$begin2[5] = '2021-06-12';
$begin2[4] = '2021-06-01';
$end2 = $end;
$end2[6] = '2021-11-30';
$end2[5] = '2021-11-28';
$end2[4] = '2021-11-23';
$branch1 = array();
$branch1['id'] = $id1;
$branch1['title'] = $title1;
$branch1['begin'] = $begin1;
$branch1['end'] = $end1;
$branch2 = array();
$branch2['id'] = $id2;
$branch2['title'] = $title2;
$branch2['begin'] = $begin2;
$branch2['end'] = $end2;
$batchUpdate = $plan->batchUpdate($product[0], $branch1);
$batchUpdate1 = $batchUpdate[1];
$batchUpdate2 = $batchUpdate[2];
$batchUpdate3 = $batchUpdate[3];
$newBatchUpdate = $plan->batchUpdate($product[1], $branch2);
$batchUpdate4 = $newBatchUpdate[4];
$batchUpdate5 = $newBatchUpdate[5];
$batchUpdate6 = $newBatchUpdate[6];
r($batchUpdate1) && p('0:new') && e('list-1'); //当product=1时,传入正常参数批量修改id=1,2,3的计划,打印id=1修改后的名字new
r($batchUpdate2) && p('0:new') && e('list-2'); //当product=1时,传入正常参数批量修改id=1,2,3的计划,打印id=2修改后的名字new
r($batchUpdate3) && p('0:new') && e('list-3'); //当product=1时,传入正常参数批量修改id=1,2,3的计划,打印id=3修改后的名字new
r($batchUpdate4) && p('0:new') && e('list-4'); //当product=2时,传入正常参数批量修改id=4,5,6的计划,打印id=4修改后的名字new
r($batchUpdate5) && p('0:new') && e('list-5'); //当product=2时,传入正常参数批量修改id=4,5,6的计划,打印id=5修改后的名字new
r($batchUpdate6) && p('0:new') && e('list-6'); //当product=2时,传入正常参数批量修改id=4,5,6的计划,打印id=6修改后的名字new
system("./ztest init");
?>
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(Dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=productplanModel->changeParentField();
cid=1
pid=1
传入ID为1的情况,返回true >> 1
传入ID为5的情况,返回true,如不存在函数会报错 >> 1
*/
$plan = new productPlan('admin');
$planID = array();
$planID[0] = 1;
$planID[1] = 5;
r($plan->changeParentField($planID[0])) && p() && e('1'); //传入ID为1的情况,返回true
r($plan->changeParentField($planID[1])) && p() && e('1'); //传入ID为5的情况,返回true,如不存在函数会报错
?>
+62
View File
@@ -0,0 +1,62 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=productpanModel->create();
cid=1
pid=1
测试正常创建 >> 110
测试不传入名称的情况 >> 『名称』不能为空。
测试不传开始时间的情况 >> 111
测试不传结束时间的情况 >> 112
测试不传开始时间及结束时间的情况 >> 113
测试不传UID的情况 >> 114
测试不传关联产品的情况 >> 『产品』应当是数字。
测试不传父级计划的情况 >> 『父计划』应当是数字。
*/
$plan = new productPlan('admin');
$posts = array();
$posts['title'] = '测试创建1';
$posts['begin'] = '2021-10-25';
$posts['end'] = '2021-10-29';
$posts['uid'] = '623927843dd9b';
$posts['product'] = '2';
$posts['parent'] = '0';
$noTitle = $posts;
$noTitle['title'] = '';
$noBegin = $posts;
$noBegin['begin'] = '';
$noEnd = $posts;
$noEnd['end'] = '';
$noBeginEnd = $noBegin;
$noBeginEnd['end'] = '';
$noUid = $posts;
$noUid['uid'] = '';
$noProduct = $posts;
$noProduct['product'] = '';
$noParent = $posts;
$noParent['parent'] = '';
r($plan->create($posts)) && p() && e('110'); //测试正常创建
r($plan->create($noTitle)) && p('title:0') && e('『名称』不能为空。'); //测试不传入名称的情况
r($plan->create($noBegin)) && p() && e('111'); //测试不传开始时间的情况
r($plan->create($noEnd)) && p() && e('112'); //测试不传结束时间的情况
r($plan->create($noBeginEnd)) && p() && e('113'); //测试不传开始时间及结束时间的情况
r($plan->create($noUid)) && p() && e('114'); //测试不传UID的情况
r($plan->create($noProduct)) && p('product:0') && e('『产品』应当是数字。'); //测试不传关联产品的情况
r($plan->create($noParent)) && p('parent:0') && e('『父计划』应当是数字。'); //测试不传父级计划的情况
system("./ztest init");
?>
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=productpanModel->getLast();
cid=1
pid=1
传入存在的数据,返回相应信息 >> 1.0 [2021-06-11~2022-04-26]
传入不存在的分支 >> 0
传入不存在的产品id >> 0
*/
$plan = new productPlan('admin');
$product = array();
$product[0] = 41;
$product[1] = 1;
$product[2] = 111;
$branch = array();
$branch[0] = 1;
$branch[1] = 111;
$branch[2] = 1;
r($plan->getBranchPlanPairs($product[0], $branch[0])) && p('1:31') && e('1.0 [2021-06-11~2022-04-26]'); //传入存在的数据,返回相应信息
r($plan->getBranchPlanPairs($product[1], $branch[1])) && p('1:31') && e('0'); //传入不存在的分支
r($plan->getBranchPlanPairs($product[2], $branch[2])) && p('1:31') && e('0'); //传入不存在的产品id
?>
+19 -6
View File
@@ -3,15 +3,28 @@
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
$productplan = new Productplan('admin');
/**
title=cid=1
cid=1
pid=1
传入一个数组,取值id为3的数据 >> 3
传入一个数组,取值id为1的数据 >> 1
传入一个数值,正常取值 >> 1
传入一个不存在的值返回布尔值 >> 0
*/
$plan = new productPlan('admin');
$IDlist = array();
$IDlist[0] = 1;
$IDlist[1] = 1000;
$IDlist[2] = 3;
r($productplan->getByIDList($IDlist)) && p('3:id') && e('3'); //传入一个数组,取值id为3的数据
r($productplan->getByIDList($IDlist)) && p('1:id') && e('1'); //传入一个数组,取值id为1的数据
r($productplan->getByIDList($IDlist[0])) && p('1:id') && e('1'); //传入一个数值,正常取值
r($productplan->getByIDList($IDlist[1])) && p() && e('0'); //传入一个不存在的值返回布尔值
?>
r($plan->getByIDList($IDlist)) && p('3:id') && e('3'); //传入一个数组,取值id为3的数据
r($plan->getByIDList($IDlist)) && p('1:id') && e('1'); //传入一个数组,取值id为1的数据
r($plan->getByIDList($IDlist[0])) && p('1:id') && e('1'); //传入一个数值,正常取值
r($plan->getByIDList($IDlist[1])) && p() && e('0'); //传入一个不存在的值返回布尔值
?>
+5 -5
View File
@@ -3,14 +3,14 @@
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
$productplan = new Productplan('admin');
$plan = new productPlan('admin');
$planID = array();
$planID[0] = 5;
$planID[1] = 1000;
r($productplan->getByIDPlan($planID[0])) && p('status') && e('wait'); //如果存在,返回数组类型数据
r($productplan->getByIDPlan($planID[0])) && p('begin') && e('2021-06-13'); //取出开始时间
r($productplan->getByIDPlan($planID[0])) && p('end') && e('2021-10-14'); //取出结束时间
r($productplan->getByIDPlan($planID[1])) && p() && e('0'); //如不存在,返回布尔值
r($plan->getByIDPlan($planID[0])) && p('status') && e('wait'); //如果存在,返回数组类型数据
r($plan->getByIDPlan($planID[0])) && p('begin') && e('2021-06-13'); //取出开始时间
r($plan->getByIDPlan($planID[0])) && p('end') && e('2021-10-14'); //取出结束时间
r($plan->getByIDPlan($planID[1])) && p() && e('0'); //如不存在,返回布尔值
?>
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=productpanModel->getChildren();
cid=1
pid=1
这里统计了取出所有的数量 >> 61
这里统计不存在的情况 >> 1
*/
$plan = new productPlan('admin');
$planid = array();
$planid[0] = 0;
$planid[1] = 1;
r($plan->getChildren(0)) && p() && e('61'); //这里统计了取出所有的数量
r($plan->getChildren(1)) && p() && e('1'); //这里统计不存在的情况
?>
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=productpanModel->getForProducts();
cid=1
pid=1
测试传入一个数组,取出产品名称count >> 1.0
测试传入一个不存在的product数组,应为空 >> 0
*/
$plan = new productPlan('admin');
$products = array();
$products[0] = array(1, 2);
$products[1] = array(1000,1001);
$noProduct = count($plan->getForProducts(array(1000,1001))) -1;
r($plan->getForProducts($products[0])) && p('1') && e('1.0'); //测试传入一个数组,取出产品名称count
r($noProduct) && p() && e('0'); //测试传入一个不存在的product数组,应为空
?>
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=productpanModel->getGroupByProduct();
cid=1
pid=1
传入正常product 12 >> 2
传入部分不存在product >> 1
传入不存在product >> 0
传入正常product 12;未过期param >> 0
传入部分不存在product;未过期param >> 0
传入不存在product 未过期param >> 0
*/
$plan = new productPlan('admin');
$products = array();
$products[0] = array(1, 2);
$products[1] = array(2, 10000);
$products[2] = array(9999, 10000);
$param = array();
$param[0] = 'skipParent';
$param[1] = 'unexpired';
r($plan->getGroupByProduct($products[0], $param[0])) && p() && e('2'); //传入正常product 12
r($plan->getGroupByProduct($products[1], $param[0])) && p() && e('1'); //传入部分不存在product
r($plan->getGroupByProduct($products[2], $param[0])) && p() && e('0'); //传入不存在product
r($plan->getGroupByProduct($products[0], $param[1])) && p() && e('0'); //传入正常product 12;未过期param
r($plan->getGroupByProduct($products[1], $param[1])) && p() && e('0'); //传入部分不存在product;未过期param
r($plan->getGroupByProduct($products[2], $param[1])) && p() && e('0'); //传入不存在product 未过期param
?>
+17 -5
View File
@@ -3,14 +3,26 @@
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
$productplan = new Productplan('admin');
/**
title=productpanModel->getLast();
cid=1
pid=1
获取id为1的最后一个产品 >> 3
获取id为2的最后一个产品 >> 6
获取不存在的id返回布尔值 >> 0
*/
$plan = new productPlan('admin');
$getLast = array();
$getLast[0] = 1;
$getLast[1] = 2;
$getLast[2] = 200;
r($productplan->getLast($getLast[0])) && p('id') && e('3'); //获取id为1的最后一个产品
r($productplan->getLast($getLast[1])) && p('id') && e('6'); //获取id为2的最后一个产品
r($productplan->getLast($getLast[2])) && p('id') && e('0'); //获取不存在的id返回布尔值
?>
r($plan->getLast($getLast[0])) && p('id') && e('3'); //获取id为1的最后一个产品
r($plan->getLast($getLast[1])) && p('id') && e('6'); //获取id为2的最后一个产品
r($plan->getLast($getLast[2])) && p('id') && e('0'); //获取不存在的id返回布尔值
?>
+18 -3
View File
@@ -3,10 +3,25 @@
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=cid=1
cid=1
pid=1
获取product=1的所有数据 >> 3
*/
$productplan = new Productplan('admin');
$List = array();
$List[0] = 0;
$List[0] = 1;
$List[1] = 0;
$List[2] = 'all';
$List[3] = null;
$List[4] = 'begin_desc';
$List[5] = 'kipparent';
r($productplan->getList(1, 0, 'all', null, 'begin_desc', 'kipparent')) && p('') && e('0'); //返回空数组
?>
r($productplan->getList(1, 0, 'all', null, 'begin_desc', 'kipparent')) && p('3:id') && e('3'); //获取product=1的所有数据
?>
+23 -2
View File
@@ -3,6 +3,27 @@
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
$productplan = new Productplan('admin');
/**
?>
title=productpanModel->getPairs();
cid=1
pid=1
id为41的产品分支32 >> 分支2 / 1.1 [2021-06-18 ~ 2022-05-03]
id为41的产品分支31 >> 分支1 / 1.0 [2021-06-11 ~ 2022-04-26]
id为42的产品分支34 >> 分支4 / 1.0 [2021-07-02 ~ 2022-05-17]
*/
$plan = new productPlan('admin');
$product = array();
$product[0] = 41;
$product[1] = 42;
$branch = 1;
$expired = 'unexpired';
r($plan->getPairs($product[0], $branch, $expired)) && p('32') && e('分支2 / 1.1 [2021-06-18 ~ 2022-05-03]'); //id为41的产品分支32
r($plan->getPairs($product[0], $branch, $expired)) && p('31') && e('分支1 / 1.0 [2021-06-11 ~ 2022-04-26]'); //id为41的产品分支31
r($plan->getPairs($product[1], $branch, $expired)) && p('34') && e('分支4 / 1.0 [2021-07-02 ~ 2022-05-17]'); //id为42的产品分支34
?>
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=productpanModel->getPairsForStory();
cid=1
pid=1
测试传入已有数据product=10branch=0情况,正常返回 >> 3
测试传入product=41, branch=1的数据 >> 1
测试传入一个数组 >> 4
测试传入不存在的product >> 0
测试传入不同param情况 >> 3
测试传入不同param情况 >> 3
*/
$plan = new productPlan('admin');
$product = array(10, 41, 42, 1000);
$branch = array(0, 1);
$param = array('skipParent', 'withMainPlan', 'unexpired');
r($plan->getPairsForStory($product[0], $branch[0], $param[1])) && p('') && e('3'); //测试传入已有数据product=10branch=0情况,正常返回
r($plan->getPairsForStory($product[1], $branch[1], $param[1])) && p('') && e('1'); //测试传入product=41, branch=1的数据
r($plan->getPairsForStory($product, $branch[1], $param[1])) && p('') && e('4'); //测试传入一个数组
r($plan->getPairsForStory($product[3], $branch[1], $param[1])) && p('') && e('0'); //测试传入不存在的product
r($plan->getPairsForStory($product[0], $branch[0], $param[0])) && p('') && e('3'); //测试传入不同param情况
r($plan->getPairsForStory($product[0], $branch[0], $param[2])) && p('') && e('3'); //测试传入不同param情况
?>
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=productpanModel->getPlansByStories();
cid=1
pid=1
查询存在的id >> 3
查询部分存在的id >> 1
查询不存在的id >> 0
*/
$plan = new productPlan('admin');
$storyIdList = array();
$storyIdList[0] = array(5, 6, 7);
$storyIdList[1] = array(5, 1000);
$storyIdList[2] = array(1000, 1001);
r($plan->getPlansByStories($storyIdList[0])) && p() && e('3'); //查询存在的id
r($plan->getPlansByStories($storyIdList[1])) && p() && e('1'); //查询部分存在的id
r($plan->getPlansByStories($storyIdList[2])) && p() && e('0'); //查询不存在的id
?>
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=productplanModel->isClickable();
cid=1
pid=1
id=100,无子集计划,可以点击的id=100 >> 1
id=1,有子集计划,不能点击 >> 0
id=102,无子集计划,计划关闭,不可点击 >> 0
id=105,无子集计划,等待状态,不可点击 >> 0
*/
$plan = new productPlan('admin');
$planID = array();
$planID[0] = 100;
$planID[1] = 101;
$planID[2] = 1;
$planID[3] = 102;
$planID[4] = 105;
$action = array();
$action[0] = 'start';
$action[1] = 'finish';
$action[2] = 'close';
$action[3] = 'activate';
r($plan->isClickable($planID[0], $action[0])) && p() && e('1'); //id=100,无子集计划,可以点击的id=100
r($plan->isClickable($planID[2], $action[1])) && p() && e('0'); //id=1,有子集计划,不能点击
r($plan->isClickable($planID[3], $action[2])) && p() && e('0'); //id=102,无子集计划,计划关闭,不可点击
r($plan->isClickable($planID[4], $action[3])) && p() && e('0'); //id=105,无子集计划,等待状态,不可点击
?>
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=productplanModel->linkBug()
cid=1
pid=1
id为100的计划关联id为3的bug >> 0
id为100的计划关联id为1和2的bug >> 0
传入不存在的id >> 0
解除bugid为1的关联关系 >> 0
解除bugid为2的关联关系 >> 0
解除不存在的id >> 0
*/
$plan = new productPlan('admin');
$planID = array();
$planID[0] = 100;
$bugID = array();
$bugID[0] = array('bugs' => array(3));
$bugID[1] = array('bugs' => array(1, 2));
$bugID[2] = array('bugs' => array(10000));
$unbugID = array();
$unbugID[0] = 1;
$unbugID[1] = 2;
$unbugID[2] = 10000;
r($plan->linkBug($planID[0], $bugID[0])) && p() && e('0'); //id为100的计划关联id为3的bug
r($plan->linkBug($planID[0], $bugID[1])) && p() && e('0'); //id为100的计划关联id为1和2的bug
r($plan->linkBug($planID[0], $bugID[2])) && p() && e('0'); //传入不存在的id
r($plan->unlinkBug($planID[0], $unbugID[0])) && p() && e('0'); //解除bugid为1的关联关系
r($plan->unlinkBug($planID[0], $unbugID[1])) && p() && e('0'); //解除bugid为2的关联关系
r($plan->unlinkBug($planID[0], $unbugID[2])) && p() && e('0'); //解除不存在的id
system("./ztest init");
?>
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=prodeutplanModel->linkProject();
cid=1
pid=1
项目ID=3关联计划ID为1112的产品计划 >> 0
*/
$plan = new productPlan('admin');
r($plan->linkProject(13, array(11 ,12))) && p() && e('0'); //项目ID=3关联计划ID为11,12的产品计划
?>
+46
View File
@@ -0,0 +1,46 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=productplanModel->linkStory();
cid=1
pid=1
关联计划id为100的需求4 >> 0
关联计划id为101的需求8 >> 0
传入不存在id的情况 >> 0
解除id为100关联需求4 >> 0
解除id为101关联需求8 >> 0
*/
$plan = new productPlan('admin');
$planID = array();
$planID[0] = 100;
$planID[1] = 101;
$planID[2] = 10000;
$storyID = array();
$storyID[0] = array('stories' => array(4));
$storyID[1] = array('stories' => array(8));
$storyID[2] = array('stories' => array(1111));
$unstoryID = array();
$unstoryID[0] = 4;
$unstoryID[1] = 8;
$unstoryID[2] = 1111;
#方法没有return返回结果,页面上看关联成功了,成功失败均返回空
r($plan->linkStory($planID[0], $storyID[0])) && p() && e('0'); //关联计划id为100的需求4
r($plan->linkStory($planID[1], $storyID[1])) && p() && e('0'); //关联计划id为101的需求8
r($plan->linkStory($planID[2], $storyID[2])) && p() && e('0'); //传入不存在id的情况
#这里将另一个同类方法unlinkStory放在这里调用
r($plan->unlinkStory($unstoryID[0], $planID[0])) && p() && e('0'); //解除id为100关联需求4
r($plan->unlinkStory($unstoryID[1], $planID[1])) && p() && e('0'); //解除id为101关联需求8
system("./ztest init");
?>
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=productplanModel->reorder4Children();
cid=1
pid=1
传入三个子计划id100,102,101,排序第一个 >> 100
第二个 >> 101
第三个,会输出正序排列的数组100101102 >> 102
传入不存在的id时 >> 0
*/
$plan = new productPlan('admin');
$planID = array();
$planID[0] = array(100, 102, 101);
$planID[1] = array(1000, 10000);
r($plan->reorder4Children($planID[0])) && p('100:id') && e('100'); //传入三个子计划id100,102,101,排序第一个
r($plan->reorder4Children($planID[0])) && p('101:id') && e('101'); //第二个
r($plan->reorder4Children($planID[0])) && p('102:id') && e('102'); //第三个,会输出正序排列的数组100,101,102
r($plan->reorder4Children($planID[1])) && p() && e('0'); //传入不存在的id时
?>
+8
View File
@@ -0,0 +1,8 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
$plan = new productPlan('admin');
?>
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=productpanModel->update();
cid=1
pid=1
修改planId=5的数据,打印出旧的名称 >> 1.1
二次修改旧的数据,由于数据发生变化,理应失败 >> 0
测试传入结束时间小于开始时间的情况 >> 父计划[5]的完成日期:2021-10-10,不能小于子计划的完成日期: 2021-10-26
*/
$plan = new productPlan('admin');
$planId = array();
$planId[0] = 5;
$planId[1] = 6;
$posts = array();
$posts['title'] = '测试修改';
$posts['status'] = 'doing';
$posts['begin'] = '2021-03-22';
$posts['end'] = '2022-10-31';
$posts['uid'] = '';
$posts['product'] = '2';
$late = $posts;
$late['end'] = '2021-10-10';
r($plan->update($planId[0], $posts)) && p('0:old') && e('1.1'); //修改planId=5的数据,打印出旧的名称
r($plan->update($planId[0], $posts)) && p('0:old') && e('0'); //二次修改旧的数据,由于数据发生变化,理应失败
r($plan->update($planId[0], $late)) && p('end') && e('父计划[5]的完成日期:2021-10-10,不能小于子计划的完成日期: 2021-10-26'); //测试传入结束时间小于开始时间的情况
system("./ztest init");
?>
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=productpanModel->updateParentStatus();
cid=1
pid=1
将id为1的计划改为wait状态 >> 0
将id为2的计划改为doing状态 >> 1
将id为3的计划改为closed状态 >> 1
将id为4的计划改为done状态 >> 1
*/
$plan = new productPlan('admin');
$parentId = array();
$parentid[0] = 1;
$parentid[1] = 2;
$parentid[2] = 3;
$parentid[3] = 4;
#此方法将父级plan状态改为与子plan相同的状态
r($plan->updateParentStatus($parentid[0])) && p() && e('0'); //将id为1的计划改为wait状态
r($plan->updateParentStatus($parentid[1])) && p() && e('1'); //将id为2的计划改为doing状态
r($plan->updateParentStatus($parentid[2])) && p() && e('1'); //将id为3的计划改为closed状态
r($plan->updateParentStatus($parentid[3])) && p() && e('1'); //将id为4的计划改为done状态
system("./ztest init");
?>
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
/**
title=productpanModel->updateStatus();
cid=1
pid=1
修改id=5的状态为doing >> 1
修改状态为done >> 1
修改状态为closed >> 1
*/
$plan = new productPlan('admin');
$planId = array();
$planId[0] = 5;
$planId[1] = 'doing';
$planId[2] = 'done';
$planId[3] = 'closed';
$planId[4] = 'started';
$planId[5] = 'finished';
$planId[6] = 'closed';
$planId[7] = 'activated';
r($plan->updateStatus($planId[0], $planId[1], $planId[4])) && p() && e('1'); //修改id=5的状态为doing
r($plan->updateStatus($planId[0], $planId[2], $planId[5])) && p() && e('1'); //修改状态为done
r($plan->updateStatus($planId[0], $planId[3], $planId[6])) && p() && e('1'); //修改状态为closed
system("./ztest init");
?>