* [task#127527,done,2h] fix product ID error.

This commit is contained in:
tianshujie
2024-09-20 10:23:47 +08:00
committed by 刘刚
parent d8dc3b7d89
commit 584fb373ea
2 changed files with 20 additions and 3 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ class story extends control
/* Set menu. */
$this->story->replaceURLang($storyType);
$copyStoryID = $storyID;
list($productID, $objectID) = $this->storyZen->setMenuForCreate($productID, $objectID);
list($productID, $objectID) = $this->storyZen->setMenuForCreate($productID, $objectID, $extra);
if($productID == 0 && $objectID == 0) return $this->locate($this->createLink('product', 'create'));
if($productID == 0 && $objectID != 0) return $this->sendError($this->lang->execution->errorNoLinkedProducts, $this->createLink('execution', 'manageproducts', "executionID=$objectID"));
+19 -2
View File
@@ -18,10 +18,11 @@ class storyZen extends story
*
* @param int $productID
* @param int $objectID
* @param string $extra
* @access protected
* @return int[]
*/
protected function setMenuForCreate(int $productID, int $objectID): array
protected function setMenuForCreate(int $productID, int $objectID, string $extra = ''): array
{
/* Get product id according to the project id when lite vision todo transfer story */
if($this->config->vision == 'lite' && $productID == 0)
@@ -38,7 +39,23 @@ class storyZen extends story
}
/* Set menu by tab. */
if($this->app->tab == 'product') $this->product->setMenu($productID);
if($this->app->tab == 'product')
{
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
parse_str($extra, $output);
if(!empty($output['from']) && $output['from'] == 'global')
{
$product = $this->product->getById($productID);
if(!$product || $product->deleted || $product->shadow)
{
$newProduct = $this->product->getOrderedProducts('noclosed');
if(!empty($newProduct)) $productID = (int) key($newProduct);
}
}
$this->product->setMenu($productID);
}
if($this->app->tab == 'execution')
{
$this->execution->setMenu($objectID);