Skip to content

Commit 99defaf

Browse files
committed
Merge remote-tracking branch 'origin/ref-2940' into ref-2940
2 parents 9085a10 + 30f22b3 commit 99defaf

File tree

11 files changed

+241
-38
lines changed

11 files changed

+241
-38
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ UPS shut down their old CGI APIs so we removed the support for it from the Mage_
283283
- `catalog/search/search_separator`
284284
- `dev/log/max_level`
285285
- `newsletter/security/enable_form_key`
286+
- `rss/admin_order/new_period`
286287
- `sitemap/category/lastmod`
287288
- `sitemap/page/lastmod`
288289
- `sitemap/product/lastmod`

app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,7 @@ protected function _prepareColumns()
291291
);
292292

293293
if (Mage::helper('catalog')->isModuleEnabled('Mage_Rss') &&
294-
Mage::helper('rss')->isRssEnabled() &&
295-
Mage::getStoreConfigFlag('rss/catalog/notifystock')
294+
Mage::helper('rss')->isRssAdminCatalogNotifyStockEnabled()
296295
) {
297296
$this->addRssList('rss/catalog/notifystock', Mage::helper('catalog')->__('Notify Low Stock RSS'));
298297
}

app/code/core/Mage/Adminhtml/Block/Review/Grid.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ protected function _prepareColumns()
189189
'ret' => (Mage::registry('usePendingFilter')) ? 'pending' : null
190190
]
191191
],
192-
'field' => 'id'
192+
'field' => 'id'
193193
]
194194
],
195195
'filter' => false,
@@ -198,8 +198,7 @@ protected function _prepareColumns()
198198
);
199199

200200
if (Mage::helper('catalog')->isModuleEnabled('Mage_Rss') &&
201-
Mage::helper('rss')->isRssEnabled() &&
202-
Mage::getStoreConfigFlag('rss/catalog/review')
201+
Mage::helper('rss')->isRssAdminCatalogReviewEnabled()
203202
) {
204203
$this->addRssList('rss/catalog/review', Mage::helper('catalog')->__('Pending Reviews RSS'));
205204
}

app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,15 @@ protected function _prepareColumns()
141141
);
142142
}
143143

144-
if (Mage::helper('catalog')->isModuleEnabled('Mage_Rss') &&
145-
Mage::helper('rss')->isRssEnabled() &&
146-
Mage::getStoreConfigFlag('rss/order/new')
147-
) {
148-
$this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
144+
if (Mage::helper('sales')->isModuleOutputEnabled('Mage_Rss')) {
145+
$filterString = $this->getParam($this->getVarNameFilter());
146+
$filter = Mage::helper('adminhtml')->prepareFilterString($filterString);
147+
$storeId = array_key_exists('store_id', $filter) ? $filter['store_id'] : null;
148+
149+
if (Mage::helper('rss')->isRssAdminOrderNewEnabled($storeId)) {
150+
$slug = $storeId ? '/store/' . $storeId : '';
151+
$this->addRssList('rss/order/new' . $slug, Mage::helper('sales')->__('New Order RSS'));
152+
}
149153
}
150154

151155
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));

app/code/core/Mage/Rss/Block/Order/New.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ protected function _construct()
4444
*/
4545
protected function _toHtml()
4646
{
47+
$storeId = $this->getRequest()->getParam('store');
4748
$order = Mage::getModel('sales/order');
49+
$period = Mage::helper('rss')->getRssAdminOrderNewPeriod($storeId);
4850
$passDate = $order->getResource()->formatDate(
49-
mktime(0, 0, 0, (int)date('m'), (int)date('d') - 7)
51+
mktime(0, 0, 0, (int)date('m'), (int)date('d') - $period)
5052
);
5153

5254
$newurl = Mage::helper('adminhtml')->getUrl('adminhtml/sales_order', ['_secure' => true, '_nosecret' => true]);
@@ -65,6 +67,10 @@ protected function _toHtml()
6567
->addAttributeToSort('created_at', 'desc')
6668
;
6769

70+
if ($storeId) {
71+
$collection->addAttributeToFilter('store_id', $storeId);
72+
}
73+
6874
$detailBlock = Mage::getBlockSingleton('rss/order_details');
6975

7076
Mage::dispatchEvent('rss_order_new_collection_select', ['collection' => $collection]);

app/code/core/Mage/Rss/Helper/Data.php

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ class Mage_Rss_Helper_Data extends Mage_Core_Helper_Abstract
2424
/**
2525
* Config path to RSS field
2626
*/
27-
public const XML_PATH_RSS_ACTIVE = 'rss/config/active';
27+
public const XML_PATH_RSS_ACTIVE = 'rss/config/active';
28+
public const XML_PATH_RSS_ADMIN_CATALOG_NOTIFYSTOCK = 'rss/admin_catalog/notifystock';
29+
public const XML_PATH_RSS_ADMIN_CATALOG_REVIEW = 'rss/admin_catalog/review';
30+
public const XML_PATH_RSS_ADMIN_ORDER_NEW = 'rss/admin_order/new';
31+
public const XML_PATH_RSS_ADMIN_ORDER_NEW_PERIOD = 'rss/admin_order/new_period';
2832

2933
protected $_moduleName = 'Mage_Rss';
3034

@@ -131,4 +135,30 @@ public function isRssEnabled()
131135
{
132136
return Mage::getStoreConfigFlag(self::XML_PATH_RSS_ACTIVE);
133137
}
138+
139+
public function isRssAdminCatalogNotifyStockEnabled(): bool
140+
{
141+
return $this->isRssEnabled() && Mage::getStoreConfigFlag(self::XML_PATH_RSS_ADMIN_CATALOG_NOTIFYSTOCK);
142+
}
143+
144+
public function isRssAdminCatalogReviewEnabled(): bool
145+
{
146+
return $this->isRssEnabled() && Mage::getStoreConfigFlag(self::XML_PATH_RSS_ADMIN_CATALOG_REVIEW);
147+
}
148+
149+
/**
150+
* @param null|string|bool|int|Mage_Core_Model_Store $store
151+
*/
152+
public function isRssAdminOrderNewEnabled($store = null): bool
153+
{
154+
return $this->isRssEnabled() && Mage::getStoreConfigFlag(self::XML_PATH_RSS_ADMIN_ORDER_NEW, $store);
155+
}
156+
157+
/**
158+
* @param null|string|bool|int|Mage_Core_Model_Store $store
159+
*/
160+
public function getRssAdminOrderNewPeriod($store = null): int
161+
{
162+
return (int)Mage::getStoreConfig(self::XML_PATH_RSS_ADMIN_ORDER_NEW_PERIOD, $store);
163+
}
134164
}

