+ [task#132178,start,0.5h] add story version and save story version.
This commit is contained in:
@@ -51,3 +51,5 @@ DELETE FROM `zt_actionrecent` WHERE `objectType` = 'account';
|
||||
DELETE FROM `zt_config` WHERE `module` ='common' AND `section` = 'zentaoWebsite';
|
||||
ALTER TABLE `zt_review` ADD `toAuditBy` varchar(30) not NULL default '' AFTER `lastAuditedDate`;
|
||||
ALTER TABLE `zt_review` ADD `toAuditDate` datetime NULL AFTER `toAuditBy`;
|
||||
|
||||
ALTER TABLE `zt_design` ADD `storyVersion` smallint(6) UNSIGNED NOT NULL DEFAULT 0 AFTER `story`;
|
||||
|
||||
@@ -154,6 +154,9 @@ class design extends control
|
||||
->setDefault('createdBy', $this->app->user->account)
|
||||
->get();
|
||||
|
||||
$story = $this->loadModel('story')->getById($designData->story);
|
||||
if($story) $designData->storyVersion = $story->version;
|
||||
|
||||
$designID = $this->design->create($designData);
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
|
||||
@@ -263,6 +266,13 @@ class design extends control
|
||||
if($_POST)
|
||||
{
|
||||
$designData = form::data()->setDefault('editedBy', $this->app->user->account)->get();
|
||||
|
||||
if($design->story != $designData->story)
|
||||
{
|
||||
$story = $this->loadModel('story')->getById($designData->story);
|
||||
if($story) $designData->storyVersion = $story->version;
|
||||
}
|
||||
|
||||
$changes = $this->design->update($designID, $designData);
|
||||
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
|
||||
@@ -58,11 +58,15 @@ class designModel extends model
|
||||
public function batchCreate(int $projectID = 0, int $productID = 0, array $designs = array()): bool
|
||||
{
|
||||
$this->loadModel('action');
|
||||
|
||||
$stories = is_array($_POST['story']) ? $this->loadModel('story')->getByList($this->post->story) : array();
|
||||
|
||||
foreach($designs as $rowID => $design)
|
||||
{
|
||||
$design->product = $productID;
|
||||
$design->project = $projectID;
|
||||
$design->createdBy = $this->app->user->account;
|
||||
if(!empty($stories[$design->story])) $design->storyVersion = $stories[$design->story]->version;
|
||||
$this->dao->insert(TABLE_DESIGN)->data($design)->autoCheck()->batchCheck($this->config->design->batchcreate->requiredFields, 'notempty')->exec();
|
||||
|
||||
if(dao::isError())
|
||||
|
||||
Reference in New Issue
Block a user