* Support for flow.

This commit is contained in:
王怡栋
2021-12-02 10:55:04 +08:00
parent d99bd57aa6
commit bf16167b19
8 changed files with 73 additions and 8 deletions
+15 -4
View File
@@ -608,6 +608,7 @@ class executionModel extends model
}
}
$extendFields = $this->getFlowExtendFields();
foreach($data->executionIDList as $executionID)
{
$executionName = $data->names[$executionID];
@@ -644,6 +645,16 @@ class executionModel extends model
if(isset($codeList[$executionCode])) dao::$errors['code'][] = 'execution#' . $executionID . sprintf($this->lang->error->unique, $this->lang->project->code, $executionCode);
$codeList[$executionCode] = $executionCode;
}
foreach($extendFields as $extendField)
{
$executions[$executionID]->{$extendField->field} = $this->post->{$extendField->field}[$executionID];
if(is_array($executions[$executionID]->{$extendField->field})) $executions[$executionID]->{$extendField->field} = join(',', $executions[$executionID]->{$extendField->field});
$executions[$executionID]->{$extendField->field} = htmlSpecialString($executions[$executionID]->{$extendField->field});
$message = $this->checkFlowRule($extendField, $executions[$executionID]->{$extendField->field});
if($message) die(js::alert($message));
}
}
if(dao::isError()) die(js::error(dao::getError()));
@@ -717,7 +728,7 @@ class executionModel extends model
->setDefault('lastEditedDate', $now)
->remove('comment')
->get();
$this->dao->update(TABLE_EXECUTION)->data($execution)
->autoCheck()
->check($this->config->execution->start->requiredFields, 'notempty')
@@ -727,7 +738,7 @@ class executionModel extends model
/* When it has multiple errors, only the first one is prompted */
if(dao::isError() and count(dao::$errors['realBegan']) > 1) dao::$errors['realBegan'] = dao::$errors['realBegan'][0];
if(!dao::isError()) return common::createChanges($oldExecution, $execution);
}
@@ -866,7 +877,7 @@ class executionModel extends model
{
$oldExecution = $this->getById($executionID);
$now = helper::now();
$execution = fixer::input('post')
->setDefault('status', 'closed')
->setDefault('closedBy', $this->app->user->account)
@@ -875,7 +886,7 @@ class executionModel extends model
->setDefault('lastEditedDate', $now)
->remove('comment')
->get();
$this->lang->error->ge = $this->lang->execution->ge;
$this->dao->update(TABLE_EXECUTION)->data($execution)
+5
View File
@@ -66,6 +66,10 @@
<th class='c-desc <?php echo zget($visibleFields, 'desc', ' hidden') . zget($requiredFields, 'desc', '', ' required');?>'><?php echo $lang->execution->$desc;?></th>
<th class='c-team-name <?php echo zget($visibleFields, 'teamname', ' hidden') . zget($requiredFields, 'teamname', '', ' required');?>'><?php echo $lang->execution->teamname;?></th>
<th class='c-days<?php echo zget($visibleFields, 'days', ' hidden') . zget($requiredFields, 'days', '', ' required');?>'><?php echo $lang->execution->days;?></th>
<?php
$extendFields = $this->execution->getFlowExtendFields();
foreach($extendFields as $extendField) echo "<th class='c-extend'>{$extendField->name}</th>";
?>
</tr>
</thead>
<tbody>
@@ -110,6 +114,7 @@
<span class='input-group-addon'><?php echo $lang->execution->day;?></span>
</div>
</td>
<?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, $executions[$executionID], $extendField->field . "[{$executionID}]") . "</td>";?>
</tr>
<?php
if(isset($this->config->moreLinks["PMs[$executionID]"])) unset($this->config->moreLinks["PMs[$executionID]"]);
+11
View File
@@ -700,6 +700,7 @@ class productModel extends model
$oldProducts = $this->getByIdList($this->post->productIDList);
$nameList = array();
$extendFields = $this->getFlowExtendFields();
foreach($data->productIDList as $productID)
{
$productName = $data->names[$productID];
@@ -716,6 +717,16 @@ class productModel extends model
$products[$productID]->status = $data->statuses[$productID];
$products[$productID]->desc = strip_tags($this->post->descs[$productID], $this->config->allowedTags);
$products[$productID]->acl = $data->acls[$productID];
foreach($extendFields as $extendField)
{
$products[$productID]->{$extendField->field} = $this->post->{$extendField->field}[$productID];
if(is_array($products[$productID]->{$extendField->field})) $products[$productID]->{$extendField->field} = join(',', $products[$productID]->{$extendField->field});
$products[$productID]->{$extendField->field} = htmlSpecialString($products[$productID]->{$extendField->field});
$message = $this->checkFlowRule($extendField, $products[$productID]->{$extendField->field});
if($message) die(js::alert($message));
}
}
if(dao::isError()) die(js::error(dao::getError()));
+5
View File
@@ -64,6 +64,10 @@
<th class='c-status<?php echo zget($visibleFields, 'status', ' hidden') . zget($requiredFields, 'status', '', ' required');?>'><?php echo $lang->product->status;?></th>
<th class='c-desc<?php echo zget($visibleFields, 'desc', ' hidden') . zget($requiredFields, 'desc', '', ' required');?>'><?php echo $lang->product->desc;?></th>
<th class='c-acl<?php echo zget($visibleFields, 'acl', ' hidden');?>'><?php echo $lang->product->acl;?></th>
<?php
$extendFields = $this->product->getFlowExtendFields();
foreach($extendFields as $extendField) echo "<th class='c-extend'>{$extendField->name}</th>";
?>
</tr>
</thead>
<tbody>
@@ -92,6 +96,7 @@
<td class='<?php echo zget($visibleFields, 'status', 'hidden')?>'><?php echo html::select("statuses[$productID]", $lang->product->statusList, $products[$productID]->status, "class='form-control'");?></td>
<td class='<?php echo zget($visibleFields, 'desc', 'hidden')?>'><?php echo html::textarea("descs[$productID]", htmlSpecialString($products[$productID]->desc), "rows='1' class='form-control autosize'");?></td>
<td class='<?php echo zget($visibleFields, 'acl', 'hidden')?>'> <?php echo nl2br(html::radio("acls[$productID]", $lang->product->acls, $products[$productID]->acl));?></td>
<?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, $products[$productID], $extendField->field . "[{$productID}]") . "</td>";?>
</tr>
<?php
if(isset($this->config->moreLinks["POs[$productID]"])) unset($this->config->moreLinks["POs[$productID]"]);
+11
View File
@@ -485,6 +485,7 @@ class productplanModel extends model
$purifier = new HTMLPurifier($config);
$plans = array();
$extendFields = $this->getFlowExtendFields();
foreach($data->id as $planID)
{
$plan = new stdclass();
@@ -498,6 +499,16 @@ class productplanModel extends model
if(empty($plan->end)) die(js::alert(sprintf($this->lang->productplan->errorNoEnd, $planID)));
if($plan->begin > $plan->end) die(js::alert(sprintf($this->lang->productplan->beginGeEnd, $planID)));
foreach($extendFields as $extendField)
{
$plan->{$extendField->field} = $this->post->{$extendField->field}[$planID];
if(is_array($plan->{$extendField->field})) $plan->{$extendField->field} = join(',', $plan->{$extendField->field});
$plan->{$extendField->field} = htmlSpecialString($plan->{$extendField->field});
$message = $this->checkFlowRule($extendField, $plan->{$extendField->field});
if($message) die(js::alert($message));
}
$plans[$planID] = $plan;
}
@@ -26,6 +26,10 @@
<th class='c-full-date'><?php echo $lang->productplan->begin?></th>
<th class='c-full-date'><?php echo $lang->productplan->end?></th>
<th class='c-future'><?php echo $lang->productplan->future?></th>
<?php
$extendFields = $this->productplan->getFlowExtendFields();
foreach($extendFields as $extendField) echo "<th class='c-extend'>{$extendField->name}</th>";
?>
</tr>
</thead>
<tbody>
@@ -40,6 +44,7 @@
<td><?php echo html::input("begin[$plan->id]", $plan->begin, "class='form-control form-date $hiddenInput'");echo html::input("begin$plan->id", '', "class='form-control $showInput' disabled='disabled'");?></td>
<td><?php echo html::input("end[$plan->id]", $plan->end, "class='form-control form-date $hiddenInput'");echo html::input("end$plan->id", '', "class='form-control $showInput' disabled='disabled'");?></td>
<td><div class='checkbox-primary'><input type='checkbox' id="future<?php echo $plan->id; ?>" name='future<?php echo $plan->id; ?>' <?php echo $isChecked;?> onclick="changeDate(<?php echo $plan->id;?>);"/><label for='future<?php echo $plan->id; ?>'><?php echo $lang->productplan->future;?></label></div></td>
<?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, $plan, $extendField->field . "[{$plan->id}]") . "</td>";?>
</tr>
<?php endforeach;?>
</tbody>
+16 -4
View File
@@ -1096,6 +1096,7 @@ class projectModel extends model
$oldProjects = $this->getByIdList($this->post->projectIdList);
$nameList = array();
$extendFields = $this->getFlowExtendFields();
foreach($data->projectIdList as $projectID)
{
$projectID = (int)$projectID;
@@ -1126,7 +1127,18 @@ class projectModel extends model
}
}
foreach($extendFields as $extendField)
{
$projects[$projectID]->{$extendField->field} = $this->post->{$extendField->field}[$projectID];
if(is_array($projects[$projectID]->{$extendField->field})) $projects[$projectID]->{$extendField->field} = join(',', $projects[$projectID]->{$extendField->field});
$projects[$projectID]->{$extendField->field} = htmlSpecialString($projects[$projectID]->{$extendField->field});
$message = $this->checkFlowRule($extendField, $projects[$projectID]->{$extendField->field});
if($message) die(js::alert($message));
}
}
if(dao::isError()) die(js::error(dao::getError()));
foreach($projects as $projectID => $project)
{
@@ -1497,13 +1509,13 @@ class projectModel extends model
$class = "c-$id" . (in_array($id, array('budget', 'teamCount', 'estimate', 'consume')) ? ' c-number' : '');
if($id == 'id') $class .= ' cell-id';
if($id == 'code')
{
$class .= ' c-name';
$class .= ' c-name';
$title = "title={$project->code}";
}
}
if($id == 'name')
{
$class .= ' text-left';
+5
View File
@@ -30,6 +30,10 @@
<th class='c-date required'><?php echo $lang->project->begin;?></th>
<th class='c-date required'><?php echo $lang->project->end;?></th>
<th class='c-acl'><?php echo $lang->project->acl;?></th>
<?php
$extendFields = $this->project->getFlowExtendFields();
foreach($extendFields as $extendField) echo "<th class='c-extend'>{$extendField->name}</th>";
?>
</tr>
</thead>
<tbody>
@@ -56,6 +60,7 @@
?>
</td>
<td><?php echo nl2br(html::radio("acls[$projectID]", $aclList, $project->acl));?></td>
<?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, $project, $extendField->field . "[{$projectID}]") . "</td>";?>
</tr>
<?php endforeach;?>
</tbody>