app/code/core/Mage/Rss/etc/config.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@
113113
</layout>
114114
</frontend>
115115
<default>
116+
<rss>
117+
<admin_order>
118+
<new_period>7</new_period>
119+
</admin_order>
120+
</rss>
116121
<validators>
117122
<custom_layout>
118123
<disallowed_block>

app/code/core/Mage/Rss/etc/system.xml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<show_in_website>1</show_in_website>
5151
<show_in_store>1</show_in_store>
5252
<fields>
53-
<active translate="label">
53+
<active translate="label">
5454
<label>Enable RSS</label>
5555
<frontend_type>select</frontend_type>
5656
<source_model>adminhtml/system_config_source_enabledisable</source_model>
@@ -140,7 +140,7 @@
140140
<show_in_website>1</show_in_website>
141141
<show_in_store>1</show_in_store>
142142
<fields>
143-
<status_notified translate="label comment">
143+
<status_notified translate="label comment">
144144
<label>Customer Order Status Notification</label>
145145
<comment>Enabling can increase security risk by exposing some order details.</comment>
146146
<frontend_type>select</frontend_type>
@@ -174,26 +174,20 @@
174174
<label>Admin Catalog</label>
175175
<sort_order>5</sort_order>
176176
<show_in_default>1</show_in_default>
177-
<show_in_website>1</show_in_website>
178-
<show_in_store>1</show_in_store>
179177
<fields>
180178
<review translate="label">
181179
<label>Review Notification</label>
182180
<frontend_type>select</frontend_type>
183181
<source_model>adminhtml/system_config_source_enabledisable</source_model>
184182
<sort_order>10</sort_order>
185183
<show_in_default>1</show_in_default>
186-
<show_in_website>1</show_in_website>
187-
<show_in_store>1</show_in_store>
188184
</review>
189185
<notifystock translate="label">
190186
<label>Stock Notification</label>
191187
<frontend_type>select</frontend_type>
192188
<source_model>adminhtml/system_config_source_enabledisable</source_model>
193189
<sort_order>20</sort_order>
194190
<show_in_default>1</show_in_default>
195-
<show_in_website>1</show_in_website>
196-
<show_in_store>1</show_in_store>
197191
</notifystock>
198192
</fields>
199193
</admin_catalog>
@@ -204,7 +198,7 @@
204198
<show_in_website>1</show_in_website>
205199
<show_in_store>1</show_in_store>
206200
<fields>
207-
<new translate="label">
201+
<new translate="label">
208202
<label>New Order Notification</label>
209203
<frontend_type>select</frontend_type>
210204
<source_model>adminhtml/system_config_source_enabledisable</source_model>
@@ -213,6 +207,16 @@
213207
<show_in_website>1</show_in_website>
214208
<show_in_store>1</show_in_store>
215209
</new>
210+
<new_period translate="label">
211+
<label>New Order Period (days)</label>
212+
<validate>validate-digits</validate>
213+
<sort_order>20</sort_order>
214+
<show_in_default>1</show_in_default>
215+
<show_in_website>1</show_in_website>
216+
<show_in_store>1</show_in_store>
217+
<depends><new>1</new></depends>
218+
<validate>required-entry validate-digits validate-greater-than-zero</validate>
219+
</new_period>
216220
</fields>
217221
</admin_order>
218222
</groups>

app/locale/en_US/Mage_Rss.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"Message:","Message:"
3030
"Miscellaneous Feeds","Miscellaneous Feeds"
3131
"New Order Notification","New Order Notification"
32+
"New Order Period (days)","New Order Period (days)"
3233
"New Orders","New Orders"
3334
"New Products","New Products"
3435
"New Products from %s","New Products from %s"

composer.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@
3232
"phpseclib/mcrypt_compat": "^2.0.3",
3333
"phpseclib/phpseclib": "^3.0.14",
3434
"shardj/zf1-future": "1.24.0",
35-
"symfony/polyfill-php74": "^1.29",
36-
"symfony/polyfill-php80": "^1.29",
37-
"symfony/polyfill-php81": "^1.29",
38-
"symfony/polyfill-php82": "^1.29"
35+
"symfony/polyfill-php74": "^1.31",
36+
"symfony/polyfill-php80": "^1.31",
37+
"symfony/polyfill-php81": "^1.31",
38+
"symfony/polyfill-php82": "^1.31",
39+
"symfony/polyfill-php83": "^1.31",
40+
"symfony/polyfill-php84": "^1.31"
3941
},
4042
"require-dev": {
4143
"ext-xmlreader": "*",

0 commit comments

Comments
 (0)