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); }