-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
14 changed files
with
836 additions
and
801 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
diff --git a/vendor/magento/module-company/Model/Company/Delete.php b/vendor/magento/module-company/Model/Company/Delete.php | ||
index d190977d5862..11cc2aa2175a 100644 | ||
--- a/vendor/magento/module-company/Model/Company/Delete.php | ||
+++ b/vendor/magento/module-company/Model/Company/Delete.php | ||
@@ -21,6 +21,8 @@ | ||
|
||
/** | ||
* Class for deleting a company entity. | ||
+ * | ||
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects) | ||
*/ | ||
class Delete | ||
{ | ||
@@ -150,6 +152,7 @@ private function detachCustomerFromCompany($customerId) | ||
$companyAttributes = $customer->getExtensionAttributes()->getCompanyAttributes(); | ||
$companyAttributes->setCompanyId($this->noCompanyId); | ||
$companyAttributes->setStatus(CompanyCustomerInterface::STATUS_INACTIVE); | ||
+ $customer->setData('ignore_validation_flag', true); | ||
$this->customerRepository->save($customer); | ||
} | ||
} | ||
diff --git a/vendor/magento/module-company/Model/CompanySuperUserGet.php b/vendor/magento/module-company/Model/CompanySuperUserGet.php | ||
index 6be15b5f7c16..40eec97aaa46 100644 | ||
--- a/vendor/magento/module-company/Model/CompanySuperUserGet.php | ||
+++ b/vendor/magento/module-company/Model/CompanySuperUserGet.php | ||
@@ -164,6 +164,7 @@ public function getUserForCompanyAdmin(array $data): CustomerInterface | ||
$companyAttributes->setStatus($customerStatus); | ||
} | ||
if ($customer->getId()) { | ||
+ $customer->setData('ignore_validation_flag', true); | ||
$customer = $this->customerRepository->save($customer); | ||
} else { | ||
if (!$customer->getCreatedIn()) { | ||
diff --git a/vendor/magento/module-company/Model/SaveHandler/CustomerGroup.php b/vendor/magento/module-company/Model/SaveHandler/CustomerGroup.php | ||
index a49470c67065..850bb7f8a3f5 100644 | ||
--- a/vendor/magento/module-company/Model/SaveHandler/CustomerGroup.php | ||
+++ b/vendor/magento/module-company/Model/SaveHandler/CustomerGroup.php | ||
@@ -39,7 +39,7 @@ public function __construct( | ||
} | ||
|
||
/** | ||
- * {@inheritdoc} | ||
+ * @inheritdoc | ||
* @throws \Magento\Framework\Exception\InputException | ||
* @throws \Magento\Framework\Exception\LocalizedException | ||
* @throws \Magento\Framework\Exception\State\InputMismatchException | ||
@@ -52,6 +52,7 @@ public function execute(CompanyInterface $company, CompanyInterface $initialComp | ||
foreach ($customerIds as $customerId) { | ||
$customer = $this->customerRepository->getById($customerId); | ||
$customer->setGroupId($company->getCustomerGroupId()); | ||
+ $customer->setData('ignore_validation_flag', true); | ||
$this->customerRepository->save($customer); | ||
} | ||
} | ||
diff --git a/vendor/magento/module-company/Model/SaveHandler/SuperUser.php b/vendor/magento/module-company/Model/SaveHandler/SuperUser.php | ||
index a510b3083b3b..74a9df1ef044 100644 | ||
--- a/vendor/magento/module-company/Model/SaveHandler/SuperUser.php | ||
+++ b/vendor/magento/module-company/Model/SaveHandler/SuperUser.php | ||
@@ -65,6 +65,7 @@ public function execute(CompanyInterface $company, CompanyInterface $initialComp | ||
$admin->getExtensionAttributes()->setCompanyAttributes($companyAttributes); | ||
} | ||
$admin->getExtensionAttributes()->getCompanyAttributes()->setCompanyId($company->getId()); | ||
+ $admin->setData('ignore_validation_flag', true); | ||
$this->customerRepository->save($admin); | ||
$initialAdmin = $initialCompany->getSuperUserId() | ||
? $this->customerRepository->getById($initialCompany->getSuperUserId()) : null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
diff --git a/vendor/magento/module-company/Block/Adminhtml/Customer/Edit/Tab/View/PersonalInfo.php b/vendor/magento/module-company/Block/Adminhtml/Customer/Edit/Tab/View/PersonalInfo.php | ||
index fe6ac9a1886e..3236510caf67 100644 | ||
--- a/vendor/magento/module-company/Block/Adminhtml/Customer/Edit/Tab/View/PersonalInfo.php | ||
+++ b/vendor/magento/module-company/Block/Adminhtml/Customer/Edit/Tab/View/PersonalInfo.php | ||
@@ -103,8 +103,8 @@ public function getJobTitle() | ||
public function getCustomerType() | ||
{ | ||
$customerType = CompanyCustomerInterface::TYPE_INDIVIDUAL_USER; | ||
- if ($this->getCustomerAttributes() && $this->getCustomerAttributes()->getCompanyId()) { | ||
- $company = $this->getCompany(); | ||
+ $company = $this->getCompany(); | ||
+ if ($company !== null) { | ||
$customer = $this->_backendSession->getCustomerData()['account']; | ||
$customerType = ($company->getSuperUserId() == $customer['id']) | ||
? CompanyCustomerInterface::TYPE_COMPANY_ADMIN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
diff --git a/vendor/magento/module-purchase-order/Plugin/Quote/ExpiredQuotesCollectionFilter.php b/vendor/magento/module-purchase-order/Plugin/Quote/ExpiredQuotesCollectionFilter.php | ||
new file mode 100644 | ||
index 0000000000..54510ebe51 | ||
--- /dev/null | ||
+++ b/vendor/magento/module-purchase-order/Plugin/Quote/ExpiredQuotesCollectionFilter.php | ||
@@ -0,0 +1,80 @@ | ||
+<?php | ||
+/** | ||
+ * Copyright 2024 Adobe | ||
+ * All Rights Reserved. | ||
+ */ | ||
+declare(strict_types=1); | ||
+ | ||
+namespace Magento\PurchaseOrder\Plugin\Quote; | ||
+ | ||
+use Magento\Framework\Exception\LocalizedException; | ||
+use Magento\Store\Api\Data\StoreInterface; | ||
+use Magento\Store\Api\WebsiteRepositoryInterface; | ||
+use Magento\PurchaseOrder\Model\Config; | ||
+use Magento\PurchaseOrder\Model\ResourceModel\PurchaseOrder as PurchaseOrderResource; | ||
+use Magento\Sales\Model\ResourceModel\Collection\ExpiredQuotesCollection; | ||
+use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; | ||
+ | ||
+/** | ||
+ * Plugin to filter out quotes used in purchase orders to prevent from deletion | ||
+ */ | ||
+class ExpiredQuotesCollectionFilter | ||
+{ | ||
+ /** | ||
+ * @var PurchaseOrderResource | ||
+ */ | ||
+ private $purchaseOrderResource; | ||
+ | ||
+ /** | ||
+ * @var Config | ||
+ */ | ||
+ private $config; | ||
+ | ||
+ /** | ||
+ * @var WebsiteRepositoryInterface | ||
+ */ | ||
+ private $websiteRepository; | ||
+ | ||
+ /** | ||
+ * @param PurchaseOrderResource $purchaseOrderResource | ||
+ * @param Config $config | ||
+ * @param WebsiteRepositoryInterface $websiteRepository | ||
+ */ | ||
+ public function __construct( | ||
+ PurchaseOrderResource $purchaseOrderResource, | ||
+ Config $config, | ||
+ WebsiteRepositoryInterface $websiteRepository | ||
+ ) { | ||
+ $this->purchaseOrderResource = $purchaseOrderResource; | ||
+ $this->config = $config; | ||
+ $this->websiteRepository = $websiteRepository; | ||
+ } | ||
+ | ||
+ /** | ||
+ * Add filter to the expired quotes collection | ||
+ * | ||
+ * @param ExpiredQuotesCollection $subject | ||
+ * @param AbstractCollection $result | ||
+ * @param StoreInterface $store | ||
+ * @return AbstractCollection | ||
+ * @throws LocalizedException | ||
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter) | ||
+ */ | ||
+ public function afterGetExpiredQuotes( | ||
+ ExpiredQuotesCollection $subject, | ||
+ AbstractCollection $result, | ||
+ StoreInterface $store | ||
+ ): AbstractCollection { | ||
+ $website = $this->websiteRepository->getById($store->getWebsiteId()); | ||
+ if ($this->config->isEnabledForWebsite($website)) { | ||
+ $result->getSelect()->joinLeft( | ||
+ ['po' => $this->purchaseOrderResource->getTable($this->purchaseOrderResource->getMainTable())], | ||
+ 'po.quote_id = main_table.entity_id', | ||
+ 'po.quote_id' | ||
+ ); | ||
+ $result->addFieldToFilter('po.entity_id', ['null' => true]); | ||
+ } | ||
+ | ||
+ return $result; | ||
+ } | ||
+} | ||
diff --git a/vendor/magento/module-purchase-order/etc/di.xml b/vendor/magento/module-purchase-order/etc/di.xml | ||
index acdc58579d..893e294d7b 100644 | ||
--- a/vendor/magento/module-purchase-order/etc/di.xml | ||
+++ b/vendor/magento/module-purchase-order/etc/di.xml | ||
@@ -316,4 +316,7 @@ | ||
<type name="Magento\AsyncOrder\Model\AsyncPaymentInformationCustomerPublisher"> | ||
<plugin name="company_user_po_permission_plugin" type="Magento\PurchaseOrder\Plugin\AsyncOrder\Model\PermissionCheckPlugin"/> | ||
</type> | ||
+ <type name="Magento\Sales\Model\ResourceModel\Collection\ExpiredQuotesCollection"> | ||
+ <plugin name="expiredQuotesCollectionFilter" type="Magento\PurchaseOrder\Plugin\Quote\ExpiredQuotesCollectionFilter"/> | ||
+ </type> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
diff --git a/vendor/magento/module-company-graph-ql/Model/Company/Users/Formatter.php b/vendor/magento/module-company-graph-ql/Model/Company/Users/Formatter.php | ||
index d24f6d6cbe..0091d6d69b 100644 | ||
--- a/vendor/magento/module-company-graph-ql/Model/Company/Users/Formatter.php | ||
+++ b/vendor/magento/module-company-graph-ql/Model/Company/Users/Formatter.php | ||
@@ -9,6 +9,7 @@ declare(strict_types=1); | ||
namespace Magento\CompanyGraphQl\Model\Company\Users; | ||
|
||
use Magento\Company\Api\Data\TeamInterface; | ||
+use Magento\Company\Api\RoleManagementInterface; | ||
use Magento\Company\Api\RoleRepositoryInterface; | ||
use Magento\Company\Model\Company\Structure; | ||
use Magento\Company\Model\UserRoleManagement; | ||
@@ -49,6 +50,11 @@ class Formatter | ||
*/ | ||
private $roleRepository; | ||
|
||
+ /** | ||
+ * @var RoleManagementInterface | ||
+ */ | ||
+ private $roleManagement; | ||
+ | ||
/** | ||
* @var Uid | ||
*/ | ||
@@ -60,6 +66,7 @@ class Formatter | ||
* @param Structure $structure | ||
* @param PermissionsFormatter $permissionsFormatter | ||
* @param RoleRepositoryInterface $roleRepository | ||
+ * @param RoleManagementInterface $roleManagement | ||
* @param Uid $idEncoder | ||
*/ | ||
public function __construct( | ||
@@ -68,6 +75,7 @@ class Formatter | ||
Structure $structure, | ||
PermissionsFormatter $permissionsFormatter, | ||
RoleRepositoryInterface $roleRepository, | ||
+ RoleManagementInterface $roleManagement, | ||
Uid $idEncoder | ||
) { | ||
$this->customerData = $customerData; | ||
@@ -75,6 +83,7 @@ class Formatter | ||
$this->permissionsFormatter = $permissionsFormatter; | ||
$this->structure = $structure; | ||
$this->roleRepository = $roleRepository; | ||
+ $this->roleManagement = $roleManagement; | ||
$this->idEncoder = $idEncoder; | ||
} | ||
|
||
@@ -108,7 +117,7 @@ class Formatter | ||
* Format user's role according to the GraphQL schema | ||
* | ||
* @param int $userId | ||
- * @return array | ||
+ * @return array|null | ||
*/ | ||
public function formatRole(int $userId): ?array | ||
{ | ||
@@ -118,13 +127,18 @@ class Formatter | ||
} | ||
|
||
$role = current($roles); | ||
+ $userCount = 1; | ||
|
||
try { | ||
- $role = $this->roleRepository->get($role->getId()); | ||
+ if ($this->roleManagement->getCompanyAdminRoleId() !== $role->getId()) { | ||
+ $role = $this->roleRepository->get($role->getId()); | ||
+ $userCount = count($this->userRoleManagement->getUsersByRoleId($role->getId())); | ||
+ } | ||
+ | ||
return [ | ||
'id' => $this->idEncoder->encode((string)$role->getId()), | ||
'name' => $role->getRoleName(), | ||
- 'users_count' => count($this->userRoleManagement->getUsersByRoleId($role->getId())), | ||
+ 'users_count' => $userCount, | ||
'permissions' => $this->permissionsFormatter->format($role) | ||
]; | ||
} catch (\Exception $e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
diff --git a/vendor/magento/module-multicoupon/Model/CouponManagement.php b/vendor/magento/module-multicoupon/Model/CouponManagement.php | ||
index 7f37d005afa..d9162e2a65f 100644 | ||
--- a/vendor/magento/module-multicoupon/Model/CouponManagement.php | ||
+++ b/vendor/magento/module-multicoupon/Model/CouponManagement.php | ||
@@ -151,8 +151,8 @@ class CouponManagement implements CouponManagementInterface | ||
} | ||
|
||
$invalidCouponCodes = array_diff( | ||
- $couponCodes, | ||
- array_values($this->validateCouponCode->execute($couponCodes, $customerId)) | ||
+ array_map('strtolower', $couponCodes), | ||
+ array_map('strtolower', array_values($this->validateCouponCode->execute($couponCodes, $customerId))) | ||
); | ||
|
||
if (!empty($invalidCouponCodes)) { | ||
diff --git a/vendor/magento/module-multicoupon-ui/Plugin/AdminCreateOrderApplyCoupons.php b/vendor/magento/module-multicoupon-ui/Plugin/AdminCreateOrderApplyCoupons.php | ||
index dfe3eda9d4e..dfe583bcd0a 100644 | ||
--- a/vendor/magento/module-multicoupon-ui/Plugin/AdminCreateOrderApplyCoupons.php | ||
+++ b/vendor/magento/module-multicoupon-ui/Plugin/AdminCreateOrderApplyCoupons.php | ||
@@ -163,8 +163,8 @@ class AdminCreateOrderApplyCoupons | ||
} | ||
|
||
$invalidCouponCodes = array_diff( | ||
- [$appendCouponCode], | ||
- array_values($this->validateCouponCode->execute([$appendCouponCode], $customerId)) | ||
+ [strtolower($appendCouponCode)], | ||
+ array_map('strtolower', array_values($this->validateCouponCode->execute([$appendCouponCode], $customerId))) | ||
); | ||
if (!empty($invalidCouponCodes)) { | ||
return false; | ||
diff --git a/vendor/magento/module-multicoupon-ui/Plugin/AdminCreateOrderValidateCoupon.php b/vendor/magento/module-multicoupon-ui/Plugin/AdminCreateOrderValidateCoupon.php | ||
index 9aaceb9179d..d5f2e29febf 100644 | ||
--- a/vendor/magento/module-multicoupon-ui/Plugin/AdminCreateOrderValidateCoupon.php | ||
+++ b/vendor/magento/module-multicoupon-ui/Plugin/AdminCreateOrderValidateCoupon.php | ||
@@ -73,13 +73,13 @@ class AdminCreateOrderValidateCoupon | ||
return; | ||
} | ||
|
||
- if (in_array($code, $quote->getExtensionAttributes()->getCouponCodes())) { | ||
+ if (in_array(strtolower($code), array_map('strtolower', $quote->getExtensionAttributes()->getCouponCodes()))) { | ||
$this->messageManager->addSuccessMessage(__('The coupon code has been accepted.')); | ||
return; | ||
} | ||
|
||
if (count($quote->getExtensionAttributes()->getCouponCodes()) | ||
- >= $this->config->getMaximumNumberOfCoupons() | ||
+ > $this->config->getMaximumNumberOfCoupons() | ||
) { | ||
$this->messageManager->addErrorMessage( | ||
__('Maximum allowed number of applied coupons was exceeded.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
diff --git a/vendor/magento/module-sales/Model/Order/Email/Sender/CreditmemoSender.php b/vendor/magento/module-sales/Model/Order/Email/Sender/CreditmemoSender.php | ||
index 19dc62772513..22d5bc2b7a56 100644 | ||
--- a/vendor/magento/module-sales/Model/Order/Email/Sender/CreditmemoSender.php | ||
+++ b/vendor/magento/module-sales/Model/Order/Email/Sender/CreditmemoSender.php | ||
@@ -118,6 +118,7 @@ public function send(Creditmemo $creditmemo, $forceSyncMode = false) | ||
|
||
if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) { | ||
$order = $creditmemo->getOrder(); | ||
+ $paymentHTML = $this->getPaymentHtml($order); | ||
$this->appEmulation->startEnvironmentEmulation($order->getStoreId(), Area::AREA_FRONTEND, true); | ||
$transport = [ | ||
'order' => $order, | ||
@@ -126,7 +127,7 @@ public function send(Creditmemo $creditmemo, $forceSyncMode = false) | ||
'creditmemo_id' => $creditmemo->getId(), | ||
'comment' => $creditmemo->getCustomerNoteNotify() ? $creditmemo->getCustomerNote() : '', | ||
'billing' => $order->getBillingAddress(), | ||
- 'payment_html' => $this->getPaymentHtml($order), | ||
+ 'payment_html' => $paymentHTML, | ||
'store' => $order->getStore(), | ||
'formattedShippingAddress' => $this->getFormattedShippingAddress($order), | ||
'formattedBillingAddress' => $this->getFormattedBillingAddress($order), | ||
diff --git a/vendor/magento/module-sales/Model/Order/Email/Sender/InvoiceSender.php b/vendor/magento/module-sales/Model/Order/Email/Sender/InvoiceSender.php | ||
index d94e02816e26..d8afe6beba5e 100644 | ||
--- a/vendor/magento/module-sales/Model/Order/Email/Sender/InvoiceSender.php | ||
+++ b/vendor/magento/module-sales/Model/Order/Email/Sender/InvoiceSender.php | ||
@@ -125,6 +125,7 @@ public function send(Invoice $invoice, $forceSyncMode = false) | ||
$order->setBaseTaxAmount((float) $invoice->getBaseTaxAmount()); | ||
$order->setBaseShippingAmount((float) $invoice->getBaseShippingAmount()); | ||
} | ||
+ $paymentHTML = $this->getPaymentHtml($order); | ||
$this->appEmulation->startEnvironmentEmulation($order->getStoreId(), Area::AREA_FRONTEND, true); | ||
$transport = [ | ||
'order' => $order, | ||
@@ -133,7 +134,7 @@ public function send(Invoice $invoice, $forceSyncMode = false) | ||
'invoice_id' => $invoice->getId(), | ||
'comment' => $invoice->getCustomerNoteNotify() ? $invoice->getCustomerNote() : '', | ||
'billing' => $order->getBillingAddress(), | ||
- 'payment_html' => $this->getPaymentHtml($order), | ||
+ 'payment_html' => $paymentHTML, | ||
'store' => $order->getStore(), | ||
'formattedShippingAddress' => $this->getFormattedShippingAddress($order), | ||
'formattedBillingAddress' => $this->getFormattedBillingAddress($order), | ||
diff --git a/vendor/magento/module-sales/Model/Order/Email/Sender/ShipmentSender.php b/vendor/magento/module-sales/Model/Order/Email/Sender/ShipmentSender.php | ||
index ba6d65a40c65..78aaf1a696e9 100644 | ||
--- a/vendor/magento/module-sales/Model/Order/Email/Sender/ShipmentSender.php | ||
+++ b/vendor/magento/module-sales/Model/Order/Email/Sender/ShipmentSender.php | ||
@@ -120,6 +120,7 @@ public function send(Shipment $shipment, $forceSyncMode = false) | ||
if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) { | ||
$order = $shipment->getOrder(); | ||
$this->identityContainer->setStore($order->getStore()); | ||
+ $paymentHTML = $this->getPaymentHtml($order); | ||
$this->appEmulation->startEnvironmentEmulation($order->getStoreId(), Area::AREA_FRONTEND, true); | ||
$transport = [ | ||
'order' => $order, | ||
@@ -128,7 +129,7 @@ public function send(Shipment $shipment, $forceSyncMode = false) | ||
'shipment_id' => $shipment->getId(), | ||
'comment' => $shipment->getCustomerNoteNotify() ? $shipment->getCustomerNote() : '', | ||
'billing' => $order->getBillingAddress(), | ||
- 'payment_html' => $this->getPaymentHtml($order), | ||
+ 'payment_html' => $paymentHTML, | ||
'store' => $order->getStore(), | ||
'formattedShippingAddress' => $this->getFormattedShippingAddress($order), | ||
'formattedBillingAddress' => $this->getFormattedBillingAddress($order), |
Oops, something went wrong.