当用户添加查询时,它应该如何工作,它必须将it_queries表中的query_type字段更改为OPEN,当IT部门查看查询时,它们会对其进行回复/评论,并且必须将query_type字段从OPEN更改为PENDING然后最后,当用户得到帮助/协助时,他们应该能够使用复选框将查询标记为已关闭,然后将状态从PENDING更改为CLOSE。
不确定它们是否是在添加视图中设置常量并在表格中插入的方法。
显然我正在学习,有人可以指导我必须采取的步骤。
以下是我为用户添加it_query的代码
<?php echo $this->Form->create('ItQuery'); ?>
<fieldset>
<legend><?php echo __('Add It Query'); ?></legend>
<?php
echo $this->Form->hidden('hr_employee_id',array('value'=>$loggedInId));
echo $this->Form->input('it_query_type_id');
echo $this->Form->input('comment');
echo $this->Form->hidden('status_type', array('value'=>OPEN));
?>
</fieldset>
<?php echo $this->Form->end(__('Submit')); ?>
以下是我对IT部门的评论的代码
<?php echo $this->Form->create('ItQueryComment'); ?>
<?php echo __('Add It Query Comment'); ?>
<?php
echo $this->Form->input('it_query_id');
echo $this->Form->input('comment');
echo $this->Form->input('close_query');
?>
<?php echo $this->Form->end(__('Submit')); ?>
以下是我的ItQueryComments的代码
public function add() {
if ($this->request->is('post')) {
$this->ItQueryComment->create();
if ($this->ItQueryComment->save($this->request->data)) {
$this->Session->setFlash(__('The it query comment has been saved'));
$this->redirect(array('controller' => 'it_queries','action' => 'view', $this->request->data['ItQueryComment']['it_query_id']));
} else {
$this->Session->setFlash(__('The it query comment could not be saved. Please, try again.'));
}
}
$itQueries = $this->ItQueryComment->ItQuery->find('list');
$hrEmployees = $this->ItQueryComment->HrEmployee->find('list');
$this->set(compact('itQueries', 'hrEmployees'));
}
答案 0 :(得分:0)
在保存特定Itquery的注释时,在向数据库添加注释后,在注释控制器的添加功能中使用$ this-&gt; getLastInsertID();获取其ID 并为Itquery Model调用函数updateAll,并将该特定Query的状态更改为“Pending”。