Skip to content

Commit

Permalink
OM PR 4303
Browse files Browse the repository at this point in the history
  • Loading branch information
fballiano committed Nov 11, 2024
1 parent d8c480e commit 706473d
Show file tree
Hide file tree
Showing 210 changed files with 1,009 additions and 1,250 deletions.
55 changes: 0 additions & 55 deletions .phpstan.baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,6 @@ parameters:
count: 1
path: app/code/core/Mage/Adminhtml/Model/Giftmessage/Save.php

-
message: "#^Method Mage_Adminhtml_Model_Sales_Order_Create\\:\\:initFromOrderItem\\(\\) should return Mage_Sales_Model_Quote_Item\\|string but returns \\$this\\(Mage_Adminhtml_Model_Sales_Order_Create\\)\\.$#"
count: 2
path: app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php

-
message: "#^Variable \\$billingAddress might not be defined\\.$#"
count: 2
Expand Down Expand Up @@ -760,16 +755,6 @@ parameters:
count: 1
path: app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php

-
message: "#^Variable \\$_items might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php

-
message: "#^Variable \\$_items might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Bundle/Block/Sales/Order/Items/Renderer.php

-
message: "#^Call to an undefined method Mage_Catalog_Model_Product_Configuration_Item_Interface\\:\\:getQty\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -845,11 +830,6 @@ parameters:
count: 1
path: app/code/core/Mage/Bundle/Model/Resource/Price/Index.php

-
message: "#^Variable \\$_items might not be defined\\.$#"
count: 1
path: app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Abstract.php

-
message: "#^Argument of an invalid type string supplied for foreach, only iterables are supported\\.$#"
count: 1
Expand Down Expand Up @@ -1210,11 +1190,6 @@ parameters:
count: 1
path: app/code/core/Mage/Catalog/Model/Product/Indexer/Eav.php

-
message: "#^Method Mage_Catalog_Model_Product_Option\\:\\:groupFactory\\(\\) should return Mage_Catalog_Model_Product_Option_Type_Default but returns Mage_Core_Model_Abstract\\|false\\.$#"
count: 1
path: app/code/core/Mage/Catalog/Model/Product/Option.php

-
message: "#^Call to an undefined method Mage_Catalog_Model_Product_Configuration_Item_Option_Interface\\:\\:getId\\(\\)\\.$#"
count: 2
Expand Down Expand Up @@ -1830,11 +1805,6 @@ parameters:
count: 1
path: app/code/core/Mage/Core/Controller/Varien/Router/Admin.php

-
message: "#^Argument of an invalid type string supplied for foreach, only iterables are supported\\.$#"
count: 1
path: app/code/core/Mage/Core/Controller/Varien/Router/Standard.php

-
message: "#^Negated boolean expression is always true\\.$#"
count: 1
Expand Down Expand Up @@ -1935,11 +1905,6 @@ parameters:
count: 1
path: app/code/core/Mage/Core/Model/Design/Fallback.php

-
message: "#^Binary operation \"\\.\" between non\\-falsy\\-string and array results in an error\\.$#"
count: 1
path: app/code/core/Mage/Core/Model/Design/Package.php

-
message: "#^Property Mage_Core_Model_Design_Package\\:\\:\\$_store \\(int\\|Mage_Core_Model_Store\\|string\\) on left side of \\?\\? is not nullable\\.$#"
count: 1
Expand Down Expand Up @@ -2020,11 +1985,6 @@ parameters:
count: 1
path: app/code/core/Mage/Core/Model/Layout.php

-
message: "#^Method Mage_Core_Model_Layout_Update\\:\\:saveCache\\(\\) should return bool but returns Mage_Core_Model_App\\.$#"
count: 1
path: app/code/core/Mage/Core/Model/Layout/Update.php

-
message: "#^Call to an undefined method Mage_Core_Model_Resource_Type_Abstract\\:\\:getConnection\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -3830,16 +3790,6 @@ parameters:
count: 2
path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php

-
message: "#^Method Mage_Usa_Model_Shipping_Carrier_Dhl\\:\\:_doRequest\\(\\) should return Mage_Shipping_Model_Rate_Result\\|Varien_Object but empty return statement found\\.$#"
count: 1
path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php

-
message: "#^Method Mage_Usa_Model_Shipping_Carrier_Dhl\\:\\:_getQuotes\\(\\) should return Mage_Shipping_Model_Rate_Result but returns Varien_Object\\.$#"
count: 1
path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php

-
message: "#^Property Mage_Usa_Model_Shipping_Carrier_Dhl\\:\\:\\$_request \\(Mage_Shipping_Model_Rate_Request\\|null\\) does not accept Varien_Object\\.$#"
count: 1
Expand Down Expand Up @@ -3940,11 +3890,6 @@ parameters:
count: 2
path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php

-
message: "#^Method Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page\\:\\:drawText\\(\\) should return \\$this\\(Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page\\) but returns Zend_Pdf_Canvas_Interface\\.$#"
count: 1
path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/Page.php

