diff --git a/vendor/magento/module-company/Model/SaveValidator/SanitizeRegion.php b/vendor/magento/module-company/Model/SaveValidator/SanitizeRegion.php new file mode 100644 index 000000000000..4592ab614d06 --- /dev/null +++ b/vendor/magento/module-company/Model/SaveValidator/SanitizeRegion.php @@ -0,0 +1,53 @@ +company->getRegion(); + if (empty($region)) { + return; + } + + $sanitized = trim($this->stripTags->filter($region)); + $this->company->setRegion($sanitized); + } +} diff --git a/vendor/magento/module-company/Ui/Component/Form/Field/Company/Options.php b/vendor/magento/module-company/Ui/Component/Form/Field/Company/Options.php index 51abde37a55d..e884e112e6c0 100644 --- a/vendor/magento/module-company/Ui/Component/Form/Field/Company/Options.php +++ b/vendor/magento/module-company/Ui/Component/Form/Field/Company/Options.php @@ -106,7 +106,8 @@ private function formatItems(array $searchResult): array return [ 'label' => $company->getCompanyName(), 'value' => $company->getId(), - 'text' => sprintf('%s, %s', $company->getCountryId(), $region) + 'text' => sprintf('%s, %s', $company->getCountryId(), $region), + '__disableTmpl' => true ]; }, $searchResult); } diff --git a/vendor/magento/module-company/etc/di.xml b/vendor/magento/module-company/etc/di.xml index fc9922cba5a3..07fac4b356a5 100644 --- a/vendor/magento/module-company/etc/di.xml +++ b/vendor/magento/module-company/etc/di.xml @@ -48,6 +48,7 @@ \Magento\Company\Model\SaveValidator\CompanyId \Magento\Company\Model\SaveValidator\RequiredFields \Magento\Company\Model\SaveValidator\SanitizeCompanyName + \Magento\Company\Model\SaveValidator\SanitizeRegion \Magento\Company\Model\SaveValidator\SalesRepresentative \Magento\Company\Model\SaveValidator\CustomerGroup \Magento\Company\Model\SaveValidator\CompanyStatus diff --git a/vendor/magento/module-purchase-order-rule/Plugin/Customer/Authorization/ApproveRejectPurchaseOrderPlugin.php b/vendor/magento/module-purchase-order-rule/Plugin/Customer/Authorization/ApproveRejectPurchaseOrderPlugin.php index 9619bbb4f14b..a4681cf9dbfc 100644 --- a/vendor/magento/module-purchase-order-rule/Plugin/Customer/Authorization/ApproveRejectPurchaseOrderPlugin.php +++ b/vendor/magento/module-purchase-order-rule/Plugin/Customer/Authorization/ApproveRejectPurchaseOrderPlugin.php @@ -108,6 +108,7 @@ public function afterIsAllowed(ApproveRejectPurchaseOrder $subject, $result, $pu if ($companyId && $this->companyAdminPermission->isGivenUserCompanyAdmin($customerId, $companyId) && $this->companyStructure->getAllowedChildrenIds((int)$customerId) + && (int) $purchaseOrder->getCompanyId() === $companyId ) { return true; } diff --git a/vendor/magento/module-purchase-order-rule/Plugin/Customer/Authorization/ViewPurchaseOrderPlugin.php b/vendor/magento/module-purchase-order-rule/Plugin/Customer/Authorization/ViewPurchaseOrderPlugin.php index 69338e182644..6e7b7ffd6045 100644 --- a/vendor/magento/module-purchase-order-rule/Plugin/Customer/Authorization/ViewPurchaseOrderPlugin.php +++ b/vendor/magento/module-purchase-order-rule/Plugin/Customer/Authorization/ViewPurchaseOrderPlugin.php @@ -112,6 +112,7 @@ public function afterIsAllowed(ViewPurchaseOrder $subject, $result, $purchaseOrd if ($companyId && $this->companyAdminPermission->isGivenUserCompanyAdmin($customerId, $companyId) && $this->companyStructure->getAllowedChildrenIds((int)$customerId) + && (int) $purchaseOrder->getCompanyId() === $companyId ) { return true; }