Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mage_Report: Migrated hardcoded cron expressions to configurable fields #1869

Merged
merged 14 commits into from
Jul 12, 2023
5 changes: 4 additions & 1 deletion app/code/core/Mage/Reports/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,16 @@
<ytd_start>1,1</ytd_start>
<mtd_start>1</mtd_start>
</dashboard>
<crontab>
<viewed_expr>0 0 * * *</viewed_expr>
</crontab>
</reports>
</default>
<crontab>
<jobs>
<aggregate_reports_report_product_viewed_data>
<schedule>
<cron_expr>0 0 * * *</cron_expr>
<config_path>reports/crontab/viewed_expr</config_path>
</schedule>
<run>
<model>reports/observer::aggregateReportsReportProductViewedData</model>
Expand Down
17 changes: 17 additions & 0 deletions app/code/core/Mage/Reports/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,23 @@
</mtd_start>
</fields>
</dashboard>
<crontab translate="label">
<label>Cron Settings</label>
<sort_order>3</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<fields>
<viewed_expr translate="label comment">
<label>Most Viewed</label>
<sort_order>800</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<comment>Most Viewed Products Report</comment>
</viewed_expr>
</fields>
</crontab>
</groups>
</reports>
</sections>
Expand Down
19 changes: 14 additions & 5 deletions app/code/core/Mage/Sales/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1703,6 +1703,15 @@
<dashboard>
<use_aggregated_data>0</use_aggregated_data>
</dashboard>
<reports>
<crontab>
<sales_expr>0 0 * * *</sales_expr>
<shipping_expr>0 0 * * *</shipping_expr>
<invoiced_expr>0 0 * * *</invoiced_expr>
<refunded_expr>0 0 * * *</refunded_expr>
<bestsellers_expr>0 0 * * *</bestsellers_expr>
</crontab>
</reports>
</default>
<crontab>
<jobs>
Expand All @@ -1716,39 +1725,39 @@
</sales_clean_quotes>
<aggregate_sales_report_order_data>
<schedule>
<cron_expr>0 0 * * *</cron_expr>
<config_path>reports/crontab/sales_expr</config_path>
</schedule>
<run>
<model>sales/observer::aggregateSalesReportOrderData</model>
</run>
</aggregate_sales_report_order_data>
<aggregate_sales_report_shipment_data>
<schedule>
<cron_expr>0 0 * * *</cron_expr>
<config_path>reports/crontab/shipping_expr</config_path>
</schedule>
<run>
<model>sales/observer::aggregateSalesReportShipmentData</model>
</run>
</aggregate_sales_report_shipment_data>
<aggregate_sales_report_invoiced_data>
<schedule>
<cron_expr>0 0 * * *</cron_expr>
<config_path>reports/crontab/invoiced_expr</config_path>
</schedule>
<run>
<model>sales/observer::aggregateSalesReportInvoicedData</model>
</run>
</aggregate_sales_report_invoiced_data>
<aggregate_sales_report_refunded_data>
<schedule>
<cron_expr>0 0 * * *</cron_expr>
<config_path>reports/crontab/refunded_expr</config_path>
</schedule>
<run>
<model>sales/observer::aggregateSalesReportRefundedData</model>
</run>
</aggregate_sales_report_refunded_data>
<aggregate_sales_report_bestsellers_data>
<schedule>
<cron_expr>0 0 * * *</cron_expr>
<config_path>reports/crontab/bestsellers_expr</config_path>
</schedule>
<run>
<model>sales/observer::aggregateSalesReportBestsellersData</model>
Expand Down
53 changes: 53 additions & 0 deletions app/code/core/Mage/Sales/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -819,5 +819,58 @@
</creditmemo>
</groups>
</sales_pdf>
<reports>
<groups>
<crontab>
<fields>
<sales_expr translate="label comment">
<label>Orders</label>
<frontend_type>text</frontend_type>
<sort_order>100</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<comment>Total Ordered Report</comment>
</sales_expr>
<shipping_expr translate="label comment">
<label>Shipping</label>
<frontend_type>text</frontend_type>
<sort_order>300</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<comment>Total Shipped Report</comment>
</shipping_expr>
<invoiced_expr translate="label comment">
<label>Total Invoiced</label>
<frontend_type>text</frontend_type>
<sort_order>400</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<comment>Total Invoiced VS Paid Report</comment>
</invoiced_expr>
<refunded_expr translate="label comment">
<label>Total Refunded</label>
<frontend_type>text</frontend_type>
<sort_order>500</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<comment>Total Refunded Report</comment>
</refunded_expr>
<bestsellers_expr translate="label comment">
<label>Bestsellers</label>
<frontend_type>text</frontend_type>
<sort_order>700</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<comment>Products Bestsellers Report</comment>
</bestsellers_expr>
</fields>
</crontab>
</groups>
</reports>
</sections>
</config>
7 changes: 6 additions & 1 deletion app/code/core/Mage/SalesRule/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
<jobs>
<aggregate_sales_report_coupons_data>
<schedule>
<cron_expr>0 0 * * *</cron_expr>
<config_path>reports/crontab/coupons_expr</config_path>
</schedule>
<run>
<model>salesrule/observer::aggregateSalesReportCouponsData</model>
Expand All @@ -218,5 +218,10 @@
<format>1</format>
</auto_generated_coupon_codes>
</promo>
<reports>
<crontab>
<coupons_expr>0 0 * * *</coupons_expr>
</crontab>
</reports>
</default>
</config>
17 changes: 17 additions & 0 deletions app/code/core/Mage/SalesRule/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,22 @@
</auto_generated_coupon_codes>
</groups>
</promo>
<reports>
<groups>
<crontab>
<fields>
<coupons_expr translate="label comment">
<label>Coupons</label>
<frontend_type>text</frontend_type>
<sort_order>600</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<comment>Promotion Coupons Usage Report</comment>
</coupons_expr>
</fields>
</crontab>
</groups>
</reports>
</sections>
</config>
7 changes: 6 additions & 1 deletion app/code/core/Mage/Tax/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,17 @@
<url>https://web.archive.org/web/20150315064836/https://www.magentocommerce.com/knowledge-base/entry/magento-ce-18-ee-113-tax-calc</url>
</notification>
</tax>
<reports>
<crontab>
<tax_expr>0 0 * * *</tax_expr>
</crontab>
</reports>
</default>
<crontab>
<jobs>
<aggregate_sales_report_tax_data>
<schedule>
<cron_expr>0 0 * * *</cron_expr>
<config_path>reports/crontab/tax_expr</config_path>
</schedule>
<run>
<model>tax/observer::aggregateSalesReportTaxData</model>
Expand Down
21 changes: 19 additions & 2 deletions app/code/core/Mage/Tax/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</full_summary>
<zero_tax translate="label">
<zero_tax translate="label">
<label>Display Zero Tax Subtotal</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
Expand Down Expand Up @@ -336,7 +336,7 @@
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</full_summary>
<zero_tax translate="label">
<zero_tax translate="label">
<label>Display Zero Tax Subtotal</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
Expand All @@ -349,5 +349,22 @@
</sales_display>
</groups>
</tax>
<reports>
<groups>
<crontab>
<fields>
<tax_expr translate="label comment">
<label>Tax</label>
<frontend_type>text</frontend_type>
<sort_order>200</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<comment>Order Taxes Report Grouped by Tax Rates</comment>
</tax_expr>
</fields>
</crontab>
</groups>
</reports>
</sections>
</config>