-
message: "#^Call to an undefined method Zend_Pdf_Page\\:\\:drawLines\\(\\)\\.$#"
count: 5
Expand Down
6 changes: 3 additions & 3 deletions app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesedit.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://openmage.org)
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand All @@ -23,11 +23,11 @@ public function __construct()

$resources = Mage::getModel('api/roles')->getResourcesList();

$rules_set = Mage::getResourceModel('api/rules_collection')->getByRoles($rid)->load();
$rules = Mage::getResourceModel('api/rules_collection')->getByRoles($rid)->load();

$selrids = [];

foreach ($rules_set->getItems() as $item) {
foreach ($rules->getItems() as $item) {
if (array_key_exists(strtolower($item->getResource_id()), $resources)
&& $item->getApiPermission() == 'allow'
) {
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Adminhtml/Block/Api/Tab/Userroles.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ public function __construct()
->getCollection()
->load();

$user_roles = Mage::getModel('api/roles')
$userRoles = Mage::getModel('api/roles')
->getUsersCollection()
->setUserFilter($uid)
->load();

$this->setTemplate('api/userroles.phtml')
->assign('roles', $roles)
->assign('user_roles', $user_roles);
->assign('user_roles', $userRoles);
}
}
1 change: 0 additions & 1 deletion app/code/core/Mage/Adminhtml/Block/Cache/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ protected function _prepareColumns()
*
* @return string
*/
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassAfterLastUsed
public function decorateStatus($value, $row, $column, $isExport)
{
$class = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://openmage.org)
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://openmage.org)
* @copyright Copyright (c) 2024 Maho (https://mahocommerce.com)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
Expand Down Expand Up @@ -233,37 +233,37 @@ public function getOptionValues()
if ($option->getGroupByType() == Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT) {
$i = 0;
$itemCount = 0;
foreach ($option->getValues() as $_value) {
/** @var Mage_Catalog_Model_Product_Option_Value $_value */
foreach ($option->getValues() as $optionValue) {
/** @var Mage_Catalog_Model_Product_Option_Value $optionValue */
$value['optionValues'][$i] = [
'item_count' => max($itemCount, $_value->getOptionTypeId()),
'option_id' => $_value->getOptionId(),
'option_type_id' => $_value->getOptionTypeId(),
'title' => $this->escapeHtml($_value->getTitle()),
'item_count' => max($itemCount, $optionValue->getOptionTypeId()),
'option_id' => $optionValue->getOptionId(),
'option_type_id' => $optionValue->getOptionTypeId(),
'title' => $this->escapeHtml($optionValue->getTitle()),
'price' => ($showPrice)
? $this->getPriceValue($_value->getPrice(), $_value->getPriceType()) : '',
'price_type' => ($showPrice) ? $_value->getPriceType() : 0,
'sku' => $this->escapeHtml($_value->getSku()),
'sort_order' => $_value->getSortOrder(),
? $this->getPriceValue($optionValue->getPrice(), $optionValue->getPriceType()) : '',
'price_type' => ($showPrice) ? $optionValue->getPriceType() : 0,
'sku' => $this->escapeHtml($optionValue->getSku()),
'sort_order' => $optionValue->getSortOrder(),
];

if ($this->getProduct()->getStoreId() != '0') {
$value['optionValues'][$i]['checkboxScopeTitle'] = $this->getCheckboxScopeHtml(
$_value->getOptionId(),
$optionValue->getOptionId(),
'title',
is_null($_value->getStoreTitle()),
$_value->getOptionTypeId()
is_null($optionValue->getStoreTitle()),
$optionValue->getOptionTypeId()
);
$value['optionValues'][$i]['scopeTitleDisabled'] = is_null($_value->getStoreTitle())
$value['optionValues'][$i]['scopeTitleDisabled'] = is_null($optionValue->getStoreTitle())
? 'disabled' : null;
if ($scope == Mage_Core_Model_Store::PRICE_SCOPE_WEBSITE) {
$value['optionValues'][$i]['checkboxScopePrice'] = $this->getCheckboxScopeHtml(
$_value->getOptionId(),
$optionValue->getOptionId(),
'price',
is_null($_value->getstorePrice()),
$_value->getOptionTypeId()
is_null($optionValue->getstorePrice()),
$optionValue->getOptionTypeId()
);
$value['optionValues'][$i]['scopePriceDisabled'] = is_null($_value->getStorePrice())
$value['optionValues'][$i]['scopePriceDisabled'] = is_null($optionValue->getStorePrice())
? 'disabled' : null;
}
}
Expand Down Expand Up @@ -303,20 +303,20 @@ public function getOptionValues()
* @param string $id
* @param string $name
* @param bool $checked
* @param string $select_id
* @param string $selectId
* @return string
*/
public function getCheckboxScopeHtml($id, $name, $checked = true, $select_id = '-1')
public function getCheckboxScopeHtml($id, $name, $checked = true, $selectId = '-1')
{
$checkedHtml = '';
if ($checked) {
$checkedHtml = ' checked="checked"';
}
$selectNameHtml = '';
$selectIdHtml = '';
if ($select_id != '-1') {
$selectNameHtml = '[values][' . $select_id . ']';
$selectIdHtml = 'select_' . $select_id . '_';
if ($selectId != '-1') {
$selectNameHtml = '[values][' . $selectId . ']';
$selectIdHtml = 'select_' . $selectId . '_';
}
$checkbox = '<input type="checkbox" id="' . $this->getFieldId() . '_' . $id . '_' .
$selectIdHtml . $name . '_use_default" class="product-option-scope-checkbox" name="' .
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ public function usedDefault($attribute)
// special management for "label" and "position" since they're columns of the
// catalog_product_entity_media_gallery_value database table
if ($attributeCode == 'label' || $attributeCode == 'position') {
$media_gallery = $this->getDataObject()->getMediaGallery();
if (!count($media_gallery['images'])) {
$mediaGallery = $this->getDataObject()->getMediaGallery();
if (!count($mediaGallery['images'])) {
return true;
}
return $media_gallery['images'][0]["{$attributeCode}_use_default"];
return $mediaGallery['images'][0]["{$attributeCode}_use_default"];
}

$defaultValue = $this->getDataObject()->getAttributeDefaultValue($attributeCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,16 @@ function(v, elem){

$prefix = $form->getHtmlIdPrefix();
if ($sendEmail) {
$_disableStoreField = '';
$disableStoreField = '';
if (!$isSingleMode) {
$_disableStoreField = "$('{$prefix}sendemail_store_id').disabled=(''==this.value || '0'==this.value);";
$disableStoreField = "$('{$prefix}sendemail_store_id').disabled=(''==this.value || '0'==this.value);";
}
$sendEmail->setAfterElementHtml(
'<script type="text/javascript">'
. "
$('{$prefix}website_id').disableSendemail = function() {
$('{$prefix}sendemail').disabled = ('' == this.value || '0' == this.value);" .
$_disableStoreField
$disableStoreField
. "}.bind($('{$prefix}website_id'));
Event.observe('{$prefix}website_id', 'change', $('{$prefix}website_id').disableSendemail);
$('{$prefix}website_id').disableSendemail();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
*/
class Mage_Adminhtml_Block_Customer_Online_Grid_Renderer_Ip extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
/**
* @SuppressWarnings(PHPMD.ErrorControlOperator)
*/
#[\Override]
public function render(Varien_Object $row)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @category Mage
* @package Mage_Adminhtml
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://openmage.org)
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://openmage.org)
* @copyright Copyright (c) 2024 Maho (https://mahocommerce.com)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
Expand Down Expand Up @@ -83,12 +83,12 @@ public function __construct()

$resources = Mage::getModel('admin/roles')->getResourcesList();

$rules_set = Mage::getResourceModel('admin/rules_collection')->getByRoles($rid)->load();
$rules = Mage::getResourceModel('admin/rules_collection')->getByRoles($rid)->load();

$selrids = [];

/** @var Mage_Admin_Model_Rules $item */
foreach ($rules_set->getItems() as $item) {
foreach ($rules->getItems() as $item) {
$itemResourceId = $item->getResource_id();
if (array_key_exists(strtolower($itemResourceId), $resources)) {
if ($item->isAllowed()) {
Expand All @@ -98,7 +98,7 @@ public function __construct()
}
}

$resourcesPermissionsMap = $rules_set->getResourcesPermissionsArray();
$resourcesPermissionsMap = $rules->getResourcesPermissionsArray();
$undefinedResources = array_diff(array_keys($resources), array_keys($resourcesPermissionsMap));

foreach ($undefinedResources as $undefinedResourceId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ public function __construct()
->getCollection()
->load();

$user_roles = Mage::getModel('admin/roles')
$userRoles = Mage::getModel('admin/roles')
->getUsersCollection()
->setUserFilter($uid)
->load();

$this->setTemplate('permissions/userroles.phtml')
->assign('roles', $roles)
->assign('user_roles', $user_roles);
->assign('user_roles', $userRoles);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)

$element->setName($element->getName() . '[]');

$_monthsHtml = $element->setStyle('width:100px;')
$monthsHtml = $element->setStyle('width:100px;')
->setValues($_months)
->setValue($values[0] ?? null)
->getElementHtml();

$_daysHtml = $element->setStyle('width:50px;')
$daysHtml = $element->setStyle('width:50px;')
->setValues($_days)
->setValue($values[1] ?? null)
->getElementHtml();

return sprintf('%s %s', $_monthsHtml, $_daysHtml);
return sprintf('%s %s', $monthsHtml, $daysHtml);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ protected function _addOrderStatusFilter($collection, $filterData)
* @param Varien_Object $filterData
* @return $this
*/
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassAfterLastUsed
protected function _addCustomFilter($collection, $filterData)
{
return $this;
Expand Down
Loading

0 comments on commit 706473d

Please sign in to comment.