* code for task #8496.

This commit is contained in:
z
2020-11-24 15:38:21 +08:00
parent 3c7da6dc60
commit bef3194549
7 changed files with 52 additions and 23 deletions
+23 -8
View File
@@ -145,8 +145,11 @@ class programModel extends model
}
/* Redefines the language entries for the fields in the project table. */
$this->lang->project->code = $this->lang->program->PGMCode;
$this->lang->project->name = $this->lang->program->PGMName;
foreach(explode(',', $this->config->program->PGMCreate->requiredFields) as $fieldName)
{
$fieldKey = 'PGM' . ucfirst($fieldName);
if(isset($this->lang->program->$fieldKey)) $this->lang->project->$fieldName = $this->lang->program->$fieldKey;
}
$program = $this->loadModel('file')->processImgURL($program, $this->config->program->editor->pgmcreate['id'], $this->post->uid);
$this->dao->insert(TABLE_PROGRAM)->data($program)
@@ -246,8 +249,12 @@ class programModel extends model
if(dao::isError()) return false;
/* Redefines the language entries for the fields in the project table. */
$this->lang->project->code = $this->lang->program->PGMCode;
$this->lang->project->name = $this->lang->program->PGMName;
foreach(explode(',', $this->config->program->PGMCreate->requiredFields) as $fieldName)
{
$fieldKey = 'PGM' . ucfirst($fieldName);
if(isset($this->lang->program->$fieldKey)) $this->lang->project->$fieldName = $this->lang->program->$fieldKey;
}
$this->dao->update(TABLE_PROGRAM)->data($program)
->autoCheck($skipFields = 'begin,end')
->batchcheck($this->config->program->PGMEdit->requiredFields, 'notempty')
@@ -1226,8 +1233,12 @@ class programModel extends model
if($this->post->delta == 999) $requiredFields = trim(str_replace(',end,', ',', ",{$requiredFields},"), ',');
/* Redefines the language entries for the fields in the project table. */
$this->lang->project->name = $this->lang->program->PRJName;
$this->lang->project->code = $this->lang->program->PRJCode;
foreach(explode(',', $requiredFields) as $fieldName)
{
$fieldKey = 'PRJ' . ucfirst($fieldName);
if(isset($this->lang->program->$fieldKey)) $this->lang->project->$fieldName = $this->lang->program->$fieldKey;
}
$project = $this->loadModel('file')->processImgURL($project, $this->config->program->editor->prjcreate['id'], $this->post->uid);
$this->dao->insert(TABLE_PROJECT)->data($project)
->autoCheck()
@@ -1361,8 +1372,12 @@ class programModel extends model
if($this->post->delta == 999) $requiredFields = trim(str_replace(',end,', ',', ",{$requiredFields},"), ',');
/* Redefines the language entries for the fields in the project table. */
$this->lang->project->name = $this->lang->program->PRJName;
$this->lang->project->code = $this->lang->program->PRJCode;
foreach(explode(',', $requiredFields) as $fieldName)
{
$fieldKey = 'PRJ' . ucfirst($fieldName);
if(isset($this->lang->program->$fieldKey)) $this->lang->project->$fieldName = $this->lang->program->$fieldKey;
}
$this->dao->update(TABLE_PROJECT)->data($project)
->autoCheck($skipFields = 'begin,end')
->batchcheck($requiredFields, 'notempty')
+4 -3
View File
@@ -34,6 +34,7 @@
<?php js::set('weekend', $config->project->weekend);?>
<?php js::set('holders', $lang->project->placeholder);?>
<?php js::set('errorSameProducts', $lang->project->errorSameProducts);?>
<?php $requiredFields = $config->program->PGMCreate->requiredFields;?>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
@@ -57,7 +58,7 @@
</tr>
<tr>
<th><?php echo $lang->program->PGMPM;?></th>
<td><?php echo html::select('PM', $pmUsers, '', "class='form-control chosen'");?></td>
<td><?php echo html::select('PM', $pmUsers, '', "class='form-control chosen'" . (strpos($requiredFields, 'PM') !== false ? ' required' : ''));?></td>
</tr>
<tr>
<th><?php echo $lang->program->PO;?></th>
@@ -67,7 +68,7 @@
<th><?php echo $lang->program->PGMBudget;?></th>
<td>
<div class='input-group'>
<?php echo html::input('budget', '', "class='form-control'");?>
<?php echo html::input('budget', '', "class='form-control'" . (strpos($requiredFields, 'budget') !== false ? ' required' : ''));?>
<span class='input-group-addon'></span>
<?php echo html::select('budgetUnit', $lang->program->unitList, empty($parentProgram->budgetUnit) ? 'yuan' : $parentProgram->budgetUnit, "class='form-control'");?>
</div>
@@ -97,7 +98,7 @@
<th><?php echo $lang->program->PGMDesc;?></th>
<td colspan='3'>
<?php echo $this->fetch('user', 'ajaxPrintTemplates', 'type=project&link=desc');?>
<?php echo html::textarea('desc', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?>
<?php echo html::textarea('desc', '', "rows='6' class='form-control kindeditor' hidefocus='true'" . (strpos($requiredFields, 'desc') !== false ? ' required' : ''));?>
</td>
</tr>
<tr>
+4 -3
View File
@@ -14,6 +14,7 @@
<?php include '../../common/view/kindeditor.html.php';?>
<?php js::set('weekend', $config->project->weekend);?>
<?php $aclList = $program->parent ? $lang->program->subPGMAclList : $lang->program->PGMAclList;?>
<?php $requiredFields = $config->program->PGMEdit->requiredFields;?>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
@@ -36,7 +37,7 @@
</tr>
<tr>
<th><?php echo $lang->program->PGMPM;?></th>
<td><?php echo html::select('PM', $pmUsers, $program->PM, "class='form-control chosen'");?></td>
<td><?php echo html::select('PM', $pmUsers, $program->PM, "class='form-control chosen'" . (strpos($requiredFields, 'PM') !== false ? ' required' : ''));?></td>
</tr>
<tr>
<th><?php echo $lang->program->PO;?></th>
@@ -44,7 +45,7 @@
</tr>
<tr>
<th><?php echo $lang->program->PGMBudget;?></th>
<td><?php echo html::input('budget', $program->budget, "class='form-control'");?></td>
<td><?php echo html::input('budget', $program->budget, "class='form-control'" . (strpos($requiredFields, 'budget') !== false ? ' required' : ''));?></td>
<td style='float:left'><?php echo html::select('budgetUnit', $lang->program->unitList, $program->budgetUnit, "class='form-control'");?></td><td></td>
</tr>
<tr>
@@ -68,7 +69,7 @@
<th><?php echo $lang->program->PGMDesc;?></th>
<td colspan='3'>
<?php echo $this->fetch('user', 'ajaxPrintTemplates', 'type=program&link=desc');?>
<?php echo html::textarea('desc', $program->desc, "rows='6' class='form-control kindeditor' hidefocus='true'");?>
<?php echo html::textarea('desc', $program->desc, "rows='6' class='form-control kindeditor' hidefocus='true'" . (strpos($requiredFields, 'desc') !== false ? ' required' : ''));?>
</td>
</tr>
<tr>
+4 -3
View File
@@ -45,6 +45,7 @@ else
<?php js::set('from', $from);?>
<?php js::set('weekend', $config->project->weekend);?>
<?php js::set('errorSameProducts', $lang->program->errorSameProducts);?>
<?php $requiredFields = $config->program->PRJCreate->requiredFields;?>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
@@ -120,13 +121,13 @@ else
</tr>
<tr>
<th><?php echo $lang->program->PRJPM;?></th>
<td><?php echo html::select('PM', $pmUsers, '', "class='form-control chosen'");?></td>
<td><?php echo html::select('PM', $pmUsers, '', "class='form-control chosen'" . (strpos($requiredFields, 'PM') !== false ? ' required' : ''));?></td>
</tr>
<tr>
<th><?php echo $lang->program->PRJBudget;?></th>
<td>
<div class='input-group'>
<?php echo html::input('budget', '', "class='form-control'");?>
<?php echo html::input('budget', '', "class='form-control'" . (strpos($requiredFields, 'budget') !== false ? ' required' : ''));?>
<span class='input-group-addon'></span>
<?php echo html::select('budgetUnit', $lang->program->unitList, empty($parentProgram->budgetUnit) ? 'yuan' : $parentProgram->budgetUnit, "class='form-control'");?>
</div>
@@ -160,7 +161,7 @@ else
<th><?php echo $lang->program->PRJDesc;?></th>
<td colspan='3'>
<?php echo $this->fetch('user', 'ajaxPrintTemplates', 'type=project&link=desc');?>
<?php echo html::textarea('desc', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?>
<?php echo html::textarea('desc', '', "rows='6' class='form-control kindeditor' hidefocus='true'" . (strpos($requiredFields, 'desc') !== false ? ' required' : ''));?>
</td>
</tr>
<tr>
+4 -3
View File
@@ -19,6 +19,7 @@
<?php js::set('projectID', $project->id);?>
<?php js::set('PGMChangeTips', $lang->program->PGMChangeTips);?>
<?php $aclList = $project->parent ? $lang->program->PGMPRJAclList : $lang->program->PRJAclList;?>
<?php $requiredFields = $config->program->PRJEdit->requiredFields;?>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
@@ -91,13 +92,13 @@
</tr>
<tr>
<th><?php echo $lang->program->PRJPM;?></th>
<td><?php echo html::select('PM', $PMUsers, $project->PM, "class='form-control chosen'");?></td>
<td><?php echo html::select('PM', $PMUsers, $project->PM, "class='form-control chosen'" . (strpos($requiredFields, 'PM') !== false ? ' required' : ''));?></td>
</tr>
<tr>
<th><?php echo $lang->program->PRJBudget;?></th>
<td>
<div class='input-group'>
<?php echo html::input('budget', $project->budget, "class='form-control'");?>
<?php echo html::input('budget', $project->budget, "class='form-control'" . (strpos($requiredFields, 'budget') !== false ? ' required' : ''));?>
<span class='input-group-addon'></span>
<?php echo html::select('budgetUnit', $lang->program->unitList, $project->budgetUnit, "class='form-control'");?>
</div>
@@ -136,7 +137,7 @@
<th><?php echo $lang->program->PRJDesc;?></th>
<td colspan='3'>
<?php echo $this->fetch('user', 'ajaxPrintTemplates', 'type=project&link=desc');?>
<?php echo html::textarea('desc', $project->desc, "rows='6' class='form-control kindeditor' hidefocus='true'");?>
<?php echo html::textarea('desc', $project->desc, "rows='6' class='form-control kindeditor' hidefocus='true'" . (strpos($requiredFields, 'desc') !== false ? ' required' : ''));?>
</td>
</tr>
<tr>