From fc6c33c1af6244e2a38757193abd489551aebbd6 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Mon, 8 Apr 2024 16:28:32 +0800 Subject: [PATCH] * Fix bug of no-product project to link plans. --- lib/zin/wg/productsbox/v1.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/zin/wg/productsbox/v1.php b/lib/zin/wg/productsbox/v1.php index 8d7ce0e4fc..359517c8b9 100644 --- a/lib/zin/wg/productsbox/v1.php +++ b/lib/zin/wg/productsbox/v1.php @@ -168,10 +168,13 @@ class productsBox extends wg list($currentPlan, $productPlans, $project) = $this->prop(array('currentPlan', 'productPlans', 'project')); $planProductID = current(array_keys($productItems)); - $productsBox = array(); - $productsBox[] = !empty($project->hasProduct) ? div + $productPlans = isset($productPlans[$planProductID]) && isset($productPlans[$planProductID][0]) ? $productPlans[$planProductID][0] : array(); + if(empty($project->hasProduct) && empty($currentPlan) && !empty($productPlans)) $currentPlan = key($productPlans); + + $productsBox = array(); + $productsBox[] = div ( - set::className('productBox'), + set::className('productBox noProductBox'), formGroup ( set::width('1/2'), @@ -187,11 +190,6 @@ class productsBox extends wg formHidden("branch[{$planProductID}][0]", 0) ) ) - ) : div - ( - set::className('productBox'), - formHidden("products[{$planProductID}]", $planProductID), - formHidden("branch[{$planProductID}][0]", 0) ); return $productsBox;