Skip to content

Commit

Permalink
Merge branch 'OpenMage:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel authored May 28, 2024
2 parents d605609 + 1b86733 commit 10a44ec
Show file tree
Hide file tree
Showing 9 changed files with 779 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,31 @@ protected function _prepareColumns()
'filter_condition_callback' => [$this, '_addLinkModelFilterCallback']
]);

$this->addColumn('action', [
'header' => Mage::helper('catalog')->__('Action'),
'width' => '50px',
'type' => 'action',
'getter' => 'getId',
'actions' => [
[
'caption' => Mage::helper('catalog')->__('Edit'),
'id' => 'editlink',
'field' => 'id',
'onclick' => "popWin(this.href,'win','width=1000,height=700,resizable=1,scrollbars=1');return false;",
'url' => [
'base' => 'adminhtml/catalog_product/edit',
'params' => [
'store' => $this->getRequest()->getParam('store'),
'popup' => 1
],
],
],
],
'filter' => false,
'sortable' => false,
'index' => 'stores',
]);

return parent::_prepareColumns();
}

Expand Down
7 changes: 6 additions & 1 deletion app/code/core/Mage/Adminhtml/Block/Review/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,12 @@ protected function _prepareColumns()
]
);

$this->addRssList('rss/catalog/review', Mage::helper('catalog')->__('Pending Reviews RSS'));
if (Mage::helper('catalog')->isModuleEnabled('Mage_Rss') &&
Mage::helper('rss')->isRssEnabled() &&
Mage::getStoreConfigFlag('rss/catalog/review')
) {
$this->addRssList('rss/catalog/review', Mage::helper('catalog')->__('Pending Reviews RSS'));
}

return parent::_prepareColumns();
}
Expand Down
8 changes: 7 additions & 1 deletion app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,13 @@ protected function _prepareColumns()
]
);
}
$this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));

if (Mage::helper('catalog')->isModuleEnabled('Mage_Rss') &&
Mage::helper('rss')->isRssEnabled() &&
Mage::getStoreConfigFlag('rss/order/new')
) {
$this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
}

$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
Expand Down
1 change: 1 addition & 0 deletions app/code/core/Mage/Paypal/Model/Express/Checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,7 @@ protected function _prepareNewCustomerQuote()
$customer->setSuffix($quote->getCustomerSuffix());
$customer->setPassword($customer->decryptPassword($quote->getPasswordHash()));
$customer->setPasswordHash($customer->hashPassword($customer->getPassword()));
$customer->setPasswordCreatedAt(time());
$customer->save();
$quote->setCustomer($customer);
$quote->setPasswordHash('');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,13 @@ protected function _beforeSave()
if (!method_exists($sourceModel, 'toOptionArray')) {
Mage::throwException(Mage::helper('usa')->__('Method toOptionArray not found in source model.'));
}
$hasCorrectValue = false;
$value = $this->getValue();
foreach ($sourceModel->toOptionArray() as $allowedValue) {
if (isset($allowedValue['value']) && $allowedValue['value'] == $value) {
$hasCorrectValue = true;
break;
return $this;
}
}
if (!$hasCorrectValue) {
Mage::throwException(Mage::helper('usa')->__('Field "%s" has wrong value.', $this->_nameErrorField));
}
return $this;

Mage::throwException(Mage::helper('usa')->__('Field "%s" has wrong value.', $this->_nameErrorField));
}
}
2 changes: 1 addition & 1 deletion app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php
Original file line number Diff line number Diff line change
Expand Up @@ -2348,7 +2348,7 @@ protected function _parseRestResponse(string $rateResponse)
if (@$rateResponseData['RateResponse']['Response']['ResponseStatus']['Description'] === 'Success') {
$arr = $rateResponseData['RateResponse']['RatedShipment'] ?? [];
$allowedMethods = explode(",", $this->getConfigData('allowed_methods') ?? '');
$allowedCurrencies = Mage::app()->getStore()->getAvailableCurrencyCodes();
$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
foreach ($arr as $shipElement) {
$negotiatedArr = $shipElement['NegotiatedRateCharges'] ?? [] ;
$negotiatedActive = $this->getConfigFlag('negotiated_active')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,20 @@ public function toOptionArray()
{
$ups = Mage::getSingleton('usa/shipping_carrier_ups');
$arr = [];

// necessary after the add of Rest API
$origins = $ups->getCode('originShipment');
foreach ($origins as $origin) {
foreach ($origin as $k => $v) {
$arr[] = ['value' => $k, 'label' => Mage::helper('usa')->__($v)];
}
}

// old XML API codes
foreach ($ups->getCode('method') as $k => $v) {
$arr[] = ['value' => $k, 'label' => Mage::helper('usa')->__($v)];
}

return $arr;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
$upsModel = Mage::getSingleton('usa/shipping_carrier_ups');
$orShipArr = $upsModel->getCode('originShipment');
$defShipArr = $upsModel->getCode('method');

$allMethodsCodes = [];
foreach (Mage::getModel('usa/shipping_carrier_ups_source_method')->toOptionArray() as $method) {
$allMethodsCodes[]= $method['value'];
}
/** @var $this Mage_Adminhtml_Block_Template */
$sectionCode = $this->getRequest()->getParam('section');
$websiteCode = $this->getRequest()->getParam('website');
Expand All @@ -44,7 +47,7 @@ if (!$storeCode && $websiteCode) {
if (!in_array($storedOriginShipment, array_keys($orShipArr))) {
$storedOriginShipment = '';
}
if ($storedFreeShipment != '' && !in_array($storedFreeShipment, array_keys($defShipArr))) {
if ($storedFreeShipment != '' && !in_array($storedFreeShipment, $allMethodsCodes)) {
$storedFreeShipment = '';
}
if (!Mage::helper('usa')->validateUpsType($storedUpsType)) {
Expand Down
Loading

0 comments on commit 10a44ec

Please sign in to comment.