* [task#127527,done,2h] fix product ID error.
This commit is contained in:
@@ -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
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user