Skip to content

Commit

Permalink
Merge branch 'main' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
fballiano committed Jun 4, 2023
2 parents b844f34 + 820a805 commit a1a66eb
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 17 deletions.
1 change: 0 additions & 1 deletion app/code/core/Mage/Captcha/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
</failed_attempts_login>
<failed_attempts_ip translate="label">
<label>Number of Unsuccessful Attempts to Login per IP Address</label>
<frontend_type>text</frontend_type>
<sort_order>6</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Core/Model/Translate.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function getConfig($key)
* Loading data from module translation files
*
* @param string $moduleName
* @param string $files
* @param array $files
* @param bool $forceReload
* @return $this
*/
Expand Down Expand Up @@ -224,7 +224,7 @@ protected function _addData($data, $scope, $forceReload = false)
continue;
}
$key = $this->_prepareDataString($key);
$value = $this->_prepareDataString($value);
$value = $value === null ? '' : $this->_prepareDataString($value);
if ($scope && isset($this->_dataScope[$key]) && !$forceReload) {
/**
* Checking previos value
Expand Down
5 changes: 3 additions & 2 deletions app/code/core/Mage/Rule/Block/Editable.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ public function render(Varien_Data_Form_Element_Abstract $element)

$translate = Mage::getSingleton('core/translate_inline');

$html .= $translate->isAllowed() ? Mage::helper('core')->escapeHtml($valueName) :
Mage::helper('core')->escapeHtml(Mage::helper('core/string')->truncate($valueName, 33, '...'));
$html .= $translate->isAllowed()
? Mage::helper('core')->escapeHtml($valueName)
: Mage::helper('core')->escapeHtml(Mage::helper('core/string')->truncate($valueName, 100, '...'));

$html .= '</a><span class="element"> ' . $element->getElementHtml();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,68 @@
*/
class Mage_Sales_Model_Api2_Order_Comment_Rest_Admin_V1 extends Mage_Sales_Model_Api2_Order_Comment_Rest
{
/**
* Add comment to order
*
* @param array $data
* @return string
*/
protected function _create(array $data)
{
$orderId = $this->getRequest()->getParam(self::PARAM_ORDER_ID);
$order = $this->_loadOrderById($orderId);

$status = $data['status'] ?? false;
$comment = $data['comment'] ?? '';
$visibleOnFront = $data['is_visible_on_front'] ?? 0;
$notifyCustomer = array_key_exists('is_customer_notified', $data) ? $data['is_customer_notified'] : false;

$historyItem = $order->addStatusHistoryComment($comment, $status);
$historyItem->setIsCustomerNotified($notifyCustomer)
->setIsVisibleOnFront((int) $visibleOnFront)
->save();

try {
$oldStore = Mage::getDesign()->getStore();
$oldArea = Mage::getDesign()->getArea();

if ($notifyCustomer && $comment) {
Mage::getDesign()->setStore($order->getStoreId());
Mage::getDesign()->setArea('frontend');
}

$order->save();
$order->sendOrderUpdateEmail((bool) $notifyCustomer, $comment);

if ($notifyCustomer && $comment) {
Mage::getDesign()->setStore($oldStore);
Mage::getDesign()->setArea($oldArea);
}
} catch (Mage_Core_Exception $e) {
$this->_critical($e->getMessage(), self::RESOURCE_INTERNAL_ERROR);
} catch (Throwable $t) {
Mage::logException($t);
$this->_critical($t->getMessage(), self::RESOURCE_UNKNOWN_ERROR);
}

return $this->_getLocation($historyItem);
}

/**
* Retrieve order comment by id
*
* @return array
*/
protected function _retrieve()
{
$comment = Mage::getModel('sales/order_status_history')->load(
$this->getRequest()->getParam(self::PARAM_COMMENT_ID)
);

if (!$comment->getId()) {
$this->_critical(self::RESOURCE_NOT_FOUND);
}

return $comment->getData();
}
}
10 changes: 5 additions & 5 deletions app/code/core/Mage/Tax/Model/Resource/Calculation.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ class Mage_Tax_Model_Resource_Calculation extends Mage_Core_Model_Resource_Db_Ab
*
* @var array
*/
protected $_ratesCache = [];
protected $_ratesCache = [];

/**
* Primery key auto increment flag
*
* @var bool
*/
protected $_isPkAutoIncrement = false;
protected $_isPkAutoIncrement = false;

protected function _construct()
{
Expand Down Expand Up @@ -81,8 +81,8 @@ public function getRateInfo($request)
{
$rates = $this->_getRates($request);
return [
'process' => $this->getCalculationProcess($request, $rates),
'value' => $this->_calculateRate($rates)
'process' => $this->getCalculationProcess($request, $rates),
'value' => $this->_calculateRate($rates),
];
}

Expand Down Expand Up @@ -235,7 +235,7 @@ protected function _getRates($request)
$customerClassId = $request->getCustomerClassId();
$countryId = $request->getCountryId();
$regionId = $request->getRegionId();
$postcode = trim($request->getPostcode());
$postcode = trim((string)$request->getPostcode());

// Process productClassId as it can be array or usual value. Form best key for cache.
$productClassId = $request->getProductClassId();
Expand Down
4 changes: 2 additions & 2 deletions js/mage/adminhtml/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ VarienRulesForm.prototype = {
elem.value = str;
if (str=='') {
str = '...';
} else if (str.length>30) {
str = str.substr(0, 30)+'...';
} else if (str.length>100) {
str = str.substr(0, 100)+'...';
}
label.innerHTML = str.escapeHTML();
}
Expand Down
5 changes: 0 additions & 5 deletions phpstan.dist.baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2345,11 +2345,6 @@ parameters:
count: 1
path: app/code/core/Mage/Core/Model/Store.php

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

-
message: "#^Method Mage_Core_Model_Url\\:\\:getRequest\\(\\) should return Mage_Core_Controller_Request_Http but returns Zend_Controller_Request_Http\\.$#"
count: 1
Expand Down

0 comments on commit a1a66eb

Please sign in to comment.