* fix bug#345.

This commit is contained in:
wangchunsheng
2012-09-01 05:53:57 +00:00
parent d3a15be3ea
commit 722b1ec24e
+13 -2
View File
@@ -86,7 +86,12 @@ class productplanModel extends model
public function create()
{
$plan = fixer::input('post')->stripTags('title')->get();
$this->dao->insert(TABLE_PRODUCTPLAN)->data($plan)->autoCheck()->batchCheck($this->config->productplan->create->requiredFields, 'notempty')->exec();
$this->dao->insert(TABLE_PRODUCTPLAN)
->data($plan)
->autoCheck()
->batchCheck($this->config->productplan->create->requiredFields, 'notempty')
->check('end', 'gt', $plan->begin)
->exec();
if(!dao::isError()) return $this->dao->lastInsertID();
}
@@ -101,7 +106,13 @@ class productplanModel extends model
{
$oldPlan = $this->getById($planID);
$plan = fixer::input('post')->stripTags('title')->get();
$this->dao->update(TABLE_PRODUCTPLAN)->data($plan)->autoCheck()->batchCheck($this->config->productplan->edit->requiredFields, 'notempty')->where('id')->eq((int)$planID)->exec();
$this->dao->update(TABLE_PRODUCTPLAN)
->data($plan)
->autoCheck()
->batchCheck($this->config->productplan->edit->requiredFields, 'notempty')
->check('end', 'gt', $plan->begin)
->where('id')->eq((int)$planID)
->exec();
if(!dao::isError()) return common::createChanges($oldPlan, $plan);
}