From 722b1ec24e2a67a9f12cb69ec701baa44a6c235d Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Sat, 1 Sep 2012 05:53:57 +0000 Subject: [PATCH] * fix bug#345. --- module/productplan/model.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/module/productplan/model.php b/module/productplan/model.php index daceb3f9d2..d375a90251 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -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); }