diff --git a/src/QUI/ERP/Products/Field/Field.php b/src/QUI/ERP/Products/Field/Field.php index df358494971694df1a5665164d1143caee0ad368..0f1c74b5fd4427a9dd96381eb8b1074f68cb99f3 100644 --- a/src/QUI/ERP/Products/Field/Field.php +++ b/src/QUI/ERP/Products/Field/Field.php @@ -124,6 +124,15 @@ abstract class Field extends QUI\QDOM implements QUI\ERP\Products\Interfaces\Fie */ protected $titles = []; + /** + * Current instance of a product + * optional and only needed at the runtime instance + * this is the product from which the field are + * + * @var null + */ + protected $Product = null; + /** * Model constructor. * @@ -1309,4 +1318,12 @@ public function hasViewPermission($User = null) return false; } + + /** + * @param $Product - Product instance + */ + public function setProduct($Product) + { + $this->Product = $Product; + } } diff --git a/src/QUI/ERP/Products/Field/Types/AttributeGroupFrontendView.php b/src/QUI/ERP/Products/Field/Types/AttributeGroupFrontendView.php index 62c406a23ce1b399e67e4d6e42e829fc49b08a31..c03110f8fd45cb274101f94bee6506163c459df6 100644 --- a/src/QUI/ERP/Products/Field/Types/AttributeGroupFrontendView.php +++ b/src/QUI/ERP/Products/Field/Types/AttributeGroupFrontendView.php @@ -3,7 +3,6 @@ namespace QUI\ERP\Products\Field\Types; use QUI; -use QUI\ERP\Accounting\Calc as ErpCalc; /** * Class AttributeGroupFrontendView @@ -27,6 +26,11 @@ public function create() return $this->notChangeableDisplay(); } + if ($this->Product + && $this->Product instanceof QUI\ERP\Products\Product\Types\Product) { + return $this->notChangeableDisplay(); + } + $current = QUI::getLocale()->getCurrent(); $id = $this->getId(); @@ -191,6 +195,6 @@ protected function notChangeableDisplay() $Engine->assign('valueText', $text); - return $Engine->fetch(\dirname(__FILE__).'/ProductAttributeListFrontendViewNotChangeable.html'); + return $Engine->fetch(\dirname(__FILE__).'/AttributeGroupFrontendViewNotChangeable.html'); } } diff --git a/src/QUI/ERP/Products/Field/Types/AttributeGroupFrontendViewNotChangeable.html b/src/QUI/ERP/Products/Field/Types/AttributeGroupFrontendViewNotChangeable.html new file mode 100644 index 0000000000000000000000000000000000000000..7d35ab2af6a77e180436b5bcd5fe56f5a2a3621a --- /dev/null +++ b/src/QUI/ERP/Products/Field/Types/AttributeGroupFrontendViewNotChangeable.html @@ -0,0 +1 @@ +{$valueText} diff --git a/src/QUI/ERP/Products/Field/UniqueField.php b/src/QUI/ERP/Products/Field/UniqueField.php index ec575841b72307d2f671666577e4f870fc2b4e23..8ecf6a69a7294d03b963638ca943230b5ef2c43f 100644 --- a/src/QUI/ERP/Products/Field/UniqueField.php +++ b/src/QUI/ERP/Products/Field/UniqueField.php @@ -148,6 +148,15 @@ class UniqueField implements QUI\ERP\Products\Interfaces\UniqueFieldInterface */ protected $parentFieldClass = ''; + /** + * Current instance of a product + * optional and only needed at the runtime instance + * this is the product from which the field are + * + * @var null + */ + protected $Product = null; + /** * Model constructor. * @@ -210,10 +219,16 @@ public function __construct($fieldId, $params = []) public function getView() { if (\defined('QUIQQER_BACKEND')) { - return $this->getBackendView(); + $View = $this->getBackendView(); + } else { + $View = $this->getFrontendView(); + } + + if ($this->Product) { + $View->setProduct($this->Product); } - return $this->getFrontendView(); + return $View; } /** @@ -683,4 +698,12 @@ public function showInDetails() { return $this->showInDetails; } + + /** + * @param $Product - Product instance + */ + public function setProduct($Product) + { + $this->Product = $Product; + } } diff --git a/src/QUI/ERP/Products/Product/Model.php b/src/QUI/ERP/Products/Product/Model.php index 56fdd2a3d3ca35539edf50d845bb8677129fcca9..a79b1471f0d0f46be7122f535d7f17099f149d83 100644 --- a/src/QUI/ERP/Products/Product/Model.php +++ b/src/QUI/ERP/Products/Product/Model.php @@ -170,6 +170,7 @@ public function __construct($pid, $product = []) try { $Field = Fields::getField($field['id']); + $Field->setProduct($this); $this->fields[$Field->getId()] = $Field; } catch (QUI\Exception $Exception) {