Version Notes
1.9.2.0
Download this release
Release Info
Developer | Magento Core Team |
Extension | Mage_Core_Modules |
Version | 1.9.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.9.1.1 to 1.9.2.0
- RELEASE_NOTES.txt +11 -0
- api.php +12 -4
- app/Mage.php +4 -4
- app/bootstrap.php +34 -0
- app/code/core/Mage/Admin/Helper/Rules/Fallback.php +74 -0
- app/code/core/Mage/Admin/Model/Resource/Rules/Collection.php +14 -0
- app/code/core/Mage/Admin/Model/Rules.php +45 -3
- app/code/core/Mage/Admin/Model/User.php +8 -2
- app/code/core/Mage/Api/Model/Server/Adapter/Soap.php +35 -11
- app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php +14 -4
- app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php +14 -4
- app/code/core/Mage/Api2/Block/Adminhtml/Roles/Buttons.php +1 -1
- app/code/core/Mage/Api2/Model/Request/Interpreter/Json.php +6 -1
- app/code/core/Mage/Api2/controllers/Adminhtml/Api2/AttributeController.php +10 -0
- app/code/core/Mage/Authorizenet/Model/Directpost.php +1 -0
- app/code/core/Mage/Authorizenet/controllers/Directpost/PaymentController.php +4 -0
- app/code/core/Mage/Authorizenet/etc/system.xml +1 -1
- app/code/core/Mage/Backup/Model/Db.php +4 -1
- app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php +30 -10
- app/code/core/Mage/Bundle/Model/Selection.php +3 -3
- app/code/core/Mage/Bundle/controllers/Adminhtml/Bundle/SelectionController.php +9 -1
- app/code/core/Mage/Captcha/controllers/Adminhtml/RefreshController.php +10 -0
- app/code/core/Mage/Catalog/Helper/Product/Compare.php +70 -22
- app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php +50 -5
- app/code/core/Mage/Catalog/Model/Convert/Parser/Product.php +42 -5
- app/code/core/Mage/Catalog/Model/Observer.php +1 -1
- app/code/core/Mage/Catalog/Model/Product.php +17 -6
- app/code/core/Mage/Catalog/Model/Product/Compare/Item.php +13 -1
- app/code/core/Mage/Catalog/Model/Product/Status.php +28 -3
- app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php +9 -2
- app/code/core/Mage/Catalog/Model/Resource/Product.php +26 -0
- app/code/core/Mage/Catalog/Model/Resource/Product/Action.php +3 -0
- app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php +2 -2
- app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Source.php +1 -1
- app/code/core/Mage/Catalog/etc/config.xml +1 -1
- app/code/core/Mage/Catalog/etc/wsdl.xml +4 -0
- app/code/core/Mage/Catalog/etc/wsi.xml +4 -0
- app/code/core/Mage/Catalog/sql/catalog_setup/upgrade-1.6.0.0.19.1.1-1.6.0.0.19.1.2.php +34 -0
- app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api.php +4 -0
- app/code/core/Mage/CatalogRule/Model/Observer.php +58 -7
- app/code/core/Mage/CatalogRule/etc/config.xml +8 -0
- app/code/core/Mage/CatalogSearch/Block/Advanced/Form.php +1 -1
- app/code/core/Mage/CatalogSearch/Block/Autocomplete.php +8 -2
- app/code/core/Mage/CatalogSearch/Model/Query.php +1 -0
- app/code/core/Mage/CatalogSearch/etc/config.xml +1 -0
- app/code/core/Mage/CatalogSearch/etc/system.xml +9 -0
- app/code/core/Mage/Checkout/Block/Cart.php +10 -0
- app/code/core/Mage/Checkout/Block/Cart/Coupon.php +9 -0
- app/code/core/Mage/Checkout/Block/Cart/Shipping.php +20 -0
- app/code/core/Mage/Checkout/Block/Cart/Sidebar.php +21 -0
- app/code/core/Mage/Checkout/Block/Onepage/Billing.php +20 -2
- app/code/core/Mage/Checkout/Helper/Data.php +13 -13
- app/code/core/Mage/Checkout/Model/Type/Onepage.php +28 -0
- app/code/core/Mage/Checkout/controllers/CartController.php +1 -0
- app/code/core/Mage/Checkout/controllers/MultishippingController.php +24 -1
- app/code/core/Mage/Checkout/etc/jstranslator.xml +2 -2
- app/code/core/Mage/Cms/Block/Block.php +15 -0
- app/code/core/Mage/Cms/Block/Widget/Block.php +15 -0
- app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php +17 -4
- app/code/core/Mage/Cms/Model/Resource/Page.php +1 -1
- app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php +6 -3
- app/code/core/Mage/ConfigurableSwatches/Block/Catalog/Media/Js/Abstract.php +28 -6
- app/code/core/Mage/Connect/controllers/Adminhtml/Extension/LocalController.php +10 -0
- app/code/core/Mage/Contacts/controllers/IndexController.php +1 -1
- app/code/core/Mage/Core/Block/Abstract.php +10 -0
- app/code/core/Mage/Core/Controller/Front/Action.php +19 -0
- app/code/core/Mage/Core/Controller/Varien/Router/Admin.php +11 -0
- app/code/core/Mage/Core/Controller/Varien/Router/Standard.php +15 -1
- app/code/core/Mage/Core/Helper/Abstract.php +1 -1
- app/code/core/Mage/Core/Helper/Http.php +2 -2
- app/code/core/Mage/Core/Helper/Url.php +60 -0
- app/code/core/Mage/Core/Model/App.php +22 -6
- app/code/core/Mage/Core/Model/Email/Queue.php +0 -2
- app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php +1 -1
- app/code/core/Mage/Core/Model/Store.php +4 -4
- app/code/core/Mage/Core/Model/Translate/Inline.php +6 -6
- app/code/core/Mage/Core/Model/Url.php +6 -2
- app/code/core/Mage/Core/Model/Url/Rewrite/Request.php +6 -1
- app/code/core/Mage/Core/etc/config.xml +3 -0
- app/code/core/Mage/Core/etc/system.xml +23 -0
- app/code/core/Mage/Cron/Model/Observer.php +1 -0
- app/code/core/Mage/Cron/Model/Resource/Schedule/Collection.php +12 -0
- app/code/core/Mage/Customer/Block/Account/Dashboard/Info.php +4 -2
- app/code/core/Mage/Customer/Helper/Data.php +61 -0
- app/code/core/Mage/Customer/Model/Address/Abstract.php +1 -3
- app/code/core/Mage/Customer/Model/Customer.php +6 -3
- app/code/core/Mage/Customer/Model/Resource/Setup.php +2 -2
- app/code/core/Mage/Customer/controllers/AccountController.php +7 -2
- app/code/core/Mage/Customer/etc/config.xml +2 -2
- app/code/core/Mage/Customer/sql/customer_setup/upgrade-1.6.2.0.3-1.6.2.0.4.php +72 -0
- app/code/core/Mage/Dataflow/Model/Convert/Iterator.php +26 -17
- app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php +4 -0
- app/code/core/Mage/Directory/Model/Currency/Filter.php +1 -1
- app/code/core/Mage/Directory/data/directory_setup/data-upgrade-1.6.0.2-1.6.0.3.php +41 -0
- app/code/core/Mage/Directory/etc/config.xml +1 -1
- app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php +3 -6
- app/code/core/Mage/Downloadable/Helper/Data.php +17 -1
- app/code/core/Mage/Downloadable/Helper/Download.php +14 -4
- app/code/core/Mage/Downloadable/Model/Link/Api.php +2 -1
- app/code/core/Mage/Eav/Model/Entity/Abstract.php +22 -10
- app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php +4 -0
- app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php +2 -1
- app/code/core/Mage/Eav/Model/Resource/Entity/Attribute/Collection.php +4 -4
- app/code/core/Mage/GoogleAnalytics/Block/Ga.php +11 -1
- app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Edit.php +5 -5
- app/code/core/Mage/ImportExport/Model/Abstract.php +1 -1
- app/code/core/Mage/ImportExport/Model/Export/Adapter/Abstract.php +9 -0
- app/code/core/Mage/ImportExport/Model/Export/Adapter/Csv.php +15 -5
- app/code/core/Mage/ImportExport/Model/Import/Adapter/Abstract.php +9 -0
- app/code/core/Mage/ImportExport/Model/Import/Adapter/Csv.php +2 -4
- app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php +20 -7
- app/code/core/Mage/Install/Controller/Router/Install.php +39 -0
- app/code/core/Mage/Install/Model/Installer/Config.php +4 -9
- app/code/core/Mage/Install/controllers/WizardController.php +2 -0
- app/code/core/Mage/Install/etc/config.xml +23 -1
- app/code/core/Mage/Install/etc/install.xml +2 -0
- app/code/core/Mage/Log/Helper/Data.php +42 -0
- app/code/core/Mage/Log/Model/Adminhtml/System/Config/Source/Loglevel.php +81 -0
- app/code/core/Mage/Log/Model/Resource/Visitor.php +37 -8
- app/code/core/Mage/Log/Model/Resource/Visitor/Collection.php +8 -7
- app/code/core/Mage/Log/Model/Resource/Visitor/Online/Collection.php +4 -3
- app/code/core/Mage/Log/Model/Visitor.php +53 -23
- app/code/core/Mage/Log/etc/config.xml +8 -2
- app/code/core/Mage/Log/etc/system.xml +18 -8
- app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-1.6.1.0-1.6.1.1.php +76 -0
- app/code/core/Mage/Newsletter/Helper/Data.php +1 -0
- app/code/core/Mage/Newsletter/Model/Resource/Subscriber/Collection.php +24 -13
- app/code/core/Mage/Newsletter/Model/Subscriber.php +1 -1
- app/code/core/Mage/Newsletter/Model/Template.php +2 -2
- app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/AuthorizeController.php +10 -0
- app/code/core/Mage/Page/Block/Html/Topmenu.php +6 -5
- app/code/core/Mage/Page/Block/Html/Welcome.php +16 -11
- app/code/core/Mage/Paygate/Model/Authorizenet.php +57 -14
- app/code/core/Mage/Paygate/controllers/Adminhtml/Paygate/Authorizenet/PaymentController.php +10 -0
- app/code/core/Mage/Paygate/etc/config.xml +1 -0
- app/code/core/Mage/Paygate/etc/system.xml +28 -20
- app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Report.php +5 -2
- app/code/core/Mage/Paypal/Block/Express/Review/Billing.php +3 -0
- app/code/core/Mage/Paypal/controllers/Adminhtml/Paypal/ReportsController.php +2 -1
- app/code/core/Mage/Persistent/Model/Observer.php +13 -4
- app/code/core/Mage/Persistent/etc/persistent.xml +7 -1
- app/code/core/Mage/Poll/Model/Resource/Poll.php +3 -5
- app/code/core/Mage/Poll/etc/config.xml +1 -1
- app/code/core/Mage/Poll/sql/poll_setup/mysql4-upgrade-1.6.0.0-1.6.0.1.php +45 -0
- app/code/core/Mage/ProductAlert/Model/Email.php +5 -2
- app/code/core/Mage/ProductAlert/Model/Observer.php +6 -0
- app/code/core/Mage/Rating/etc/config.xml +1 -1
- app/code/core/Mage/Rating/sql/rating_setup/mysql4-upgrade-1.6.0.0-1.6.0.1.php +54 -0
- app/code/core/Mage/Reports/Helper/Data.php +14 -0
- app/code/core/Mage/Reports/Model/Event/Observer.php +53 -13
- app/code/core/Mage/Reports/Model/Product/Index/Abstract.php +9 -4
- app/code/core/Mage/Reports/Model/Resource/Customer/Collection.php +4 -4
- app/code/core/Mage/Reports/Model/Resource/Order/Collection.php +5 -1
- app/code/core/Mage/Reports/Model/Resource/Quote/Collection.php +22 -10
- app/code/core/Mage/Reports/Model/Resource/Review/Customer/Collection.php +30 -5
- app/code/core/Mage/Reports/etc/config.xml +3 -0
- app/code/core/Mage/Reports/etc/system.xml +20 -1
- app/code/core/Mage/Review/Block/Form.php +6 -2
- app/code/core/Mage/Rss/Helper/Data.php +27 -20
- app/code/core/Mage/Rss/controllers/CatalogController.php +3 -2
- app/code/core/Mage/Rss/controllers/OrderController.php +2 -1
- app/code/core/Mage/Rule/Block/Editable.php +10 -4
- app/code/core/Mage/Rule/Model/Condition/Abstract.php +71 -35
- app/code/core/Mage/Rule/Model/Condition/Product/Abstract.php +6 -2
- app/code/core/Mage/Rule/Model/Resource/Rule/Condition/SqlBuilder.php +17 -6
- app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/Grid.php +7 -0
- app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View.php +4 -3
- app/code/core/Mage/Sales/Block/Adminhtml/Customer/Edit/Tab/Agreement.php +6 -1
- app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View.php +7 -5
- app/code/core/Mage/Sales/Block/Billing/Agreements.php +1 -1
- app/code/core/Mage/Sales/Block/Order/Recent.php +29 -4
- app/code/core/Mage/Sales/Block/Recurring/Profile/View.php +16 -2
- app/code/core/Mage/Sales/Block/Widget/Guest/Form.php +1 -1
- app/code/core/Mage/Sales/Helper/Data.php +5 -0
- app/code/core/Mage/Sales/Model/Api2/Order.php +1 -0
- app/code/core/Mage/Sales/Model/Observer.php +18 -1
- app/code/core/Mage/Sales/Model/Order.php +9 -3
- app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Cost.php +1 -1
- app/code/core/Mage/Sales/Model/Order/Invoice.php +11 -1
- app/code/core/Mage/Sales/Model/Order/Invoice/Total/Cost.php +1 -1
- app/code/core/Mage/Sales/Model/Order/Item.php +6 -0
- app/code/core/Mage/Sales/Model/Quote/Item.php +3 -1
- app/code/core/Mage/Sales/Model/Resource/Billing/Agreement/Collection.php +14 -1
- app/code/core/Mage/Sales/Model/Resource/Order.php +8 -1
- app/code/core/Mage/Sales/Model/Resource/Order/Address.php +2 -1
- app/code/core/Mage/Sales/Model/Resource/Order/Collection.php +5 -0
- app/code/core/Mage/Sales/Model/Resource/Order/Creditmemo.php +11 -4
- app/code/core/Mage/Sales/Model/Resource/Order/Invoice.php +12 -5
- app/code/core/Mage/Sales/Model/Resource/Order/Shipment.php +11 -4
- app/code/core/Mage/Sales/Model/Resource/Quote.php +39 -16
- app/code/core/Mage/Sales/Model/Resource/Report/Bestsellers.php +67 -33
- app/code/core/Mage/Sales/Model/Resource/Report/Order/Createdat.php +3 -1
- app/code/core/Mage/Sales/Model/Service/Order.php +8 -3
- app/code/core/Mage/Sales/controllers/Recurring/ProfileController.php +2 -1
- app/code/core/Mage/Sales/etc/config.xml +1 -1
- app/code/core/Mage/Sales/sql/sales_setup/upgrade-1.6.0.8-1.6.0.9.php +40 -0
- app/code/core/Mage/Sendfriend/Block/Send.php +2 -1
- app/code/core/Mage/Sendfriend/etc/config.xml +1 -1
- app/code/core/Mage/Sendfriend/sql/sendfriend_setup/mysql4-upgrade-1.6.0.0-1.6.0.1.php +45 -0
- app/code/core/Mage/Tag/Block/Product/List.php +2 -1
- app/code/core/Mage/Tag/Model/Resource/Customer/Collection.php +1 -0
- app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract.php +11 -0
- app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php +33 -7
- app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php +7 -1
- app/code/core/Mage/Weee/Helper/Data.php +4 -2
- app/code/core/Mage/Widget/Block/Adminhtml/Widget/Chooser.php +2 -1
- app/code/core/Mage/Widget/controllers/Adminhtml/WidgetController.php +10 -0
- app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Column/Remove.php +5 -1
- app/code/core/Mage/Wishlist/controllers/IndexController.php +7 -2
- app/code/core/Zend/Date.php +199 -183
- app/code/core/Zend/Db/Select.php +1396 -0
- app/code/core/Zend/Mime.php +1 -1
- app/code/core/Zend/XmlRpc/Request.php +0 -442
- app/code/core/Zend/XmlRpc/Response.php +0 -254
- app/etc/local.xml.additional +50 -48
- app/etc/local.xml.template +6 -6
- cron.php +1 -0
- cron.sh +25 -0
- errors/processor.php +2 -2
- get.php +3 -2
- index.php.sample +1 -4
- install.php +1 -0
- package.xml +5 -5
RELEASE_NOTES.txt
CHANGED
@@ -1,3 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
3 |
] NOTE: Current Release Notes are maintained at: [
|
1 |
+
==== 1.9.2.0 ====
|
2 |
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
3 |
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
4 |
+
] NOTE: Current Release Notes are maintained at: [
|
5 |
+
] [
|
6 |
+
] http://merch.docs.magento.com/ce/user_guide/Magento_Community_Edition_User_Guide.html#magento/release-notes-ce-1.9.2.html [
|
7 |
+
] [
|
8 |
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
9 |
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
10 |
+
|
11 |
+
==== 1.9.1.0 ====
|
12 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
13 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
14 |
] NOTE: Current Release Notes are maintained at: [
|
api.php
CHANGED
@@ -28,14 +28,20 @@ if (version_compare(phpversion(), '5.2.0', '<')) {
|
|
28 |
echo 'It looks like you have an invalid PHP version. Magento supports PHP 5.2.0 or newer';
|
29 |
exit;
|
30 |
}
|
31 |
-
error_reporting(E_ALL | E_STRICT);
|
32 |
|
33 |
-
$
|
|
|
|
|
34 |
|
|
|
|
|
|
|
|
|
35 |
if (!file_exists($mageFilename)) {
|
36 |
echo 'Mage file not found';
|
37 |
exit;
|
38 |
}
|
|
|
39 |
require $mageFilename;
|
40 |
|
41 |
if (!Mage::isInstalled()) {
|
@@ -49,8 +55,6 @@ if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
|
|
49 |
|
50 |
#ini_set('display_errors', 1);
|
51 |
|
52 |
-
// emulate index.php entry point for correct URLs generation in API
|
53 |
-
Mage::register('custom_entry_point', true);
|
54 |
Mage::$headersSentThrowsException = false;
|
55 |
Mage::init('admin');
|
56 |
Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_GLOBAL, Mage_Core_Model_App_Area::PART_EVENTS);
|
@@ -61,6 +65,8 @@ $apiAlias = Mage::app()->getRequest()->getParam('type');
|
|
61 |
|
62 |
// check request could be processed by API2
|
63 |
if (in_array($apiAlias, Mage_Api2_Model_Server::getApiTypes())) {
|
|
|
|
|
64 |
/** @var $server Mage_Api2_Model_Server */
|
65 |
$server = Mage::getSingleton('api2/server');
|
66 |
|
@@ -76,6 +82,8 @@ if (in_array($apiAlias, Mage_Api2_Model_Server::getApiTypes())) {
|
|
76 |
}
|
77 |
try {
|
78 |
$server->initialize($adapterCode);
|
|
|
|
|
79 |
$server->run();
|
80 |
|
81 |
Mage::app()->getResponse()->sendResponse();
|
28 |
echo 'It looks like you have an invalid PHP version. Magento supports PHP 5.2.0 or newer';
|
29 |
exit;
|
30 |
}
|
|
|
31 |
|
32 |
+
$magentoRootDir = getcwd();
|
33 |
+
$bootstrapFilename = $magentoRootDir . '/app/bootstrap.php';
|
34 |
+
$mageFilename = $magentoRootDir . '/app/Mage.php';
|
35 |
|
36 |
+
if (!file_exists($bootstrapFilename)) {
|
37 |
+
echo 'Bootstrap file not found';
|
38 |
+
exit;
|
39 |
+
}
|
40 |
if (!file_exists($mageFilename)) {
|
41 |
echo 'Mage file not found';
|
42 |
exit;
|
43 |
}
|
44 |
+
require $bootstrapFilename;
|
45 |
require $mageFilename;
|
46 |
|
47 |
if (!Mage::isInstalled()) {
|
55 |
|
56 |
#ini_set('display_errors', 1);
|
57 |
|
|
|
|
|
58 |
Mage::$headersSentThrowsException = false;
|
59 |
Mage::init('admin');
|
60 |
Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_GLOBAL, Mage_Core_Model_App_Area::PART_EVENTS);
|
65 |
|
66 |
// check request could be processed by API2
|
67 |
if (in_array($apiAlias, Mage_Api2_Model_Server::getApiTypes())) {
|
68 |
+
// emulate index.php entry point for correct URLs generation in API
|
69 |
+
Mage::register('custom_entry_point', true);
|
70 |
/** @var $server Mage_Api2_Model_Server */
|
71 |
$server = Mage::getSingleton('api2/server');
|
72 |
|
82 |
}
|
83 |
try {
|
84 |
$server->initialize($adapterCode);
|
85 |
+
// emulate index.php entry point for correct URLs generation in API
|
86 |
+
Mage::register('custom_entry_point', true);
|
87 |
$server->run();
|
88 |
|
89 |
Mage::app()->getResponse()->sendResponse();
|
app/Mage.php
CHANGED
@@ -170,8 +170,8 @@ final class Mage
|
|
170 |
return array(
|
171 |
'major' => '1',
|
172 |
'minor' => '9',
|
173 |
-
'revision' => '
|
174 |
-
'patch' => '
|
175 |
'stability' => '',
|
176 |
'number' => '',
|
177 |
);
|
@@ -814,12 +814,12 @@ final class Mage
|
|
814 |
|
815 |
if (!is_dir($logDir)) {
|
816 |
mkdir($logDir);
|
817 |
-
chmod($logDir,
|
818 |
}
|
819 |
|
820 |
if (!file_exists($logFile)) {
|
821 |
file_put_contents($logFile, '');
|
822 |
-
chmod($logFile,
|
823 |
}
|
824 |
|
825 |
$format = '%timestamp% %priorityName% (%priority%): %message%' . PHP_EOL;
|
170 |
return array(
|
171 |
'major' => '1',
|
172 |
'minor' => '9',
|
173 |
+
'revision' => '2',
|
174 |
+
'patch' => '0',
|
175 |
'stability' => '',
|
176 |
'number' => '',
|
177 |
);
|
814 |
|
815 |
if (!is_dir($logDir)) {
|
816 |
mkdir($logDir);
|
817 |
+
chmod($logDir, 0750);
|
818 |
}
|
819 |
|
820 |
if (!file_exists($logFile)) {
|
821 |
file_put_contents($logFile, '');
|
822 |
+
chmod($logFile, 0640);
|
823 |
}
|
824 |
|
825 |
$format = '%timestamp% %priorityName% (%priority%): %message%' . PHP_EOL;
|
app/bootstrap.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Apply workaround for the libxml PHP bugs:
|
29 |
+
* @link https://bugs.php.net/bug.php?id=62577
|
30 |
+
* @link https://bugs.php.net/bug.php?id=64938
|
31 |
+
*/
|
32 |
+
if (function_exists('libxml_disable_entity_loader')) {
|
33 |
+
libxml_disable_entity_loader(false);
|
34 |
+
}
|
app/code/core/Mage/Admin/Helper/Rules/Fallback.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Admin
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Admin Data Helper
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Admin
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
|
35 |
+
class Mage_Admin_Helper_Rules_Fallback extends Mage_Core_Helper_Abstract
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Fallback to resource parent node
|
39 |
+
* @param $resourceId
|
40 |
+
*
|
41 |
+
* @return string
|
42 |
+
*/
|
43 |
+
protected function _getParentResourceId($resourceId)
|
44 |
+
{
|
45 |
+
$resourcePathInfo = explode('/', $resourceId);
|
46 |
+
array_pop($resourcePathInfo);
|
47 |
+
return implode('/', $resourcePathInfo);
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Fallback resource permissions similarly to zend_acl
|
53 |
+
* @param $resources
|
54 |
+
* @param $resourceId
|
55 |
+
* @param string $defaultValue
|
56 |
+
*
|
57 |
+
* @return string
|
58 |
+
*/
|
59 |
+
public function fallbackResourcePermissions(
|
60 |
+
&$resources,
|
61 |
+
$resourceId,
|
62 |
+
$defaultValue = Mage_Admin_Model_Rules::RULE_PERMISSION_DENIED
|
63 |
+
) {
|
64 |
+
if (empty($resourceId)) {
|
65 |
+
return $defaultValue;
|
66 |
+
}
|
67 |
+
|
68 |
+
if (!array_key_exists($resourceId, $resources)) {
|
69 |
+
return $this->fallbackResourcePermissions($resources, $this->_getParentResourceId($resourceId));
|
70 |
+
}
|
71 |
+
|
72 |
+
return $resources[$resourceId];
|
73 |
+
}
|
74 |
+
}
|
app/code/core/Mage/Admin/Model/Resource/Rules/Collection.php
CHANGED
@@ -68,4 +68,18 @@ class Mage_Admin_Model_Resource_Rules_Collection extends Mage_Core_Model_Resourc
|
|
68 |
|
69 |
return $this;
|
70 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
68 |
|
69 |
return $this;
|
70 |
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Generate and retrieve a resource - permissions map
|
74 |
+
* @return array
|
75 |
+
*/
|
76 |
+
public function getResourcesPermissionsArray()
|
77 |
+
{
|
78 |
+
$resourcesPermissionsArray = array();
|
79 |
+
foreach ($this as $item) {
|
80 |
+
$resourcesPermissionsArray[$item->getResourceId()] = $item->getPermission();
|
81 |
+
}
|
82 |
+
|
83 |
+
return $resourcesPermissionsArray;
|
84 |
+
}
|
85 |
}
|
app/code/core/Mage/Admin/Model/Rules.php
CHANGED
@@ -48,22 +48,64 @@
|
|
48 |
*/
|
49 |
class Mage_Admin_Model_Rules extends Mage_Core_Model_Abstract
|
50 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
protected function _construct()
|
52 |
{
|
53 |
$this->_init('admin/rules');
|
54 |
}
|
55 |
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
57 |
$this->getResource()->update($this);
|
58 |
return $this;
|
59 |
}
|
60 |
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
62 |
return Mage::getResourceModel('admin/permissions_collection');
|
63 |
}
|
64 |
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
66 |
$this->getResource()->saveRel($this);
|
67 |
return $this;
|
68 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
48 |
*/
|
49 |
class Mage_Admin_Model_Rules extends Mage_Core_Model_Abstract
|
50 |
{
|
51 |
+
/**
|
52 |
+
* Allowed permission code
|
53 |
+
*/
|
54 |
+
const RULE_PERMISSION_ALLOWED = 'allow';
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Denied permission code
|
58 |
+
*/
|
59 |
+
const RULE_PERMISSION_DENIED = 'deny';
|
60 |
+
|
61 |
protected function _construct()
|
62 |
{
|
63 |
$this->_init('admin/rules');
|
64 |
}
|
65 |
|
66 |
+
/**
|
67 |
+
* Update rules
|
68 |
+
* @return $this
|
69 |
+
*/
|
70 |
+
public function update()
|
71 |
+
{
|
72 |
$this->getResource()->update($this);
|
73 |
return $this;
|
74 |
}
|
75 |
|
76 |
+
/**
|
77 |
+
* Initialize and retrieve permissions collection
|
78 |
+
* @return Object
|
79 |
+
*/
|
80 |
+
public function getCollection()
|
81 |
+
{
|
82 |
return Mage::getResourceModel('admin/permissions_collection');
|
83 |
}
|
84 |
|
85 |
+
/**
|
86 |
+
* Save rules relations to the database
|
87 |
+
* @return $this
|
88 |
+
*/
|
89 |
+
public function saveRel()
|
90 |
+
{
|
91 |
$this->getResource()->saveRel($this);
|
92 |
return $this;
|
93 |
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Check if the current rule is allowed
|
97 |
+
* @return bool
|
98 |
+
*/
|
99 |
+
public function isAllowed()
|
100 |
+
{
|
101 |
+
return $this->getPermission() == self::RULE_PERMISSION_ALLOWED;
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Check if the current rule is denied
|
106 |
+
*/
|
107 |
+
public function isDenied()
|
108 |
+
{
|
109 |
+
return $this->getPermission() == self::RULE_PERMISSION_DENIED;
|
110 |
+
}
|
111 |
}
|
app/code/core/Mage/Admin/Model/User.php
CHANGED
@@ -131,11 +131,16 @@ class Mage_Admin_Model_User extends Mage_Core_Model_Abstract
|
|
131 |
}
|
132 |
|
133 |
if ($this->getNewPassword()) {
|
134 |
-
// Change password
|
135 |
$data['password'] = $this->_getEncodedPassword($this->getNewPassword());
|
|
|
136 |
} elseif ($this->getPassword() && $this->getPassword() != $this->getOrigData('password')) {
|
137 |
// New user password
|
138 |
$data['password'] = $this->_getEncodedPassword($this->getPassword());
|
|
|
|
|
|
|
|
|
139 |
}
|
140 |
|
141 |
$this->cleanPasswordsValidationData();
|
@@ -639,12 +644,13 @@ class Mage_Admin_Model_User extends Mage_Core_Model_Abstract
|
|
639 |
}
|
640 |
|
641 |
/**
|
642 |
-
* Clean password's validation data (password, new_password, password_confirmation)
|
643 |
*
|
644 |
* @return Mage_Admin_Model_User
|
645 |
*/
|
646 |
public function cleanPasswordsValidationData()
|
647 |
{
|
|
|
648 |
$this->setData('current_password', null);
|
649 |
$this->setData('new_password', null);
|
650 |
$this->setData('password_confirmation', null);
|
131 |
}
|
132 |
|
133 |
if ($this->getNewPassword()) {
|
134 |
+
// Change user password
|
135 |
$data['password'] = $this->_getEncodedPassword($this->getNewPassword());
|
136 |
+
$data['new_password'] = $data['password'];
|
137 |
} elseif ($this->getPassword() && $this->getPassword() != $this->getOrigData('password')) {
|
138 |
// New user password
|
139 |
$data['password'] = $this->_getEncodedPassword($this->getPassword());
|
140 |
+
} elseif (!$this->getPassword() && $this->getOrigData('password') // Change user data
|
141 |
+
|| $this->getPassword() == $this->getOrigData('password') // Retrieve user password
|
142 |
+
) {
|
143 |
+
$data['password'] = $this->getOrigData('password');
|
144 |
}
|
145 |
|
146 |
$this->cleanPasswordsValidationData();
|
644 |
}
|
645 |
|
646 |
/**
|
647 |
+
* Clean password's validation data (password, current_password, new_password, password_confirmation)
|
648 |
*
|
649 |
* @return Mage_Admin_Model_User
|
650 |
*/
|
651 |
public function cleanPasswordsValidationData()
|
652 |
{
|
653 |
+
$this->setData('password', null);
|
654 |
$this->setData('current_password', null);
|
655 |
$this->setData('new_password', null);
|
656 |
$this->setData('password_confirmation', null);
|
app/code/core/Mage/Api/Model/Server/Adapter/Soap.php
CHANGED
@@ -35,6 +35,13 @@ class Mage_Api_Model_Server_Adapter_Soap
|
|
35 |
extends Varien_Object
|
36 |
implements Mage_Api_Model_Server_Adapter_Interface
|
37 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
/**
|
39 |
* Soap server
|
40 |
*
|
@@ -42,6 +49,33 @@ class Mage_Api_Model_Server_Adapter_Soap
|
|
42 |
*/
|
43 |
protected $_soap = null;
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
/**
|
46 |
* Set handler class name for webservice
|
47 |
*
|
@@ -114,17 +148,7 @@ class Mage_Api_Model_Server_Adapter_Soap
|
|
114 |
|
115 |
$template = Mage::getModel('core/email_template_filter');
|
116 |
|
117 |
-
$
|
118 |
-
$queryParams = $this->getController()->getRequest()->getQuery();
|
119 |
-
if (isset($queryParams['wsdl'])) {
|
120 |
-
unset($queryParams['wsdl']);
|
121 |
-
}
|
122 |
-
|
123 |
-
$wsdlConfig->setUrl(htmlspecialchars(Mage::getUrl('*/*/*', array('_query'=>$queryParams))));
|
124 |
-
$wsdlConfig->setName('Magento');
|
125 |
-
$wsdlConfig->setHandler($this->getHandler());
|
126 |
-
|
127 |
-
$template->setVariables(array('wsdl' => $wsdlConfig));
|
128 |
|
129 |
$this->getController()->getResponse()
|
130 |
->clearHeaders()
|
35 |
extends Varien_Object
|
36 |
implements Mage_Api_Model_Server_Adapter_Interface
|
37 |
{
|
38 |
+
/**
|
39 |
+
* Wsdl config
|
40 |
+
*
|
41 |
+
* @var Varien_Object
|
42 |
+
*/
|
43 |
+
protected $wsdlConfig = null;
|
44 |
+
|
45 |
/**
|
46 |
* Soap server
|
47 |
*
|
49 |
*/
|
50 |
protected $_soap = null;
|
51 |
|
52 |
+
/**
|
53 |
+
* Internal constructor
|
54 |
+
*/
|
55 |
+
protected function _construct()
|
56 |
+
{
|
57 |
+
$this->wsdlConfig = $this->_getWsdlConfig();
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Get wsdl config
|
62 |
+
*
|
63 |
+
* @return Varien_Object
|
64 |
+
*/
|
65 |
+
protected function _getWsdlConfig()
|
66 |
+
{
|
67 |
+
$wsdlConfig = new Varien_Object();
|
68 |
+
$queryParams = $this->getController()->getRequest()->getQuery();
|
69 |
+
if (isset($queryParams['wsdl'])) {
|
70 |
+
unset($queryParams['wsdl']);
|
71 |
+
}
|
72 |
+
|
73 |
+
$wsdlConfig->setUrl(htmlspecialchars(Mage::getUrl('*/*/*', array('_query'=>$queryParams))));
|
74 |
+
$wsdlConfig->setName('Magento');
|
75 |
+
$wsdlConfig->setHandler($this->getHandler());
|
76 |
+
return $wsdlConfig;
|
77 |
+
}
|
78 |
+
|
79 |
/**
|
80 |
* Set handler class name for webservice
|
81 |
*
|
148 |
|
149 |
$template = Mage::getModel('core/email_template_filter');
|
150 |
|
151 |
+
$template->setVariables(array('wsdl' => $this->wsdlConfig));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
|
153 |
$this->getController()->getResponse()
|
154 |
->clearHeaders()
|
app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php
CHANGED
@@ -33,6 +33,19 @@
|
|
33 |
*/
|
34 |
class Mage_Api_Model_Server_V2_Adapter_Soap extends Mage_Api_Model_Server_Adapter_Soap
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
/**
|
37 |
* Run webservice
|
38 |
*
|
@@ -44,9 +57,6 @@ class Mage_Api_Model_Server_V2_Adapter_Soap extends Mage_Api_Model_Server_Adapte
|
|
44 |
$apiConfigCharset = Mage::getStoreConfig("api/config/charset");
|
45 |
|
46 |
if ($this->getController()->getRequest()->getParam('wsdl') !== null) {
|
47 |
-
$wsdlConfig = Mage::getModel('api/wsdl_config');
|
48 |
-
$wsdlConfig->setHandler($this->getHandler())
|
49 |
-
->init();
|
50 |
$this->getController()->getResponse()
|
51 |
->clearHeaders()
|
52 |
->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
|
@@ -54,7 +64,7 @@ class Mage_Api_Model_Server_V2_Adapter_Soap extends Mage_Api_Model_Server_Adapte
|
|
54 |
preg_replace(
|
55 |
'/<\?xml version="([^\"]+)"([^\>]+)>/i',
|
56 |
'<?xml version="$1" encoding="'.$apiConfigCharset.'"?>',
|
57 |
-
$wsdlConfig->getWsdlContent()
|
58 |
)
|
59 |
);
|
60 |
} else {
|
33 |
*/
|
34 |
class Mage_Api_Model_Server_V2_Adapter_Soap extends Mage_Api_Model_Server_Adapter_Soap
|
35 |
{
|
36 |
+
/**
|
37 |
+
* Get wsdl config
|
38 |
+
*
|
39 |
+
* @return Mage_Api_Model_Wsdl_Config
|
40 |
+
*/
|
41 |
+
protected function _getWsdlConfig()
|
42 |
+
{
|
43 |
+
$wsdlConfig = Mage::getModel('api/wsdl_config');
|
44 |
+
$wsdlConfig->setHandler($this->getHandler())
|
45 |
+
->init();
|
46 |
+
return $wsdlConfig;
|
47 |
+
}
|
48 |
+
|
49 |
/**
|
50 |
* Run webservice
|
51 |
*
|
57 |
$apiConfigCharset = Mage::getStoreConfig("api/config/charset");
|
58 |
|
59 |
if ($this->getController()->getRequest()->getParam('wsdl') !== null) {
|
|
|
|
|
|
|
60 |
$this->getController()->getResponse()
|
61 |
->clearHeaders()
|
62 |
->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
|
64 |
preg_replace(
|
65 |
'/<\?xml version="([^\"]+)"([^\>]+)>/i',
|
66 |
'<?xml version="$1" encoding="'.$apiConfigCharset.'"?>',
|
67 |
+
$this->wsdlConfig->getWsdlContent()
|
68 |
)
|
69 |
);
|
70 |
} else {
|
app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php
CHANGED
@@ -33,6 +33,19 @@
|
|
33 |
*/
|
34 |
class Mage_Api_Model_Server_WSI_Adapter_Soap extends Mage_Api_Model_Server_Adapter_Soap
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
/**
|
37 |
* Run webservice
|
38 |
*
|
@@ -44,9 +57,6 @@ class Mage_Api_Model_Server_WSI_Adapter_Soap extends Mage_Api_Model_Server_Adapt
|
|
44 |
$apiConfigCharset = Mage::getStoreConfig("api/config/charset");
|
45 |
|
46 |
if ($this->getController()->getRequest()->getParam('wsdl') !== null) {
|
47 |
-
$wsdlConfig = Mage::getModel('api/wsdl_config');
|
48 |
-
$wsdlConfig->setHandler($this->getHandler())
|
49 |
-
->init();
|
50 |
$this->getController()->getResponse()
|
51 |
->clearHeaders()
|
52 |
->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
|
@@ -63,7 +73,7 @@ class Mage_Api_Model_Server_WSI_Adapter_Soap extends Mage_Api_Model_Server_Adapt
|
|
63 |
preg_replace(
|
64 |
'/<\?xml version="([^\"]+)"([^\>]+)>/i',
|
65 |
'<?xml version="$1" encoding="'.$apiConfigCharset.'"?>',
|
66 |
-
$wsdlConfig->getWsdlContent()
|
67 |
)
|
68 |
)
|
69 |
)
|
33 |
*/
|
34 |
class Mage_Api_Model_Server_WSI_Adapter_Soap extends Mage_Api_Model_Server_Adapter_Soap
|
35 |
{
|
36 |
+
/**
|
37 |
+
* Get wsdl config
|
38 |
+
*
|
39 |
+
* @return Mage_Api_Model_Wsdl_Config
|
40 |
+
*/
|
41 |
+
protected function _getWsdlConfig()
|
42 |
+
{
|
43 |
+
$wsdlConfig = Mage::getModel('api/wsdl_config');
|
44 |
+
$wsdlConfig->setHandler($this->getHandler())
|
45 |
+
->init();
|
46 |
+
return $wsdlConfig;
|
47 |
+
}
|
48 |
+
|
49 |
/**
|
50 |
* Run webservice
|
51 |
*
|
57 |
$apiConfigCharset = Mage::getStoreConfig("api/config/charset");
|
58 |
|
59 |
if ($this->getController()->getRequest()->getParam('wsdl') !== null) {
|
|
|
|
|
|
|
60 |
$this->getController()->getResponse()
|
61 |
->clearHeaders()
|
62 |
->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
|
73 |
preg_replace(
|
74 |
'/<\?xml version="([^\"]+)"([^\>]+)>/i',
|
75 |
'<?xml version="$1" encoding="'.$apiConfigCharset.'"?>',
|
76 |
+
$this->wsdlConfig->getWsdlContent()
|
77 |
)
|
78 |
)
|
79 |
)
|
app/code/core/Mage/Api2/Block/Adminhtml/Roles/Buttons.php
CHANGED
@@ -125,7 +125,7 @@ class Mage_Api2_Block_Adminhtml_Roles_Buttons extends Mage_Adminhtml_Block_Templ
|
|
125 |
}
|
126 |
|
127 |
$this->getChild('deleteButton')->setData('onclick', sprintf("deleteConfirm('%s', '%s')",
|
128 |
-
Mage::helper('adminhtml')->__('Are you sure you want to do this?'),
|
129 |
$this->getUrl('*/*/delete', array('id' => $this->getRole()->getId()))
|
130 |
));
|
131 |
|
125 |
}
|
126 |
|
127 |
$this->getChild('deleteButton')->setData('onclick', sprintf("deleteConfirm('%s', '%s')",
|
128 |
+
Mage::helper('core')->jsQuoteEscape(Mage::helper('adminhtml')->__('Are you sure you want to do this?')),
|
129 |
$this->getUrl('*/*/delete', array('id' => $this->getRole()->getId()))
|
130 |
));
|
131 |
|
app/code/core/Mage/Api2/Model/Request/Interpreter/Json.php
CHANGED
@@ -46,7 +46,12 @@ class Mage_Api2_Model_Request_Interpreter_Json implements Mage_Api2_Model_Reques
|
|
46 |
throw new Exception(sprintf('Invalid data type "%s". String expected.', gettype($body)));
|
47 |
}
|
48 |
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
if ($body != 'null' && $decoded === null) {
|
52 |
throw new Mage_Api2_Exception('Decoding error.', Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
|
46 |
throw new Exception(sprintf('Invalid data type "%s". String expected.', gettype($body)));
|
47 |
}
|
48 |
|
49 |
+
try {
|
50 |
+
$decoded = Zend_Json::decode($body);
|
51 |
+
} catch (Zend_Json_Exception $e) {
|
52 |
+
throw new Mage_Api2_Exception('Decoding error.', Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
|
53 |
+
}
|
54 |
+
|
55 |
|
56 |
if ($body != 'null' && $decoded === null) {
|
57 |
throw new Mage_Api2_Exception('Decoding error.', Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
|
app/code/core/Mage/Api2/controllers/Adminhtml/Api2/AttributeController.php
CHANGED
@@ -145,4 +145,14 @@ class Mage_Api2_Adminhtml_Api2_AttributeController extends Mage_Adminhtml_Contro
|
|
145 |
|
146 |
$this->_redirect('*/*/edit', array('type' => $type));
|
147 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
}
|
145 |
|
146 |
$this->_redirect('*/*/edit', array('type' => $type));
|
147 |
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Check is allowed access to action
|
151 |
+
*
|
152 |
+
* @return bool
|
153 |
+
*/
|
154 |
+
protected function _isAllowed()
|
155 |
+
{
|
156 |
+
return Mage::getSingleton('admin/session')->isAllowed('system/api');
|
157 |
+
}
|
158 |
}
|
app/code/core/Mage/Authorizenet/Model/Directpost.php
CHANGED
@@ -51,6 +51,7 @@ class Mage_Authorizenet_Model_Directpost extends Mage_Paygate_Model_Authorizenet
|
|
51 |
protected $_canUseForMultishipping = false;
|
52 |
protected $_canSaveCc = false;
|
53 |
protected $_isInitializeNeeded = true;
|
|
|
54 |
|
55 |
/**
|
56 |
* Do not validate payment form using server methods
|
51 |
protected $_canUseForMultishipping = false;
|
52 |
protected $_canSaveCc = false;
|
53 |
protected $_isInitializeNeeded = true;
|
54 |
+
protected $_canFetchTransactionInfo = false;
|
55 |
|
56 |
/**
|
57 |
* Do not validate payment form using server methods
|
app/code/core/Mage/Authorizenet/controllers/Directpost/PaymentController.php
CHANGED
@@ -68,6 +68,8 @@ class Mage_Authorizenet_Directpost_PaymentController extends Mage_Core_Controlle
|
|
68 |
public function responseAction()
|
69 |
{
|
70 |
$data = $this->getRequest()->getPost();
|
|
|
|
|
71 |
/* @var $paymentMethod Mage_Authorizenet_Model_DirectPost */
|
72 |
$paymentMethod = Mage::getModel('authorizenet/directpost');
|
73 |
|
@@ -113,6 +115,8 @@ class Mage_Authorizenet_Directpost_PaymentController extends Mage_Core_Controlle
|
|
113 |
public function redirectAction()
|
114 |
{
|
115 |
$redirectParams = $this->getRequest()->getParams();
|
|
|
|
|
116 |
$params = array();
|
117 |
if (!empty($redirectParams['success'])
|
118 |
&& isset($redirectParams['x_invoice_num'])
|
68 |
public function responseAction()
|
69 |
{
|
70 |
$data = $this->getRequest()->getPost();
|
71 |
+
unset($data['redirect_parent']);
|
72 |
+
unset($data['redirect']);
|
73 |
/* @var $paymentMethod Mage_Authorizenet_Model_DirectPost */
|
74 |
$paymentMethod = Mage::getModel('authorizenet/directpost');
|
75 |
|
115 |
public function redirectAction()
|
116 |
{
|
117 |
$redirectParams = $this->getRequest()->getParams();
|
118 |
+
unset($redirectParams['redirect_parent']);
|
119 |
+
unset($redirectParams['redirect']);
|
120 |
$params = array();
|
121 |
if (!empty($redirectParams['success'])
|
122 |
&& isset($redirectParams['x_invoice_num'])
|
app/code/core/Mage/Authorizenet/etc/system.xml
CHANGED
@@ -116,7 +116,7 @@
|
|
116 |
<show_in_website>1</show_in_website>
|
117 |
<show_in_store>0</show_in_store>
|
118 |
</cgi_url>
|
119 |
-
|
120 |
<label>Accepted Currency</label>
|
121 |
<frontend_type>select</frontend_type>
|
122 |
<source_model>adminhtml/system_config_source_currency</source_model>
|
116 |
<show_in_website>1</show_in_website>
|
117 |
<show_in_store>0</show_in_store>
|
118 |
</cgi_url>
|
119 |
+
<currency translate="label">
|
120 |
<label>Accepted Currency</label>
|
121 |
<frontend_type>select</frontend_type>
|
122 |
<source_model>adminhtml/system_config_source_currency</source_model>
|
app/code/core/Mage/Backup/Model/Db.php
CHANGED
@@ -130,16 +130,19 @@ class Mage_Backup_Model_Db
|
|
130 |
$backup->write($this->getResource()->getTableDataBeforeSql($table));
|
131 |
|
132 |
if ($tableStatus->getDataLength() > self::BUFFER_LENGTH) {
|
133 |
-
if ($tableStatus->getAvgRowLength() < self::BUFFER_LENGTH) {
|
|
|
134 |
$limit = floor(self::BUFFER_LENGTH / $tableStatus->getAvgRowLength());
|
135 |
$multiRowsLength = ceil($tableStatus->getRows() / $limit);
|
136 |
}
|
137 |
else {
|
|
|
138 |
$limit = 1;
|
139 |
$multiRowsLength = $tableStatus->getRows();
|
140 |
}
|
141 |
}
|
142 |
else {
|
|
|
143 |
$limit = $tableStatus->getRows();
|
144 |
$multiRowsLength = 1;
|
145 |
}
|
130 |
$backup->write($this->getResource()->getTableDataBeforeSql($table));
|
131 |
|
132 |
if ($tableStatus->getDataLength() > self::BUFFER_LENGTH) {
|
133 |
+
if ($tableStatus->getAvgRowLength() > 0 && $tableStatus->getAvgRowLength() < self::BUFFER_LENGTH) {
|
134 |
+
// Process rows in batches
|
135 |
$limit = floor(self::BUFFER_LENGTH / $tableStatus->getAvgRowLength());
|
136 |
$multiRowsLength = ceil($tableStatus->getRows() / $limit);
|
137 |
}
|
138 |
else {
|
139 |
+
// Process rows one by one
|
140 |
$limit = 1;
|
141 |
$multiRowsLength = $tableStatus->getRows();
|
142 |
}
|
143 |
}
|
144 |
else {
|
145 |
+
// Process all rows at once
|
146 |
$limit = $tableStatus->getRows();
|
147 |
$multiRowsLength = 1;
|
148 |
}
|
app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php
CHANGED
@@ -36,11 +36,22 @@ class Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Bundle_Model_
|
|
36 |
/**
|
37 |
* Draw item line
|
38 |
*
|
|
|
39 |
*/
|
40 |
public function draw()
|
41 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
$order = $this->getOrder();
|
|
|
|
|
43 |
$item = $this->getItem();
|
|
|
44 |
$pdf = $this->getPdf();
|
45 |
$page = $this->getPage();
|
46 |
|
@@ -50,12 +61,13 @@ class Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Bundle_Model_
|
|
50 |
$_prevOptionId = '';
|
51 |
$drawItems = array();
|
52 |
|
|
|
53 |
foreach ($items as $_item) {
|
54 |
$line = array();
|
55 |
|
56 |
$attributes = $this->getSelectionAttributes($_item);
|
57 |
if (is_array($attributes)) {
|
58 |
-
$optionId
|
59 |
}
|
60 |
else {
|
61 |
$optionId = 0;
|
@@ -71,9 +83,9 @@ class Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Bundle_Model_
|
|
71 |
if ($_item->getOrderItem()->getParentItem()) {
|
72 |
if ($_prevOptionId != $attributes['option_id']) {
|
73 |
$line[0] = array(
|
74 |
-
'font'
|
75 |
-
'text'
|
76 |
-
'feed'
|
77 |
);
|
78 |
|
79 |
$drawItems[$optionId] = array(
|
@@ -96,14 +108,14 @@ class Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Bundle_Model_
|
|
96 |
$name = $_item->getName();
|
97 |
}
|
98 |
$line[] = array(
|
99 |
-
'text' =>
|
100 |
'feed' => $feed
|
101 |
);
|
102 |
|
103 |
// draw SKUs
|
104 |
if (!$_item->getOrderItem()->getParentItem()) {
|
105 |
$text = array();
|
106 |
-
foreach (
|
107 |
$text[] = $part;
|
108 |
}
|
109 |
$line[] = array(
|
@@ -114,7 +126,11 @@ class Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Bundle_Model_
|
|
114 |
|
115 |
// draw prices
|
116 |
if ($this->canShowPriceInfo($_item)) {
|
117 |
-
|
|
|
|
|
|
|
|
|
118 |
$line[] = array(
|
119 |
'text' => $price,
|
120 |
'feed' => 395,
|
@@ -135,7 +151,11 @@ class Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Bundle_Model_
|
|
135 |
'align' => 'right'
|
136 |
);
|
137 |
|
138 |
-
|
|
|
|
|
|
|
|
|
139 |
$line[] = array(
|
140 |
'text' => $row_total,
|
141 |
'feed' => 565,
|
@@ -154,7 +174,7 @@ class Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Bundle_Model_
|
|
154 |
foreach ($options['options'] as $option) {
|
155 |
$lines = array();
|
156 |
$lines[][] = array(
|
157 |
-
'text' =>
|
158 |
'font' => 'italic',
|
159 |
'feed' => 35
|
160 |
);
|
@@ -166,7 +186,7 @@ class Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Bundle_Model_
|
|
166 |
: strip_tags($option['value']);
|
167 |
$values = explode(', ', $_printValue);
|
168 |
foreach ($values as $value) {
|
169 |
-
foreach (
|
170 |
$text[] = $_value;
|
171 |
}
|
172 |
}
|
36 |
/**
|
37 |
* Draw item line
|
38 |
*
|
39 |
+
* @return void
|
40 |
*/
|
41 |
public function draw()
|
42 |
{
|
43 |
+
/** @var Mage_Tax_Helper_Data $taxHelper */
|
44 |
+
$taxHelper = Mage::helper('tax');
|
45 |
+
|
46 |
+
/** @var Mage_Core_Helper_String $stringHelper */
|
47 |
+
$stringHelper = Mage::helper('core/string');
|
48 |
+
|
49 |
+
/** @var Mage_Sales_Model_Order $order */
|
50 |
$order = $this->getOrder();
|
51 |
+
|
52 |
+
/** @var Mage_Sales_Model_Order_Invoice_Item $item */
|
53 |
$item = $this->getItem();
|
54 |
+
|
55 |
$pdf = $this->getPdf();
|
56 |
$page = $this->getPage();
|
57 |
|
61 |
$_prevOptionId = '';
|
62 |
$drawItems = array();
|
63 |
|
64 |
+
/** @var Mage_Sales_Model_Order_Invoice_Item $_item */
|
65 |
foreach ($items as $_item) {
|
66 |
$line = array();
|
67 |
|
68 |
$attributes = $this->getSelectionAttributes($_item);
|
69 |
if (is_array($attributes)) {
|
70 |
+
$optionId = $attributes['option_id'];
|
71 |
}
|
72 |
else {
|
73 |
$optionId = 0;
|
83 |
if ($_item->getOrderItem()->getParentItem()) {
|
84 |
if ($_prevOptionId != $attributes['option_id']) {
|
85 |
$line[0] = array(
|
86 |
+
'font' => 'italic',
|
87 |
+
'text' => $stringHelper->str_split($attributes['option_label'], 45, true, true),
|
88 |
+
'feed' => 35
|
89 |
);
|
90 |
|
91 |
$drawItems[$optionId] = array(
|
108 |
$name = $_item->getName();
|
109 |
}
|
110 |
$line[] = array(
|
111 |
+
'text' => $stringHelper->str_split($name, 35, true, true),
|
112 |
'feed' => $feed
|
113 |
);
|
114 |
|
115 |
// draw SKUs
|
116 |
if (!$_item->getOrderItem()->getParentItem()) {
|
117 |
$text = array();
|
118 |
+
foreach ($stringHelper->str_split($item->getSku(), 17) as $part) {
|
119 |
$text[] = $part;
|
120 |
}
|
121 |
$line[] = array(
|
126 |
|
127 |
// draw prices
|
128 |
if ($this->canShowPriceInfo($_item)) {
|
129 |
+
if ($taxHelper->displaySalesPriceInclTax()) {
|
130 |
+
$price = $order->formatPriceTxt($_item->getPriceInclTax());
|
131 |
+
} else {
|
132 |
+
$price = $order->formatPriceTxt($_item->getPrice());
|
133 |
+
}
|
134 |
$line[] = array(
|
135 |
'text' => $price,
|
136 |
'feed' => 395,
|
151 |
'align' => 'right'
|
152 |
);
|
153 |
|
154 |
+
if ($taxHelper->displaySalesPriceInclTax()) {
|
155 |
+
$row_total = $order->formatPriceTxt($_item->getRowTotalInclTax());
|
156 |
+
} else {
|
157 |
+
$row_total = $order->formatPriceTxt($_item->getRowTotal());
|
158 |
+
}
|
159 |
$line[] = array(
|
160 |
'text' => $row_total,
|
161 |
'feed' => 565,
|
174 |
foreach ($options['options'] as $option) {
|
175 |
$lines = array();
|
176 |
$lines[][] = array(
|
177 |
+
'text' => $stringHelper->str_split(strip_tags($option['label']), 40, true, true),
|
178 |
'font' => 'italic',
|
179 |
'feed' => 35
|
180 |
);
|
186 |
: strip_tags($option['value']);
|
187 |
$values = explode(', ', $_printValue);
|
188 |
foreach ($values as $value) {
|
189 |
+
foreach ($stringHelper->str_split($value, 30, true, true) as $_value) {
|
190 |
$text[] = $_value;
|
191 |
}
|
192 |
}
|
app/code/core/Mage/Bundle/Model/Selection.php
CHANGED
@@ -64,11 +64,11 @@ class Mage_Bundle_Model_Selection extends Mage_Core_Model_Abstract
|
|
64 |
}
|
65 |
|
66 |
/**
|
67 |
-
* Processing object
|
68 |
*
|
69 |
* @return Mage_Bundle_Model_Selection
|
70 |
*/
|
71 |
-
protected function
|
72 |
{
|
73 |
$storeId = Mage::registry('product')->getStoreId();
|
74 |
if (!Mage::helper('catalog')->isPriceGlobal() && $storeId) {
|
@@ -80,6 +80,6 @@ class Mage_Bundle_Model_Selection extends Mage_Core_Model_Abstract
|
|
80 |
$this->unsSelectionPriceType();
|
81 |
}
|
82 |
}
|
83 |
-
parent::
|
84 |
}
|
85 |
}
|
64 |
}
|
65 |
|
66 |
/**
|
67 |
+
* Processing object after save data
|
68 |
*
|
69 |
* @return Mage_Bundle_Model_Selection
|
70 |
*/
|
71 |
+
protected function _afterSave()
|
72 |
{
|
73 |
$storeId = Mage::registry('product')->getStoreId();
|
74 |
if (!Mage::helper('catalog')->isPriceGlobal() && $storeId) {
|
80 |
$this->unsSelectionPriceType();
|
81 |
}
|
82 |
}
|
83 |
+
parent::_afterSave();
|
84 |
}
|
85 |
}
|
app/code/core/Mage/Bundle/controllers/Adminhtml/Bundle/SelectionController.php
CHANGED
@@ -59,5 +59,13 @@ class Mage_Bundle_Adminhtml_Bundle_SelectionController extends Mage_Adminhtml_Co
|
|
59 |
->toHtml()
|
60 |
);
|
61 |
}
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
}
|
59 |
->toHtml()
|
60 |
);
|
61 |
}
|
62 |
+
/**
|
63 |
+
* Check for is allowed
|
64 |
+
*
|
65 |
+
* @return boolean
|
66 |
+
*/
|
67 |
+
protected function _isAllowed()
|
68 |
+
{
|
69 |
+
return Mage::getSingleton('admin/session')->isAllowed('catalog/products');
|
70 |
+
}
|
71 |
}
|
app/code/core/Mage/Captcha/controllers/Adminhtml/RefreshController.php
CHANGED
@@ -47,4 +47,14 @@ class Mage_Captcha_Adminhtml_RefreshController extends Mage_Adminhtml_Controller
|
|
47 |
$this->getResponse()->setBody(json_encode(array('imgSrc' => $captchaModel->getImgSrc())));
|
48 |
$this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
|
49 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
47 |
$this->getResponse()->setBody(json_encode(array('imgSrc' => $captchaModel->getImgSrc())));
|
48 |
$this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
|
49 |
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Check is allowed access to action
|
53 |
+
*
|
54 |
+
* @return bool
|
55 |
+
*/
|
56 |
+
protected function _isAllowed()
|
57 |
+
{
|
58 |
+
return true;
|
59 |
+
}
|
60 |
}
|
app/code/core/Mage/Catalog/Helper/Product/Compare.php
CHANGED
@@ -62,6 +62,52 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
|
|
62 |
*/
|
63 |
protected $_customerId = null;
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
/**
|
66 |
* Retrieve Catalog Session instance
|
67 |
*
|
@@ -69,7 +115,7 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
|
|
69 |
*/
|
70 |
protected function _getSession()
|
71 |
{
|
72 |
-
return
|
73 |
}
|
74 |
|
75 |
/**
|
@@ -103,7 +149,7 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
|
|
103 |
return array(
|
104 |
'product' => $product->getId(),
|
105 |
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl(),
|
106 |
-
Mage_Core_Model_Url::FORM_KEY => $this->
|
107 |
);
|
108 |
}
|
109 |
|
@@ -115,7 +161,10 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
|
|
115 |
*/
|
116 |
public function getAddUrl($product)
|
117 |
{
|
118 |
-
|
|
|
|
|
|
|
119 |
}
|
120 |
|
121 |
/**
|
@@ -126,11 +175,11 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
|
|
126 |
*/
|
127 |
public function getAddToWishlistUrl($product)
|
128 |
{
|
129 |
-
$beforeCompareUrl =
|
130 |
|
131 |
$params = array(
|
132 |
'product' => $product->getId(),
|
133 |
-
Mage_Core_Model_Url::FORM_KEY => $this->
|
134 |
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl($beforeCompareUrl)
|
135 |
);
|
136 |
|
@@ -145,11 +194,11 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
|
|
145 |
*/
|
146 |
public function getAddToCartUrl($product)
|
147 |
{
|
148 |
-
$beforeCompareUrl = $this->
|
149 |
$params = array(
|
150 |
'product' => $product->getId(),
|
151 |
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl($beforeCompareUrl),
|
152 |
-
Mage_Core_Model_Url::FORM_KEY => $this->
|
153 |
);
|
154 |
|
155 |
return $this->_getUrl('checkout/cart/add', $params);
|
@@ -191,20 +240,20 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
|
|
191 |
public function getItemCollection()
|
192 |
{
|
193 |
if (!$this->_itemCollection) {
|
|
|
194 |
$this->_itemCollection = Mage::getResourceModel('catalog/product_compare_item_collection')
|
195 |
->useProductItem(true)
|
196 |
->setStoreId(Mage::app()->getStore()->getId());
|
197 |
|
198 |
-
if (
|
199 |
-
$this->_itemCollection->setCustomerId(
|
200 |
} elseif ($this->_customerId) {
|
201 |
$this->_itemCollection->setCustomerId($this->_customerId);
|
202 |
} else {
|
203 |
-
$this->_itemCollection->setVisitorId(
|
204 |
}
|
205 |
|
206 |
-
|
207 |
-
->addVisibleInSiteFilterToCollection($this->_itemCollection);
|
208 |
|
209 |
/* Price data is added to consider item stock status using price index */
|
210 |
$this->_itemCollection->addPriceData();
|
@@ -214,7 +263,7 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
|
|
214 |
->load();
|
215 |
|
216 |
/* update compare items count */
|
217 |
-
$this->
|
218 |
}
|
219 |
|
220 |
return $this->_itemCollection;
|
@@ -229,30 +278,29 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
|
|
229 |
public function calculate($logout = false)
|
230 |
{
|
231 |
// first visit
|
232 |
-
if (!$this->
|
233 |
$count = 0;
|
234 |
} else {
|
235 |
/** @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Compare_Item_Collection */
|
236 |
$collection = Mage::getResourceModel('catalog/product_compare_item_collection')
|
237 |
->useProductItem(true);
|
238 |
-
if (!$logout &&
|
239 |
-
$collection->setCustomerId(
|
240 |
} elseif ($this->_customerId) {
|
241 |
$collection->setCustomerId($this->_customerId);
|
242 |
} else {
|
243 |
-
$collection->setVisitorId(
|
244 |
}
|
245 |
|
246 |
/* Price data is added to consider item stock status using price index */
|
247 |
$collection->addPriceData();
|
248 |
|
249 |
-
|
250 |
-
->addVisibleInSiteFilterToCollection($collection);
|
251 |
|
252 |
$count = $collection->getSize();
|
253 |
}
|
254 |
|
255 |
-
$this->
|
256 |
|
257 |
return $this;
|
258 |
}
|
@@ -264,11 +312,11 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
|
|
264 |
*/
|
265 |
public function getItemCount()
|
266 |
{
|
267 |
-
if (!$this->
|
268 |
$this->calculate();
|
269 |
}
|
270 |
|
271 |
-
return $this->
|
272 |
}
|
273 |
|
274 |
/**
|
62 |
*/
|
63 |
protected $_customerId = null;
|
64 |
|
65 |
+
/**
|
66 |
+
* @var Mage_Log_Helper_Data
|
67 |
+
*/
|
68 |
+
protected $_logCondition;
|
69 |
+
|
70 |
+
/**
|
71 |
+
* @var Mage_Catalog_Model_Session
|
72 |
+
*/
|
73 |
+
protected $_catalogSession;
|
74 |
+
|
75 |
+
/**
|
76 |
+
* @var Mage_Customer_Model_Session
|
77 |
+
*/
|
78 |
+
protected $_customerSession;
|
79 |
+
|
80 |
+
/**
|
81 |
+
* @var Mage_Core_Model_Session
|
82 |
+
*/
|
83 |
+
protected $_coreSession;
|
84 |
+
|
85 |
+
/**
|
86 |
+
* @var Mage_Log_Model_Visitor
|
87 |
+
*/
|
88 |
+
protected $_logVisitor;
|
89 |
+
|
90 |
+
/**
|
91 |
+
* @var Mage_Catalog_Model_Product_Visibility
|
92 |
+
*/
|
93 |
+
protected $_productVisibility;
|
94 |
+
|
95 |
+
public function __construct(array $data = array())
|
96 |
+
{
|
97 |
+
$this->_logCondition = isset($data['log_condition'])
|
98 |
+
? $data['log_condition'] : Mage::helper('log');
|
99 |
+
$this->_catalogSession = isset($data['catalog_session'])
|
100 |
+
? $data['catalog_session'] : Mage::getSingleton('catalog/session');
|
101 |
+
$this->_customerSession = isset($data['customer_session'])
|
102 |
+
? $data['customer_session'] : Mage::getSingleton('customer/session');
|
103 |
+
$this->_coreSession = isset($data['core_session'])
|
104 |
+
? $data['core_session'] : Mage::getSingleton('core/session');
|
105 |
+
$this->_productVisibility = isset($data['product_visibility'])
|
106 |
+
? $data['product_visibility'] : Mage::getSingleton('catalog/product_visibility');
|
107 |
+
$this->_logVisitor = isset($data['log_visitor'])
|
108 |
+
? $data['log_visitor'] : Mage::getSingleton('log/visitor');
|
109 |
+
}
|
110 |
+
|
111 |
/**
|
112 |
* Retrieve Catalog Session instance
|
113 |
*
|
115 |
*/
|
116 |
protected function _getSession()
|
117 |
{
|
118 |
+
return $this->_catalogSession;
|
119 |
}
|
120 |
|
121 |
/**
|
149 |
return array(
|
150 |
'product' => $product->getId(),
|
151 |
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl(),
|
152 |
+
Mage_Core_Model_Url::FORM_KEY => $this->_coreSession->getFormKey()
|
153 |
);
|
154 |
}
|
155 |
|
161 |
*/
|
162 |
public function getAddUrl($product)
|
163 |
{
|
164 |
+
if ($this->_logCondition->isVisitorLogEnabled()) {
|
165 |
+
return $this->_getUrl('catalog/product_compare/add', $this->_getUrlParams($product));
|
166 |
+
}
|
167 |
+
return '';
|
168 |
}
|
169 |
|
170 |
/**
|
175 |
*/
|
176 |
public function getAddToWishlistUrl($product)
|
177 |
{
|
178 |
+
$beforeCompareUrl = $this->_catalogSession->getBeforeCompareUrl();
|
179 |
|
180 |
$params = array(
|
181 |
'product' => $product->getId(),
|
182 |
+
Mage_Core_Model_Url::FORM_KEY => $this->_coreSession->getFormKey(),
|
183 |
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl($beforeCompareUrl)
|
184 |
);
|
185 |
|
194 |
*/
|
195 |
public function getAddToCartUrl($product)
|
196 |
{
|
197 |
+
$beforeCompareUrl = $this->_catalogSession->getBeforeCompareUrl();
|
198 |
$params = array(
|
199 |
'product' => $product->getId(),
|
200 |
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl($beforeCompareUrl),
|
201 |
+
Mage_Core_Model_Url::FORM_KEY => $this->_coreSession->getFormKey()
|
202 |
);
|
203 |
|
204 |
return $this->_getUrl('checkout/cart/add', $params);
|
240 |
public function getItemCollection()
|
241 |
{
|
242 |
if (!$this->_itemCollection) {
|
243 |
+
/** @var Mage_Catalog_Model_Resource_Product_Compare_Item_Collection _itemCollection */
|
244 |
$this->_itemCollection = Mage::getResourceModel('catalog/product_compare_item_collection')
|
245 |
->useProductItem(true)
|
246 |
->setStoreId(Mage::app()->getStore()->getId());
|
247 |
|
248 |
+
if ($this->_customerSession->isLoggedIn()) {
|
249 |
+
$this->_itemCollection->setCustomerId($this->_customerSession->getCustomerId());
|
250 |
} elseif ($this->_customerId) {
|
251 |
$this->_itemCollection->setCustomerId($this->_customerId);
|
252 |
} else {
|
253 |
+
$this->_itemCollection->setVisitorId($this->_logVisitor->getId());
|
254 |
}
|
255 |
|
256 |
+
$this->_productVisibility->addVisibleInSiteFilterToCollection($this->_itemCollection);
|
|
|
257 |
|
258 |
/* Price data is added to consider item stock status using price index */
|
259 |
$this->_itemCollection->addPriceData();
|
263 |
->load();
|
264 |
|
265 |
/* update compare items count */
|
266 |
+
$this->_catalogSession->setCatalogCompareItemsCount(count($this->_itemCollection));
|
267 |
}
|
268 |
|
269 |
return $this->_itemCollection;
|
278 |
public function calculate($logout = false)
|
279 |
{
|
280 |
// first visit
|
281 |
+
if (!$this->_catalogSession->hasCatalogCompareItemsCount() && !$this->_customerId) {
|
282 |
$count = 0;
|
283 |
} else {
|
284 |
/** @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Compare_Item_Collection */
|
285 |
$collection = Mage::getResourceModel('catalog/product_compare_item_collection')
|
286 |
->useProductItem(true);
|
287 |
+
if (!$logout && $this->_customerSession->isLoggedIn()) {
|
288 |
+
$collection->setCustomerId($this->_customerSession->getCustomerId());
|
289 |
} elseif ($this->_customerId) {
|
290 |
$collection->setCustomerId($this->_customerId);
|
291 |
} else {
|
292 |
+
$collection->setVisitorId($this->_logVisitor->getId());
|
293 |
}
|
294 |
|
295 |
/* Price data is added to consider item stock status using price index */
|
296 |
$collection->addPriceData();
|
297 |
|
298 |
+
$this->_productVisibility->addVisibleInSiteFilterToCollection($collection);
|
|
|
299 |
|
300 |
$count = $collection->getSize();
|
301 |
}
|
302 |
|
303 |
+
$this->_catalogSession->setCatalogCompareItemsCount($count);
|
304 |
|
305 |
return $this;
|
306 |
}
|
312 |
*/
|
313 |
public function getItemCount()
|
314 |
{
|
315 |
+
if (!$this->_catalogSession->hasCatalogCompareItemsCount()) {
|
316 |
$this->calculate();
|
317 |
}
|
318 |
|
319 |
+
return $this->_catalogSession->getCatalogCompareItemsCount();
|
320 |
}
|
321 |
|
322 |
/**
|
app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php
CHANGED
@@ -99,6 +99,13 @@ class Mage_Catalog_Model_Convert_Adapter_Product
|
|
99 |
|
100 |
protected $_toNumber = array();
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
/**
|
103 |
* Retrieve event prefix for adapter
|
104 |
*
|
@@ -424,6 +431,8 @@ class Mage_Catalog_Model_Convert_Adapter_Product
|
|
424 |
if (!Mage::registry('Object_Cache_StockItem')) {
|
425 |
$this->setStockItem(Mage::getModel('cataloginventory/stock_item'));
|
426 |
}
|
|
|
|
|
427 |
}
|
428 |
|
429 |
/**
|
@@ -574,6 +583,38 @@ class Mage_Catalog_Model_Convert_Adapter_Product
|
|
574 |
return $this;
|
575 |
}
|
576 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
577 |
/**
|
578 |
* Save product (import)
|
579 |
*
|
@@ -643,6 +684,12 @@ class Mage_Catalog_Model_Convert_Adapter_Product
|
|
643 |
}
|
644 |
}
|
645 |
|
|
|
|
|
|
|
|
|
|
|
|
|
646 |
$this->setProductTypeInstance($product);
|
647 |
|
648 |
if (isset($importData['category_ids'])) {
|
@@ -757,20 +804,18 @@ class Mage_Catalog_Model_Convert_Adapter_Product
|
|
757 |
}
|
758 |
$product->setStockData($stockData);
|
759 |
|
760 |
-
$mediaGalleryBackendModel = $this->getAttribute('media_gallery')->getBackend();
|
761 |
-
|
762 |
$arrayToMassAdd = array();
|
763 |
|
764 |
foreach ($product->getMediaAttributes() as $mediaAttributeCode => $mediaAttribute) {
|
765 |
if (isset($importData[$mediaAttributeCode])) {
|
766 |
$file = trim($importData[$mediaAttributeCode]);
|
767 |
-
if (!empty($file) && !$
|
768 |
$arrayToMassAdd[] = array('file' => trim($file), 'mediaAttribute' => $mediaAttributeCode);
|
769 |
}
|
770 |
}
|
771 |
}
|
772 |
|
773 |
-
$addedFilesCorrespondence = $
|
774 |
$product,
|
775 |
$arrayToMassAdd, Mage::getBaseDir('media') . DS . 'import',
|
776 |
false,
|
@@ -793,7 +838,7 @@ class Mage_Catalog_Model_Convert_Adapter_Product
|
|
793 |
$addedFile = $product->getData($mediaAttributeCode);
|
794 |
}
|
795 |
if ($fileLabel && $addedFile) {
|
796 |
-
$
|
797 |
}
|
798 |
}
|
799 |
}
|
99 |
|
100 |
protected $_toNumber = array();
|
101 |
|
102 |
+
/**
|
103 |
+
* Gallery backend model
|
104 |
+
*
|
105 |
+
* @var Mage_Catalog_Model_Product_Attribute_Backend_Media
|
106 |
+
*/
|
107 |
+
protected $_galleryBackendModel;
|
108 |
+
|
109 |
/**
|
110 |
* Retrieve event prefix for adapter
|
111 |
*
|
431 |
if (!Mage::registry('Object_Cache_StockItem')) {
|
432 |
$this->setStockItem(Mage::getModel('cataloginventory/stock_item'));
|
433 |
}
|
434 |
+
|
435 |
+
$this->_galleryBackendModel = $this->getAttribute('media_gallery')->getBackend();
|
436 |
}
|
437 |
|
438 |
/**
|
583 |
return $this;
|
584 |
}
|
585 |
|
586 |
+
/**
|
587 |
+
* Save data row with gallery image info only
|
588 |
+
*
|
589 |
+
* @param Mage_Catalog_Model_Product $product
|
590 |
+
* @param array $importData
|
591 |
+
*
|
592 |
+
* @return Mage_Catalog_Model_Convert_Adapter_Product
|
593 |
+
*/
|
594 |
+
public function saveImageDataRow($product, $importData)
|
595 |
+
{
|
596 |
+
$imageData = array(
|
597 |
+
'label' => $importData['_media_lable'],
|
598 |
+
'position' => $importData['_media_position'],
|
599 |
+
'disabled' => $importData['_media_is_disabled']
|
600 |
+
);
|
601 |
+
|
602 |
+
$imageFile = trim($importData['_media_image']);
|
603 |
+
$imageFile = ltrim($imageFile, DS);
|
604 |
+
$imageFilePath = Mage::getBaseDir('media') . DS . 'import' . DS . $imageFile;
|
605 |
+
|
606 |
+
$updatedFileName = $this->_galleryBackendModel->addImage($product, $imageFilePath, null, false,
|
607 |
+
(bool) $importData['_media_is_disabled']);
|
608 |
+
$this->_galleryBackendModel->updateImage($product, $updatedFileName, $imageData);
|
609 |
+
|
610 |
+
$this->_addAffectedEntityIds($product->getId());
|
611 |
+
$product->setIsMassupdate(true)
|
612 |
+
->setExcludeUrlRewrite(true)
|
613 |
+
->save();
|
614 |
+
|
615 |
+
return $this;
|
616 |
+
}
|
617 |
+
|
618 |
/**
|
619 |
* Save product (import)
|
620 |
*
|
684 |
}
|
685 |
}
|
686 |
|
687 |
+
// process row with media data only
|
688 |
+
if (isset($importData['_media_image']) && strlen($importData['_media_image'])) {
|
689 |
+
$this->saveImageDataRow($product, $importData);
|
690 |
+
return true;
|
691 |
+
}
|
692 |
+
|
693 |
$this->setProductTypeInstance($product);
|
694 |
|
695 |
if (isset($importData['category_ids'])) {
|
804 |
}
|
805 |
$product->setStockData($stockData);
|
806 |
|
|
|
|
|
807 |
$arrayToMassAdd = array();
|
808 |
|
809 |
foreach ($product->getMediaAttributes() as $mediaAttributeCode => $mediaAttribute) {
|
810 |
if (isset($importData[$mediaAttributeCode])) {
|
811 |
$file = trim($importData[$mediaAttributeCode]);
|
812 |
+
if (!empty($file) && !$this->_galleryBackendModel->getImage($product, $file)) {
|
813 |
$arrayToMassAdd[] = array('file' => trim($file), 'mediaAttribute' => $mediaAttributeCode);
|
814 |
}
|
815 |
}
|
816 |
}
|
817 |
|
818 |
+
$addedFilesCorrespondence = $this->_galleryBackendModel->addImagesWithDifferentMediaAttributes(
|
819 |
$product,
|
820 |
$arrayToMassAdd, Mage::getBaseDir('media') . DS . 'import',
|
821 |
false,
|
838 |
$addedFile = $product->getData($mediaAttributeCode);
|
839 |
}
|
840 |
if ($fileLabel && $addedFile) {
|
841 |
+
$this->_galleryBackendModel->updateImage($product, $addedFile, array('label' => $fileLabel));
|
842 |
}
|
843 |
}
|
844 |
}
|
app/code/core/Mage/Catalog/Model/Convert/Parser/Product.php
CHANGED
@@ -482,19 +482,56 @@ class Mage_Catalog_Model_Convert_Parser_Product
|
|
482 |
}
|
483 |
}
|
484 |
|
|
|
|
|
|
|
|
|
485 |
foreach ($this->_imageFields as $field) {
|
486 |
-
if (isset($row[$field])
|
487 |
-
$row[$field]
|
|
|
|
|
|
|
|
|
488 |
}
|
489 |
}
|
|
|
490 |
|
491 |
-
$
|
|
|
492 |
->setId(null)
|
493 |
-
->setBatchId($
|
494 |
->setBatchData($row)
|
495 |
->setStatus(1)
|
496 |
->save();
|
497 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
498 |
}
|
499 |
|
500 |
return $this;
|
482 |
}
|
483 |
}
|
484 |
|
485 |
+
$productMediaGallery = $product->getMediaGallery();
|
486 |
+
$product->reset();
|
487 |
+
|
488 |
+
$processedImageList = array();
|
489 |
foreach ($this->_imageFields as $field) {
|
490 |
+
if (isset($row[$field])) {
|
491 |
+
if ($row[$field] == 'no_selection') {
|
492 |
+
$row[$field] = null;
|
493 |
+
} else {
|
494 |
+
$processedImageList[] = $row[$field];
|
495 |
+
}
|
496 |
}
|
497 |
}
|
498 |
+
$processedImageList = array_unique($processedImageList);
|
499 |
|
500 |
+
$batchModelId = $this->getBatchModel()->getId();
|
501 |
+
$this->getBatchExportModel()
|
502 |
->setId(null)
|
503 |
+
->setBatchId($batchModelId)
|
504 |
->setBatchData($row)
|
505 |
->setStatus(1)
|
506 |
->save();
|
507 |
+
|
508 |
+
$baseRowData = array(
|
509 |
+
'store' => $row['store'],
|
510 |
+
'website' => $row['website'],
|
511 |
+
'sku' => $row['sku']
|
512 |
+
);
|
513 |
+
unset($row);
|
514 |
+
|
515 |
+
foreach ($productMediaGallery['images'] as $image) {
|
516 |
+
if (in_array($image['file'], $processedImageList)) {
|
517 |
+
continue;
|
518 |
+
}
|
519 |
+
|
520 |
+
$rowMediaGallery = array(
|
521 |
+
'_media_image' => $image['file'],
|
522 |
+
'_media_lable' => $image['label'],
|
523 |
+
'_media_position' => $image['position'],
|
524 |
+
'_media_is_disabled' => $image['disabled']
|
525 |
+
);
|
526 |
+
$rowMediaGallery = array_merge($baseRowData, $rowMediaGallery);
|
527 |
+
|
528 |
+
$this->getBatchExportModel()
|
529 |
+
->setId(null)
|
530 |
+
->setBatchId($batchModelId)
|
531 |
+
->setBatchData($rowMediaGallery)
|
532 |
+
->setStatus(1)
|
533 |
+
->save();
|
534 |
+
}
|
535 |
}
|
536 |
|
537 |
return $this;
|
app/code/core/Mage/Catalog/Model/Observer.php
CHANGED
@@ -214,7 +214,7 @@ class Mage_Catalog_Model_Observer
|
|
214 |
$block = $observer->getEvent()->getBlock();
|
215 |
$block->addCacheTag(Mage_Catalog_Model_Category::CACHE_TAG);
|
216 |
$this->_addCategoriesToMenu(
|
217 |
-
Mage::helper('catalog/category')->getStoreCategories(), $observer->getMenu(), $block
|
218 |
);
|
219 |
}
|
220 |
|
214 |
$block = $observer->getEvent()->getBlock();
|
215 |
$block->addCacheTag(Mage_Catalog_Model_Category::CACHE_TAG);
|
216 |
$this->_addCategoriesToMenu(
|
217 |
+
Mage::helper('catalog/category')->getStoreCategories(), $observer->getMenu(), $block
|
218 |
);
|
219 |
}
|
220 |
|
app/code/core/Mage/Catalog/Model/Product.php
CHANGED
@@ -1889,19 +1889,30 @@ class Mage_Catalog_Model_Product extends Mage_Catalog_Model_Abstract
|
|
1889 |
*
|
1890 |
* @return array
|
1891 |
*/
|
1892 |
-
public function
|
1893 |
{
|
1894 |
-
$tags =
|
1895 |
-
$affectedCategoryIds = $this->
|
1896 |
-
if (!$affectedCategoryIds) {
|
1897 |
-
$affectedCategoryIds = $this->getCategoryIds();
|
1898 |
-
}
|
1899 |
foreach ($affectedCategoryIds as $categoryId) {
|
1900 |
$tags[] = Mage_Catalog_Model_Category::CACHE_TAG.'_'.$categoryId;
|
1901 |
}
|
1902 |
return $tags;
|
1903 |
}
|
1904 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1905 |
/**
|
1906 |
* Check for empty SKU on each product
|
1907 |
*
|
1889 |
*
|
1890 |
* @return array
|
1891 |
*/
|
1892 |
+
public function getCacheIdTagsWithCategories()
|
1893 |
{
|
1894 |
+
$tags = $this->getCacheTags();
|
1895 |
+
$affectedCategoryIds = $this->_getResource()->getCategoryIdsWithAnchors($this);
|
|
|
|
|
|
|
1896 |
foreach ($affectedCategoryIds as $categoryId) {
|
1897 |
$tags[] = Mage_Catalog_Model_Category::CACHE_TAG.'_'.$categoryId;
|
1898 |
}
|
1899 |
return $tags;
|
1900 |
}
|
1901 |
|
1902 |
+
/**
|
1903 |
+
* Remove model onject related cache
|
1904 |
+
*
|
1905 |
+
* @return Mage_Core_Model_Abstract
|
1906 |
+
*/
|
1907 |
+
public function cleanModelCache()
|
1908 |
+
{
|
1909 |
+
$tags = $this->getCacheIdTagsWithCategories();
|
1910 |
+
if ($tags !== false) {
|
1911 |
+
Mage::app()->cleanCache($tags);
|
1912 |
+
}
|
1913 |
+
return $this;
|
1914 |
+
}
|
1915 |
+
|
1916 |
/**
|
1917 |
* Check for empty SKU on each product
|
1918 |
*
|
app/code/core/Mage/Catalog/Model/Product/Compare/Item.php
CHANGED
@@ -28,7 +28,6 @@
|
|
28 |
/**
|
29 |
* Catalog Compare Item Model
|
30 |
*
|
31 |
-
* @method Mage_Catalog_Model_Resource_Product_Compare_Item _getResource()
|
32 |
* @method Mage_Catalog_Model_Resource_Product_Compare_Item getResource()
|
33 |
* @method Mage_Catalog_Model_Product_Compare_Item setVisitorId(int $value)
|
34 |
* @method Mage_Catalog_Model_Product_Compare_Item setCustomerId(int $value)
|
@@ -100,6 +99,19 @@ class Mage_Catalog_Model_Product_Compare_Item extends Mage_Core_Model_Abstract
|
|
100 |
return $this;
|
101 |
}
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
/**
|
104 |
* Add customer data from customer object
|
105 |
*
|
28 |
/**
|
29 |
* Catalog Compare Item Model
|
30 |
*
|
|
|
31 |
* @method Mage_Catalog_Model_Resource_Product_Compare_Item getResource()
|
32 |
* @method Mage_Catalog_Model_Product_Compare_Item setVisitorId(int $value)
|
33 |
* @method Mage_Catalog_Model_Product_Compare_Item setCustomerId(int $value)
|
99 |
return $this;
|
100 |
}
|
101 |
|
102 |
+
/**
|
103 |
+
* Save object data
|
104 |
+
*
|
105 |
+
* @return Mage_Catalog_Model_Product_Compare_Item
|
106 |
+
*/
|
107 |
+
public function save()
|
108 |
+
{
|
109 |
+
if ($this->hasCustomerId() || $this->hasVisitorId()) {
|
110 |
+
parent::save();
|
111 |
+
}
|
112 |
+
return $this;
|
113 |
+
}
|
114 |
+
|
115 |
/**
|
116 |
* Add customer data from customer object
|
117 |
*
|
app/code/core/Mage/Catalog/Model/Product/Status.php
CHANGED
@@ -248,7 +248,23 @@ class Mage_Catalog_Model_Product_Status extends Mage_Core_Model_Abstract
|
|
248 |
*/
|
249 |
public function getFlatColums()
|
250 |
{
|
251 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
}
|
253 |
|
254 |
/**
|
@@ -258,7 +274,15 @@ class Mage_Catalog_Model_Product_Status extends Mage_Core_Model_Abstract
|
|
258 |
*/
|
259 |
public function getFlatIndexes()
|
260 |
{
|
261 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
}
|
263 |
|
264 |
/**
|
@@ -270,7 +294,8 @@ class Mage_Catalog_Model_Product_Status extends Mage_Core_Model_Abstract
|
|
270 |
*/
|
271 |
public function getFlatUpdateSelect($store)
|
272 |
{
|
273 |
-
return
|
|
|
274 |
}
|
275 |
|
276 |
/**
|
248 |
*/
|
249 |
public function getFlatColums()
|
250 |
{
|
251 |
+
$attributeCode = $this->getAttribute()->getAttributeCode();
|
252 |
+
$column = array(
|
253 |
+
'unsigned' => true,
|
254 |
+
'default' => null,
|
255 |
+
'extra' => null
|
256 |
+
);
|
257 |
+
|
258 |
+
if (Mage::helper('core')->useDbCompatibleMode()) {
|
259 |
+
$column['type'] = 'tinyint';
|
260 |
+
$column['is_null'] = true;
|
261 |
+
} else {
|
262 |
+
$column['type'] = Varien_Db_Ddl_Table::TYPE_SMALLINT;
|
263 |
+
$column['nullable'] = true;
|
264 |
+
$column['comment'] = 'Catalog Product Status ' . $attributeCode . ' column';
|
265 |
+
}
|
266 |
+
|
267 |
+
return array($attributeCode => $column);
|
268 |
}
|
269 |
|
270 |
/**
|
274 |
*/
|
275 |
public function getFlatIndexes()
|
276 |
{
|
277 |
+
$indexes = array();
|
278 |
+
|
279 |
+
$index = 'IDX_' . strtoupper($this->getAttribute()->getAttributeCode());
|
280 |
+
$indexes[$index] = array(
|
281 |
+
'type' => 'index',
|
282 |
+
'fields' => array($this->getAttribute()->getAttributeCode())
|
283 |
+
);
|
284 |
+
|
285 |
+
return $indexes;
|
286 |
}
|
287 |
|
288 |
/**
|
294 |
*/
|
295 |
public function getFlatUpdateSelect($store)
|
296 |
{
|
297 |
+
return Mage::getResourceSingleton('eav/entity_attribute')
|
298 |
+
->getFlatUpdateSelect($this->getAttribute(), $store);
|
299 |
}
|
300 |
|
301 |
/**
|
app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php
CHANGED
@@ -127,7 +127,12 @@ class Mage_Catalog_Model_Resource_Layer_Filter_Price extends Mage_Core_Model_Res
|
|
127 |
|
128 |
// processing WHERE part
|
129 |
$wherePart = $select->getPart(Zend_Db_Select::WHERE);
|
|
|
130 |
foreach ($wherePart as $key => $wherePartItem) {
|
|
|
|
|
|
|
|
|
131 |
$wherePart[$key] = $this->_replaceTableAlias($wherePartItem);
|
132 |
}
|
133 |
$select->setPart(Zend_Db_Select::WHERE, $wherePart);
|
@@ -225,9 +230,11 @@ class Mage_Catalog_Model_Resource_Layer_Filter_Price extends Mage_Core_Model_Res
|
|
225 |
{
|
226 |
$currencyRate = $filter->getLayer()->getProductCollection()->getCurrencyRate();
|
227 |
if ($decrease) {
|
228 |
-
|
|
|
|
|
229 |
}
|
230 |
-
return ($
|
231 |
}
|
232 |
|
233 |
/**
|
127 |
|
128 |
// processing WHERE part
|
129 |
$wherePart = $select->getPart(Zend_Db_Select::WHERE);
|
130 |
+
$excludedWherePart = Mage_Catalog_Model_Resource_Product_Collection::MAIN_TABLE_ALIAS . '.status';
|
131 |
foreach ($wherePart as $key => $wherePartItem) {
|
132 |
+
if (strpos($wherePartItem, $excludedWherePart) !== false) {
|
133 |
+
$wherePart[$key] = new Zend_Db_Expr('1=1');
|
134 |
+
continue;
|
135 |
+
}
|
136 |
$wherePart[$key] = $this->_replaceTableAlias($wherePartItem);
|
137 |
}
|
138 |
$select->setPart(Zend_Db_Select::WHERE, $wherePart);
|
230 |
{
|
231 |
$currencyRate = $filter->getLayer()->getProductCollection()->getCurrencyRate();
|
232 |
if ($decrease) {
|
233 |
+
$result = ($price - (self::MIN_POSSIBLE_PRICE / 2)) / $currencyRate;
|
234 |
+
} else {
|
235 |
+
$result = ($price + (self::MIN_POSSIBLE_PRICE / 2)) / $currencyRate;
|
236 |
}
|
237 |
+
return sprintf('%F', $result);
|
238 |
}
|
239 |
|
240 |
/**
|
app/code/core/Mage/Catalog/Model/Resource/Product.php
CHANGED
@@ -702,4 +702,30 @@ class Mage_Catalog_Model_Resource_Product extends Mage_Catalog_Model_Resource_Ab
|
|
702 |
$images = $read->fetchAll($select);
|
703 |
return $images;
|
704 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
705 |
}
|
702 |
$images = $read->fetchAll($select);
|
703 |
return $images;
|
704 |
}
|
705 |
+
|
706 |
+
/**
|
707 |
+
* Retrieve product categories
|
708 |
+
*
|
709 |
+
* @param Mage_Catalog_Model_Product $object
|
710 |
+
* @return array
|
711 |
+
*/
|
712 |
+
public function getCategoryIdsWithAnchors($object)
|
713 |
+
{
|
714 |
+
$selectRootCategories = $this->_getReadAdapter()->select()
|
715 |
+
->from(
|
716 |
+
array($this->getTable('catalog/category')),
|
717 |
+
array('entity_id')
|
718 |
+
)
|
719 |
+
->where('level <= 1');
|
720 |
+
$rootIds = $this->_getReadAdapter()->fetchCol($selectRootCategories);
|
721 |
+
$select = $this->_getReadAdapter()->select()
|
722 |
+
->from(
|
723 |
+
array($this->getTable('catalog/category_product_index')),
|
724 |
+
array('category_id')
|
725 |
+
)
|
726 |
+
->where('product_id = ?', (int)$object->getEntityId())
|
727 |
+
->where('category_id NOT IN(?)', $rootIds);
|
728 |
+
|
729 |
+
return $this->_getReadAdapter()->fetchCol($select);
|
730 |
+
}
|
731 |
}
|
app/code/core/Mage/Catalog/Model/Resource/Product/Action.php
CHANGED
@@ -58,6 +58,9 @@ class Mage_Catalog_Model_Resource_Product_Action extends Mage_Catalog_Model_Reso
|
|
58 |
*/
|
59 |
public function updateAttributes($entityIds, $attrData, $storeId)
|
60 |
{
|
|
|
|
|
|
|
61 |
$object = new Varien_Object();
|
62 |
$object->setIdFieldName('entity_id')
|
63 |
->setStoreId($storeId);
|
58 |
*/
|
59 |
public function updateAttributes($entityIds, $attrData, $storeId)
|
60 |
{
|
61 |
+
$this->_attributeValuesToSave = array();
|
62 |
+
$this->_attributeValuesToDelete = array();
|
63 |
+
|
64 |
$object = new Varien_Object();
|
65 |
$object->setIdFieldName('entity_id')
|
66 |
->setStoreId($storeId);
|
app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php
CHANGED
@@ -452,11 +452,11 @@ class Mage_Catalog_Model_Resource_Product_Collection extends Mage_Catalog_Model_
|
|
452 |
if ($this->isEnabledFlat()) {
|
453 |
$this->getSelect()
|
454 |
->from(array(self::MAIN_TABLE_ALIAS => $this->getEntity()->getFlatTableName()), null)
|
455 |
-
->
|
456 |
$this->addAttributeToSelect(array('entity_id', 'type_id', 'attribute_set_id'));
|
457 |
if ($this->getFlatHelper()->isAddChildData()) {
|
458 |
$this->getSelect()
|
459 |
-
->where('e.is_child
|
460 |
$this->addAttributeToSelect(array('child_id', 'is_child'));
|
461 |
}
|
462 |
} else {
|
452 |
if ($this->isEnabledFlat()) {
|
453 |
$this->getSelect()
|
454 |
->from(array(self::MAIN_TABLE_ALIAS => $this->getEntity()->getFlatTableName()), null)
|
455 |
+
->where('e.status = ?', new Zend_Db_Expr(Mage_Catalog_Model_Product_Status::STATUS_ENABLED));
|
456 |
$this->addAttributeToSelect(array('entity_id', 'type_id', 'attribute_set_id'));
|
457 |
if ($this->getFlatHelper()->isAddChildData()) {
|
458 |
$this->getSelect()
|
459 |
+
->where('e.is_child = ?', 0);
|
460 |
$this->addAttributeToSelect(array('child_id', 'is_child'));
|
461 |
}
|
462 |
} else {
|
app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Source.php
CHANGED
@@ -240,7 +240,7 @@ class Mage_Catalog_Model_Resource_Product_Indexer_Eav_Source
|
|
240 |
$data = array();
|
241 |
$query = $select->query();
|
242 |
while ($row = $query->fetch()) {
|
243 |
-
$values = explode(',', $row['value']);
|
244 |
foreach ($values as $valueId) {
|
245 |
if (isset($options[$row['attribute_id']][$valueId])) {
|
246 |
$data[] = array(
|
240 |
$data = array();
|
241 |
$query = $select->query();
|
242 |
while ($row = $query->fetch()) {
|
243 |
+
$values = array_unique(explode(',', $row['value']));
|
244 |
foreach ($values as $valueId) {
|
245 |
if (isset($options[$row['attribute_id']][$valueId])) {
|
246 |
$data[] = array(
|
app/code/core/Mage/Catalog/etc/config.xml
CHANGED
@@ -28,7 +28,7 @@
|
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_Catalog>
|
31 |
-
<version>1.6.0.0.19</version>
|
32 |
</Mage_Catalog>
|
33 |
</modules>
|
34 |
<admin>
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_Catalog>
|
31 |
+
<version>1.6.0.0.19.1.2</version>
|
32 |
</Mage_Catalog>
|
33 |
</modules>
|
34 |
<admin>
|
app/code/core/Mage/Catalog/etc/wsdl.xml
CHANGED
@@ -257,6 +257,10 @@
|
|
257 |
<element name="custom_layout_update" type="xsd:string" minOccurs="0"/>
|
258 |
<element name="default_sort_by" type="xsd:string" minOccurs="0"/>
|
259 |
<element name="landing_page" type="xsd:int" minOccurs="0"/>
|
|
|
|
|
|
|
|
|
260 |
</all>
|
261 |
</complexType>
|
262 |
<complexType name="catalogAssignedProduct">
|
257 |
<element name="custom_layout_update" type="xsd:string" minOccurs="0"/>
|
258 |
<element name="default_sort_by" type="xsd:string" minOccurs="0"/>
|
259 |
<element name="landing_page" type="xsd:int" minOccurs="0"/>
|
260 |
+
<element name="include_in_menu" type="xsd:int" minOccurs="0"/>
|
261 |
+
<element name="custom_use_parent_settings" type="xsd:int" minOccurs="0"/>
|
262 |
+
<element name="custom_apply_to_products" type="xsd:int" minOccurs="0"/>
|
263 |
+
<element name="filter_price_range" type="xsd:string" minOccurs="0"/>
|
264 |
</all>
|
265 |
</complexType>
|
266 |
<complexType name="catalogAssignedProduct">
|
app/code/core/Mage/Catalog/etc/wsi.xml
CHANGED
@@ -235,6 +235,10 @@
|
|
235 |
<xsd:element name="custom_layout_update" type="xsd:string" minOccurs="0" />
|
236 |
<xsd:element name="default_sort_by" type="xsd:string" minOccurs="0" />
|
237 |
<xsd:element name="landing_page" type="xsd:int" minOccurs="0" />
|
|
|
|
|
|
|
|
|
238 |
</xsd:sequence>
|
239 |
</xsd:complexType>
|
240 |
<xsd:complexType name="catalogAssignedProduct">
|
235 |
<xsd:element name="custom_layout_update" type="xsd:string" minOccurs="0" />
|
236 |
<xsd:element name="default_sort_by" type="xsd:string" minOccurs="0" />
|
237 |
<xsd:element name="landing_page" type="xsd:int" minOccurs="0" />
|
238 |
+
<xsd:element name="include_in_menu" type="xsd:int" minOccurs="0" />
|
239 |
+
<xsd:element name="custom_use_parent_settings" type="xsd:int" minOccurs="0" />
|
240 |
+
<xsd:element name="custom_apply_to_products" type="xsd:int" minOccurs="0" />
|
241 |
+
<xsd:element name="filter_price_range" type="xsd:string" minOccurs="0" />
|
242 |
</xsd:sequence>
|
243 |
</xsd:complexType>
|
244 |
<xsd:complexType name="catalogAssignedProduct">
|
app/code/core/Mage/Catalog/sql/catalog_setup/upgrade-1.6.0.0.19.1.1-1.6.0.0.19.1.2.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Catalog
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
$installer = $this;
|
28 |
+
/** @var $installer Mage_Catalog_Model_Resource_Setup */
|
29 |
+
$installer->updateAttribute(
|
30 |
+
Mage_Catalog_Model_Product::ENTITY,
|
31 |
+
'special_price',
|
32 |
+
'note',
|
33 |
+
'The Special Price is active only when lower than the Actual Price'
|
34 |
+
);
|
app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api.php
CHANGED
@@ -116,6 +116,10 @@ class Mage_CatalogInventory_Model_Stock_Item_Api extends Mage_Catalog_Model_Api_
|
|
116 |
$stockData['backorders'] = $data['backorders'];
|
117 |
}
|
118 |
|
|
|
|
|
|
|
|
|
119 |
$product->setStockData($stockData);
|
120 |
|
121 |
try {
|
116 |
$stockData['backorders'] = $data['backorders'];
|
117 |
}
|
118 |
|
119 |
+
if (isset($data['min_sale_qty'])) {
|
120 |
+
$stockData['min_sale_qty'] = $data['min_sale_qty'];
|
121 |
+
}
|
122 |
+
|
123 |
$product->setStockData($stockData);
|
124 |
|
125 |
try {
|
app/code/core/Mage/CatalogRule/Model/Observer.php
CHANGED
@@ -29,6 +29,13 @@
|
|
29 |
*/
|
30 |
class Mage_CatalogRule_Model_Observer
|
31 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
/**
|
33 |
* Store calculated catalog rules prices for products
|
34 |
* Prices collected per website, customer group, date and product
|
@@ -93,6 +100,40 @@ class Mage_CatalogRule_Model_Observer
|
|
93 |
return $this;
|
94 |
}
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
/**
|
97 |
* Apply catalog price rules to product on frontend
|
98 |
*
|
@@ -126,7 +167,7 @@ class Mage_CatalogRule_Model_Observer
|
|
126 |
$gId = Mage::getSingleton('customer/session')->getCustomerGroupId();
|
127 |
}
|
128 |
|
129 |
-
$key =
|
130 |
if (!isset($this->_rulePrices[$key])) {
|
131 |
$rulePrice = Mage::getResourceModel('catalogrule/rule')
|
132 |
->getRulePrice($date, $wId, $gId, $pId);
|
@@ -158,13 +199,13 @@ class Mage_CatalogRule_Model_Observer
|
|
158 |
$gId = $ruleData->getCustomerGroupId();
|
159 |
$pId = $product->getId();
|
160 |
|
161 |
-
$key =
|
162 |
}
|
163 |
-
elseif (!is_null($
|
164 |
-
$wId = $
|
165 |
$gId = $product->getCustomerGroupId();
|
166 |
$pId = $product->getId();
|
167 |
-
$key =
|
168 |
}
|
169 |
|
170 |
if ($key) {
|
@@ -372,7 +413,7 @@ class Mage_CatalogRule_Model_Observer
|
|
372 |
$productIds = array();
|
373 |
/* @var $product Mage_Core_Model_Product */
|
374 |
foreach ($collection as $product) {
|
375 |
-
$key =
|
376 |
if (!isset($this->_rulePrices[$key])) {
|
377 |
$productIds[] = $product->getId();
|
378 |
}
|
@@ -382,7 +423,7 @@ class Mage_CatalogRule_Model_Observer
|
|
382 |
$rulePrices = Mage::getResourceModel('catalogrule/rule')
|
383 |
->getRulePrices($date, $websiteId, $groupId, $productIds);
|
384 |
foreach ($productIds as $productId) {
|
385 |
-
$key =
|
386 |
$this->_rulePrices[$key] = isset($rulePrices[$productId]) ? $rulePrices[$productId] : false;
|
387 |
}
|
388 |
}
|
@@ -425,4 +466,14 @@ class Mage_CatalogRule_Model_Observer
|
|
425 |
$indexProcess->reindexAll();
|
426 |
}
|
427 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
428 |
}
|
29 |
*/
|
30 |
class Mage_CatalogRule_Model_Observer
|
31 |
{
|
32 |
+
/**
|
33 |
+
* Preload price rules for all items in quote
|
34 |
+
*
|
35 |
+
* @var array
|
36 |
+
*/
|
37 |
+
protected $_preloadedPrices = array();
|
38 |
+
|
39 |
/**
|
40 |
* Store calculated catalog rules prices for products
|
41 |
* Prices collected per website, customer group, date and product
|
100 |
return $this;
|
101 |
}
|
102 |
|
103 |
+
/**
|
104 |
+
* Preload all price rules for all items in quote
|
105 |
+
*
|
106 |
+
* @param Varien_Event_Observer $observer
|
107 |
+
*
|
108 |
+
* @return Mage_CatalogRule_Model_Observer
|
109 |
+
*/
|
110 |
+
public function preloadPriceRules(Varien_Event_Observer $observer)
|
111 |
+
{
|
112 |
+
$quote = $observer->getQuote();
|
113 |
+
$date = Mage::app()->getLocale()->storeTimeStamp($quote->getStoreId());
|
114 |
+
$wId = $quote->getStore()->getWebsiteId();
|
115 |
+
$gId = $quote->getCustomerGroupId();
|
116 |
+
|
117 |
+
$productIds = array();
|
118 |
+
foreach ($quote->getAllItems() as $item) {
|
119 |
+
$productIds[] = $item->getProductId();
|
120 |
+
}
|
121 |
+
|
122 |
+
$cacheKey = spl_object_hash($quote);
|
123 |
+
|
124 |
+
if (!isset($this->_preloadedPrices[$cacheKey])) {
|
125 |
+
$this->_preloadedPrices[$cacheKey] = Mage::getResourceSingleton('catalogrule/rule')
|
126 |
+
->getRulePrices($date, $wId, $gId, $productIds);
|
127 |
+
}
|
128 |
+
|
129 |
+
foreach ($this->_preloadedPrices[$cacheKey] as $pId => $price) {
|
130 |
+
$key = $this->_getRulePricesKey(array($date, $wId, $gId, $pId));
|
131 |
+
$this->_rulePrices[$key] = $price;
|
132 |
+
}
|
133 |
+
|
134 |
+
return $this;
|
135 |
+
}
|
136 |
+
|
137 |
/**
|
138 |
* Apply catalog price rules to product on frontend
|
139 |
*
|
167 |
$gId = Mage::getSingleton('customer/session')->getCustomerGroupId();
|
168 |
}
|
169 |
|
170 |
+
$key = $this->_getRulePricesKey(array($date, $wId, $gId, $pId));
|
171 |
if (!isset($this->_rulePrices[$key])) {
|
172 |
$rulePrice = Mage::getResourceModel('catalogrule/rule')
|
173 |
->getRulePrice($date, $wId, $gId, $pId);
|
199 |
$gId = $ruleData->getCustomerGroupId();
|
200 |
$pId = $product->getId();
|
201 |
|
202 |
+
$key = $this->_getRulePricesKey(array($date, $wId, $gId, $pId));
|
203 |
}
|
204 |
+
elseif (!is_null($storeId) && !is_null($product->getCustomerGroupId())) {
|
205 |
+
$wId = Mage::app()->getStore($storeId)->getWebsiteId();
|
206 |
$gId = $product->getCustomerGroupId();
|
207 |
$pId = $product->getId();
|
208 |
+
$key = $this->_getRulePricesKey(array($date, $wId, $gId, $pId));
|
209 |
}
|
210 |
|
211 |
if ($key) {
|
413 |
$productIds = array();
|
414 |
/* @var $product Mage_Core_Model_Product */
|
415 |
foreach ($collection as $product) {
|
416 |
+
$key = $this->_getRulePricesKey(array($date, $websiteId, $groupId, $product->getId()));
|
417 |
if (!isset($this->_rulePrices[$key])) {
|
418 |
$productIds[] = $product->getId();
|
419 |
}
|
423 |
$rulePrices = Mage::getResourceModel('catalogrule/rule')
|
424 |
->getRulePrices($date, $websiteId, $groupId, $productIds);
|
425 |
foreach ($productIds as $productId) {
|
426 |
+
$key = $this->_getRulePricesKey(array($date, $websiteId, $groupId, $productId));
|
427 |
$this->_rulePrices[$key] = isset($rulePrices[$productId]) ? $rulePrices[$productId] : false;
|
428 |
}
|
429 |
}
|
466 |
$indexProcess->reindexAll();
|
467 |
}
|
468 |
}
|
469 |
+
|
470 |
+
/**
|
471 |
+
* Generate key for rule prices
|
472 |
+
*
|
473 |
+
* @param array
|
474 |
+
*/
|
475 |
+
protected function _getRulePricesKey($keyInfo)
|
476 |
+
{
|
477 |
+
return implode('|', $keyInfo);
|
478 |
+
}
|
479 |
}
|
app/code/core/Mage/CatalogRule/etc/config.xml
CHANGED
@@ -106,6 +106,14 @@
|
|
106 |
</global>
|
107 |
<frontend>
|
108 |
<events>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
<catalog_product_get_final_price>
|
110 |
<observers>
|
111 |
<catalogrule>
|
106 |
</global>
|
107 |
<frontend>
|
108 |
<events>
|
109 |
+
<sales_quote_collect_totals_before>
|
110 |
+
<observers>
|
111 |
+
<preload_price_rules>
|
112 |
+
<class>catalogrule/observer</class>
|
113 |
+
<method>preloadPriceRules</method>
|
114 |
+
</preload_price_rules>
|
115 |
+
</observers>
|
116 |
+
</sales_quote_collect_totals_before>
|
117 |
<catalog_product_get_final_price>
|
118 |
<observers>
|
119 |
<catalogrule>
|
app/code/core/Mage/CatalogSearch/Block/Advanced/Form.php
CHANGED
@@ -284,7 +284,7 @@ class Mage_CatalogSearch_Block_Advanced_Form extends Mage_Core_Block_Template
|
|
284 |
*/
|
285 |
public function getSearchPostUrl()
|
286 |
{
|
287 |
-
return $this->getUrl('*/*/result');
|
288 |
}
|
289 |
|
290 |
/**
|
284 |
*/
|
285 |
public function getSearchPostUrl()
|
286 |
{
|
287 |
+
return $this->getUrl('*/*/result', array('_secure' => $this->_isSecure()));
|
288 |
}
|
289 |
|
290 |
/**
|
app/code/core/Mage/CatalogSearch/Block/Autocomplete.php
CHANGED
@@ -44,6 +44,9 @@ class Mage_CatalogSearch_Block_Autocomplete extends Mage_Core_Block_Abstract
|
|
44 |
return $html;
|
45 |
}
|
46 |
|
|
|
|
|
|
|
47 |
$count--;
|
48 |
|
49 |
$html = '<ul><li style="display:none"></li>';
|
@@ -56,8 +59,11 @@ class Mage_CatalogSearch_Block_Autocomplete extends Mage_Core_Block_Abstract
|
|
56 |
$item['row_class'] .= ' last';
|
57 |
}
|
58 |
|
59 |
-
$html .= '<li title="'
|
60 |
-
|
|
|
|
|
|
|
61 |
}
|
62 |
|
63 |
$html.= '</ul>';
|
44 |
return $html;
|
45 |
}
|
46 |
|
47 |
+
$isAjaxSuggestionCountResultsEnabled = (bool) Mage::app()->getStore()
|
48 |
+
->getConfig(Mage_CatalogSearch_Model_Query::XML_PATH_AJAX_SUGGESTION_COUNT);
|
49 |
+
|
50 |
$count--;
|
51 |
|
52 |
$html = '<ul><li style="display:none"></li>';
|
59 |
$item['row_class'] .= ' last';
|
60 |
}
|
61 |
|
62 |
+
$html .= '<li title="' . $this->escapeHtml($item['title']) . '" class="' . $item['row_class'] . '">';
|
63 |
+
if ($isAjaxSuggestionCountResultsEnabled) {
|
64 |
+
$html .= '<span class="amount">' . $item['num_of_results'] . '</span>';
|
65 |
+
}
|
66 |
+
$html .= $this->escapeHtml($item['title']) . '</li>';
|
67 |
}
|
68 |
|
69 |
$html.= '</ul>';
|
app/code/core/Mage/CatalogSearch/Model/Query.php
CHANGED
@@ -72,6 +72,7 @@ class Mage_CatalogSearch_Model_Query extends Mage_Core_Model_Abstract
|
|
72 |
const XML_PATH_MIN_QUERY_LENGTH = 'catalog/search/min_query_length';
|
73 |
const XML_PATH_MAX_QUERY_LENGTH = 'catalog/search/max_query_length';
|
74 |
const XML_PATH_MAX_QUERY_WORDS = 'catalog/search/max_query_words';
|
|
|
75 |
|
76 |
/**
|
77 |
* Init resource model
|
72 |
const XML_PATH_MIN_QUERY_LENGTH = 'catalog/search/min_query_length';
|
73 |
const XML_PATH_MAX_QUERY_LENGTH = 'catalog/search/max_query_length';
|
74 |
const XML_PATH_MAX_QUERY_WORDS = 'catalog/search/max_query_words';
|
75 |
+
const XML_PATH_AJAX_SUGGESTION_COUNT = 'catalog/search/show_autocomplete_results_count';
|
76 |
|
77 |
/**
|
78 |
* Init resource model
|
app/code/core/Mage/CatalogSearch/etc/config.xml
CHANGED
@@ -138,6 +138,7 @@
|
|
138 |
<max_query_words>10</max_query_words>
|
139 |
<search_type>1</search_type>
|
140 |
<use_layered_navigation_count>2000</use_layered_navigation_count>
|
|
|
141 |
</search>
|
142 |
</catalog>
|
143 |
</default>
|
138 |
<max_query_words>10</max_query_words>
|
139 |
<search_type>1</search_type>
|
140 |
<use_layered_navigation_count>2000</use_layered_navigation_count>
|
141 |
+
<show_autocomplete_results_count>1</show_autocomplete_results_count>
|
142 |
</search>
|
143 |
</catalog>
|
144 |
</default>
|
app/code/core/Mage/CatalogSearch/etc/system.xml
CHANGED
@@ -108,6 +108,15 @@
|
|
108 |
<show_in_store>1</show_in_store>
|
109 |
<comment>Enter "0" to enable layered navigation for any number of results.</comment>
|
110 |
</use_layered_navigation_count>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
</fields>
|
112 |
</search>
|
113 |
</groups>
|
108 |
<show_in_store>1</show_in_store>
|
109 |
<comment>Enter "0" to enable layered navigation for any number of results.</comment>
|
110 |
</use_layered_navigation_count>
|
111 |
+
<show_autocomplete_results_count translate="label">
|
112 |
+
<label>Show Autocomplete Results Count</label>
|
113 |
+
<frontend_type>select</frontend_type>
|
114 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
115 |
+
<sort_order>74</sort_order>
|
116 |
+
<show_in_default>1</show_in_default>
|
117 |
+
<show_in_website>1</show_in_website>
|
118 |
+
<show_in_store>1</show_in_store>
|
119 |
+
</show_autocomplete_results_count>
|
120 |
</fields>
|
121 |
</search>
|
122 |
</groups>
|
app/code/core/Mage/Checkout/Block/Cart.php
CHANGED
@@ -120,6 +120,16 @@ class Mage_Checkout_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
|
|
120 |
return $this->getUrl('checkout/onepage', array('_secure'=>true));
|
121 |
}
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
public function getContinueShoppingUrl()
|
124 |
{
|
125 |
$url = $this->getData('continue_shopping_url');
|
120 |
return $this->getUrl('checkout/onepage', array('_secure'=>true));
|
121 |
}
|
122 |
|
123 |
+
/**
|
124 |
+
* Return "cart" form action url
|
125 |
+
*
|
126 |
+
* @return string
|
127 |
+
*/
|
128 |
+
public function getFormActionUrl()
|
129 |
+
{
|
130 |
+
return $this->getUrl('checkout/cart/updatePost', array('_secure' => $this->_isSecure()));
|
131 |
+
}
|
132 |
+
|
133 |
public function getContinueShoppingUrl()
|
134 |
{
|
135 |
$url = $this->getData('continue_shopping_url');
|
app/code/core/Mage/Checkout/Block/Cart/Coupon.php
CHANGED
@@ -32,5 +32,14 @@ class Mage_Checkout_Block_Cart_Coupon extends Mage_Checkout_Block_Cart_Abstract
|
|
32 |
return $this->getQuote()->getCouponCode();
|
33 |
}
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
}
|
32 |
return $this->getQuote()->getCouponCode();
|
33 |
}
|
34 |
|
35 |
+
/**
|
36 |
+
* Return "discount" form action url
|
37 |
+
*
|
38 |
+
* @return string
|
39 |
+
*/
|
40 |
+
public function getFormActionUrl()
|
41 |
+
{
|
42 |
+
return $this->getUrl('checkout/cart/couponPost', array('_secure' => $this->_isSecure()));
|
43 |
+
}
|
44 |
|
45 |
}
|
app/code/core/Mage/Checkout/Block/Cart/Shipping.php
CHANGED
@@ -263,4 +263,24 @@ class Mage_Checkout_Block_Cart_Shipping extends Mage_Checkout_Block_Cart_Abstrac
|
|
263 |
}
|
264 |
return false;
|
265 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
}
|
263 |
}
|
264 |
return false;
|
265 |
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Return 'Estimate Shipping and Tax' form action url
|
269 |
+
*
|
270 |
+
* @return string
|
271 |
+
*/
|
272 |
+
public function getFormActionUrl()
|
273 |
+
{
|
274 |
+
return $this->getUrl('checkout/cart/estimatePost', array('_secure' => $this->_isSecure()));
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Return 'Update Estimate Shipping and Tax' form action url
|
279 |
+
*
|
280 |
+
* @return string
|
281 |
+
*/
|
282 |
+
public function getUpdateFormActionUrl()
|
283 |
+
{
|
284 |
+
return $this->getUrl('checkout/cart/estimateUpdatePost', array('_secure' => $this->_isSecure()));
|
285 |
+
}
|
286 |
}
|
app/code/core/Mage/Checkout/Block/Cart/Sidebar.php
CHANGED
@@ -307,4 +307,25 @@ class Mage_Checkout_Block_Cart_Sidebar extends Mage_Checkout_Block_Cart_Minicart
|
|
307 |
{
|
308 |
return Mage::getSingleton('core/session')->getFormKey();
|
309 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
}
|
307 |
{
|
308 |
return Mage::getSingleton('core/session')->getFormKey();
|
309 |
}
|
310 |
+
|
311 |
+
/**
|
312 |
+
* Processing block html after rendering
|
313 |
+
*
|
314 |
+
* @param string $html
|
315 |
+
* @return string
|
316 |
+
*/
|
317 |
+
protected function _afterToHtml($html)
|
318 |
+
{
|
319 |
+
$html = parent::_afterToHtml($html);
|
320 |
+
$transport = new Varien_Object();
|
321 |
+
$transport->setHtml($html);
|
322 |
+
Mage::dispatchEvent(
|
323 |
+
'checkout_block_cart_sidebar_aftertohtml',
|
324 |
+
array(
|
325 |
+
'block' => $this,
|
326 |
+
'transport' => $transport,
|
327 |
+
)
|
328 |
+
);
|
329 |
+
return $transport->getHtml();
|
330 |
+
}
|
331 |
}
|
app/code/core/Mage/Checkout/Block/Onepage/Billing.php
CHANGED
@@ -104,10 +104,13 @@ class Mage_Checkout_Block_Onepage_Billing extends Mage_Checkout_Block_Onepage_Ab
|
|
104 |
if (is_null($this->_address)) {
|
105 |
if ($this->isCustomerLoggedIn()) {
|
106 |
$this->_address = $this->getQuote()->getBillingAddress();
|
107 |
-
if(!$this->_address->getFirstname()) {
|
108 |
$this->_address->setFirstname($this->getQuote()->getCustomer()->getFirstname());
|
109 |
}
|
110 |
-
if(!$this->_address->
|
|
|
|
|
|
|
111 |
$this->_address->setLastname($this->getQuote()->getCustomer()->getLastname());
|
112 |
}
|
113 |
} else {
|
@@ -148,6 +151,21 @@ class Mage_Checkout_Block_Onepage_Billing extends Mage_Checkout_Block_Onepage_Ab
|
|
148 |
return $lastname;
|
149 |
}
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
/**
|
152 |
* Check is Quote items can ship to
|
153 |
*
|
104 |
if (is_null($this->_address)) {
|
105 |
if ($this->isCustomerLoggedIn()) {
|
106 |
$this->_address = $this->getQuote()->getBillingAddress();
|
107 |
+
if (!$this->_address->getFirstname()) {
|
108 |
$this->_address->setFirstname($this->getQuote()->getCustomer()->getFirstname());
|
109 |
}
|
110 |
+
if (!$this->_address->getMiddlename()) {
|
111 |
+
$this->_address->setMiddlename($this->getQuote()->getCustomer()->getMiddlename());
|
112 |
+
}
|
113 |
+
if (!$this->_address->getLastname()) {
|
114 |
$this->_address->setLastname($this->getQuote()->getCustomer()->getLastname());
|
115 |
}
|
116 |
} else {
|
151 |
return $lastname;
|
152 |
}
|
153 |
|
154 |
+
/**
|
155 |
+
* Return Customer Address Middle Name
|
156 |
+
* If Sales Quote Address Middle Name is not defined - return Customer Middle Name
|
157 |
+
*
|
158 |
+
* @return string | NULL
|
159 |
+
*/
|
160 |
+
public function getMiddlename()
|
161 |
+
{
|
162 |
+
$middlename = $this->getAddress()->getMiddlename();
|
163 |
+
if (empty($middlename) && $this->getQuote()->getCustomer()) {
|
164 |
+
return $this->getQuote()->getCustomer()->getMiddlename();
|
165 |
+
}
|
166 |
+
return $middlename;
|
167 |
+
}
|
168 |
+
|
169 |
/**
|
170 |
* Check is Quote items can ship to
|
171 |
*
|
app/code/core/Mage/Checkout/Helper/Data.php
CHANGED
@@ -231,19 +231,19 @@ class Mage_Checkout_Helper_Data extends Mage_Core_Helper_Abstract
|
|
231 |
Mage::getStoreConfig('checkout/payment_failed/identity', $checkout->getStoreId()),
|
232 |
$recipient['email'],
|
233 |
$recipient['name'],
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
);
|
248 |
}
|
249 |
|
231 |
Mage::getStoreConfig('checkout/payment_failed/identity', $checkout->getStoreId()),
|
232 |
$recipient['email'],
|
233 |
$recipient['name'],
|
234 |
+
array(
|
235 |
+
'reason' => $message,
|
236 |
+
'checkoutType' => $checkoutType,
|
237 |
+
'dateAndTime' => Mage::app()->getLocale()->date(),
|
238 |
+
'customer' => Mage::helper('customer')->getFullCustomerName($checkout),
|
239 |
+
'customerEmail' => $checkout->getCustomerEmail(),
|
240 |
+
'billingAddress' => $checkout->getBillingAddress(),
|
241 |
+
'shippingAddress' => $checkout->getShippingAddress(),
|
242 |
+
'shippingMethod' => Mage::getStoreConfig('carriers/' . $shippingMethod . '/title'),
|
243 |
+
'paymentMethod' => Mage::getStoreConfig('payment/' . $paymentMethod . '/title'),
|
244 |
+
'items' => nl2br($items),
|
245 |
+
'total' => $total,
|
246 |
+
)
|
247 |
);
|
248 |
}
|
249 |
|
app/code/core/Mage/Checkout/Model/Type/Onepage.php
CHANGED
@@ -137,12 +137,40 @@ class Mage_Checkout_Model_Type_Onepage
|
|
137 |
}
|
138 |
}
|
139 |
|
|
|
|
|
|
|
140 |
/**
|
141 |
* Reset multishipping flag before any manipulations with quote address
|
142 |
* addAddress method for quote object related on this flag
|
143 |
*/
|
144 |
if ($this->getQuote()->getIsMultiShipping()) {
|
145 |
$this->getQuote()->setIsMultiShipping(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
$this->getQuote()->save();
|
147 |
}
|
148 |
|
137 |
}
|
138 |
}
|
139 |
|
140 |
+
$quoteSave = false;
|
141 |
+
$collectTotals = false;
|
142 |
+
|
143 |
/**
|
144 |
* Reset multishipping flag before any manipulations with quote address
|
145 |
* addAddress method for quote object related on this flag
|
146 |
*/
|
147 |
if ($this->getQuote()->getIsMultiShipping()) {
|
148 |
$this->getQuote()->setIsMultiShipping(false);
|
149 |
+
$quoteSave = true;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Reset customer balance
|
154 |
+
*/
|
155 |
+
if ($this->getQuote()->getUseCustomerBalance()) {
|
156 |
+
$this->getQuote()->setUseCustomerBalance(false);
|
157 |
+
$quoteSave = true;
|
158 |
+
$collectTotals = true;
|
159 |
+
}
|
160 |
+
/**
|
161 |
+
* Reset reward points
|
162 |
+
*/
|
163 |
+
if ($this->getQuote()->getUseRewardPoints()) {
|
164 |
+
$this->getQuote()->setUseRewardPoints(false);
|
165 |
+
$quoteSave = true;
|
166 |
+
$collectTotals = true;
|
167 |
+
}
|
168 |
+
|
169 |
+
if ($collectTotals) {
|
170 |
+
$this->getQuote()->collectTotals();
|
171 |
+
}
|
172 |
+
|
173 |
+
if ($quoteSave) {
|
174 |
$this->getQuote()->save();
|
175 |
}
|
176 |
|
app/code/core/Mage/Checkout/controllers/CartController.php
CHANGED
@@ -616,6 +616,7 @@ class Mage_Checkout_CartController extends Mage_Core_Controller_Front_Action
|
|
616 |
|
617 |
$result['success'] = 1;
|
618 |
$result['message'] = $this->__('Item was removed successfully.');
|
|
|
619 |
} catch (Exception $e) {
|
620 |
$result['success'] = 0;
|
621 |
$result['error'] = $this->__('Can not remove the item.');
|
616 |
|
617 |
$result['success'] = 1;
|
618 |
$result['message'] = $this->__('Item was removed successfully.');
|
619 |
+
Mage::dispatchEvent('ajax_cart_remove_item_success', array('id' => $id));
|
620 |
} catch (Exception $e) {
|
621 |
$result['success'] = 0;
|
622 |
$result['error'] = $this->__('Can not remove the item.');
|
app/code/core/Mage/Checkout/controllers/MultishippingController.php
CHANGED
@@ -86,7 +86,7 @@ class Mage_Checkout_MultishippingController extends Mage_Checkout_Controller_Act
|
|
86 |
return $this;
|
87 |
}
|
88 |
|
89 |
-
$action = $this->getRequest()->getActionName();
|
90 |
|
91 |
$checkoutSessionQuote = $this->_getCheckoutSession()->getQuote();
|
92 |
/**
|
@@ -379,6 +379,29 @@ class Mage_Checkout_MultishippingController extends Mage_Checkout_Controller_Act
|
|
379 |
*/
|
380 |
public function billingAction()
|
381 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
382 |
if (!$this->_validateBilling()) {
|
383 |
return;
|
384 |
}
|
86 |
return $this;
|
87 |
}
|
88 |
|
89 |
+
$action = strtolower($this->getRequest()->getActionName());
|
90 |
|
91 |
$checkoutSessionQuote = $this->_getCheckoutSession()->getQuote();
|
92 |
/**
|
379 |
*/
|
380 |
public function billingAction()
|
381 |
{
|
382 |
+
$collectTotals = false;
|
383 |
+
$quote = $this->_getCheckoutSession()->getQuote();
|
384 |
+
|
385 |
+
/**
|
386 |
+
* Reset customer balance
|
387 |
+
*/
|
388 |
+
if ($quote->getUseCustomerBalance()) {
|
389 |
+
$quote->setUseCustomerBalance(false);
|
390 |
+
$collectTotals = true;
|
391 |
+
}
|
392 |
+
|
393 |
+
/**
|
394 |
+
* Reset reward points
|
395 |
+
*/
|
396 |
+
if ($quote->getUseRewardPoints()) {
|
397 |
+
$quote->setUseRewardPoints(false);
|
398 |
+
$collectTotals = true;
|
399 |
+
}
|
400 |
+
|
401 |
+
if ($collectTotals) {
|
402 |
+
$quote->collectTotals()->save();
|
403 |
+
}
|
404 |
+
|
405 |
if (!$this->_validateBilling()) {
|
406 |
return;
|
407 |
}
|
app/code/core/Mage/Checkout/etc/jstranslator.xml
CHANGED
@@ -39,8 +39,8 @@
|
|
39 |
<validate-payment-methods-not-available translate="message" module="checkout">
|
40 |
<message>Your order cannot be completed at this time as there is no payment methods available for it.</message>
|
41 |
</validate-payment-methods-not-available>
|
42 |
-
<validate-
|
43 |
<message>Please specify payment method.</message>
|
44 |
-
</validate-
|
45 |
<!-- end opcheckout.js -->
|
46 |
</jstranslator>
|
39 |
<validate-payment-methods-not-available translate="message" module="checkout">
|
40 |
<message>Your order cannot be completed at this time as there is no payment methods available for it.</message>
|
41 |
</validate-payment-methods-not-available>
|
42 |
+
<validate-payment-methods-required translate="message" module="checkout">
|
43 |
<message>Please specify payment method.</message>
|
44 |
+
</validate-payment-methods-required>
|
45 |
<!-- end opcheckout.js -->
|
46 |
</jstranslator>
|
app/code/core/Mage/Cms/Block/Block.php
CHANGED
@@ -34,6 +34,21 @@
|
|
34 |
*/
|
35 |
class Mage_Cms_Block_Block extends Mage_Core_Block_Abstract
|
36 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
/**
|
38 |
* Prepare Content HTML
|
39 |
*
|
34 |
*/
|
35 |
class Mage_Cms_Block_Block extends Mage_Core_Block_Abstract
|
36 |
{
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Initialize cache
|
40 |
+
*
|
41 |
+
* @return null
|
42 |
+
*/
|
43 |
+
protected function _construct()
|
44 |
+
{
|
45 |
+
/*
|
46 |
+
* setting cache to save the cms block
|
47 |
+
*/
|
48 |
+
$this->setCacheTags(array(Mage_Cms_Model_Block::CACHE_TAG));
|
49 |
+
$this->setCacheLifetime(false);
|
50 |
+
}
|
51 |
+
|
52 |
/**
|
53 |
* Prepare Content HTML
|
54 |
*
|
app/code/core/Mage/Cms/Block/Widget/Block.php
CHANGED
@@ -34,6 +34,21 @@
|
|
34 |
*/
|
35 |
class Mage_Cms_Block_Widget_Block extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface
|
36 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
/**
|
38 |
* Storage for used widgets
|
39 |
*
|
34 |
*/
|
35 |
class Mage_Cms_Block_Widget_Block extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface
|
36 |
{
|
37 |
+
/**
|
38 |
+
* Initialize cache
|
39 |
+
*
|
40 |
+
* @return null
|
41 |
+
*/
|
42 |
+
protected function _construct()
|
43 |
+
{
|
44 |
+
parent::_construct();
|
45 |
+
/*
|
46 |
+
* setting cache to save the cms block
|
47 |
+
*/
|
48 |
+
$this->setCacheTags(array(Mage_Cms_Model_Block::CACHE_TAG));
|
49 |
+
$this->setCacheLifetime(false);
|
50 |
+
}
|
51 |
+
|
52 |
/**
|
53 |
* Storage for used widgets
|
54 |
*
|
app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php
CHANGED
@@ -49,6 +49,11 @@ class Mage_Cms_Helper_Wysiwyg_Images extends Mage_Core_Helper_Abstract
|
|
49 |
*/
|
50 |
protected $_storeId = null;
|
51 |
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
/**
|
54 |
* Set a specified store ID value
|
@@ -68,8 +73,16 @@ class Mage_Cms_Helper_Wysiwyg_Images extends Mage_Core_Helper_Abstract
|
|
68 |
*/
|
69 |
public function getStorageRoot()
|
70 |
{
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
}
|
74 |
|
75 |
/**
|
@@ -79,7 +92,7 @@ class Mage_Cms_Helper_Wysiwyg_Images extends Mage_Core_Helper_Abstract
|
|
79 |
*/
|
80 |
public function getBaseUrl()
|
81 |
{
|
82 |
-
return Mage::getBaseUrl('media')
|
83 |
}
|
84 |
|
85 |
/**
|
@@ -199,7 +212,7 @@ class Mage_Cms_Helper_Wysiwyg_Images extends Mage_Core_Helper_Abstract
|
|
199 |
public function getCurrentPath()
|
200 |
{
|
201 |
if (!$this->_currentPath) {
|
202 |
-
$currentPath =
|
203 |
$node = $this->_getRequest()->getParam($this->getTreeNodeName());
|
204 |
if ($node) {
|
205 |
$path = realpath($this->convertIdToPath($node));
|
49 |
*/
|
50 |
protected $_storeId = null;
|
51 |
|
52 |
+
/**
|
53 |
+
* Image Storage root directory
|
54 |
+
* @var string
|
55 |
+
*/
|
56 |
+
protected $_storageRoot;
|
57 |
|
58 |
/**
|
59 |
* Set a specified store ID value
|
73 |
*/
|
74 |
public function getStorageRoot()
|
75 |
{
|
76 |
+
if (!$this->_storageRoot) {
|
77 |
+
$path = Mage::getConfig()->getOptions()->getMediaDir()
|
78 |
+
. DS . Mage_Cms_Model_Wysiwyg_Config::IMAGE_DIRECTORY;
|
79 |
+
$this->_storageRoot = realpath($path);
|
80 |
+
if (!$this->_storageRoot) {
|
81 |
+
$this->_storageRoot = $path;
|
82 |
+
}
|
83 |
+
$this->_storageRoot .= DS;
|
84 |
+
}
|
85 |
+
return $this->_storageRoot;
|
86 |
}
|
87 |
|
88 |
/**
|
92 |
*/
|
93 |
public function getBaseUrl()
|
94 |
{
|
95 |
+
return Mage::getBaseUrl('media');
|
96 |
}
|
97 |
|
98 |
/**
|
212 |
public function getCurrentPath()
|
213 |
{
|
214 |
if (!$this->_currentPath) {
|
215 |
+
$currentPath = $this->getStorageRoot();
|
216 |
$node = $this->_getRequest()->getParam($this->getTreeNodeName());
|
217 |
if ($node) {
|
218 |
$path = realpath($this->convertIdToPath($node));
|
app/code/core/Mage/Cms/Model/Resource/Page.php
CHANGED
@@ -249,7 +249,7 @@ class Mage_Cms_Model_Resource_Page extends Mage_Core_Model_Resource_Db_Abstract
|
|
249 |
*/
|
250 |
public function getIsUniquePageToStores(Mage_Core_Model_Abstract $object)
|
251 |
{
|
252 |
-
if (
|
253 |
$stores = array(Mage_Core_Model_App::ADMIN_STORE_ID);
|
254 |
} else {
|
255 |
$stores = (array)$object->getData('stores');
|
249 |
*/
|
250 |
public function getIsUniquePageToStores(Mage_Core_Model_Abstract $object)
|
251 |
{
|
252 |
+
if (!$object->hasStores()) {
|
253 |
$stores = array(Mage_Core_Model_App::ADMIN_STORE_ID);
|
254 |
} else {
|
255 |
$stores = (array)$object->getData('stores');
|
app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php
CHANGED
@@ -89,7 +89,7 @@ class Mage_Cms_Model_Wysiwyg_Images_Storage extends Varien_Object
|
|
89 |
foreach ($collection as $key => $value) {
|
90 |
$rootChildParts = explode(DIRECTORY_SEPARATOR, substr($value->getFilename(), $storageRootLength));
|
91 |
|
92 |
-
if (array_key_exists($rootChildParts
|
93 |
|| ($regExp && preg_match($regExp, $value->getFilename()))) {
|
94 |
$collection->removeItemByKey($key);
|
95 |
}
|
@@ -336,11 +336,14 @@ class Mage_Cms_Model_Wysiwyg_Images_Storage extends Varien_Object
|
|
336 |
$mediaRootDir = $this->getHelper()->getStorageRoot();
|
337 |
|
338 |
if (strpos($filePath, $mediaRootDir) === 0) {
|
339 |
-
$thumbSuffix = self::THUMBS_DIRECTORY_NAME . DS .
|
|
|
340 |
|
341 |
if (! $checkFile || is_readable($mediaRootDir . $thumbSuffix)) {
|
342 |
$randomIndex = '?rand=' . time();
|
343 |
-
|
|
|
|
|
344 |
}
|
345 |
}
|
346 |
|
89 |
foreach ($collection as $key => $value) {
|
90 |
$rootChildParts = explode(DIRECTORY_SEPARATOR, substr($value->getFilename(), $storageRootLength));
|
91 |
|
92 |
+
if (array_key_exists(end($rootChildParts), $conditions['plain'])
|
93 |
|| ($regExp && preg_match($regExp, $value->getFilename()))) {
|
94 |
$collection->removeItemByKey($key);
|
95 |
}
|
336 |
$mediaRootDir = $this->getHelper()->getStorageRoot();
|
337 |
|
338 |
if (strpos($filePath, $mediaRootDir) === 0) {
|
339 |
+
$thumbSuffix = self::THUMBS_DIRECTORY_NAME . DS . Mage_Cms_Model_Wysiwyg_Config::IMAGE_DIRECTORY
|
340 |
+
. DS . substr($filePath, strlen($mediaRootDir));
|
341 |
|
342 |
if (! $checkFile || is_readable($mediaRootDir . $thumbSuffix)) {
|
343 |
$randomIndex = '?rand=' . time();
|
344 |
+
$thumbUrl = $this->getHelper()->getBaseUrl() . Mage_Cms_Model_Wysiwyg_Config::IMAGE_DIRECTORY
|
345 |
+
. DS . $thumbSuffix;
|
346 |
+
return str_replace('\\', '/', $thumbUrl) . $randomIndex;
|
347 |
}
|
348 |
}
|
349 |
|
app/code/core/Mage/ConfigurableSwatches/Block/Catalog/Media/Js/Abstract.php
CHANGED
@@ -27,6 +27,13 @@ abstract class Mage_ConfigurableSwatches_Block_Catalog_Media_Js_Abstract extends
|
|
27 |
{
|
28 |
protected $_template = 'configurableswatches/catalog/media/js.phtml';
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
/**
|
31 |
* Get target product IDs
|
32 |
*
|
@@ -58,6 +65,7 @@ abstract class Mage_ConfigurableSwatches_Block_Catalog_Media_Js_Abstract extends
|
|
58 |
* Get image fallbacks by product as
|
59 |
* array(product ID => array( product => product, image_fallback => image fallback ) )
|
60 |
*
|
|
|
61 |
* @return array
|
62 |
*/
|
63 |
public function getProductImageFallbacks($keepFrame = null) {
|
@@ -69,12 +77,7 @@ abstract class Mage_ConfigurableSwatches_Block_Catalog_Media_Js_Abstract extends
|
|
69 |
$products = $this->getProducts();
|
70 |
|
71 |
if ($keepFrame === null) {
|
72 |
-
$
|
73 |
-
if ($listBlock && $listBlock->getMode() == 'grid') {
|
74 |
-
$keepFrame = true;
|
75 |
-
} else {
|
76 |
-
$keepFrame = false;
|
77 |
-
}
|
78 |
}
|
79 |
|
80 |
/* @var $product Mage_Catalog_Model_Product */
|
@@ -90,6 +93,25 @@ abstract class Mage_ConfigurableSwatches_Block_Catalog_Media_Js_Abstract extends
|
|
90 |
return $fallbacks;
|
91 |
}
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
/**
|
94 |
* Get image type to pass to configurable media image JS
|
95 |
*
|
27 |
{
|
28 |
protected $_template = 'configurableswatches/catalog/media/js.phtml';
|
29 |
|
30 |
+
/**
|
31 |
+
* A list of blocks that contain products. Used to get the current display mode (grid/list).
|
32 |
+
*
|
33 |
+
* @var array
|
34 |
+
*/
|
35 |
+
protected $_productListBlocks = array('product_list', 'search_result_list');
|
36 |
+
|
37 |
/**
|
38 |
* Get target product IDs
|
39 |
*
|
65 |
* Get image fallbacks by product as
|
66 |
* array(product ID => array( product => product, image_fallback => image fallback ) )
|
67 |
*
|
68 |
+
* @param null $keepFrame
|
69 |
* @return array
|
70 |
*/
|
71 |
public function getProductImageFallbacks($keepFrame = null) {
|
77 |
$products = $this->getProducts();
|
78 |
|
79 |
if ($keepFrame === null) {
|
80 |
+
$keepFrame = $this->isKeepFrame();
|
|
|
|
|
|
|
|
|
|
|
81 |
}
|
82 |
|
83 |
/* @var $product Mage_Catalog_Model_Product */
|
93 |
return $fallbacks;
|
94 |
}
|
95 |
|
96 |
+
/**
|
97 |
+
* Is need keep frame
|
98 |
+
*
|
99 |
+
* @return bool
|
100 |
+
*/
|
101 |
+
public function isKeepFrame()
|
102 |
+
{
|
103 |
+
$keepFrame = false;
|
104 |
+
foreach ($this->_productListBlocks as $blockName) {
|
105 |
+
$listBlock = $this->getLayout()->getBlock($blockName);
|
106 |
+
|
107 |
+
if ($listBlock && $listBlock->getMode() == 'grid') {
|
108 |
+
$keepFrame = true;
|
109 |
+
break;
|
110 |
+
}
|
111 |
+
}
|
112 |
+
return $keepFrame;
|
113 |
+
}
|
114 |
+
|
115 |
/**
|
116 |
* Get image type to pass to configurable media image JS
|
117 |
*
|
app/code/core/Mage/Connect/controllers/Adminhtml/Extension/LocalController.php
CHANGED
@@ -42,4 +42,14 @@ class Mage_Connect_Adminhtml_Extension_LocalController extends Mage_Adminhtml_Co
|
|
42 |
$url = Mage::getBaseUrl('web') . 'downloader/?return=' . urlencode(Mage::getUrl('adminhtml'));
|
43 |
$this->getResponse()->setRedirect($url);
|
44 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
42 |
$url = Mage::getBaseUrl('web') . 'downloader/?return=' . urlencode(Mage::getUrl('adminhtml'));
|
43 |
$this->getResponse()->setRedirect($url);
|
44 |
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Check is allowed access to action
|
48 |
+
*
|
49 |
+
* @return bool
|
50 |
+
*/
|
51 |
+
protected function _isAllowed()
|
52 |
+
{
|
53 |
+
return Mage::getSingleton('admin/session')->isAllowed('system/extensions/local');
|
54 |
+
}
|
55 |
}
|
app/code/core/Mage/Contacts/controllers/IndexController.php
CHANGED
@@ -52,7 +52,7 @@ class Mage_Contacts_IndexController extends Mage_Core_Controller_Front_Action
|
|
52 |
{
|
53 |
$this->loadLayout();
|
54 |
$this->getLayout()->getBlock('contactForm')
|
55 |
-
->setFormAction( Mage::getUrl('*/*/post') );
|
56 |
|
57 |
$this->_initLayoutMessages('customer/session');
|
58 |
$this->_initLayoutMessages('catalog/session');
|
52 |
{
|
53 |
$this->loadLayout();
|
54 |
$this->getLayout()->getBlock('contactForm')
|
55 |
+
->setFormAction( Mage::getUrl('*/*/post', array('_secure' => $this->getRequest()->isSecure())) );
|
56 |
|
57 |
$this->_initLayoutMessages('customer/session');
|
58 |
$this->_initLayoutMessages('catalog/session');
|
app/code/core/Mage/Core/Block/Abstract.php
CHANGED
@@ -1471,4 +1471,14 @@ abstract class Mage_Core_Block_Abstract extends Varien_Object
|
|
1471 |
}
|
1472 |
return $tags;
|
1473 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1474 |
}
|
1471 |
}
|
1472 |
return $tags;
|
1473 |
}
|
1474 |
+
|
1475 |
+
/**
|
1476 |
+
* Checks is request Url is secure
|
1477 |
+
*
|
1478 |
+
* @return bool
|
1479 |
+
*/
|
1480 |
+
protected function _isSecure()
|
1481 |
+
{
|
1482 |
+
return $this->_getApp()->getFrontController()->getRequest()->isSecure();
|
1483 |
+
}
|
1484 |
}
|
app/code/core/Mage/Core/Controller/Front/Action.php
CHANGED
@@ -38,6 +38,11 @@ class Mage_Core_Controller_Front_Action extends Mage_Core_Controller_Varien_Acti
|
|
38 |
*/
|
39 |
const SESSION_NAMESPACE = 'frontend';
|
40 |
|
|
|
|
|
|
|
|
|
|
|
41 |
/**
|
42 |
* Currently used area
|
43 |
*
|
@@ -159,4 +164,18 @@ class Mage_Core_Controller_Front_Action extends Mage_Core_Controller_Varien_Acti
|
|
159 |
}
|
160 |
return $this;
|
161 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
}
|
38 |
*/
|
39 |
const SESSION_NAMESPACE = 'frontend';
|
40 |
|
41 |
+
/**
|
42 |
+
* Add secret key to url config path
|
43 |
+
*/
|
44 |
+
const XML_CSRF_USE_FLAG_CONFIG_PATH = 'system/csrf/use_form_key';
|
45 |
+
|
46 |
/**
|
47 |
* Currently used area
|
48 |
*
|
164 |
}
|
165 |
return $this;
|
166 |
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Validate Form Key
|
170 |
+
*
|
171 |
+
* @return bool
|
172 |
+
*/
|
173 |
+
protected function _validateFormKey()
|
174 |
+
{
|
175 |
+
$validated = true;
|
176 |
+
if (Mage::getStoreConfigFlag(self::XML_CSRF_USE_FLAG_CONFIG_PATH)) {
|
177 |
+
$validated = parent::_validateFormKey();
|
178 |
+
}
|
179 |
+
return $validated;
|
180 |
+
}
|
181 |
}
|
app/code/core/Mage/Core/Controller/Varien/Router/Admin.php
CHANGED
@@ -129,4 +129,15 @@ class Mage_Core_Controller_Varien_Router_Admin extends Mage_Core_Controller_Vari
|
|
129 |
}
|
130 |
parent::collectRoutes($configArea, $useRouterName);
|
131 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
}
|
129 |
}
|
130 |
parent::collectRoutes($configArea, $useRouterName);
|
131 |
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Check if current controller instance is allowed in current router.
|
135 |
+
*
|
136 |
+
* @param Mage_Core_Controller_Varien_Action $controllerInstance
|
137 |
+
* @return boolean
|
138 |
+
*/
|
139 |
+
protected function _validateControllerInstance($controllerInstance)
|
140 |
+
{
|
141 |
+
return true;
|
142 |
+
}
|
143 |
}
|
app/code/core/Mage/Core/Controller/Varien/Router/Standard.php
CHANGED
@@ -201,6 +201,10 @@ class Mage_Core_Controller_Varien_Router_Standard extends Mage_Core_Controller_V
|
|
201 |
// instantiate controller class
|
202 |
$controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $front->getResponse());
|
203 |
|
|
|
|
|
|
|
|
|
204 |
if (!$controllerInstance->hasAction($action)) {
|
205 |
continue;
|
206 |
}
|
@@ -271,6 +275,17 @@ class Mage_Core_Controller_Varien_Router_Standard extends Mage_Core_Controller_V
|
|
271 |
return false;
|
272 |
}
|
273 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
/**
|
275 |
* Generating and validating class file name,
|
276 |
* class and if evrything ok do include if needed and return of class name
|
@@ -297,7 +312,6 @@ class Mage_Core_Controller_Varien_Router_Standard extends Mage_Core_Controller_V
|
|
297 |
return $controllerClassName;
|
298 |
}
|
299 |
|
300 |
-
|
301 |
/**
|
302 |
* @deprecated
|
303 |
* @see _includeControllerClass()
|
201 |
// instantiate controller class
|
202 |
$controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $front->getResponse());
|
203 |
|
204 |
+
if (!$this->_validateControllerInstance($controllerInstance)) {
|
205 |
+
continue;
|
206 |
+
}
|
207 |
+
|
208 |
if (!$controllerInstance->hasAction($action)) {
|
209 |
continue;
|
210 |
}
|
275 |
return false;
|
276 |
}
|
277 |
|
278 |
+
/**
|
279 |
+
* Check if current controller instance is allowed in current router.
|
280 |
+
*
|
281 |
+
* @param Mage_Core_Controller_Varien_Action $controllerInstance
|
282 |
+
* @return boolean
|
283 |
+
*/
|
284 |
+
protected function _validateControllerInstance($controllerInstance)
|
285 |
+
{
|
286 |
+
return $controllerInstance instanceof Mage_Core_Controller_Front_Action;
|
287 |
+
}
|
288 |
+
|
289 |
/**
|
290 |
* Generating and validating class file name,
|
291 |
* class and if evrything ok do include if needed and return of class name
|
312 |
return $controllerClassName;
|
313 |
}
|
314 |
|
|
|
315 |
/**
|
316 |
* @deprecated
|
317 |
* @see _includeControllerClass()
|
app/code/core/Mage/Core/Helper/Abstract.php
CHANGED
@@ -283,7 +283,7 @@ abstract class Mage_Core_Helper_Abstract
|
|
283 |
/**
|
284 |
* Escape quotes in java script
|
285 |
*
|
286 |
-
* @param
|
287 |
* @param string $quote
|
288 |
* @return mixed
|
289 |
*/
|
283 |
/**
|
284 |
* Escape quotes in java script
|
285 |
*
|
286 |
+
* @param mixed $data
|
287 |
* @param string $quote
|
288 |
* @return mixed
|
289 |
*/
|
app/code/core/Mage/Core/Helper/Http.php
CHANGED
@@ -146,7 +146,7 @@ class Mage_Core_Helper_Http extends Mage_Core_Helper_Abstract
|
|
146 |
return false;
|
147 |
}
|
148 |
|
149 |
-
return $ipToLong ?
|
150 |
}
|
151 |
|
152 |
/**
|
@@ -161,7 +161,7 @@ class Mage_Core_Helper_Http extends Mage_Core_Helper_Abstract
|
|
161 |
if (!$address) {
|
162 |
return false;
|
163 |
}
|
164 |
-
return $ipToLong ?
|
165 |
}
|
166 |
|
167 |
/**
|
146 |
return false;
|
147 |
}
|
148 |
|
149 |
+
return $ipToLong ? inet_pton($this->_remoteAddr) : $this->_remoteAddr;
|
150 |
}
|
151 |
|
152 |
/**
|
161 |
if (!$address) {
|
162 |
return false;
|
163 |
}
|
164 |
+
return $ipToLong ? inet_pton($address) : $address;
|
165 |
}
|
166 |
|
167 |
/**
|
app/code/core/Mage/Core/Helper/Url.php
CHANGED
@@ -168,4 +168,64 @@ class Mage_Core_Helper_Url extends Mage_Core_Helper_Abstract
|
|
168 |
{
|
169 |
return Mage::getSingleton($name, $arguments);
|
170 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
}
|
168 |
{
|
169 |
return Mage::getSingleton($name, $arguments);
|
170 |
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Retrieve encoding domain name in punycode
|
174 |
+
*
|
175 |
+
* @param string $url encode url to Punycode
|
176 |
+
* @return string
|
177 |
+
*/
|
178 |
+
public function encodePunycode($url)
|
179 |
+
{
|
180 |
+
$parsedUrl = parse_url($url);
|
181 |
+
if (!$this->_isPunycode($parsedUrl['host'])) {
|
182 |
+
if (function_exists('idn_to_ascii')) {
|
183 |
+
$host = idn_to_ascii($parsedUrl['host']);
|
184 |
+
} else {
|
185 |
+
$idn = new Net_IDNA2();
|
186 |
+
$host = $idn->encode($parsedUrl['host']);
|
187 |
+
}
|
188 |
+
return str_replace($parsedUrl['host'], $host, $url);
|
189 |
+
} else {
|
190 |
+
return $url;
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Retrieve decoding domain name from punycode
|
196 |
+
*
|
197 |
+
* @param string $url decode url from Punycode
|
198 |
+
* @return string
|
199 |
+
*/
|
200 |
+
public function decodePunycode($url)
|
201 |
+
{
|
202 |
+
$parsedUrl = parse_url($url);
|
203 |
+
if ($this->_isPunycode($parsedUrl['host'])) {
|
204 |
+
if (function_exists('idn_to_utf8')) {
|
205 |
+
$host = idn_to_utf8($parsedUrl['host']);
|
206 |
+
} else {
|
207 |
+
$idn = new Net_IDNA2();
|
208 |
+
$host = $idn->decode($parsedUrl['host']);
|
209 |
+
}
|
210 |
+
return str_replace($parsedUrl['host'], $host, $url);
|
211 |
+
} else {
|
212 |
+
return $url;
|
213 |
+
}
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Check domain name for IDN using ACE prefix http://tools.ietf.org/html/rfc3490#section-5
|
218 |
+
*
|
219 |
+
* @param string $host domain name
|
220 |
+
* @return boolean
|
221 |
+
*/
|
222 |
+
private function _isPunycode($host)
|
223 |
+
{
|
224 |
+
if (strpos($host, 'xn--') === 0 || strpos($host, '.xn--') !== false
|
225 |
+
|| strpos($host, 'XN--') === 0 || strpos($host, '.XN--') !== false
|
226 |
+
) {
|
227 |
+
return true;
|
228 |
+
}
|
229 |
+
return false;
|
230 |
+
}
|
231 |
}
|
app/code/core/Mage/Core/Model/App.php
CHANGED
@@ -240,6 +240,13 @@ class Mage_Core_Model_App
|
|
240 |
*/
|
241 |
protected $_isCacheLocked = null;
|
242 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
/**
|
244 |
* Constructor
|
245 |
*/
|
@@ -270,7 +277,11 @@ class Mage_Core_Model_App
|
|
270 |
$this->_config->init($options);
|
271 |
Varien_Profiler::stop('mage::app::init::config');
|
272 |
|
273 |
-
if (
|
|
|
|
|
|
|
|
|
274 |
$this->_initCurrentStore($code, $type);
|
275 |
$this->_initRequest();
|
276 |
}
|
@@ -684,7 +695,11 @@ class Mage_Core_Model_App
|
|
684 |
*/
|
685 |
public function isSingleStoreMode()
|
686 |
{
|
687 |
-
if (
|
|
|
|
|
|
|
|
|
688 |
return false;
|
689 |
}
|
690 |
return $this->_isSingleStore;
|
@@ -811,7 +826,11 @@ class Mage_Core_Model_App
|
|
811 |
*/
|
812 |
public function getStore($id = null)
|
813 |
{
|
814 |
-
if (
|
|
|
|
|
|
|
|
|
815 |
return $this->_getDefaultStore();
|
816 |
}
|
817 |
|
@@ -1458,9 +1477,6 @@ class Mage_Core_Model_App
|
|
1458 |
return $groups;
|
1459 |
}
|
1460 |
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
/**
|
1465 |
* Retrieve application installation flag
|
1466 |
*
|
240 |
*/
|
241 |
protected $_isCacheLocked = null;
|
242 |
|
243 |
+
/**
|
244 |
+
* Flag for Magento installation status
|
245 |
+
*
|
246 |
+
* @var null|bool
|
247 |
+
*/
|
248 |
+
protected $_isInstalled = null;
|
249 |
+
|
250 |
/**
|
251 |
* Constructor
|
252 |
*/
|
277 |
$this->_config->init($options);
|
278 |
Varien_Profiler::stop('mage::app::init::config');
|
279 |
|
280 |
+
if ($this->_isInstalled === null) {
|
281 |
+
$this->_isInstalled = Mage::isInstalled($options);
|
282 |
+
}
|
283 |
+
|
284 |
+
if ($this->_isInstalled) {
|
285 |
$this->_initCurrentStore($code, $type);
|
286 |
$this->_initRequest();
|
287 |
}
|
695 |
*/
|
696 |
public function isSingleStoreMode()
|
697 |
{
|
698 |
+
if ($this->_isInstalled === null) {
|
699 |
+
$this->_isInstalled = Mage::isInstalled();
|
700 |
+
}
|
701 |
+
|
702 |
+
if (!$this->_isInstalled) {
|
703 |
return false;
|
704 |
}
|
705 |
return $this->_isSingleStore;
|
826 |
*/
|
827 |
public function getStore($id = null)
|
828 |
{
|
829 |
+
if ($this->_isInstalled === null) {
|
830 |
+
$this->_isInstalled = Mage::isInstalled();
|
831 |
+
}
|
832 |
+
|
833 |
+
if (!$this->_isInstalled || $this->getUpdateMode()) {
|
834 |
return $this->_getDefaultStore();
|
835 |
}
|
836 |
|
1477 |
return $groups;
|
1478 |
}
|
1479 |
|
|
|
|
|
|
|
1480 |
/**
|
1481 |
* Retrieve application installation flag
|
1482 |
*
|
app/code/core/Mage/Core/Model/Email/Queue.php
CHANGED
@@ -44,8 +44,6 @@
|
|
44 |
*
|
45 |
* @category Mage
|
46 |
* @package Mage_Core
|
47 |
-
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
48 |
-
* @license http://www.magentocommerce.com/license/enterprise-edition
|
49 |
*/
|
50 |
class Mage_Core_Model_Email_Queue extends Mage_Core_Model_Abstract
|
51 |
{
|
44 |
*
|
45 |
* @category Mage
|
46 |
* @package Mage_Core
|
|
|
|
|
47 |
*/
|
48 |
class Mage_Core_Model_Email_Queue extends Mage_Core_Model_Abstract
|
49 |
{
|
app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php
CHANGED
@@ -564,7 +564,7 @@ abstract class Mage_Core_Model_Resource_Db_Collection_Abstract extends Varien_Da
|
|
564 |
$alias = $table;
|
565 |
}
|
566 |
|
567 |
-
if (!isset($this->_joinedTables[$
|
568 |
$this->getSelect()->join(
|
569 |
array($alias => $this->getTable($table)),
|
570 |
$cond,
|
564 |
$alias = $table;
|
565 |
}
|
566 |
|
567 |
+
if (!isset($this->_joinedTables[$alias])) {
|
568 |
$this->getSelect()->join(
|
569 |
array($alias => $this->getTable($table)),
|
570 |
$cond,
|
app/code/core/Mage/Core/Model/Store.php
CHANGED
@@ -773,10 +773,10 @@ class Mage_Core_Model_Store extends Mage_Core_Model_Abstract
|
|
773 |
if (!$secureBaseUrl) {
|
774 |
return false;
|
775 |
}
|
776 |
-
|
777 |
-
$
|
778 |
-
$port
|
779 |
-
$isSecure = ($
|
780 |
&& isset($_SERVER['SERVER_PORT'])
|
781 |
&& ($port == $_SERVER['SERVER_PORT']);
|
782 |
return $isSecure;
|
773 |
if (!$secureBaseUrl) {
|
774 |
return false;
|
775 |
}
|
776 |
+
$urlParts = parse_url($secureBaseUrl);
|
777 |
+
$scheme = isset($urlParts['scheme']) ? ':' . $urlParts['scheme'] : '';
|
778 |
+
$port = isset($urlParts['port']) ? ':' . $urlParts['port'] : '';
|
779 |
+
$isSecure = ($scheme == 'https')
|
780 |
&& isset($_SERVER['SERVER_PORT'])
|
781 |
&& ($port == $_SERVER['SERVER_PORT']);
|
782 |
return $isSecure;
|
app/code/core/Mage/Core/Model/Translate/Inline.php
CHANGED
@@ -382,13 +382,13 @@ class Mage_Core_Model_Translate_Inline
|
|
382 |
$attrRegExp = '#' . $this->_tokenRegex . '#S';
|
383 |
$trArr = $this->_getTranslateData($attrRegExp, $tagHtml, array($this, '_getAttributeLocation'));
|
384 |
if ($trArr) {
|
385 |
-
$transRegExp = '# translate=' . $quoteHtml . '\[([^'.preg_quote($quoteHtml).']*)]' . $quoteHtml . '#i';
|
386 |
if (preg_match($transRegExp, $tagHtml, $m)) {
|
387 |
$tagHtml = str_replace($m[0], '', $tagHtml); //remove tra
|
388 |
-
$trAttr = ' translate=' . $quoteHtml
|
389 |
. htmlspecialchars('[' . $m[1] . ',' . join(',', $trArr) . ']') . $quoteHtml;
|
390 |
} else {
|
391 |
-
$trAttr = ' translate=' . $quoteHtml
|
392 |
. htmlspecialchars('[' . join(',', $trArr) . ']') . $quoteHtml;
|
393 |
}
|
394 |
$tagHtml = substr_replace($tagHtml , $trAttr, strlen($tagMatch[1][0])+1, 1);
|
@@ -431,7 +431,7 @@ class Mage_Core_Model_Translate_Inline
|
|
431 |
protected function _applySpecialTagsFormat($tagHtml, $tagName, $trArr)
|
432 |
{
|
433 |
return $tagHtml . '<span class="translate-inline-' . $tagName
|
434 |
-
. '" translate='
|
435 |
. $this->_getHtmlQuote()
|
436 |
. htmlspecialchars('[' . join(',', $trArr) . ']')
|
437 |
. $this->_getHtmlQuote() . '>'
|
@@ -449,7 +449,7 @@ class Mage_Core_Model_Translate_Inline
|
|
449 |
protected function _applySimpleTagsFormat($tagHtml, $tagName, $trArr)
|
450 |
{
|
451 |
return substr($tagHtml, 0, strlen($tagName) + 1)
|
452 |
-
. ' translate='
|
453 |
. $this->_getHtmlQuote() . htmlspecialchars( '[' . join(',', $trArr) . ']')
|
454 |
. $this->_getHtmlQuote()
|
455 |
. substr($tagHtml, strlen($tagName) + 1);
|
@@ -562,7 +562,7 @@ class Mage_Core_Model_Translate_Inline
|
|
562 |
'scope' => $m[4][0],
|
563 |
));
|
564 |
|
565 |
-
$spanHtml = '<span translate=' . $quoteHtml . htmlspecialchars('[' . $tr . ']') . $quoteHtml
|
566 |
. '>' . $m[1][0] . '</span>';
|
567 |
$this->_content = substr_replace($this->_content, $spanHtml, $m[0][1], strlen($m[0][0]));
|
568 |
$next = $m[0][1] + strlen($spanHtml) - 1;
|
382 |
$attrRegExp = '#' . $this->_tokenRegex . '#S';
|
383 |
$trArr = $this->_getTranslateData($attrRegExp, $tagHtml, array($this, '_getAttributeLocation'));
|
384 |
if ($trArr) {
|
385 |
+
$transRegExp = '# data-translate=' . $quoteHtml . '\[([^'.preg_quote($quoteHtml).']*)]' . $quoteHtml . '#i';
|
386 |
if (preg_match($transRegExp, $tagHtml, $m)) {
|
387 |
$tagHtml = str_replace($m[0], '', $tagHtml); //remove tra
|
388 |
+
$trAttr = ' data-translate=' . $quoteHtml
|
389 |
. htmlspecialchars('[' . $m[1] . ',' . join(',', $trArr) . ']') . $quoteHtml;
|
390 |
} else {
|
391 |
+
$trAttr = ' data-translate=' . $quoteHtml
|
392 |
. htmlspecialchars('[' . join(',', $trArr) . ']') . $quoteHtml;
|
393 |
}
|
394 |
$tagHtml = substr_replace($tagHtml , $trAttr, strlen($tagMatch[1][0])+1, 1);
|
431 |
protected function _applySpecialTagsFormat($tagHtml, $tagName, $trArr)
|
432 |
{
|
433 |
return $tagHtml . '<span class="translate-inline-' . $tagName
|
434 |
+
. '" data-translate='
|
435 |
. $this->_getHtmlQuote()
|
436 |
. htmlspecialchars('[' . join(',', $trArr) . ']')
|
437 |
. $this->_getHtmlQuote() . '>'
|
449 |
protected function _applySimpleTagsFormat($tagHtml, $tagName, $trArr)
|
450 |
{
|
451 |
return substr($tagHtml, 0, strlen($tagName) + 1)
|
452 |
+
. ' data-translate='
|
453 |
. $this->_getHtmlQuote() . htmlspecialchars( '[' . join(',', $trArr) . ']')
|
454 |
. $this->_getHtmlQuote()
|
455 |
. substr($tagHtml, strlen($tagName) + 1);
|
562 |
'scope' => $m[4][0],
|
563 |
));
|
564 |
|
565 |
+
$spanHtml = '<span data-translate=' . $quoteHtml . htmlspecialchars('[' . $tr . ']') . $quoteHtml
|
566 |
. '>' . $m[1][0] . '</span>';
|
567 |
$this->_content = substr_replace($this->_content, $spanHtml, $m[0][1], strlen($m[0][0]));
|
568 |
$next = $m[0][1] + strlen($spanHtml) - 1;
|
app/code/core/Mage/Core/Model/Url.php
CHANGED
@@ -1141,8 +1141,12 @@ class Mage_Core_Model_Url extends Varien_Object
|
|
1141 |
*/
|
1142 |
public function sessionUrlVar($html)
|
1143 |
{
|
1144 |
-
|
1145 |
-
|
|
|
|
|
|
|
|
|
1146 |
}
|
1147 |
|
1148 |
/**
|
1141 |
*/
|
1142 |
public function sessionUrlVar($html)
|
1143 |
{
|
1144 |
+
if (strpos($html, '__SID') === false) {
|
1145 |
+
return $html;
|
1146 |
+
} else {
|
1147 |
+
return preg_replace_callback('#(\?|&|&)___SID=([SU])(&|&)?#',
|
1148 |
+
array($this, "sessionVarCallback"), $html);
|
1149 |
+
}
|
1150 |
}
|
1151 |
|
1152 |
/**
|
app/code/core/Mage/Core/Model/Url/Rewrite/Request.php
CHANGED
@@ -182,7 +182,12 @@ class Mage_Core_Model_Url_Rewrite_Request
|
|
182 |
*/
|
183 |
protected function _setStoreCodeCookie($storeCode)
|
184 |
{
|
185 |
-
$this->_app->
|
|
|
|
|
|
|
|
|
|
|
186 |
}
|
187 |
|
188 |
/**
|
182 |
*/
|
183 |
protected function _setStoreCodeCookie($storeCode)
|
184 |
{
|
185 |
+
$store = $this->_app->getStore($storeCode);
|
186 |
+
if ($store->getWebsite()->getDefaultStore()->getId() == $store->getId()) {
|
187 |
+
$this->_app->getCookie()->delete(Mage_Core_Model_Store::COOKIE_NAME);
|
188 |
+
} else {
|
189 |
+
$this->_app->getCookie()->set(Mage_Core_Model_Store::COOKIE_NAME, $storeCode, true);
|
190 |
+
}
|
191 |
}
|
192 |
|
193 |
/**
|
app/code/core/Mage/Core/etc/config.xml
CHANGED
@@ -306,6 +306,9 @@
|
|
306 |
</js>
|
307 |
</dev>
|
308 |
<system>
|
|
|
|
|
|
|
309 |
<smtp>
|
310 |
<disable>0</disable>
|
311 |
<host>localhost</host>
|
306 |
</js>
|
307 |
</dev>
|
308 |
<system>
|
309 |
+
<csrf>
|
310 |
+
<use_form_key>1</use_form_key>
|
311 |
+
</csrf>
|
312 |
<smtp>
|
313 |
<disable>0</disable>
|
314 |
<host>localhost</host>
|
app/code/core/Mage/Core/etc/system.xml
CHANGED
@@ -41,6 +41,29 @@
|
|
41 |
</advanced>
|
42 |
</tabs>
|
43 |
<sections>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
<!--<web_track translate="label" module="core">
|
45 |
<label>Web Tracking</label>
|
46 |
<frontend_type>text</frontend_type>
|
41 |
</advanced>
|
42 |
</tabs>
|
43 |
<sections>
|
44 |
+
<system>
|
45 |
+
<groups>
|
46 |
+
<csrf translate="label" module="core">
|
47 |
+
<label>CSRF protection</label>
|
48 |
+
<frontend_type>text</frontend_type>
|
49 |
+
<sort_order>0</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>1</show_in_store>
|
53 |
+
<fields>
|
54 |
+
<use_form_key translate="label">
|
55 |
+
<label>Add Secret Key To Url</label>
|
56 |
+
<frontend_type>select</frontend_type>
|
57 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
58 |
+
<sort_order>10</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>1</show_in_store>
|
62 |
+
</use_form_key>
|
63 |
+
</fields>
|
64 |
+
</csrf>
|
65 |
+
</groups>
|
66 |
+
</system>
|
67 |
<!--<web_track translate="label" module="core">
|
68 |
<label>Web Tracking</label>
|
69 |
<frontend_type>text</frontend_type>
|
app/code/core/Mage/Cron/Model/Observer.php
CHANGED
@@ -103,6 +103,7 @@ class Mage_Cron_Model_Observer
|
|
103 |
if (!$this->_pendingSchedules) {
|
104 |
$this->_pendingSchedules = Mage::getModel('cron/schedule')->getCollection()
|
105 |
->addFieldToFilter('status', Mage_Cron_Model_Schedule::STATUS_PENDING)
|
|
|
106 |
->load();
|
107 |
}
|
108 |
return $this->_pendingSchedules;
|
103 |
if (!$this->_pendingSchedules) {
|
104 |
$this->_pendingSchedules = Mage::getModel('cron/schedule')->getCollection()
|
105 |
->addFieldToFilter('status', Mage_Cron_Model_Schedule::STATUS_PENDING)
|
106 |
+
->orderByScheduledAt()
|
107 |
->load();
|
108 |
}
|
109 |
return $this->_pendingSchedules;
|
app/code/core/Mage/Cron/Model/Resource/Schedule/Collection.php
CHANGED
@@ -42,4 +42,16 @@ class Mage_Cron_Model_Resource_Schedule_Collection extends Mage_Core_Model_Resou
|
|
42 |
{
|
43 |
$this->_init('cron/schedule');
|
44 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
42 |
{
|
43 |
$this->_init('cron/schedule');
|
44 |
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Sort order by scheduled_at time
|
48 |
+
*
|
49 |
+
* @param string $dir
|
50 |
+
* @return Mage_Cron_Model_Resource_Schedule_Collection
|
51 |
+
*/
|
52 |
+
public function orderByScheduledAt($dir = self::SORT_ORDER_ASC)
|
53 |
+
{
|
54 |
+
$this->getSelect()->order('scheduled_at', $dir);
|
55 |
+
return $this;
|
56 |
+
}
|
57 |
}
|
app/code/core/Mage/Customer/Block/Account/Dashboard/Info.php
CHANGED
@@ -52,7 +52,9 @@ class Mage_Customer_Block_Account_Dashboard_Info extends Mage_Core_Block_Templat
|
|
52 |
public function getSubscriptionObject()
|
53 |
{
|
54 |
if(is_null($this->_subscription)) {
|
55 |
-
$this->_subscription = Mage::getModel('newsletter/subscriber')->loadByCustomer(
|
|
|
|
|
56 |
}
|
57 |
|
58 |
return $this->_subscription;
|
@@ -71,7 +73,7 @@ class Mage_Customer_Block_Account_Dashboard_Info extends Mage_Core_Block_Templat
|
|
71 |
/**
|
72 |
* Newsletter module availability
|
73 |
*
|
74 |
-
* @return
|
75 |
*/
|
76 |
public function isNewsletterEnabled()
|
77 |
{
|
52 |
public function getSubscriptionObject()
|
53 |
{
|
54 |
if(is_null($this->_subscription)) {
|
55 |
+
$this->_subscription = Mage::getModel('newsletter/subscriber')->loadByCustomer(
|
56 |
+
Mage::getSingleton('customer/session')->getCustomer()
|
57 |
+
);
|
58 |
}
|
59 |
|
60 |
return $this->_subscription;
|
73 |
/**
|
74 |
* Newsletter module availability
|
75 |
*
|
76 |
+
* @return boolean
|
77 |
*/
|
78 |
public function isNewsletterEnabled()
|
79 |
{
|
app/code/core/Mage/Customer/Helper/Data.php
CHANGED
@@ -148,6 +148,67 @@ class Mage_Customer_Helper_Data extends Mage_Core_Helper_Abstract
|
|
148 |
return $this->getCustomer();
|
149 |
}
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
/**
|
152 |
* Retrieve current customer name
|
153 |
*
|
148 |
return $this->getCustomer();
|
149 |
}
|
150 |
|
151 |
+
/**
|
152 |
+
* Retrieve full customer name from provided object
|
153 |
+
*
|
154 |
+
* @param Varien_Object $object
|
155 |
+
* @return string
|
156 |
+
*/
|
157 |
+
public function getFullCustomerName($object = null)
|
158 |
+
{
|
159 |
+
$name = '';
|
160 |
+
if (is_null($object)) {
|
161 |
+
$name = $this->getCustomerName();
|
162 |
+
} else {
|
163 |
+
$config = Mage::getSingleton('eav/config');
|
164 |
+
|
165 |
+
if (
|
166 |
+
$config->getAttribute('customer', 'prefix')->getIsVisible()
|
167 |
+
&& (
|
168 |
+
$object->getPrefix()
|
169 |
+
|| $object->getCustomerPrefix()
|
170 |
+
)
|
171 |
+
) {
|
172 |
+
$name .= ($object->getPrefix() ? $object->getPrefix() : $object->getCustomerPrefix()) . ' ';
|
173 |
+
}
|
174 |
+
|
175 |
+
$name .= $object->getFirstname() ? $object->getFirstname() : $object->getCustomerFirstname();
|
176 |
+
|
177 |
+
if ($config->getAttribute('customer', 'middlename')->getIsVisible()
|
178 |
+
&& (
|
179 |
+
$object->getMiddlename()
|
180 |
+
|| $object->getCustomerMiddlename()
|
181 |
+
)
|
182 |
+
) {
|
183 |
+
$name .= ' ' . (
|
184 |
+
$object->getMiddlename()
|
185 |
+
? $object->getMiddlename()
|
186 |
+
: $object->getCustomerMiddlename()
|
187 |
+
);
|
188 |
+
}
|
189 |
+
|
190 |
+
$name .= ' ' . (
|
191 |
+
$object->getLastname()
|
192 |
+
? $object->getLastname()
|
193 |
+
: $object->getCustomerLastname()
|
194 |
+
);
|
195 |
+
|
196 |
+
if ($config->getAttribute('customer', 'suffix')->getIsVisible()
|
197 |
+
&& (
|
198 |
+
$object->getSuffix()
|
199 |
+
|| $object->getCustomerSuffix()
|
200 |
+
)
|
201 |
+
) {
|
202 |
+
$name .= ' ' . (
|
203 |
+
$object->getSuffix()
|
204 |
+
? $object->getSuffix()
|
205 |
+
: $object->getCustomerSuffix()
|
206 |
+
);
|
207 |
+
}
|
208 |
+
}
|
209 |
+
return $name;
|
210 |
+
}
|
211 |
+
|
212 |
/**
|
213 |
* Retrieve current customer name
|
214 |
*
|
app/code/core/Mage/Customer/Model/Address/Abstract.php
CHANGED
@@ -367,9 +367,7 @@ class Mage_Customer_Model_Address_Abstract extends Mage_Core_Model_Abstract
|
|
367 |
|
368 |
$this->_basicCheck();
|
369 |
|
370 |
-
|
371 |
-
Mage::dispatchEvent('customer_address_validation_after', array('address' => $this));
|
372 |
-
}
|
373 |
|
374 |
$errors = $this->_getErrors();
|
375 |
|
367 |
|
368 |
$this->_basicCheck();
|
369 |
|
370 |
+
Mage::dispatchEvent('customer_address_validation_after', array('address' => $this));
|
|
|
|
|
371 |
|
372 |
$errors = $this->_getErrors();
|
373 |
|
app/code/core/Mage/Customer/Model/Customer.php
CHANGED
@@ -273,8 +273,11 @@ class Mage_Customer_Model_Customer extends Mage_Core_Model_Abstract
|
|
273 |
*/
|
274 |
public function getAddressById($addressId)
|
275 |
{
|
276 |
-
|
277 |
-
|
|
|
|
|
|
|
278 |
}
|
279 |
|
280 |
/**
|
@@ -685,7 +688,7 @@ class Mage_Customer_Model_Customer extends Mage_Core_Model_Abstract
|
|
685 |
*/
|
686 |
public function sendPasswordResetConfirmationEmail()
|
687 |
{
|
688 |
-
$storeId =
|
689 |
if (!$storeId) {
|
690 |
$storeId = $this->_getWebsiteStoreId();
|
691 |
}
|
273 |
*/
|
274 |
public function getAddressById($addressId)
|
275 |
{
|
276 |
+
$address = Mage::getModel('customer/address')->load($addressId);
|
277 |
+
if ($this->getId() == $address->getParentId()) {
|
278 |
+
return $address;
|
279 |
+
}
|
280 |
+
return Mage::getModel('customer/address');
|
281 |
}
|
282 |
|
283 |
/**
|
688 |
*/
|
689 |
public function sendPasswordResetConfirmationEmail()
|
690 |
{
|
691 |
+
$storeId = Mage::app()->getStore()->getId();
|
692 |
if (!$storeId) {
|
693 |
$storeId = $this->_getWebsiteStoreId();
|
694 |
}
|
app/code/core/Mage/Customer/Model/Resource/Setup.php
CHANGED
@@ -200,7 +200,7 @@ class Mage_Customer_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup
|
|
200 |
'input' => 'text',
|
201 |
'required' => false,
|
202 |
'sort_order' => 50,
|
203 |
-
'visible' =>
|
204 |
'system' => false,
|
205 |
'position' => 50,
|
206 |
),
|
@@ -359,7 +359,7 @@ class Mage_Customer_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup
|
|
359 |
'input' => 'text',
|
360 |
'required' => false,
|
361 |
'sort_order' => 30,
|
362 |
-
'visible' =>
|
363 |
'system' => false,
|
364 |
'position' => 30,
|
365 |
),
|
200 |
'input' => 'text',
|
201 |
'required' => false,
|
202 |
'sort_order' => 50,
|
203 |
+
'visible' => true,
|
204 |
'system' => false,
|
205 |
'position' => 50,
|
206 |
),
|
359 |
'input' => 'text',
|
360 |
'required' => false,
|
361 |
'sort_order' => 30,
|
362 |
+
'visible' => true,
|
363 |
'system' => false,
|
364 |
'position' => 30,
|
365 |
),
|
app/code/core/Mage/Customer/controllers/AccountController.php
CHANGED
@@ -228,9 +228,14 @@ class Mage_Customer_AccountController extends Mage_Core_Controller_Front_Action
|
|
228 |
*/
|
229 |
public function logoutAction()
|
230 |
{
|
231 |
-
$this->_getSession()
|
232 |
-
|
233 |
|
|
|
|
|
|
|
|
|
|
|
234 |
$this->_redirect('*/*/logoutSuccess');
|
235 |
}
|
236 |
|
228 |
*/
|
229 |
public function logoutAction()
|
230 |
{
|
231 |
+
$session = $this->_getSession();
|
232 |
+
$session->logout()->renewSession();
|
233 |
|
234 |
+
if (Mage::getStoreConfigFlag(Mage_Customer_Helper_Data::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD)) {
|
235 |
+
$session->setBeforeAuthUrl(Mage::getBaseUrl());
|
236 |
+
} else {
|
237 |
+
$session->setBeforeAuthUrl($this->_getRefererUrl());
|
238 |
+
}
|
239 |
$this->_redirect('*/*/logoutSuccess');
|
240 |
}
|
241 |
|
app/code/core/Mage/Customer/etc/config.xml
CHANGED
@@ -28,7 +28,7 @@
|
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_Customer>
|
31 |
-
<version>1.6.2.0.
|
32 |
</Mage_Customer>
|
33 |
</modules>
|
34 |
<admin>
|
@@ -526,7 +526,7 @@
|
|
526 |
<street_lines>2</street_lines>
|
527 |
<prefix_show/>
|
528 |
<prefix_options/>
|
529 |
-
<middlename_show
|
530 |
<suffix_show/>
|
531 |
<suffix_options/>
|
532 |
<dob_show/>
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_Customer>
|
31 |
+
<version>1.6.2.0.4</version>
|
32 |
</Mage_Customer>
|
33 |
</modules>
|
34 |
<admin>
|
526 |
<street_lines>2</street_lines>
|
527 |
<prefix_show/>
|
528 |
<prefix_options/>
|
529 |
+
<middlename_show>1</middlename_show>
|
530 |
<suffix_show/>
|
531 |
<suffix_options/>
|
532 |
<dob_show/>
|
app/code/core/Mage/Customer/sql/customer_setup/upgrade-1.6.2.0.3-1.6.2.0.4.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Customer
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/* @var $installer Mage_Customer_Model_Entity_Setup */
|
28 |
+
$installer = $this;
|
29 |
+
|
30 |
+
$middlenameAttributeCode = 'middlename';
|
31 |
+
|
32 |
+
$installer->addAttribute('customer', $middlenameAttributeCode, array(
|
33 |
+
'type' => 'varchar',
|
34 |
+
'label' => 'Middle Name/Initial',
|
35 |
+
'input' => 'text',
|
36 |
+
'required' => 0,
|
37 |
+
'sort_order' => 50,
|
38 |
+
'is_visible' => 1,
|
39 |
+
'is_system' => 0,
|
40 |
+
'position' => 50
|
41 |
+
));
|
42 |
+
|
43 |
+
$middlenameAttribute = Mage::getSingleton('eav/config')
|
44 |
+
->getAttribute('customer', $middlenameAttributeCode);
|
45 |
+
$middlenameAttribute->setData('used_in_forms', array(
|
46 |
+
'customer_account_create',
|
47 |
+
'customer_account_edit',
|
48 |
+
'checkout_register',
|
49 |
+
'adminhtml_customer',
|
50 |
+
'adminhtml_checkout'
|
51 |
+
));
|
52 |
+
$middlenameAttribute->save();
|
53 |
+
|
54 |
+
$installer->addAttribute('customer_address', $middlenameAttributeCode, array(
|
55 |
+
'type' => 'varchar',
|
56 |
+
'label' => 'Middle Name/Initial',
|
57 |
+
'input' => 'text',
|
58 |
+
'required' => 0,
|
59 |
+
'sort_order' => 30,
|
60 |
+
'is_visible' => 1,
|
61 |
+
'is_system' => 0,
|
62 |
+
'position' => 30
|
63 |
+
));
|
64 |
+
|
65 |
+
$middlenameAttribute = Mage::getSingleton('eav/config')
|
66 |
+
->getAttribute('customer_address', $middlenameAttributeCode);
|
67 |
+
$middlenameAttribute->setData('used_in_forms', array(
|
68 |
+
'adminhtml_customer_address',
|
69 |
+
'customer_address_edit',
|
70 |
+
'customer_register_address'
|
71 |
+
));
|
72 |
+
$middlenameAttribute->save();
|
app/code/core/Mage/Dataflow/Model/Convert/Iterator.php
CHANGED
@@ -51,19 +51,23 @@ class Mage_Dataflow_Model_Session_Adapter_Iterator extends Mage_Dataflow_Model_C
|
|
51 |
return '
|
52 |
<li>
|
53 |
<div style="position:relative">
|
54 |
-
<div id="progress_bar_'
|
|
|
|
|
55 |
<div>
|
56 |
-
'
|
57 |
-
'
|
58 |
-
|
59 |
-
'
|
|
|
|
|
60 |
</div>
|
61 |
</div>
|
62 |
</li>
|
63 |
<script type="text/javascript">
|
64 |
function updateProgress(sessionId, idx, time, memory) {
|
65 |
-
var total_rows = '
|
66 |
-
var elapsed_time = time-'.time().';
|
67 |
var total_time = Math.round(elapsed_time*total_rows/idx);
|
68 |
var eta = total_time-elapsed_time;
|
69 |
var eta_str = "";
|
@@ -71,22 +75,26 @@ function updateProgress(sessionId, idx, time, memory) {
|
|
71 |
var eta_minutes = Math.floor(eta/60)%60;
|
72 |
|
73 |
if (total_rows==idx) {
|
74 |
-
eta_str =
|
75 |
} else if (!eta_hours && !eta_minutes) {
|
76 |
-
eta_str =
|
77 |
} else {
|
78 |
if (eta_hours) {
|
79 |
-
eta_str += eta_hours+" "+(eta_hours>1 ?
|
|
|
|
|
80 |
}
|
81 |
if (eta_minutes) {
|
82 |
-
eta_str += eta_minutes+" "+(eta_minutes>1 ?
|
|
|
|
|
83 |
}
|
84 |
}
|
85 |
|
86 |
-
document.getElementById("records_processed_'
|
87 |
-
document.getElementById("finish_eta_'
|
88 |
-
document.getElementById("memory_'
|
89 |
-
document.getElementById("progress_bar_'
|
90 |
}
|
91 |
</script>';
|
92 |
}
|
@@ -94,8 +102,9 @@ function updateProgress(sessionId, idx, time, memory) {
|
|
94 |
public function updateProgress($args)
|
95 |
{
|
96 |
$memory = !empty($args['memory']) ? $args['memory'] : '';
|
97 |
-
echo '<script type="text/javascript">updateProgress("'
|
98 |
-
|
|
|
99 |
|
100 |
return array();
|
101 |
}
|
51 |
return '
|
52 |
<li>
|
53 |
<div style="position:relative">
|
54 |
+
<div id="progress_bar_' . $sessionId
|
55 |
+
. '" style="position:absolute;background:green;height:2px; width:0; top:-2px; left:-2px; overflow:hidden; ">
|
56 |
+
</div>
|
57 |
<div>
|
58 |
+
' . $this->__('Total records: %s', '<strong>' . $totalRows . '</strong>').',
|
59 |
+
' . $this->__('Processed records: %s', '<strong><span id="records_processed_'
|
60 |
+
. $sessionId . '">0</span></strong>') .',
|
61 |
+
' . $this->__('ETA: %s', '<strong><span id="finish_eta_' . $sessionId . '">N/A</span></strong>') . ',
|
62 |
+
' . $this->__('Memory Used: %s', '<strong><span id="memory_' . $sessionId . '">'
|
63 |
+
. memory_get_usage(true).'</span></strong>') . '
|
64 |
</div>
|
65 |
</div>
|
66 |
</li>
|
67 |
<script type="text/javascript">
|
68 |
function updateProgress(sessionId, idx, time, memory) {
|
69 |
+
var total_rows = ' . $totalRows . ';
|
70 |
+
var elapsed_time = time-' . time() . ';
|
71 |
var total_time = Math.round(elapsed_time*total_rows/idx);
|
72 |
var eta = total_time-elapsed_time;
|
73 |
var eta_str = "";
|
75 |
var eta_minutes = Math.floor(eta/60)%60;
|
76 |
|
77 |
if (total_rows==idx) {
|
78 |
+
eta_str = \'' . Mage::helper('core')->jsQuoteEscape($this->__('Done')) . ' \';
|
79 |
} else if (!eta_hours && !eta_minutes) {
|
80 |
+
eta_str = \'' . Mage::helper('core')->jsQuoteEscape($this->__('Less than a minute')) . '\';
|
81 |
} else {
|
82 |
if (eta_hours) {
|
83 |
+
eta_str += eta_hours+" "+(eta_hours>1 ? \''
|
84 |
+
. Mage::helper('core')->jsQuoteEscape($this->__('hours')) . '\' : \''
|
85 |
+
. Mage::helper('core')->jsQuoteEscape($this->__('hour')) . '\'");
|
86 |
}
|
87 |
if (eta_minutes) {
|
88 |
+
eta_str += eta_minutes+" "+(eta_minutes>1 ? \''
|
89 |
+
. Mage::helper('core')->jsQuoteEscape($this->__('minutes'))
|
90 |
+
. '\' : \'' . Mage::helper('core')->jsQuoteEscape($this->__('minute')) . '\');
|
91 |
}
|
92 |
}
|
93 |
|
94 |
+
document.getElementById("records_processed_' . $sessionId . '").innerHTML= idx;
|
95 |
+
document.getElementById("finish_eta_' . $sessionId . '").innerHTML = eta_str;
|
96 |
+
document.getElementById("memory_' . $sessionId . '").innerHTML = memory;
|
97 |
+
document.getElementById("progress_bar_' . $sessionId . '").style.width = (idx/total_rows*100)+"%";
|
98 |
}
|
99 |
</script>';
|
100 |
}
|
102 |
public function updateProgress($args)
|
103 |
{
|
104 |
$memory = !empty($args['memory']) ? $args['memory'] : '';
|
105 |
+
echo '<script type="text/javascript">updateProgress("'
|
106 |
+
. $args['row']['session_id'] . '", "' . $args['idx'] . '", "' . time() . '", "' . $memory . '");</script>';
|
107 |
+
echo '<li>' . $memory . '</li>';
|
108 |
|
109 |
return array();
|
110 |
}
|
app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php
CHANGED
@@ -266,6 +266,10 @@ class Mage_Dataflow_Model_Convert_Parser_Csv extends Mage_Dataflow_Model_Convert
|
|
266 |
$str = '';
|
267 |
|
268 |
foreach ($fields as $value) {
|
|
|
|
|
|
|
|
|
269 |
if (strpos($value, $delimiter) !== false ||
|
270 |
empty($enclosure) ||
|
271 |
strpos($value, $enclosure) !== false ||
|
266 |
$str = '';
|
267 |
|
268 |
foreach ($fields as $value) {
|
269 |
+
if (substr($value, 0, 1) === '=') {
|
270 |
+
$value = ' ' . $value;
|
271 |
+
}
|
272 |
+
|
273 |
if (strpos($value, $delimiter) !== false ||
|
274 |
empty($enclosure) ||
|
275 |
strpos($value, $enclosure) !== false ||
|
app/code/core/Mage/Directory/Model/Currency/Filter.php
CHANGED
@@ -72,7 +72,7 @@ class Mage_Directory_Model_Currency_Filter implements Zend_Filter_Interface
|
|
72 |
$value = Mage::app()->getLocale()->getNumber($value);
|
73 |
$value = Mage::app()->getStore()->roundPrice($this->_rate*$value);
|
74 |
//$value = round($value, 2);
|
75 |
-
$value = sprintf("%
|
76 |
return $this->_currency->toCurrency($value);
|
77 |
}
|
78 |
}
|
72 |
$value = Mage::app()->getLocale()->getNumber($value);
|
73 |
$value = Mage::app()->getStore()->roundPrice($this->_rate*$value);
|
74 |
//$value = round($value, 2);
|
75 |
+
$value = sprintf("%F", $value);
|
76 |
return $this->_currency->toCurrency($value);
|
77 |
}
|
78 |
}
|
app/code/core/Mage/Directory/data/directory_setup/data-upgrade-1.6.0.2-1.6.0.3.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Directory
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
28 |
+
$installer = $this;
|
29 |
+
|
30 |
+
$data = array(
|
31 |
+
array('directory/country_region', 'default_name'),
|
32 |
+
array('directory/country_region_name', 'name')
|
33 |
+
);
|
34 |
+
|
35 |
+
foreach ($data as $row) {
|
36 |
+
$installer->getConnection()->update(
|
37 |
+
$installer->getTable($row[0]),
|
38 |
+
array($row[1] => 'Vorarlberg'),
|
39 |
+
array($row[1] . ' = ?' => 'Voralberg')
|
40 |
+
);
|
41 |
+
}
|
app/code/core/Mage/Directory/etc/config.xml
CHANGED
@@ -28,7 +28,7 @@
|
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_Directory>
|
31 |
-
<version>1.6.0.
|
32 |
</Mage_Directory>
|
33 |
</modules>
|
34 |
<global>
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_Directory>
|
31 |
+
<version>1.6.0.3</version>
|
32 |
</Mage_Directory>
|
33 |
</modules>
|
34 |
<global>
|
app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php
CHANGED
@@ -135,15 +135,12 @@ class Mage_Downloadable_Block_Adminhtml_Catalog_Product_Edit_Tab_Downloadable_Li
|
|
135 |
/**
|
136 |
* Return true if price in website scope
|
137 |
*
|
|
|
138 |
* @return bool
|
139 |
*/
|
140 |
public function getIsPriceWebsiteScope()
|
141 |
{
|
142 |
-
|
143 |
-
if ($scope == Mage_Core_Model_Store::PRICE_SCOPE_WEBSITE) {
|
144 |
-
return true;
|
145 |
-
}
|
146 |
-
return false;
|
147 |
}
|
148 |
|
149 |
/**
|
@@ -155,7 +152,7 @@ class Mage_Downloadable_Block_Adminhtml_Catalog_Product_Edit_Tab_Downloadable_Li
|
|
155 |
{
|
156 |
$linkArr = array();
|
157 |
$links = $this->getProduct()->getTypeInstance(true)->getLinks($this->getProduct());
|
158 |
-
$priceWebsiteScope =
|
159 |
foreach ($links as $item) {
|
160 |
$tmpLinkItem = array(
|
161 |
'link_id' => $item->getId(),
|
135 |
/**
|
136 |
* Return true if price in website scope
|
137 |
*
|
138 |
+
* @deprecated since 1.14.2.0
|
139 |
* @return bool
|
140 |
*/
|
141 |
public function getIsPriceWebsiteScope()
|
142 |
{
|
143 |
+
return Mage::helper('downloadable')->getIsPriceWebsiteScope();
|
|
|
|
|
|
|
|
|
144 |
}
|
145 |
|
146 |
/**
|
152 |
{
|
153 |
$linkArr = array();
|
154 |
$links = $this->getProduct()->getTypeInstance(true)->getLinks($this->getProduct());
|
155 |
+
$priceWebsiteScope = Mage::helper('downloadable')->getIsPriceWebsiteScope();
|
156 |
foreach ($links as $item) {
|
157 |
$tmpLinkItem = array(
|
158 |
'link_id' => $item->getId(),
|
app/code/core/Mage/Downloadable/Helper/Data.php
CHANGED
@@ -48,8 +48,24 @@ class Mage_Downloadable_Helper_Data extends Mage_Core_Helper_Abstract
|
|
48 |
$shareable = (bool) $link->getIsShareable();
|
49 |
break;
|
50 |
case Mage_Downloadable_Model_Link::LINK_SHAREABLE_CONFIG:
|
51 |
-
$shareable = (bool) Mage::getStoreConfigFlag(
|
|
|
|
|
52 |
}
|
53 |
return $shareable;
|
54 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
48 |
$shareable = (bool) $link->getIsShareable();
|
49 |
break;
|
50 |
case Mage_Downloadable_Model_Link::LINK_SHAREABLE_CONFIG:
|
51 |
+
$shareable = (bool) Mage::getStoreConfigFlag(
|
52 |
+
Mage_Downloadable_Model_Link::XML_PATH_CONFIG_IS_SHAREABLE
|
53 |
+
);
|
54 |
}
|
55 |
return $shareable;
|
56 |
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Return true if price in website scope
|
60 |
+
*
|
61 |
+
* @return bool
|
62 |
+
*/
|
63 |
+
public function getIsPriceWebsiteScope()
|
64 |
+
{
|
65 |
+
$scope = (int) Mage::app()->getStore()->getConfig(Mage_Core_Model_Store::XML_PATH_PRICE_SCOPE);
|
66 |
+
if ($scope == Mage_Core_Model_Store::PRICE_SCOPE_WEBSITE) {
|
67 |
+
return true;
|
68 |
+
}
|
69 |
+
return false;
|
70 |
+
}
|
71 |
}
|
app/code/core/Mage/Downloadable/Helper/Download.php
CHANGED
@@ -93,19 +93,29 @@ class Mage_Downloadable_Helper_Download extends Mage_Core_Helper_Abstract
|
|
93 |
|
94 |
if (is_null($this->_handle)) {
|
95 |
if ($this->_linkType == self::LINK_TYPE_URL) {
|
96 |
-
$port = 80;
|
97 |
|
98 |
/**
|
99 |
* Validate URL
|
100 |
*/
|
101 |
$urlProp = parse_url($this->_resourceFile);
|
102 |
-
if (!isset($urlProp['scheme'])
|
|
|
103 |
Mage::throwException(Mage::helper('downloadable')->__('Invalid download URL scheme.'));
|
104 |
}
|
105 |
if (!isset($urlProp['host'])) {
|
106 |
Mage::throwException(Mage::helper('downloadable')->__('Invalid download URL host.'));
|
107 |
}
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
if (isset($urlProp['port'])) {
|
111 |
$port = (int)$urlProp['port'];
|
@@ -132,7 +142,7 @@ class Mage_Downloadable_Helper_Download extends Mage_Core_Helper_Abstract
|
|
132 |
}
|
133 |
|
134 |
$headers = 'GET ' . $path . $query . ' HTTP/1.0' . "\r\n"
|
135 |
-
. 'Host: ' . $
|
136 |
. 'User-Agent: Magento ver/' . Mage::getVersion() . "\r\n"
|
137 |
. 'Connection: close' . "\r\n"
|
138 |
. "\r\n";
|
93 |
|
94 |
if (is_null($this->_handle)) {
|
95 |
if ($this->_linkType == self::LINK_TYPE_URL) {
|
|
|
96 |
|
97 |
/**
|
98 |
* Validate URL
|
99 |
*/
|
100 |
$urlProp = parse_url($this->_resourceFile);
|
101 |
+
if (!isset($urlProp['scheme'])
|
102 |
+
|| strtolower($urlProp['scheme'] != 'http') && strtolower($urlProp['scheme'] != 'https')) {
|
103 |
Mage::throwException(Mage::helper('downloadable')->__('Invalid download URL scheme.'));
|
104 |
}
|
105 |
if (!isset($urlProp['host'])) {
|
106 |
Mage::throwException(Mage::helper('downloadable')->__('Invalid download URL host.'));
|
107 |
}
|
108 |
+
switch ($urlProp['scheme']) {
|
109 |
+
case 'https':
|
110 |
+
$scheme = 'ssl://';
|
111 |
+
$port = 443;
|
112 |
+
break;
|
113 |
+
case 'http':
|
114 |
+
default:
|
115 |
+
$scheme = '';
|
116 |
+
$port = 80;
|
117 |
+
}
|
118 |
+
$hostname = $scheme . $urlProp['host'];
|
119 |
|
120 |
if (isset($urlProp['port'])) {
|
121 |
$port = (int)$urlProp['port'];
|
142 |
}
|
143 |
|
144 |
$headers = 'GET ' . $path . $query . ' HTTP/1.0' . "\r\n"
|
145 |
+
. 'Host: ' . $urlProp['host'] . "\r\n"
|
146 |
. 'User-Agent: Magento ver/' . Mage::getVersion() . "\r\n"
|
147 |
. 'Connection: close' . "\r\n"
|
148 |
. "\r\n";
|
app/code/core/Mage/Downloadable/Model/Link/Api.php
CHANGED
@@ -155,6 +155,7 @@ class Mage_Downloadable_Model_Link_Api extends Mage_Catalog_Model_Api_Resource
|
|
155 |
|
156 |
$linkArr = array();
|
157 |
$links = $product->getTypeInstance(true)->getLinks($product);
|
|
|
158 |
foreach ($links as $item) {
|
159 |
$tmpLinkItem = array(
|
160 |
'link_id' => $item->getId(),
|
@@ -205,7 +206,7 @@ class Mage_Downloadable_Model_Link_Api extends Mage_Catalog_Model_Api_Resource
|
|
205 |
if ($product->getStoreId() && $item->getStoreTitle()) {
|
206 |
$tmpLinkItem['store_title'] = $item->getStoreTitle();
|
207 |
}
|
208 |
-
if ($product->getStoreId() &&
|
209 |
$tmpLinkItem['website_price'] = $item->getWebsitePrice();
|
210 |
}
|
211 |
$linkArr[] = $tmpLinkItem;
|
155 |
|
156 |
$linkArr = array();
|
157 |
$links = $product->getTypeInstance(true)->getLinks($product);
|
158 |
+
$downloadHelper = Mage::helper('downloadable');
|
159 |
foreach ($links as $item) {
|
160 |
$tmpLinkItem = array(
|
161 |
'link_id' => $item->getId(),
|
206 |
if ($product->getStoreId() && $item->getStoreTitle()) {
|
207 |
$tmpLinkItem['store_title'] = $item->getStoreTitle();
|
208 |
}
|
209 |
+
if ($product->getStoreId() && $downloadHelper->getIsPriceWebsiteScope()) {
|
210 |
$tmpLinkItem['website_price'] = $item->getWebsitePrice();
|
211 |
}
|
212 |
$linkArr[] = $tmpLinkItem;
|
app/code/core/Mage/Eav/Model/Entity/Abstract.php
CHANGED
@@ -1306,6 +1306,9 @@ abstract class Mage_Eav_Model_Entity_Abstract extends Mage_Core_Model_Resource_A
|
|
1306 |
*/
|
1307 |
protected function _processSaveData($saveData)
|
1308 |
{
|
|
|
|
|
|
|
1309 |
extract($saveData);
|
1310 |
/**
|
1311 |
* Import variables into the current symbol table from save data array
|
@@ -1458,18 +1461,24 @@ abstract class Mage_Eav_Model_Entity_Abstract extends Mage_Core_Model_Resource_A
|
|
1458 |
*/
|
1459 |
protected function _processAttributeValues()
|
1460 |
{
|
1461 |
-
|
1462 |
-
|
1463 |
-
$
|
1464 |
-
|
|
|
1465 |
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
|
|
|
|
|
|
|
|
|
|
1473 |
|
1474 |
return $this;
|
1475 |
}
|
@@ -1532,6 +1541,9 @@ abstract class Mage_Eav_Model_Entity_Abstract extends Mage_Core_Model_Resource_A
|
|
1532 |
*/
|
1533 |
public function saveAttribute(Varien_Object $object, $attributeCode)
|
1534 |
{
|
|
|
|
|
|
|
1535 |
$attribute = $this->getAttribute($attributeCode);
|
1536 |
$backend = $attribute->getBackend();
|
1537 |
$table = $backend->getTable();
|
1306 |
*/
|
1307 |
protected function _processSaveData($saveData)
|
1308 |
{
|
1309 |
+
$this->_attributeValuesToSave = array();
|
1310 |
+
$this->_attributeValuesToDelete = array();
|
1311 |
+
|
1312 |
extract($saveData);
|
1313 |
/**
|
1314 |
* Import variables into the current symbol table from save data array
|
1461 |
*/
|
1462 |
protected function _processAttributeValues()
|
1463 |
{
|
1464 |
+
try {
|
1465 |
+
$adapter = $this->_getWriteAdapter();
|
1466 |
+
foreach ($this->_attributeValuesToSave as $table => $data) {
|
1467 |
+
$adapter->insertOnDuplicate($table, $data, array('value'));
|
1468 |
+
}
|
1469 |
|
1470 |
+
foreach ($this->_attributeValuesToDelete as $table => $valueIds) {
|
1471 |
+
$adapter->delete($table, array('value_id IN (?)' => $valueIds));
|
1472 |
+
}
|
1473 |
|
1474 |
+
// reset data arrays
|
1475 |
+
$this->_attributeValuesToSave = array();
|
1476 |
+
$this->_attributeValuesToDelete = array();
|
1477 |
+
} catch (Exception $e) {
|
1478 |
+
$this->_attributeValuesToSave = array();
|
1479 |
+
$this->_attributeValuesToDelete = array();
|
1480 |
+
throw $e;
|
1481 |
+
}
|
1482 |
|
1483 |
return $this;
|
1484 |
}
|
1541 |
*/
|
1542 |
public function saveAttribute(Varien_Object $object, $attributeCode)
|
1543 |
{
|
1544 |
+
$this->_attributeValuesToSave = array();
|
1545 |
+
$this->_attributeValuesToDelete = array();
|
1546 |
+
|
1547 |
$attribute = $this->getAttribute($attributeCode);
|
1548 |
$backend = $attribute->getBackend();
|
1549 |
$table = $backend->getTable();
|
app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php
CHANGED
@@ -697,6 +697,10 @@ abstract class Mage_Eav_Model_Entity_Attribute_Abstract extends Mage_Core_Model_
|
|
697 |
$condition = $condition || $this->getIsFilterable();
|
698 |
}
|
699 |
|
|
|
|
|
|
|
|
|
700 |
if ($condition) {
|
701 |
if ($this->usesSource() && $this->getBackendType() != self::TYPE_STATIC) {
|
702 |
return $this->getSource()->getFlatIndexes();
|
697 |
$condition = $condition || $this->getIsFilterable();
|
698 |
}
|
699 |
|
700 |
+
if ($this->getAttributeCode() == 'status') {
|
701 |
+
$condition = true;
|
702 |
+
}
|
703 |
+
|
704 |
if ($condition) {
|
705 |
if ($this->usesSource() && $this->getBackendType() != self::TYPE_STATIC) {
|
706 |
return $this->getSource()->getFlatIndexes();
|
app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php
CHANGED
@@ -41,7 +41,8 @@ class Mage_Eav_Model_Entity_Attribute_Backend_Time_Created extends Mage_Eav_Mode
|
|
41 |
*/
|
42 |
protected function _getFormat($date)
|
43 |
{
|
44 |
-
if (is_string($date) && preg_match('#^\d{4,4}-\d{2,2}-\d{2,2}
|
|
|
45 |
return 'yyyy-MM-dd HH:mm:ss';
|
46 |
}
|
47 |
return null;
|
41 |
*/
|
42 |
protected function _getFormat($date)
|
43 |
{
|
44 |
+
if (is_string($date) && preg_match('#^\d{4,4}-\d{2,2}-\d{2,2}\s\d{2,2}:\d{2,2}:\d{2,2}$#', $date)
|
45 |
+
|| preg_match('#^\d{4,4}-\d{2,2}-\d{2,2}\w{1,1}\d{2,2}:\d{2,2}:\d{2,2}[+-]\d{2,2}:\d{2,2}$#', $date)) {
|
46 |
return 'yyyy-MM-dd HH:mm:ss';
|
47 |
}
|
48 |
return null;
|
app/code/core/Mage/Eav/Model/Resource/Entity/Attribute/Collection.php
CHANGED
@@ -134,7 +134,7 @@ class Mage_Eav_Model_Resource_Entity_Attribute_Collection extends Mage_Core_Mode
|
|
134 |
'entity_attribute.attribute_id = main_table.attribute_id'
|
135 |
);
|
136 |
$this->addFieldToFilter('entity_attribute.attribute_set_id', $setId);
|
137 |
-
$this->setOrder('sort_order', self::SORT_ORDER_ASC);
|
138 |
}
|
139 |
|
140 |
return $this;
|
@@ -156,7 +156,7 @@ class Mage_Eav_Model_Resource_Entity_Attribute_Collection extends Mage_Core_Mode
|
|
156 |
'attribute_id'
|
157 |
);
|
158 |
$this->addFieldToFilter('entity_attribute.attribute_set_id', array('in' => $setIds));
|
159 |
-
$this->setOrder('sort_order', self::SORT_ORDER_ASC);
|
160 |
|
161 |
return $this;
|
162 |
}
|
@@ -203,7 +203,7 @@ class Mage_Eav_Model_Resource_Entity_Attribute_Collection extends Mage_Core_Mode
|
|
203 |
'entity_attribute.attribute_id = main_table.attribute_id'
|
204 |
);
|
205 |
$this->addFieldToFilter('entity_attribute.attribute_set_id', array('neq' => $setId));
|
206 |
-
$this->setOrder('sort_order', self::SORT_ORDER_ASC);
|
207 |
|
208 |
return $this;
|
209 |
}
|
@@ -232,7 +232,7 @@ class Mage_Eav_Model_Resource_Entity_Attribute_Collection extends Mage_Core_Mode
|
|
232 |
'entity_attribute.attribute_id = main_table.attribute_id'
|
233 |
);
|
234 |
$this->addFieldToFilter('entity_attribute.attribute_group_id', $groupId);
|
235 |
-
$this->setOrder('sort_order', self::SORT_ORDER_ASC);
|
236 |
|
237 |
return $this;
|
238 |
}
|
134 |
'entity_attribute.attribute_id = main_table.attribute_id'
|
135 |
);
|
136 |
$this->addFieldToFilter('entity_attribute.attribute_set_id', $setId);
|
137 |
+
$this->setOrder('entity_attribute.sort_order', self::SORT_ORDER_ASC);
|
138 |
}
|
139 |
|
140 |
return $this;
|
156 |
'attribute_id'
|
157 |
);
|
158 |
$this->addFieldToFilter('entity_attribute.attribute_set_id', array('in' => $setIds));
|
159 |
+
$this->setOrder('entity_attribute.sort_order', self::SORT_ORDER_ASC);
|
160 |
|
161 |
return $this;
|
162 |
}
|
203 |
'entity_attribute.attribute_id = main_table.attribute_id'
|
204 |
);
|
205 |
$this->addFieldToFilter('entity_attribute.attribute_set_id', array('neq' => $setId));
|
206 |
+
$this->setOrder('entity_attribute.sort_order', self::SORT_ORDER_ASC);
|
207 |
|
208 |
return $this;
|
209 |
}
|
232 |
'entity_attribute.attribute_id = main_table.attribute_id'
|
233 |
);
|
234 |
$this->addFieldToFilter('entity_attribute.attribute_group_id', $groupId);
|
235 |
+
$this->setOrder('entity_attribute.sort_order', self::SORT_ORDER_ASC);
|
236 |
|
237 |
return $this;
|
238 |
}
|
app/code/core/Mage/GoogleAnalytics/Block/Ga.php
CHANGED
@@ -275,6 +275,16 @@ _gaq.push(['_trackPageview'{$optPageURL}]);
|
|
275 |
return "_gaq.push (['_gat._anonymizeIp']);";
|
276 |
}
|
277 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
/**
|
279 |
* Render GA tracking scripts
|
280 |
*
|
@@ -282,7 +292,7 @@ _gaq.push(['_trackPageview'{$optPageURL}]);
|
|
282 |
*/
|
283 |
protected function _toHtml()
|
284 |
{
|
285 |
-
if (
|
286 |
return '';
|
287 |
}
|
288 |
return parent::_toHtml();
|
275 |
return "_gaq.push (['_gat._anonymizeIp']);";
|
276 |
}
|
277 |
|
278 |
+
/**
|
279 |
+
* Is ga available
|
280 |
+
*
|
281 |
+
* @return bool
|
282 |
+
*/
|
283 |
+
protected function _isAvailable()
|
284 |
+
{
|
285 |
+
return Mage::helper('googleanalytics')->isGoogleAnalyticsAvailable();
|
286 |
+
}
|
287 |
+
|
288 |
/**
|
289 |
* Render GA tracking scripts
|
290 |
*
|
292 |
*/
|
293 |
protected function _toHtml()
|
294 |
{
|
295 |
+
if (!$this->_isAvailable()) {
|
296 |
return '';
|
297 |
}
|
298 |
return parent::_toHtml();
|
app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Edit.php
CHANGED
@@ -63,7 +63,7 @@ class Mage_GoogleBase_Block_Adminhtml_Types_Edit extends Mage_Adminhtml_Block_Wi
|
|
63 |
$("select_target_country")
|
64 |
].flatten();
|
65 |
$(\'save_button\').disabled = true;
|
66 |
-
new Ajax.Updater("attributes_details", "'
|
67 |
{
|
68 |
parameters:Form.serializeElements(elements),
|
69 |
evalScripts:true,
|
@@ -81,7 +81,7 @@ class Mage_GoogleBase_Block_Adminhtml_Types_Edit extends Mage_Adminhtml_Block_Wi
|
|
81 |
$("select_itemtype"),
|
82 |
$("select_target_country")
|
83 |
].flatten();
|
84 |
-
new Ajax.Updater("gbase_itemtype_select", "'
|
85 |
{
|
86 |
parameters:Form.serializeElements(elements),
|
87 |
evalScripts:true,
|
@@ -92,7 +92,7 @@ class Mage_GoogleBase_Block_Adminhtml_Types_Edit extends Mage_Adminhtml_Block_Wi
|
|
92 |
}
|
93 |
);
|
94 |
|
95 |
-
new Ajax.Updater("attribute_set_select", "'
|
96 |
{
|
97 |
parameters:Form.serializeElements(elements),
|
98 |
evalScripts:true,
|
@@ -102,14 +102,14 @@ class Mage_GoogleBase_Block_Adminhtml_Types_Edit extends Mage_Adminhtml_Block_Wi
|
|
102 |
}
|
103 |
}
|
104 |
);
|
105 |
-
$("attributes_details").innerHTML = "' . $this->__('Please, select Attribute Set and Google Item Type to load attributes') . '";
|
106 |
}
|
107 |
},
|
108 |
|
109 |
confirmChanges: function() {
|
110 |
var blocksCount = Element.select($("attributes_details"), "div[id^=gbase_attribute_]").length;
|
111 |
if (blocksCount > 0
|
112 |
-
&& confirm(
|
113 |
|| blocksCount == 0
|
114 |
) {
|
115 |
return true;
|
63 |
$("select_target_country")
|
64 |
].flatten();
|
65 |
$(\'save_button\').disabled = true;
|
66 |
+
new Ajax.Updater("attributes_details", "' . $this->getUrl('*/*/loadAttributes') . '",
|
67 |
{
|
68 |
parameters:Form.serializeElements(elements),
|
69 |
evalScripts:true,
|
81 |
$("select_itemtype"),
|
82 |
$("select_target_country")
|
83 |
].flatten();
|
84 |
+
new Ajax.Updater("gbase_itemtype_select", "' . $this->getUrl('*/*/loadItemTypes') . '",
|
85 |
{
|
86 |
parameters:Form.serializeElements(elements),
|
87 |
evalScripts:true,
|
92 |
}
|
93 |
);
|
94 |
|
95 |
+
new Ajax.Updater("attribute_set_select", "' . $this->getUrl('*/*/loadAttributeSets') . '",
|
96 |
{
|
97 |
parameters:Form.serializeElements(elements),
|
98 |
evalScripts:true,
|
102 |
}
|
103 |
}
|
104 |
);
|
105 |
+
$("attributes_details").innerHTML = "' . Mage::helper('core')->jsQuoteEscape($this->__('Please, select Attribute Set and Google Item Type to load attributes')) . '";
|
106 |
}
|
107 |
},
|
108 |
|
109 |
confirmChanges: function() {
|
110 |
var blocksCount = Element.select($("attributes_details"), "div[id^=gbase_attribute_]").length;
|
111 |
if (blocksCount > 0
|
112 |
+
&& confirm(\'' . Mage::helper('core')->jsQuoteEscape($this->__('Current Mapping will be reloaded. Continue?')) .'\')
|
113 |
|| blocksCount == 0
|
114 |
) {
|
115 |
return true;
|
app/code/core/Mage/ImportExport/Model/Abstract.php
CHANGED
@@ -95,7 +95,7 @@ abstract class Mage_ImportExport_Model_Abstract extends Varien_Object
|
|
95 |
$dirPath = Mage::getBaseDir('var') . DS . self::LOG_DIRECTORY
|
96 |
. $dirName;
|
97 |
if (!is_dir($dirPath)) {
|
98 |
-
mkdir($dirPath,
|
99 |
}
|
100 |
$fileName = substr(strstr(self::LOG_DIRECTORY, DS), 1)
|
101 |
. $dirName . $fileName . '.log';
|
95 |
$dirPath = Mage::getBaseDir('var') . DS . self::LOG_DIRECTORY
|
96 |
. $dirName;
|
97 |
if (!is_dir($dirPath)) {
|
98 |
+
mkdir($dirPath, 0750, true);
|
99 |
}
|
100 |
$fileName = substr(strstr(self::LOG_DIRECTORY, DS), 1)
|
101 |
. $dirName . $fileName . '.log';
|
app/code/core/Mage/ImportExport/Model/Export/Adapter/Abstract.php
CHANGED
@@ -56,6 +56,8 @@ abstract class Mage_ImportExport_Model_Export_Adapter_Abstract
|
|
56 |
*/
|
57 |
final public function __construct($destination = null)
|
58 |
{
|
|
|
|
|
59 |
if (!$destination) {
|
60 |
$destination = tempnam(sys_get_temp_dir(), 'importexport_');
|
61 |
}
|
@@ -75,6 +77,13 @@ abstract class Mage_ImportExport_Model_Export_Adapter_Abstract
|
|
75 |
$this->_init();
|
76 |
}
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
/**
|
79 |
* Method called as last step of object instance creation. Can be overridden in child classes.
|
80 |
*
|
56 |
*/
|
57 |
final public function __construct($destination = null)
|
58 |
{
|
59 |
+
register_shutdown_function(array($this, 'destruct'));
|
60 |
+
|
61 |
if (!$destination) {
|
62 |
$destination = tempnam(sys_get_temp_dir(), 'importexport_');
|
63 |
}
|
77 |
$this->_init();
|
78 |
}
|
79 |
|
80 |
+
/**
|
81 |
+
* Destruct method on shutdown
|
82 |
+
*/
|
83 |
+
public function destruct()
|
84 |
+
{
|
85 |
+
}
|
86 |
+
|
87 |
/**
|
88 |
* Method called as last step of object instance creation. Can be overridden in child classes.
|
89 |
*
|
app/code/core/Mage/ImportExport/Model/Export/Adapter/Csv.php
CHANGED
@@ -55,11 +55,9 @@ class Mage_ImportExport_Model_Export_Adapter_Csv extends Mage_ImportExport_Model
|
|
55 |
protected $_fileHandler;
|
56 |
|
57 |
/**
|
58 |
-
*
|
59 |
-
*
|
60 |
-
* @return void
|
61 |
*/
|
62 |
-
public function
|
63 |
{
|
64 |
if (is_resource($this->_fileHandler)) {
|
65 |
fclose($this->_fileHandler);
|
@@ -109,9 +107,21 @@ class Mage_ImportExport_Model_Export_Adapter_Csv extends Mage_ImportExport_Model
|
|
109 |
if (null === $this->_headerCols) {
|
110 |
$this->setHeaderCols(array_keys($rowData));
|
111 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
fputcsv(
|
113 |
$this->_fileHandler,
|
114 |
-
|
115 |
$this->_delimiter,
|
116 |
$this->_enclosure
|
117 |
);
|
55 |
protected $_fileHandler;
|
56 |
|
57 |
/**
|
58 |
+
* Close file handler on shutdown
|
|
|
|
|
59 |
*/
|
60 |
+
public function destruct()
|
61 |
{
|
62 |
if (is_resource($this->_fileHandler)) {
|
63 |
fclose($this->_fileHandler);
|
107 |
if (null === $this->_headerCols) {
|
108 |
$this->setHeaderCols(array_keys($rowData));
|
109 |
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Security enchancement for CSV data processing by Excel-like applications.
|
113 |
+
* @see https://bugzilla.mozilla.org/show_bug.cgi?id=1054702
|
114 |
+
*/
|
115 |
+
$data = array_merge($this->_headerCols, array_intersect_key($rowData, $this->_headerCols));
|
116 |
+
foreach ($data as $key => $value) {
|
117 |
+
if (substr($value, 0, 1) === '=') {
|
118 |
+
$data[$key] = ' ' . $value;
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
fputcsv(
|
123 |
$this->_fileHandler,
|
124 |
+
$data,
|
125 |
$this->_delimiter,
|
126 |
$this->_enclosure
|
127 |
);
|
app/code/core/Mage/ImportExport/Model/Import/Adapter/Abstract.php
CHANGED
@@ -77,6 +77,8 @@ abstract class Mage_ImportExport_Model_Import_Adapter_Abstract implements Seekab
|
|
77 |
*/
|
78 |
final public function __construct($source)
|
79 |
{
|
|
|
|
|
80 |
if (!is_string($source)) {
|
81 |
Mage::throwException(Mage::helper('importexport')->__('Source file path must be a string'));
|
82 |
}
|
@@ -99,6 +101,13 @@ abstract class Mage_ImportExport_Model_Import_Adapter_Abstract implements Seekab
|
|
99 |
}
|
100 |
}
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
/**
|
103 |
* Method called as last step of object instance creation. Can be overridden in child classes.
|
104 |
*
|
77 |
*/
|
78 |
final public function __construct($source)
|
79 |
{
|
80 |
+
register_shutdown_function(array($this, 'destruct'));
|
81 |
+
|
82 |
if (!is_string($source)) {
|
83 |
Mage::throwException(Mage::helper('importexport')->__('Source file path must be a string'));
|
84 |
}
|
101 |
}
|
102 |
}
|
103 |
|
104 |
+
/**
|
105 |
+
* Destruct method on shutdown
|
106 |
+
*/
|
107 |
+
public function destruct()
|
108 |
+
{
|
109 |
+
}
|
110 |
+
|
111 |
/**
|
112 |
* Method called as last step of object instance creation. Can be overridden in child classes.
|
113 |
*
|
app/code/core/Mage/ImportExport/Model/Import/Adapter/Csv.php
CHANGED
@@ -55,11 +55,9 @@ class Mage_ImportExport_Model_Import_Adapter_Csv extends Mage_ImportExport_Model
|
|
55 |
protected $_fileHandler;
|
56 |
|
57 |
/**
|
58 |
-
*
|
59 |
-
*
|
60 |
-
* @return void
|
61 |
*/
|
62 |
-
public function
|
63 |
{
|
64 |
if (is_resource($this->_fileHandler)) {
|
65 |
fclose($this->_fileHandler);
|
55 |
protected $_fileHandler;
|
56 |
|
57 |
/**
|
58 |
+
* Close file handler on shutdown
|
|
|
|
|
59 |
*/
|
60 |
+
public function destruct()
|
61 |
{
|
62 |
if (is_resource($this->_fileHandler)) {
|
63 |
fclose($this->_fileHandler);
|
app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php
CHANGED
@@ -822,6 +822,7 @@ class Mage_ImportExport_Model_Import_Entity_Product extends Mage_ImportExport_Mo
|
|
822 |
'multiple' => true
|
823 |
);
|
824 |
|
|
|
825 |
while ($bunch = $this->_dataSourceModel->getNextBunch()) {
|
826 |
$customOptions = array(
|
827 |
'product_id' => array(),
|
@@ -961,10 +962,14 @@ class Mage_ImportExport_Model_Import_Entity_Product extends Mage_ImportExport_Mo
|
|
961 |
$customOptions[$titleTable][$prevOptionId][$storeId] = $rowData['_custom_option_title'];
|
962 |
}
|
963 |
}
|
964 |
-
|
|
|
|
|
|
|
|
|
965 |
$this->_connection->delete(
|
966 |
$optionTable,
|
967 |
-
$this->_connection->quoteInto('product_id IN (?)',
|
968 |
);
|
969 |
}
|
970 |
// if complex options does not contain values - ignore them
|
@@ -978,8 +983,6 @@ class Mage_ImportExport_Model_Import_Entity_Product extends Mage_ImportExport_Mo
|
|
978 |
|
979 |
if ($customOptions[$optionTable]) {
|
980 |
$this->_connection->insertMultiple($optionTable, $customOptions[$optionTable]);
|
981 |
-
} else {
|
982 |
-
continue; // nothing to save
|
983 |
}
|
984 |
$titleRows = array();
|
985 |
|
@@ -1038,13 +1041,23 @@ class Mage_ImportExport_Model_Import_Entity_Product extends Mage_ImportExport_Mo
|
|
1038 |
if ($optionTypeTitleRows) {
|
1039 |
$this->_connection->insertOnDuplicate($typeTitleTable, $optionTypeTitleRows, array('title'));
|
1040 |
}
|
1041 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1042 |
$this->_connection->insertOnDuplicate(
|
1043 |
$productTable,
|
1044 |
-
$
|
1045 |
array('has_options', 'required_options', 'updated_at')
|
1046 |
);
|
1047 |
}
|
|
|
|
|
1048 |
}
|
1049 |
return $this;
|
1050 |
}
|
@@ -1408,7 +1421,7 @@ class Mage_ImportExport_Model_Import_Entity_Product extends Mage_ImportExport_Mo
|
|
1408 |
}
|
1409 |
$rowData = $this->_productTypeModels[$productType]->prepareAttributesForSave(
|
1410 |
$rowData,
|
1411 |
-
!isset($this->_oldSku[$rowSku])
|
1412 |
);
|
1413 |
try {
|
1414 |
$attributes = $this->_prepareAttributes($rowData, $rowScope, $attributes, $rowSku, $rowStore);
|
822 |
'multiple' => true
|
823 |
);
|
824 |
|
825 |
+
$alreadyUsedProductIds = array();
|
826 |
while ($bunch = $this->_dataSourceModel->getNextBunch()) {
|
827 |
$customOptions = array(
|
828 |
'product_id' => array(),
|
962 |
$customOptions[$titleTable][$prevOptionId][$storeId] = $rowData['_custom_option_title'];
|
963 |
}
|
964 |
}
|
965 |
+
$productIds = array_keys($customOptions['product_id']);
|
966 |
+
$productIds = array_diff($productIds, $alreadyUsedProductIds);
|
967 |
+
if ($this->getBehavior() != Mage_ImportExport_Model_Import::BEHAVIOR_APPEND
|
968 |
+
&& !empty($productIds)
|
969 |
+
) { // remove old data?
|
970 |
$this->_connection->delete(
|
971 |
$optionTable,
|
972 |
+
$this->_connection->quoteInto('product_id IN (?)', $productIds)
|
973 |
);
|
974 |
}
|
975 |
// if complex options does not contain values - ignore them
|
983 |
|
984 |
if ($customOptions[$optionTable]) {
|
985 |
$this->_connection->insertMultiple($optionTable, $customOptions[$optionTable]);
|
|
|
|
|
986 |
}
|
987 |
$titleRows = array();
|
988 |
|
1041 |
if ($optionTypeTitleRows) {
|
1042 |
$this->_connection->insertOnDuplicate($typeTitleTable, $optionTypeTitleRows, array('title'));
|
1043 |
}
|
1044 |
+
|
1045 |
+
if ($productIds) { // update product entity table to show that product has options
|
1046 |
+
$customOptionsProducts = $customOptions['product_id'];
|
1047 |
+
|
1048 |
+
foreach ($customOptionsProducts as $key => $value) {
|
1049 |
+
if (!in_array($key, $productIds)) {
|
1050 |
+
unset($customOptionsProducts[$key]);
|
1051 |
+
}
|
1052 |
+
}
|
1053 |
$this->_connection->insertOnDuplicate(
|
1054 |
$productTable,
|
1055 |
+
$customOptionsProducts,
|
1056 |
array('has_options', 'required_options', 'updated_at')
|
1057 |
);
|
1058 |
}
|
1059 |
+
|
1060 |
+
$alreadyUsedProductIds = array_merge($alreadyUsedProductIds, $productIds);
|
1061 |
}
|
1062 |
return $this;
|
1063 |
}
|
1421 |
}
|
1422 |
$rowData = $this->_productTypeModels[$productType]->prepareAttributesForSave(
|
1423 |
$rowData,
|
1424 |
+
!isset($this->_oldSku[$rowSku]) && (self::SCOPE_DEFAULT == $rowScope)
|
1425 |
);
|
1426 |
try {
|
1427 |
$attributes = $this->_prepareAttributes($rowData, $rowScope, $attributes, $rowSku, $rowStore);
|
app/code/core/Mage/Install/Controller/Router/Install.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Install
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Mage_Install_Controller_Router_Install extends Mage_Core_Controller_Varien_Router_Standard
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* Check if current controller instance is allowed in current router.
|
31 |
+
*
|
32 |
+
* @param Mage_Core_Controller_Varien_Action $controllerInstance
|
33 |
+
* @return boolean
|
34 |
+
*/
|
35 |
+
protected function _validateControllerInstance($controllerInstance)
|
36 |
+
{
|
37 |
+
return $controllerInstance instanceof Mage_Install_Controller_Action;
|
38 |
+
}
|
39 |
+
}
|
app/code/core/Mage/Install/Model/Installer/Config.php
CHANGED
@@ -110,15 +110,10 @@ class Mage_Install_Model_Installer_Config extends Mage_Install_Model_Installer_A
|
|
110 |
|
111 |
public function getFormData()
|
112 |
{
|
113 |
-
$
|
114 |
-
|
115 |
-
$
|
116 |
-
|
117 |
-
$uri->setPort(null);
|
118 |
-
$baseSecureUrl = str_replace('http://', 'https://', $uri->getUri());
|
119 |
-
} else {
|
120 |
-
$baseSecureUrl = $uri->getUri();
|
121 |
-
}
|
122 |
|
123 |
$connectDefault = Mage::getConfig()
|
124 |
->getResourceConnectionConfig(Mage_Core_Model_Resource::DEFAULT_SETUP_RESOURCE);
|
110 |
|
111 |
public function getFormData()
|
112 |
{
|
113 |
+
$baseUrl = Mage::helper('core/url')->decodePunycode(Mage::getBaseUrl('web'));
|
114 |
+
$uri = explode(':', $baseUrl, 2);
|
115 |
+
$scheme = strtolower($uri[0]);
|
116 |
+
$baseSecureUrl = ($scheme !== 'https') ? str_replace('http://', 'https://', $baseUrl) : $baseUrl;
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
$connectDefault = Mage::getConfig()
|
119 |
->getResourceConnectionConfig(Mage_Core_Model_Resource::DEFAULT_SETUP_RESOURCE);
|
app/code/core/Mage/Install/controllers/WizardController.php
CHANGED
@@ -314,6 +314,8 @@ class Mage_Install_WizardController extends Mage_Install_Controller_Action
|
|
314 |
|
315 |
if ($config && $connectionConfig && isset($connectionConfig[$config['db_model']])) {
|
316 |
|
|
|
|
|
317 |
$data = array_merge($config, $connectionConfig[$config['db_model']]);
|
318 |
|
319 |
Mage::getSingleton('install/session')
|
314 |
|
315 |
if ($config && $connectionConfig && isset($connectionConfig[$config['db_model']])) {
|
316 |
|
317 |
+
$config['unsecure_base_url'] = Mage::helper('core/url')->encodePunycode($config['unsecure_base_url']);
|
318 |
+
$config['secure_base_url'] = Mage::helper('core/url')->encodePunycode($config['unsecure_base_url']);
|
319 |
$data = array_merge($config, $connectionConfig[$config['db_model']]);
|
320 |
|
321 |
Mage::getSingleton('install/session')
|
app/code/core/Mage/Install/etc/config.xml
CHANGED
@@ -48,13 +48,35 @@
|
|
48 |
</install>
|
49 |
</blocks>
|
50 |
</global>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
<frontend>
|
52 |
<secure_url>
|
53 |
<install>/install/wizard/checkSecureHost</install>
|
54 |
</secure_url>
|
55 |
<routers>
|
56 |
<install>
|
57 |
-
<use>
|
58 |
<args>
|
59 |
<module>Mage_Install</module>
|
60 |
<frontName>install</frontName>
|
48 |
</install>
|
49 |
</blocks>
|
50 |
</global>
|
51 |
+
<default>
|
52 |
+
<web>
|
53 |
+
<routers>
|
54 |
+
<install>
|
55 |
+
<area>frontend</area>
|
56 |
+
<class>Mage_Install_Controller_Router_Install</class>
|
57 |
+
</install>
|
58 |
+
</routers>
|
59 |
+
</web>
|
60 |
+
</default>
|
61 |
+
<stores>
|
62 |
+
<default>
|
63 |
+
<web>
|
64 |
+
<routers>
|
65 |
+
<install>
|
66 |
+
<area>frontend</area>
|
67 |
+
<class>Mage_Install_Controller_Router_Install</class>
|
68 |
+
</install>
|
69 |
+
</routers>
|
70 |
+
</web>
|
71 |
+
</default>
|
72 |
+
</stores>
|
73 |
<frontend>
|
74 |
<secure_url>
|
75 |
<install>/install/wizard/checkSecureHost</install>
|
76 |
</secure_url>
|
77 |
<routers>
|
78 |
<install>
|
79 |
+
<use>install</use>
|
80 |
<args>
|
81 |
<module>Mage_Install</module>
|
82 |
<frontName>install</frontName>
|
app/code/core/Mage/Install/etc/install.xml
CHANGED
@@ -86,6 +86,8 @@
|
|
86 |
<iconv/>
|
87 |
<ctype/>
|
88 |
<gd/>
|
|
|
|
|
89 |
</extensions>
|
90 |
</php>
|
91 |
</check>
|
86 |
<iconv/>
|
87 |
<ctype/>
|
88 |
<gd/>
|
89 |
+
<soap/>
|
90 |
+
<mbstring/>
|
91 |
</extensions>
|
92 |
</php>
|
93 |
</check>
|
app/code/core/Mage/Log/Helper/Data.php
CHANGED
@@ -29,5 +29,47 @@
|
|
29 |
*/
|
30 |
class Mage_Log_Helper_Data extends Mage_Core_Helper_Abstract
|
31 |
{
|
|
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
29 |
*/
|
30 |
class Mage_Log_Helper_Data extends Mage_Core_Helper_Abstract
|
31 |
{
|
32 |
+
const XML_PATH_LOG_ENABLED = 'system/log/enable_log';
|
33 |
|
34 |
+
/**
|
35 |
+
* @var Mage_Log_Helper_Data
|
36 |
+
*/
|
37 |
+
protected $_logLevel;
|
38 |
+
|
39 |
+
public function __construct(array $data = array())
|
40 |
+
{
|
41 |
+
$this->_logLevel = isset($data['log_level']) ? $data['log_level']
|
42 |
+
: intval(Mage::getStoreConfig(self::XML_PATH_LOG_ENABLED));
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Are visitor should be logged
|
47 |
+
*
|
48 |
+
* @return bool
|
49 |
+
*/
|
50 |
+
public function isVisitorLogEnabled()
|
51 |
+
{
|
52 |
+
return $this->_logLevel == Mage_Log_Model_Adminhtml_System_Config_Source_Loglevel::LOG_LEVEL_VISITORS
|
53 |
+
|| $this->isLogEnabled();
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Are all events should be logged
|
58 |
+
*
|
59 |
+
* @return bool
|
60 |
+
*/
|
61 |
+
public function isLogEnabled()
|
62 |
+
{
|
63 |
+
return $this->_logLevel == Mage_Log_Model_Adminhtml_System_Config_Source_Loglevel::LOG_LEVEL_ALL;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Are all events should be disabled
|
68 |
+
*
|
69 |
+
* @return bool
|
70 |
+
*/
|
71 |
+
public function isLogDisabled()
|
72 |
+
{
|
73 |
+
return $this->_logLevel == Mage_Log_Model_Adminhtml_System_Config_Source_Loglevel::LOG_LEVEL_NONE;
|
74 |
+
}
|
75 |
}
|
app/code/core/Mage/Log/Model/Adminhtml/System/Config/Source/Loglevel.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Log
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Logging level backend source model
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Log
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_Log_Model_Adminhtml_System_Config_Source_Loglevel
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Don't log anything
|
38 |
+
*/
|
39 |
+
const LOG_LEVEL_NONE = 0;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* All possible logs enabled
|
43 |
+
*/
|
44 |
+
const LOG_LEVEL_ALL = 1;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Logs only visitors, needs for working compare products and customer segment's related functionality
|
48 |
+
* (eg. shopping cart discount for segments with not logged in customers)
|
49 |
+
*/
|
50 |
+
const LOG_LEVEL_VISITORS = 2;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @var Mage_Log_Helper_Data
|
54 |
+
*/
|
55 |
+
protected $_helper;
|
56 |
+
|
57 |
+
public function __construct(array $data = array())
|
58 |
+
{
|
59 |
+
$this->_helper = !empty($data['helper']) ? $data['helper'] : Mage::helper('log');
|
60 |
+
}
|
61 |
+
|
62 |
+
public function toOptionArray()
|
63 |
+
{
|
64 |
+
$options = array(
|
65 |
+
array(
|
66 |
+
'label' => $this->_helper->__('Yes'),
|
67 |
+
'value' => self::LOG_LEVEL_ALL,
|
68 |
+
),
|
69 |
+
array(
|
70 |
+
'label' => $this->_helper->__('No'),
|
71 |
+
'value' => self::LOG_LEVEL_NONE,
|
72 |
+
),
|
73 |
+
array(
|
74 |
+
'label' => $this->_helper->__('Visitors only'),
|
75 |
+
'value' => self::LOG_LEVEL_VISITORS,
|
76 |
+
),
|
77 |
+
);
|
78 |
+
|
79 |
+
return $options;
|
80 |
+
}
|
81 |
+
}
|
app/code/core/Mage/Log/Model/Resource/Visitor.php
CHANGED
@@ -34,6 +34,20 @@
|
|
34 |
*/
|
35 |
class Mage_Log_Model_Resource_Visitor extends Mage_Core_Model_Resource_Db_Abstract
|
36 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
/**
|
38 |
* Define main table
|
39 |
*
|
@@ -90,6 +104,9 @@ class Mage_Log_Model_Resource_Visitor extends Mage_Core_Model_Resource_Db_Abstra
|
|
90 |
*/
|
91 |
protected function _beforeSave(Mage_Core_Model_Abstract $visitor)
|
92 |
{
|
|
|
|
|
|
|
93 |
if (!$visitor->getIsNewVisitor()) {
|
94 |
$this->_saveUrlInfo($visitor);
|
95 |
}
|
@@ -104,16 +121,25 @@ class Mage_Log_Model_Resource_Visitor extends Mage_Core_Model_Resource_Db_Abstra
|
|
104 |
*/
|
105 |
protected function _afterSave(Mage_Core_Model_Abstract $visitor)
|
106 |
{
|
|
|
|
|
|
|
107 |
if ($visitor->getIsNewVisitor()) {
|
108 |
-
$this->
|
109 |
-
|
|
|
|
|
110 |
} else {
|
111 |
-
$this->
|
112 |
-
|
113 |
-
$
|
|
|
|
|
114 |
}
|
115 |
-
if ($
|
116 |
-
$
|
|
|
|
|
117 |
}
|
118 |
}
|
119 |
return $this;
|
@@ -122,12 +148,15 @@ class Mage_Log_Model_Resource_Visitor extends Mage_Core_Model_Resource_Db_Abstra
|
|
122 |
/**
|
123 |
* Perform actions after object load
|
124 |
*
|
125 |
-
* @param
|
126 |
* @return Mage_Core_Model_Resource_Db_Abstract
|
127 |
*/
|
128 |
protected function _afterLoad(Mage_Core_Model_Abstract $object)
|
129 |
{
|
130 |
parent::_afterLoad($object);
|
|
|
|
|
|
|
131 |
// Add information about quote to visitor
|
132 |
$adapter = $this->_getReadAdapter();
|
133 |
$select = $adapter->select()->from($this->getTable('log/quote_table'), 'quote_id')
|
34 |
*/
|
35 |
class Mage_Log_Model_Resource_Visitor extends Mage_Core_Model_Resource_Db_Abstract
|
36 |
{
|
37 |
+
/**
|
38 |
+
* Store condition object that know should we log something or not
|
39 |
+
*
|
40 |
+
* @var Mage_Log_Helper_Data
|
41 |
+
*/
|
42 |
+
protected $_urlLoggingCondition;
|
43 |
+
|
44 |
+
public function __construct(array $data = array())
|
45 |
+
{
|
46 |
+
parent::__construct();
|
47 |
+
$this->_urlLoggingCondition = isset($data['log_condition'])
|
48 |
+
? $data['log_condition'] : Mage::helper('log');
|
49 |
+
}
|
50 |
+
|
51 |
/**
|
52 |
* Define main table
|
53 |
*
|
104 |
*/
|
105 |
protected function _beforeSave(Mage_Core_Model_Abstract $visitor)
|
106 |
{
|
107 |
+
if (!$this->_urlLoggingCondition->isLogEnabled()) {
|
108 |
+
return $this;
|
109 |
+
}
|
110 |
if (!$visitor->getIsNewVisitor()) {
|
111 |
$this->_saveUrlInfo($visitor);
|
112 |
}
|
121 |
*/
|
122 |
protected function _afterSave(Mage_Core_Model_Abstract $visitor)
|
123 |
{
|
124 |
+
if ($this->_urlLoggingCondition->isLogDisabled()) {
|
125 |
+
return $this;
|
126 |
+
}
|
127 |
if ($visitor->getIsNewVisitor()) {
|
128 |
+
if ($this->_urlLoggingCondition->isLogEnabled()) {
|
129 |
+
$this->_saveVisitorInfo($visitor);
|
130 |
+
$visitor->setIsNewVisitor(false);
|
131 |
+
}
|
132 |
} else {
|
133 |
+
if ($this->_urlLoggingCondition->isLogEnabled()) {
|
134 |
+
$this->_saveVisitorUrl($visitor);
|
135 |
+
if ($visitor->getDoCustomerLogin() || $visitor->getDoCustomerLogout()) {
|
136 |
+
$this->_saveCustomerInfo($visitor);
|
137 |
+
}
|
138 |
}
|
139 |
+
if ($this->_urlLoggingCondition->isVisitorLogEnabled()) {
|
140 |
+
if ($visitor->getDoQuoteCreate() || $visitor->getDoQuoteDestroy()) {
|
141 |
+
$this->_saveQuoteInfo($visitor);
|
142 |
+
}
|
143 |
}
|
144 |
}
|
145 |
return $this;
|
148 |
/**
|
149 |
* Perform actions after object load
|
150 |
*
|
151 |
+
* @param Mage_Core_Model_Abstract $object
|
152 |
* @return Mage_Core_Model_Resource_Db_Abstract
|
153 |
*/
|
154 |
protected function _afterLoad(Mage_Core_Model_Abstract $object)
|
155 |
{
|
156 |
parent::_afterLoad($object);
|
157 |
+
if ($this->_urlLoggingCondition->isLogDisabled()) {
|
158 |
+
return $this;
|
159 |
+
}
|
160 |
// Add information about quote to visitor
|
161 |
$adapter = $this->_getReadAdapter();
|
162 |
$select = $adapter->select()->from($this->getTable('log/quote_table'), 'quote_id')
|
app/code/core/Mage/Log/Model/Resource/Visitor/Collection.php
CHANGED
@@ -93,7 +93,7 @@ class Mage_Log_Model_Resource_Visitor_Collection extends Mage_Core_Model_Resourc
|
|
93 |
|
94 |
/**
|
95 |
* Online filter used flag
|
96 |
-
*
|
97 |
* @var bool
|
98 |
*/
|
99 |
protected $_isOnlineFilterUsed = false;
|
@@ -104,11 +104,12 @@ class Mage_Log_Model_Resource_Visitor_Collection extends Mage_Core_Model_Resourc
|
|
104 |
* @var array
|
105 |
*/
|
106 |
protected $_fieldMap = array(
|
107 |
-
'customer_firstname'
|
108 |
-
'
|
109 |
-
'
|
110 |
-
'
|
111 |
-
'
|
|
|
112 |
);
|
113 |
|
114 |
/**
|
@@ -138,7 +139,7 @@ class Mage_Log_Model_Resource_Visitor_Collection extends Mage_Core_Model_Resourc
|
|
138 |
$this->getSelect()
|
139 |
->where('customer_table.customer_id > 0')
|
140 |
->group('customer_table.customer_id');
|
141 |
-
|
142 |
return $this;
|
143 |
}
|
144 |
|
93 |
|
94 |
/**
|
95 |
* Online filter used flag
|
96 |
+
*
|
97 |
* @var bool
|
98 |
*/
|
99 |
protected $_isOnlineFilterUsed = false;
|
104 |
* @var array
|
105 |
*/
|
106 |
protected $_fieldMap = array(
|
107 |
+
'customer_firstname' => 'customer_firstname_table.value',
|
108 |
+
'customer_middlename' => 'customer_middlename_table.value',
|
109 |
+
'customer_lastname' => 'customer_lastname_table.value',
|
110 |
+
'customer_email' => 'customer_email_table.email',
|
111 |
+
'customer_id' => 'customer_table.customer_id',
|
112 |
+
'url' => 'url_info_table.url'
|
113 |
);
|
114 |
|
115 |
/**
|
139 |
$this->getSelect()
|
140 |
->where('customer_table.customer_id > 0')
|
141 |
->group('customer_table.customer_id');
|
142 |
+
|
143 |
return $this;
|
144 |
}
|
145 |
|
app/code/core/Mage/Log/Model/Resource/Visitor/Online/Collection.php
CHANGED
@@ -60,9 +60,10 @@ class Mage_Log_Model_Resource_Visitor_Online_Collection extends Mage_Core_Model_
|
|
60 |
$customer = Mage::getModel('customer/customer');
|
61 |
// alias => attribute_code
|
62 |
$attributes = array(
|
63 |
-
'customer_lastname'
|
64 |
-
'
|
65 |
-
'
|
|
|
66 |
);
|
67 |
|
68 |
foreach ($attributes as $alias => $attributeCode) {
|
60 |
$customer = Mage::getModel('customer/customer');
|
61 |
// alias => attribute_code
|
62 |
$attributes = array(
|
63 |
+
'customer_lastname' => 'lastname',
|
64 |
+
'customer_middlename' => 'middlename',
|
65 |
+
'customer_firstname' => 'firstname',
|
66 |
+
'customer_email' => 'email'
|
67 |
);
|
68 |
|
69 |
foreach ($attributes as $alias => $attributeCode) {
|
app/code/core/Mage/Log/Model/Visitor.php
CHANGED
@@ -28,7 +28,6 @@
|
|
28 |
/**
|
29 |
* Enter description here ...
|
30 |
*
|
31 |
-
* @method Mage_Log_Model_Resource_Visitor _getResource()
|
32 |
* @method Mage_Log_Model_Resource_Visitor getResource()
|
33 |
* @method string getSessionId()
|
34 |
* @method Mage_Log_Model_Visitor setSessionId(string $value)
|
@@ -52,19 +51,53 @@ class Mage_Log_Model_Visitor extends Mage_Core_Model_Abstract
|
|
52 |
protected $_skipRequestLogging = false;
|
53 |
|
54 |
/**
|
55 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
*/
|
57 |
protected function _construct()
|
58 |
{
|
59 |
$this->_init('log/visitor');
|
60 |
-
$userAgent =
|
61 |
-
$ignoreAgents =
|
62 |
if ($ignoreAgents) {
|
63 |
$ignoreAgents = $ignoreAgents->asArray();
|
64 |
if (in_array($userAgent, $ignoreAgents)) {
|
65 |
$this->_skipRequestLogging = true;
|
66 |
}
|
67 |
}
|
|
|
|
|
|
|
68 |
}
|
69 |
|
70 |
/**
|
@@ -74,7 +107,7 @@ class Mage_Log_Model_Visitor extends Mage_Core_Model_Abstract
|
|
74 |
*/
|
75 |
protected function _getSession()
|
76 |
{
|
77 |
-
return
|
78 |
}
|
79 |
|
80 |
/**
|
@@ -84,20 +117,17 @@ class Mage_Log_Model_Visitor extends Mage_Core_Model_Abstract
|
|
84 |
*/
|
85 |
public function initServerData()
|
86 |
{
|
87 |
-
/* @var $helper Mage_Core_Helper_Http */
|
88 |
-
$helper = Mage::helper('core/http');
|
89 |
-
|
90 |
$this->addData(array(
|
91 |
-
'server_addr' => $
|
92 |
-
'remote_addr' => $
|
93 |
'http_secure' => Mage::app()->getStore()->isCurrentlySecure(),
|
94 |
-
'http_host' => $
|
95 |
-
'http_user_agent' => $
|
96 |
-
'http_accept_language' => $
|
97 |
-
'http_accept_charset' => $
|
98 |
-
'request_uri' => $
|
99 |
-
'session_id' => $this->
|
100 |
-
'http_referer' => $
|
101 |
));
|
102 |
|
103 |
return $this;
|
@@ -158,11 +188,11 @@ class Mage_Log_Model_Visitor extends Mage_Core_Model_Abstract
|
|
158 |
return $this;
|
159 |
}
|
160 |
|
161 |
-
$this->setData($this->
|
162 |
-
$this->initServerData();
|
163 |
|
164 |
$visitorId = $this->getId();
|
165 |
if (!$visitorId) {
|
|
|
166 |
$this->setFirstVisitAt(now());
|
167 |
$this->setIsNewVisitor(true);
|
168 |
$this->save();
|
@@ -180,12 +210,12 @@ class Mage_Log_Model_Visitor extends Mage_Core_Model_Abstract
|
|
180 |
*/
|
181 |
protected function _isVisitorSessionNew()
|
182 |
{
|
183 |
-
$visitorData = $this->
|
184 |
$visitorSessionId = null;
|
185 |
if (is_array($visitorData) && isset($visitorData['session_id'])) {
|
186 |
$visitorSessionId = $visitorData['session_id'];
|
187 |
}
|
188 |
-
return $this->
|
189 |
}
|
190 |
|
191 |
/**
|
@@ -205,7 +235,7 @@ class Mage_Log_Model_Visitor extends Mage_Core_Model_Abstract
|
|
205 |
try {
|
206 |
$this->setLastVisitAt(now());
|
207 |
$this->save();
|
208 |
-
$this->
|
209 |
} catch (Exception $e) {
|
210 |
Mage::logException($e);
|
211 |
}
|
@@ -302,7 +332,7 @@ class Mage_Log_Model_Visitor extends Mage_Core_Model_Abstract
|
|
302 |
|
303 |
public function isModuleIgnored($observer)
|
304 |
{
|
305 |
-
$ignores =
|
306 |
|
307 |
if( is_array($ignores) && $observer) {
|
308 |
$curModule = $observer->getEvent()->getControllerAction()->getRequest()->getRouteName();
|
28 |
/**
|
29 |
* Enter description here ...
|
30 |
*
|
|
|
31 |
* @method Mage_Log_Model_Resource_Visitor getResource()
|
32 |
* @method string getSessionId()
|
33 |
* @method Mage_Log_Model_Visitor setSessionId(string $value)
|
51 |
protected $_skipRequestLogging = false;
|
52 |
|
53 |
/**
|
54 |
+
* @var Mage_Log_Helper_Data
|
55 |
+
*/
|
56 |
+
protected $_logCondition;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @var Mage_Core_Helper_Http
|
60 |
+
*/
|
61 |
+
protected $_httpHelper;
|
62 |
+
|
63 |
+
/**
|
64 |
+
* @var Mage_Core_Model_Config
|
65 |
+
*/
|
66 |
+
protected $_config;
|
67 |
+
|
68 |
+
/**
|
69 |
+
* @var Mage_Core_Model_Session
|
70 |
+
*/
|
71 |
+
protected $_session;
|
72 |
+
|
73 |
+
public function __construct(array $data = array())
|
74 |
+
{
|
75 |
+
$this->_httpHelper = !empty($data['http_helper']) ? $data['http_helper'] : Mage::helper('core/http');
|
76 |
+
$this->_config = !empty($data['config']) ? $data['config'] : Mage::getConfig();
|
77 |
+
$this->_logCondition = !empty($data['log_condition']) ?
|
78 |
+
$data['log_condition'] : Mage::helper('log');
|
79 |
+
$this->_session = !empty($data['session']) ? $data['session'] : Mage::getSingleton('core/session');
|
80 |
+
parent::__construct($data);
|
81 |
+
}
|
82 |
+
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Object initialization
|
86 |
*/
|
87 |
protected function _construct()
|
88 |
{
|
89 |
$this->_init('log/visitor');
|
90 |
+
$userAgent = $this->_httpHelper->getHttpUserAgent();
|
91 |
+
$ignoreAgents = $this->_config->getNode('global/ignore_user_agents');
|
92 |
if ($ignoreAgents) {
|
93 |
$ignoreAgents = $ignoreAgents->asArray();
|
94 |
if (in_array($userAgent, $ignoreAgents)) {
|
95 |
$this->_skipRequestLogging = true;
|
96 |
}
|
97 |
}
|
98 |
+
if ($this->_logCondition->isLogDisabled()) {
|
99 |
+
$this->_skipRequestLogging = true;
|
100 |
+
}
|
101 |
}
|
102 |
|
103 |
/**
|
107 |
*/
|
108 |
protected function _getSession()
|
109 |
{
|
110 |
+
return $this->_session;
|
111 |
}
|
112 |
|
113 |
/**
|
117 |
*/
|
118 |
public function initServerData()
|
119 |
{
|
|
|
|
|
|
|
120 |
$this->addData(array(
|
121 |
+
'server_addr' => $this->_httpHelper->getServerAddr(true),
|
122 |
+
'remote_addr' => $this->_httpHelper->getRemoteAddr(true),
|
123 |
'http_secure' => Mage::app()->getStore()->isCurrentlySecure(),
|
124 |
+
'http_host' => $this->_httpHelper->getHttpHost(true),
|
125 |
+
'http_user_agent' => $this->_httpHelper->getHttpUserAgent(true),
|
126 |
+
'http_accept_language' => $this->_httpHelper->getHttpAcceptLanguage(true),
|
127 |
+
'http_accept_charset' => $this->_httpHelper->getHttpAcceptCharset(true),
|
128 |
+
'request_uri' => $this->_httpHelper->getRequestUri(true),
|
129 |
+
'session_id' => $this->_session->getSessionId(),
|
130 |
+
'http_referer' => $this->_httpHelper->getHttpReferer(true),
|
131 |
));
|
132 |
|
133 |
return $this;
|
188 |
return $this;
|
189 |
}
|
190 |
|
191 |
+
$this->setData($this->_session->getVisitorData());
|
|
|
192 |
|
193 |
$visitorId = $this->getId();
|
194 |
if (!$visitorId) {
|
195 |
+
$this->initServerData();
|
196 |
$this->setFirstVisitAt(now());
|
197 |
$this->setIsNewVisitor(true);
|
198 |
$this->save();
|
210 |
*/
|
211 |
protected function _isVisitorSessionNew()
|
212 |
{
|
213 |
+
$visitorData = $this->_session->getVisitorData();
|
214 |
$visitorSessionId = null;
|
215 |
if (is_array($visitorData) && isset($visitorData['session_id'])) {
|
216 |
$visitorSessionId = $visitorData['session_id'];
|
217 |
}
|
218 |
+
return $this->_session->getSessionId() != $visitorSessionId;
|
219 |
}
|
220 |
|
221 |
/**
|
235 |
try {
|
236 |
$this->setLastVisitAt(now());
|
237 |
$this->save();
|
238 |
+
$this->_session->setVisitorData($this->getData());
|
239 |
} catch (Exception $e) {
|
240 |
Mage::logException($e);
|
241 |
}
|
332 |
|
333 |
public function isModuleIgnored($observer)
|
334 |
{
|
335 |
+
$ignores = $this->_config->getNode('global/ignoredModules/entities')->asArray();
|
336 |
|
337 |
if( is_array($ignores) && $observer) {
|
338 |
$curModule = $observer->getEvent()->getControllerAction()->getRequest()->getRouteName();
|
app/code/core/Mage/Log/etc/config.xml
CHANGED
@@ -28,7 +28,7 @@
|
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_Log>
|
31 |
-
<version>1.6.1.
|
32 |
</Mage_Log>
|
33 |
</modules>
|
34 |
<global>
|
@@ -44,6 +44,11 @@
|
|
44 |
<google2>Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)</google2>
|
45 |
<google3>Googlebot/2.1 (+http://www.googlebot.com/bot.html)</google3>
|
46 |
</ignore_user_agents>
|
|
|
|
|
|
|
|
|
|
|
47 |
<models>
|
48 |
<log>
|
49 |
<class>Mage_Log_Model</class>
|
@@ -171,8 +176,9 @@
|
|
171 |
</log>
|
172 |
<system>
|
173 |
<log>
|
|
|
174 |
<clean_after_day>180</clean_after_day>
|
175 |
-
<enabled>
|
176 |
<time/>
|
177 |
<frequency>D</frequency>
|
178 |
<error_email/>
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_Log>
|
31 |
+
<version>1.6.1.1</version>
|
32 |
</Mage_Log>
|
33 |
</modules>
|
34 |
<global>
|
44 |
<google2>Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)</google2>
|
45 |
<google3>Googlebot/2.1 (+http://www.googlebot.com/bot.html)</google3>
|
46 |
</ignore_user_agents>
|
47 |
+
<helpers>
|
48 |
+
<log>
|
49 |
+
<class>Mage_Log_Helper</class>
|
50 |
+
</log>
|
51 |
+
</helpers>
|
52 |
<models>
|
53 |
<log>
|
54 |
<class>Mage_Log_Model</class>
|
176 |
</log>
|
177 |
<system>
|
178 |
<log>
|
179 |
+
<enable_log>2</enable_log>
|
180 |
<clean_after_day>180</clean_after_day>
|
181 |
+
<enabled>1</enabled>
|
182 |
<time/>
|
183 |
<frequency>D</frequency>
|
184 |
<error_email/>
|
app/code/core/Mage/Log/etc/system.xml
CHANGED
@@ -30,17 +30,27 @@
|
|
30 |
<system>
|
31 |
<groups>
|
32 |
<log translate="label" module="log">
|
33 |
-
<label>Log
|
34 |
<frontend_type>text</frontend_type>
|
35 |
<sort_order>200</sort_order>
|
36 |
<show_in_default>1</show_in_default>
|
37 |
<show_in_website>0</show_in_website>
|
38 |
<show_in_store>0</show_in_store>
|
39 |
<fields>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
<clean_after_day translate="label">
|
41 |
<label>Save Log, Days</label>
|
42 |
<frontend_type>text</frontend_type>
|
43 |
-
<sort_order>
|
44 |
<show_in_default>1</show_in_default>
|
45 |
<show_in_website>0</show_in_website>
|
46 |
<show_in_store>0</show_in_store>
|
@@ -49,7 +59,7 @@
|
|
49 |
<label>Enable Log Cleaning</label>
|
50 |
<frontend_type>select</frontend_type>
|
51 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
52 |
-
<sort_order>
|
53 |
<show_in_default>1</show_in_default>
|
54 |
<show_in_website>0</show_in_website>
|
55 |
<show_in_store>0</show_in_store>
|
@@ -57,7 +67,7 @@
|
|
57 |
<time translate="label">
|
58 |
<label>Start Time</label>
|
59 |
<frontend_type>time</frontend_type>
|
60 |
-
<sort_order>
|
61 |
<show_in_default>1</show_in_default>
|
62 |
<show_in_website>0</show_in_website>
|
63 |
<show_in_store>0</show_in_store>
|
@@ -67,7 +77,7 @@
|
|
67 |
<frontend_type>select</frontend_type>
|
68 |
<source_model>adminhtml/system_config_source_cron_frequency</source_model>
|
69 |
<backend_model>adminhtml/system_config_backend_log_cron</backend_model>
|
70 |
-
<sort_order>
|
71 |
<show_in_default>1</show_in_default>
|
72 |
<show_in_website>0</show_in_website>
|
73 |
<show_in_store>0</show_in_store>
|
@@ -76,7 +86,7 @@
|
|
76 |
<label>Error Email Recipient</label>
|
77 |
<frontend_type>text</frontend_type>
|
78 |
<validate>validate-email</validate>
|
79 |
-
<sort_order>
|
80 |
<show_in_default>1</show_in_default>
|
81 |
<show_in_website>0</show_in_website>
|
82 |
<show_in_store>0</show_in_store>
|
@@ -85,7 +95,7 @@
|
|
85 |
<label>Error Email Sender</label>
|
86 |
<frontend_type>select</frontend_type>
|
87 |
<source_model>adminhtml/system_config_source_email_identity</source_model>
|
88 |
-
<sort_order>
|
89 |
<show_in_default>1</show_in_default>
|
90 |
<show_in_website>0</show_in_website>
|
91 |
<show_in_store>0</show_in_store>
|
@@ -94,7 +104,7 @@
|
|
94 |
<label>Error Email Template</label>
|
95 |
<frontend_type>select</frontend_type>
|
96 |
<source_model>adminhtml/system_config_source_email_template</source_model>
|
97 |
-
<sort_order>
|
98 |
<show_in_default>1</show_in_default>
|
99 |
<show_in_website>0</show_in_website>
|
100 |
<show_in_store>0</show_in_store>
|
30 |
<system>
|
31 |
<groups>
|
32 |
<log translate="label" module="log">
|
33 |
+
<label>Log</label>
|
34 |
<frontend_type>text</frontend_type>
|
35 |
<sort_order>200</sort_order>
|
36 |
<show_in_default>1</show_in_default>
|
37 |
<show_in_website>0</show_in_website>
|
38 |
<show_in_store>0</show_in_store>
|
39 |
<fields>
|
40 |
+
<enable_log translate="label">
|
41 |
+
<label>Enable Log</label>
|
42 |
+
<frontend_type>select</frontend_type>
|
43 |
+
<source_model>log/adminhtml_system_config_source_loglevel</source_model>
|
44 |
+
<sort_order>1</sort_order>
|
45 |
+
<show_in_default>1</show_in_default>
|
46 |
+
<show_in_website>0</show_in_website>
|
47 |
+
<show_in_store>0</show_in_store>
|
48 |
+
<comment>If set to "No" this option disables recently viewed products and compare products functionality for not logged in customers.</comment>
|
49 |
+
</enable_log>
|
50 |
<clean_after_day translate="label">
|
51 |
<label>Save Log, Days</label>
|
52 |
<frontend_type>text</frontend_type>
|
53 |
+
<sort_order>2</sort_order>
|
54 |
<show_in_default>1</show_in_default>
|
55 |
<show_in_website>0</show_in_website>
|
56 |
<show_in_store>0</show_in_store>
|
59 |
<label>Enable Log Cleaning</label>
|
60 |
<frontend_type>select</frontend_type>
|
61 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
62 |
+
<sort_order>3</sort_order>
|
63 |
<show_in_default>1</show_in_default>
|
64 |
<show_in_website>0</show_in_website>
|
65 |
<show_in_store>0</show_in_store>
|
67 |
<time translate="label">
|
68 |
<label>Start Time</label>
|
69 |
<frontend_type>time</frontend_type>
|
70 |
+
<sort_order>4</sort_order>
|
71 |
<show_in_default>1</show_in_default>
|
72 |
<show_in_website>0</show_in_website>
|
73 |
<show_in_store>0</show_in_store>
|
77 |
<frontend_type>select</frontend_type>
|
78 |
<source_model>adminhtml/system_config_source_cron_frequency</source_model>
|
79 |
<backend_model>adminhtml/system_config_backend_log_cron</backend_model>
|
80 |
+
<sort_order>5</sort_order>
|
81 |
<show_in_default>1</show_in_default>
|
82 |
<show_in_website>0</show_in_website>
|
83 |
<show_in_store>0</show_in_store>
|
86 |
<label>Error Email Recipient</label>
|
87 |
<frontend_type>text</frontend_type>
|
88 |
<validate>validate-email</validate>
|
89 |
+
<sort_order>6</sort_order>
|
90 |
<show_in_default>1</show_in_default>
|
91 |
<show_in_website>0</show_in_website>
|
92 |
<show_in_store>0</show_in_store>
|
95 |
<label>Error Email Sender</label>
|
96 |
<frontend_type>select</frontend_type>
|
97 |
<source_model>adminhtml/system_config_source_email_identity</source_model>
|
98 |
+
<sort_order>7</sort_order>
|
99 |
<show_in_default>1</show_in_default>
|
100 |
<show_in_website>0</show_in_website>
|
101 |
<show_in_store>0</show_in_store>
|
104 |
<label>Error Email Template</label>
|
105 |
<frontend_type>select</frontend_type>
|
106 |
<source_model>adminhtml/system_config_source_email_template</source_model>
|
107 |
+
<sort_order>8</sort_order>
|
108 |
<show_in_default>1</show_in_default>
|
109 |
<show_in_website>0</show_in_website>
|
110 |
<show_in_store>0</show_in_store>
|
app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-1.6.1.0-1.6.1.1.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Log
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
28 |
+
$installer = $this;
|
29 |
+
$installer->startSetup();
|
30 |
+
|
31 |
+
$installer->getConnection()->changeColumn(
|
32 |
+
$installer->getTable('log/visitor_info'),
|
33 |
+
'server_addr',
|
34 |
+
'server_addr',
|
35 |
+
'varbinary(16)'
|
36 |
+
);
|
37 |
+
|
38 |
+
$installer->getConnection()->update(
|
39 |
+
$installer->getTable('log/visitor_info'),
|
40 |
+
array(
|
41 |
+
'server_addr' => new Zend_Db_Expr('UNHEX(HEX(CAST(server_addr as UNSIGNED INT)))')
|
42 |
+
)
|
43 |
+
);
|
44 |
+
|
45 |
+
$installer->getConnection()->changeColumn(
|
46 |
+
$installer->getTable('log/visitor_info'),
|
47 |
+
'remote_addr',
|
48 |
+
'remote_addr',
|
49 |
+
'varbinary(16)'
|
50 |
+
);
|
51 |
+
|
52 |
+
|
53 |
+
$installer->getConnection()->update(
|
54 |
+
$installer->getTable('log/visitor_info'),
|
55 |
+
array(
|
56 |
+
'remote_addr' => new Zend_Db_Expr('UNHEX(HEX(CAST(remote_addr as UNSIGNED INT)))')
|
57 |
+
)
|
58 |
+
);
|
59 |
+
|
60 |
+
|
61 |
+
$installer->getConnection()->changeColumn(
|
62 |
+
$installer->getTable('log/visitor_online'),
|
63 |
+
'remote_addr',
|
64 |
+
'remote_addr',
|
65 |
+
'varbinary(16)'
|
66 |
+
);
|
67 |
+
|
68 |
+
|
69 |
+
$installer->getConnection()->update(
|
70 |
+
$installer->getTable('log/visitor_online'),
|
71 |
+
array(
|
72 |
+
'remote_addr' => new Zend_Db_Expr('UNHEX(HEX(CAST(remote_addr as UNSIGNED INT)))')
|
73 |
+
)
|
74 |
+
);
|
75 |
+
|
76 |
+
$installer->endSetup();
|
app/code/core/Mage/Newsletter/Helper/Data.php
CHANGED
@@ -81,3 +81,4 @@ class Mage_Newsletter_Helper_Data extends Mage_Core_Helper_Abstract
|
|
81 |
return Mage::getModel($model);
|
82 |
}
|
83 |
}
|
|
81 |
return Mage::getModel($model);
|
82 |
}
|
83 |
}
|
84 |
+
|
app/code/core/Mage/Newsletter/Model/Resource/Subscriber/Collection.php
CHANGED
@@ -80,17 +80,18 @@ class Mage_Newsletter_Model_Resource_Subscriber_Collection extends Mage_Core_Mod
|
|
80 |
parent::_construct();
|
81 |
$this->_init('newsletter/subscriber');
|
82 |
$this->_queueLinkTable = $this->getTable('newsletter/queue_link');
|
83 |
-
$this->_storeTable
|
84 |
|
85 |
|
86 |
// defining mapping for fields represented in several tables
|
87 |
-
$this->_map['fields']['customer_lastname']
|
88 |
-
$this->_map['fields']['
|
89 |
-
$this->_map['fields']['
|
|
|
90 |
->getCheckSql('main_table.customer_id = 0', 1, 2);
|
91 |
-
$this->_map['fields']['website_id']
|
92 |
-
$this->_map['fields']['group_id']
|
93 |
-
$this->_map['fields']['store_id']
|
94 |
}
|
95 |
|
96 |
/**
|
@@ -129,22 +130,32 @@ class Mage_Newsletter_Model_Resource_Subscriber_Collection extends Mage_Core_Mod
|
|
129 |
*/
|
130 |
public function showCustomerInfo()
|
131 |
{
|
132 |
-
$adapter
|
133 |
-
$customer
|
134 |
$firstname = $customer->getAttribute('firstname');
|
135 |
$lastname = $customer->getAttribute('lastname');
|
|
|
136 |
|
137 |
$this->getSelect()
|
138 |
->joinLeft(
|
139 |
-
array('customer_lastname_table'
|
140 |
$adapter->quoteInto('customer_lastname_table.entity_id=main_table.customer_id
|
141 |
-
|
|
|
142 |
array('customer_lastname'=>'value')
|
143 |
)
|
144 |
->joinLeft(
|
145 |
-
array('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
$adapter->quoteInto('customer_firstname_table.entity_id=main_table.customer_id
|
147 |
-
|
|
|
148 |
array('customer_firstname'=>'value')
|
149 |
);
|
150 |
|
80 |
parent::_construct();
|
81 |
$this->_init('newsletter/subscriber');
|
82 |
$this->_queueLinkTable = $this->getTable('newsletter/queue_link');
|
83 |
+
$this->_storeTable = $this->getTable('core/store');
|
84 |
|
85 |
|
86 |
// defining mapping for fields represented in several tables
|
87 |
+
$this->_map['fields']['customer_lastname'] = 'customer_lastname_table.value';
|
88 |
+
$this->_map['fields']['customer_middlename'] = 'customer_middlename_table.value';
|
89 |
+
$this->_map['fields']['customer_firstname'] = 'customer_firstname_table.value';
|
90 |
+
$this->_map['fields']['type'] = $this->getResource()->getReadConnection()
|
91 |
->getCheckSql('main_table.customer_id = 0', 1, 2);
|
92 |
+
$this->_map['fields']['website_id'] = 'store.website_id';
|
93 |
+
$this->_map['fields']['group_id'] = 'store.group_id';
|
94 |
+
$this->_map['fields']['store_id'] = 'main_table.store_id';
|
95 |
}
|
96 |
|
97 |
/**
|
130 |
*/
|
131 |
public function showCustomerInfo()
|
132 |
{
|
133 |
+
$adapter = $this->getConnection();
|
134 |
+
$customer = Mage::getModel('customer/customer');
|
135 |
$firstname = $customer->getAttribute('firstname');
|
136 |
$lastname = $customer->getAttribute('lastname');
|
137 |
+
$middlename = $customer->getAttribute('middlename');
|
138 |
|
139 |
$this->getSelect()
|
140 |
->joinLeft(
|
141 |
+
array('customer_lastname_table' => $lastname->getBackend()->getTable()),
|
142 |
$adapter->quoteInto('customer_lastname_table.entity_id=main_table.customer_id
|
143 |
+
AND customer_lastname_table.attribute_id = ?', (int) $lastname->getAttributeId()
|
144 |
+
),
|
145 |
array('customer_lastname'=>'value')
|
146 |
)
|
147 |
->joinLeft(
|
148 |
+
array('customer_middlename_table' => $middlename->getBackend()->getTable()),
|
149 |
+
$adapter->quoteInto('customer_middlename_table.entity_id=main_table.customer_id
|
150 |
+
AND customer_middlename_table.attribute_id = ?', (int) $middlename->getAttributeId()
|
151 |
+
),
|
152 |
+
array('customer_middlename'=>'value')
|
153 |
+
)
|
154 |
+
->joinLeft(
|
155 |
+
array('customer_firstname_table' => $firstname->getBackend()->getTable()),
|
156 |
$adapter->quoteInto('customer_firstname_table.entity_id=main_table.customer_id
|
157 |
+
AND customer_firstname_table.attribute_id = ?', (int) $firstname->getAttributeId()
|
158 |
+
),
|
159 |
array('customer_firstname'=>'value')
|
160 |
);
|
161 |
|
app/code/core/Mage/Newsletter/Model/Subscriber.php
CHANGED
@@ -607,7 +607,7 @@ class Mage_Newsletter_Model_Subscriber extends Mage_Core_Model_Abstract
|
|
607 |
{
|
608 |
$name = null;
|
609 |
if ($this->hasCustomerFirstname() || $this->hasCustomerLastname()) {
|
610 |
-
$name =
|
611 |
}
|
612 |
return $name;
|
613 |
}
|
607 |
{
|
608 |
$name = null;
|
609 |
if ($this->hasCustomerFirstname() || $this->hasCustomerLastname()) {
|
610 |
+
$name = Mage::helper('customer')->getFullCustomerName($this);
|
611 |
}
|
612 |
return $name;
|
613 |
}
|
app/code/core/Mage/Newsletter/Model/Template.php
CHANGED
@@ -302,8 +302,8 @@ class Mage_Newsletter_Model_Template extends Mage_Core_Model_Email_Template_Abst
|
|
302 |
$email = '';
|
303 |
if ($subscriber instanceof Mage_Newsletter_Model_Subscriber) {
|
304 |
$email = $subscriber->getSubscriberEmail();
|
305 |
-
if (is_null($name)
|
306 |
-
$name = $subscriber->
|
307 |
}
|
308 |
}
|
309 |
else {
|
302 |
$email = '';
|
303 |
if ($subscriber instanceof Mage_Newsletter_Model_Subscriber) {
|
304 |
$email = $subscriber->getSubscriberEmail();
|
305 |
+
if (is_null($name)) {
|
306 |
+
$name = $subscriber->getSubscriberFullName();
|
307 |
}
|
308 |
}
|
309 |
else {
|
app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/AuthorizeController.php
CHANGED
@@ -298,4 +298,14 @@ class Mage_Oauth_Adminhtml_Oauth_AuthorizeController extends Mage_Adminhtml_Cont
|
|
298 |
{
|
299 |
$this->_initRejectPage();
|
300 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
}
|
298 |
{
|
299 |
$this->_initRejectPage();
|
300 |
}
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Check admin permissions for this controller
|
304 |
+
*
|
305 |
+
* @return boolean
|
306 |
+
*/
|
307 |
+
protected function _isAllowed()
|
308 |
+
{
|
309 |
+
return true;
|
310 |
+
}
|
311 |
}
|
app/code/core/Mage/Page/Block/Html/Topmenu.php
CHANGED
@@ -48,15 +48,16 @@ class Mage_Page_Block_Html_Topmenu extends Mage_Core_Block_Template
|
|
48 |
protected $_currentEntityKey;
|
49 |
|
50 |
/**
|
51 |
-
* Init top menu tree structure
|
52 |
*/
|
53 |
public function _construct()
|
54 |
{
|
55 |
$this->_menu = new Varien_Data_Tree_Node(array(), 'root', new Varien_Data_Tree());
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
));
|
|
|
60 |
}
|
61 |
|
62 |
/**
|
48 |
protected $_currentEntityKey;
|
49 |
|
50 |
/**
|
51 |
+
* Init top menu tree structure and cache
|
52 |
*/
|
53 |
public function _construct()
|
54 |
{
|
55 |
$this->_menu = new Varien_Data_Tree_Node(array(), 'root', new Varien_Data_Tree());
|
56 |
+
/*
|
57 |
+
* setting cache to save the topmenu block
|
58 |
+
*/
|
59 |
+
$this->setCacheTags(array(Mage_Catalog_Model_Category::CACHE_TAG));
|
60 |
+
$this->setCacheLifetime(false);
|
61 |
}
|
62 |
|
63 |
/**
|
app/code/core/Mage/Page/Block/Html/Welcome.php
CHANGED
@@ -34,26 +34,31 @@
|
|
34 |
class Mage_Page_Block_Html_Welcome extends Mage_Core_Block_Template
|
35 |
{
|
36 |
/**
|
37 |
-
* Get
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
*
|
39 |
* @return string
|
40 |
*/
|
41 |
protected function _toHtml()
|
42 |
{
|
43 |
if (empty($this->_data['welcome'])) {
|
44 |
-
if (Mage::isInstalled() &&
|
45 |
-
$this->_data['welcome'] = $this->__('Welcome, %s!', $this->escapeHtml(
|
46 |
} else {
|
47 |
$this->_data['welcome'] = Mage::getStoreConfig('design/header/welcome');
|
48 |
}
|
49 |
}
|
50 |
-
$returnHtml = $this->_data['welcome'];
|
51 |
-
|
52 |
-
if (!empty($this->_data['additional_html'])) {
|
53 |
-
$returnHtml .= ' ' . $this->_data['additional_html'];
|
54 |
-
}
|
55 |
|
56 |
-
return $
|
57 |
}
|
58 |
|
59 |
/**
|
@@ -63,8 +68,8 @@ class Mage_Page_Block_Html_Welcome extends Mage_Core_Block_Template
|
|
63 |
*/
|
64 |
public function getCacheTags()
|
65 |
{
|
66 |
-
if (
|
67 |
-
$this->addModelTags(
|
68 |
}
|
69 |
|
70 |
return parent::getCacheTags();
|
34 |
class Mage_Page_Block_Html_Welcome extends Mage_Core_Block_Template
|
35 |
{
|
36 |
/**
|
37 |
+
* Get customer session
|
38 |
+
*
|
39 |
+
* @return Mage_Customer_Model_Session
|
40 |
+
*/
|
41 |
+
protected function _getSession()
|
42 |
+
{
|
43 |
+
return Mage::getSingleton('customer/session');
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Get block message
|
48 |
*
|
49 |
* @return string
|
50 |
*/
|
51 |
protected function _toHtml()
|
52 |
{
|
53 |
if (empty($this->_data['welcome'])) {
|
54 |
+
if (Mage::isInstalled() && $this->_getSession()->isLoggedIn()) {
|
55 |
+
$this->_data['welcome'] = $this->__('Welcome, %s!', $this->escapeHtml($this->_getSession()->getCustomer()->getName()));
|
56 |
} else {
|
57 |
$this->_data['welcome'] = Mage::getStoreConfig('design/header/welcome');
|
58 |
}
|
59 |
}
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
+
return $this->_data['welcome'];
|
62 |
}
|
63 |
|
64 |
/**
|
68 |
*/
|
69 |
public function getCacheTags()
|
70 |
{
|
71 |
+
if ($this->_getSession()->isLoggedIn()) {
|
72 |
+
$this->addModelTags($this->_getSession()->getCustomer());
|
73 |
}
|
74 |
|
75 |
return parent::getCacheTags();
|
app/code/core/Mage/Paygate/Model/Authorizenet.php
CHANGED
@@ -35,7 +35,7 @@ class Mage_Paygate_Model_Authorizenet extends Mage_Payment_Model_Method_Cc
|
|
35 |
/*
|
36 |
* Transaction Details gateway url
|
37 |
*/
|
38 |
-
const CGI_URL_TD = 'https://
|
39 |
|
40 |
const REQUEST_METHOD_CC = 'CC';
|
41 |
const REQUEST_METHOD_ECHECK = 'ECHECK';
|
@@ -1028,27 +1028,42 @@ class Mage_Paygate_Model_Authorizenet extends Mage_Payment_Model_Method_Cc
|
|
1028 |
*/
|
1029 |
public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId)
|
1030 |
{
|
|
|
1031 |
$cardsStorage = $this->getCardsStorage($payment);
|
|
|
1032 |
if ($cardsStorage->getCardsCount() != 1) {
|
1033 |
-
return
|
1034 |
}
|
1035 |
$cards = $cardsStorage->getCards();
|
1036 |
$card = array_shift($cards);
|
1037 |
-
$transactionId = $card->getLastTransId();
|
1038 |
-
$transaction = $payment->getTransaction($transactionId);
|
1039 |
|
1040 |
-
|
1041 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1042 |
}
|
1043 |
-
|
1044 |
$response = $this->_getTransactionDetails($transactionId);
|
|
|
|
|
1045 |
if ($response->getResponseCode() == self::RESPONSE_CODE_APPROVED) {
|
1046 |
$transaction->setAdditionalInformation($this->_isTransactionFraud, false);
|
1047 |
$payment->setIsTransactionApproved(true);
|
1048 |
} elseif ($response->getResponseReasonCode() == self::RESPONSE_REASON_CODE_PENDING_REVIEW_DECLINED) {
|
1049 |
$payment->setIsTransactionDenied(true);
|
1050 |
}
|
1051 |
-
return
|
1052 |
}
|
1053 |
|
1054 |
/**
|
@@ -1526,31 +1541,59 @@ class Mage_Paygate_Model_Authorizenet extends Mage_Payment_Model_Method_Cc
|
|
1526 |
|
1527 |
$client = new Varien_Http_Client();
|
1528 |
$uri = $this->getConfigData('cgi_url_td');
|
1529 |
-
$
|
|
|
1530 |
$client->setConfig(array('timeout'=>45));
|
1531 |
$client->setHeaders(array('Content-Type: text/xml'));
|
1532 |
$client->setMethod(Zend_Http_Client::POST);
|
1533 |
$client->setRawData($requestBody);
|
1534 |
|
1535 |
-
$debugData = array(
|
|
|
|
|
|
|
1536 |
|
1537 |
try {
|
1538 |
$responseBody = $client->request()->getBody();
|
1539 |
$debugData['result'] = $responseBody;
|
1540 |
-
$this->_debug($debugData);
|
1541 |
libxml_use_internal_errors(true);
|
1542 |
$responseXmlDocument = new Varien_Simplexml_Element($responseBody);
|
1543 |
libxml_use_internal_errors(false);
|
1544 |
} catch (Exception $e) {
|
|
|
|
|
1545 |
Mage::throwException(Mage::helper('paygate')->__('Payment updating error.'));
|
1546 |
}
|
1547 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1548 |
$response = new Varien_Object;
|
|
|
|
|
1549 |
$response
|
1550 |
-
->setResponseCode((string)$
|
1551 |
-
->setResponseReasonCode((string)$
|
1552 |
-
->setTransactionStatus((string)$
|
1553 |
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1554 |
return $response;
|
1555 |
}
|
1556 |
}
|
35 |
/*
|
36 |
* Transaction Details gateway url
|
37 |
*/
|
38 |
+
const CGI_URL_TD = 'https://api.authorize.net/xml/v1/request.api';
|
39 |
|
40 |
const REQUEST_METHOD_CC = 'CC';
|
41 |
const REQUEST_METHOD_ECHECK = 'ECHECK';
|
1028 |
*/
|
1029 |
public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId)
|
1030 |
{
|
1031 |
+
$data = parent::fetchTransactionInfo($payment, $transactionId);
|
1032 |
$cardsStorage = $this->getCardsStorage($payment);
|
1033 |
+
|
1034 |
if ($cardsStorage->getCardsCount() != 1) {
|
1035 |
+
return $data;
|
1036 |
}
|
1037 |
$cards = $cardsStorage->getCards();
|
1038 |
$card = array_shift($cards);
|
|
|
|
|
1039 |
|
1040 |
+
/*
|
1041 |
+
* We need try to get transaction from Mage::registry,
|
1042 |
+
* because in cases when fetch calling from Mage_Adminhtml_Sales_TransactionsController::fetchAction()
|
1043 |
+
* this line "$transaction = $payment->getTransaction($transactionId)" loads a fetching transaction into a new object,
|
1044 |
+
* so some changes (for ex. $transaction->setAdditionalInformation($this->_isTransactionFraud, false) ) will not saved,
|
1045 |
+
* because controller have another object for this transaction and Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS isn't includes _isTransactionFraud flag.
|
1046 |
+
*/
|
1047 |
+
$transaction = Mage::registry('current_transaction');
|
1048 |
+
if (is_null($transaction)) {
|
1049 |
+
//this is for payment info update:
|
1050 |
+
$transactionId = $card->getLastTransId();
|
1051 |
+
$transaction = $payment->getTransaction($transactionId);
|
1052 |
+
}
|
1053 |
+
//because in child transaction, the txn_id spoils by added additional word (@see $this->_preauthorizeCaptureCardTransaction()):
|
1054 |
+
if (empty($transactionId) || $transaction->getParentId()) {
|
1055 |
+
$transactionId = $transaction->getAdditionalInformation($this->_realTransactionIdKey);
|
1056 |
}
|
|
|
1057 |
$response = $this->_getTransactionDetails($transactionId);
|
1058 |
+
$data = array_merge($data, $response->getData());
|
1059 |
+
|
1060 |
if ($response->getResponseCode() == self::RESPONSE_CODE_APPROVED) {
|
1061 |
$transaction->setAdditionalInformation($this->_isTransactionFraud, false);
|
1062 |
$payment->setIsTransactionApproved(true);
|
1063 |
} elseif ($response->getResponseReasonCode() == self::RESPONSE_REASON_CODE_PENDING_REVIEW_DECLINED) {
|
1064 |
$payment->setIsTransactionDenied(true);
|
1065 |
}
|
1066 |
+
return $data;
|
1067 |
}
|
1068 |
|
1069 |
/**
|
1541 |
|
1542 |
$client = new Varien_Http_Client();
|
1543 |
$uri = $this->getConfigData('cgi_url_td');
|
1544 |
+
$uri = $uri ? $uri : self::CGI_URL_TD;
|
1545 |
+
$client->setUri($uri);
|
1546 |
$client->setConfig(array('timeout'=>45));
|
1547 |
$client->setHeaders(array('Content-Type: text/xml'));
|
1548 |
$client->setMethod(Zend_Http_Client::POST);
|
1549 |
$client->setRawData($requestBody);
|
1550 |
|
1551 |
+
$debugData = array(
|
1552 |
+
'url' => $uri,
|
1553 |
+
'request' => $requestBody
|
1554 |
+
);
|
1555 |
|
1556 |
try {
|
1557 |
$responseBody = $client->request()->getBody();
|
1558 |
$debugData['result'] = $responseBody;
|
|
|
1559 |
libxml_use_internal_errors(true);
|
1560 |
$responseXmlDocument = new Varien_Simplexml_Element($responseBody);
|
1561 |
libxml_use_internal_errors(false);
|
1562 |
} catch (Exception $e) {
|
1563 |
+
$debugData['exception'] = $e->getMessage();
|
1564 |
+
$this->_debug($debugData);
|
1565 |
Mage::throwException(Mage::helper('paygate')->__('Payment updating error.'));
|
1566 |
}
|
1567 |
|
1568 |
+
$this->_debug($debugData);
|
1569 |
+
|
1570 |
+
return $this->_parseTransactionDetailsXmlResponseToVarienObject($responseXmlDocument);
|
1571 |
+
}
|
1572 |
+
|
1573 |
+
/**
|
1574 |
+
* Parses xml response object with full transaction details to Varien_Object
|
1575 |
+
*
|
1576 |
+
* @param Varien_Simplexml_Element $responseXmlDocument - xml object with full transaction details for a specified transaction ID
|
1577 |
+
* @return Varien_Object
|
1578 |
+
*/
|
1579 |
+
protected function _parseTransactionDetailsXmlResponseToVarienObject(Varien_Simplexml_Element $responseXmlDocument)
|
1580 |
+
{
|
1581 |
$response = new Varien_Object;
|
1582 |
+
$responseTransactionXmlDocument = $responseXmlDocument->transaction;
|
1583 |
+
//main fields for generating order status:
|
1584 |
$response
|
1585 |
+
->setResponseCode((string)$responseTransactionXmlDocument->responseCode)
|
1586 |
+
->setResponseReasonCode((string)$responseTransactionXmlDocument->responseReasonCode)
|
1587 |
+
->setTransactionStatus((string)$responseTransactionXmlDocument->transactionStatus)
|
1588 |
;
|
1589 |
+
//some additional fields:
|
1590 |
+
isset($responseTransactionXmlDocument->responseReasonDescription) && $response->setResponseReasonDescription((string)$responseTransactionXmlDocument->responseReasonDescription);
|
1591 |
+
isset($responseTransactionXmlDocument->FDSFilterAction) && $response->setFdsFilterAction((string)$responseTransactionXmlDocument->FDSFilterAction);
|
1592 |
+
isset($responseTransactionXmlDocument->FDSFilters) && $response->setFdsFilters(serialize($responseTransactionXmlDocument->FDSFilters->asArray()));
|
1593 |
+
isset($responseTransactionXmlDocument->transactionType) && $response->setTransactionType((string)$responseTransactionXmlDocument->transactionType);
|
1594 |
+
isset($responseTransactionXmlDocument->submitTimeUTC) && $response->setSubmitTimeUtc((string)$responseTransactionXmlDocument->submitTimeUTC);
|
1595 |
+
isset($responseTransactionXmlDocument->submitTimeLocal) && $response->setSubmitTimeLocal((string)$responseTransactionXmlDocument->submitTimeLocal);
|
1596 |
+
|
1597 |
return $response;
|
1598 |
}
|
1599 |
}
|
app/code/core/Mage/Paygate/controllers/Adminhtml/Paygate/Authorizenet/PaymentController.php
CHANGED
@@ -76,4 +76,14 @@ class Mage_Paygate_Adminhtml_Paygate_Authorizenet_PaymentController extends Mage
|
|
76 |
$output = $layout->getOutput();
|
77 |
return $output;
|
78 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
76 |
$output = $layout->getOutput();
|
77 |
return $output;
|
78 |
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Check is allowed access to action
|
82 |
+
*
|
83 |
+
* @return bool
|
84 |
+
*/
|
85 |
+
protected function _isAllowed()
|
86 |
+
{
|
87 |
+
return Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/review_payment');
|
88 |
+
}
|
89 |
}
|
app/code/core/Mage/Paygate/etc/config.xml
CHANGED
@@ -107,6 +107,7 @@
|
|
107 |
<active>0</active>
|
108 |
<cctypes>AE,VI,MC,DI</cctypes>
|
109 |
<cgi_url>https://secure.authorize.net/gateway/transact.dll</cgi_url>
|
|
|
110 |
<debug>0</debug>
|
111 |
<email_customer>0</email_customer>
|
112 |
<login backend_model="adminhtml/system_config_backend_encrypted"/>
|
107 |
<active>0</active>
|
108 |
<cctypes>AE,VI,MC,DI</cctypes>
|
109 |
<cgi_url>https://secure.authorize.net/gateway/transact.dll</cgi_url>
|
110 |
+
<cgi_url_td>https://api.authorize.net/xml/v1/request.api</cgi_url_td>
|
111 |
<debug>0</debug>
|
112 |
<email_customer>0</email_customer>
|
113 |
<login backend_model="adminhtml/system_config_backend_encrypted"/>
|
app/code/core/Mage/Paygate/etc/system.xml
CHANGED
@@ -51,7 +51,7 @@
|
|
51 |
<label>Credit Card Types</label>
|
52 |
<frontend_type>multiselect</frontend_type>
|
53 |
<source_model>paygate/authorizenet_source_cctype</source_model>
|
54 |
-
<sort_order>
|
55 |
<show_in_default>1</show_in_default>
|
56 |
<show_in_website>1</show_in_website>
|
57 |
<show_in_store>0</show_in_store>
|
@@ -60,7 +60,7 @@
|
|
60 |
<label>Credit Card Verification</label>
|
61 |
<frontend_type>select</frontend_type>
|
62 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
63 |
-
<sort_order>
|
64 |
<show_in_default>1</show_in_default>
|
65 |
<show_in_website>1</show_in_website>
|
66 |
<show_in_store>0</show_in_store>
|
@@ -69,7 +69,7 @@
|
|
69 |
<label>Email Customer</label>
|
70 |
<frontend_type>select</frontend_type>
|
71 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
72 |
-
<sort_order>
|
73 |
<show_in_default>1</show_in_default>
|
74 |
<show_in_website>1</show_in_website>
|
75 |
<show_in_store>0</show_in_store>
|
@@ -78,7 +78,7 @@
|
|
78 |
<label>API Login ID</label>
|
79 |
<frontend_type>obscure</frontend_type>
|
80 |
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
81 |
-
<sort_order>
|
82 |
<show_in_default>1</show_in_default>
|
83 |
<show_in_website>1</show_in_website>
|
84 |
<show_in_store>0</show_in_store>
|
@@ -87,7 +87,7 @@
|
|
87 |
<label>Merchant's Email</label>
|
88 |
<frontend_type>text</frontend_type>
|
89 |
<validate>validate-email</validate>
|
90 |
-
<sort_order>
|
91 |
<show_in_default>1</show_in_default>
|
92 |
<show_in_website>1</show_in_website>
|
93 |
<show_in_store>0</show_in_store>
|
@@ -96,7 +96,7 @@
|
|
96 |
<label>New Order Status</label>
|
97 |
<frontend_type>select</frontend_type>
|
98 |
<source_model>adminhtml/system_config_source_order_status_processing</source_model>
|
99 |
-
<sort_order>
|
100 |
<show_in_default>1</show_in_default>
|
101 |
<show_in_website>1</show_in_website>
|
102 |
<show_in_store>0</show_in_store>
|
@@ -104,7 +104,7 @@
|
|
104 |
<sort_order translate="label">
|
105 |
<label>Sort Order</label>
|
106 |
<frontend_type>text</frontend_type>
|
107 |
-
<sort_order>
|
108 |
<show_in_default>1</show_in_default>
|
109 |
<show_in_website>1</show_in_website>
|
110 |
<show_in_store>0</show_in_store>
|
@@ -113,7 +113,7 @@
|
|
113 |
<label>Test Mode</label>
|
114 |
<frontend_type>select</frontend_type>
|
115 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
116 |
-
<sort_order>
|
117 |
<show_in_default>1</show_in_default>
|
118 |
<show_in_website>1</show_in_website>
|
119 |
<show_in_store>0</show_in_store>
|
@@ -122,7 +122,7 @@
|
|
122 |
<label>Debug</label>
|
123 |
<frontend_type>select</frontend_type>
|
124 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
125 |
-
<sort_order>
|
126 |
<show_in_default>1</show_in_default>
|
127 |
<show_in_website>1</show_in_website>
|
128 |
<show_in_store>0</show_in_store>
|
@@ -130,7 +130,7 @@
|
|
130 |
<title translate="label">
|
131 |
<label>Title</label>
|
132 |
<frontend_type>text</frontend_type>
|
133 |
-
<sort_order>
|
134 |
<show_in_default>1</show_in_default>
|
135 |
<show_in_website>1</show_in_website>
|
136 |
<show_in_store>1</show_in_store>
|
@@ -139,7 +139,7 @@
|
|
139 |
<label>Transaction Key</label>
|
140 |
<frontend_type>obscure</frontend_type>
|
141 |
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
142 |
-
<sort_order>
|
143 |
<show_in_default>1</show_in_default>
|
144 |
<show_in_website>1</show_in_website>
|
145 |
<show_in_store>0</show_in_store>
|
@@ -148,7 +148,7 @@
|
|
148 |
<label>Payment Action</label>
|
149 |
<frontend_type>select</frontend_type>
|
150 |
<source_model>paygate/authorizenet_source_paymentAction</source_model>
|
151 |
-
<sort_order>
|
152 |
<show_in_default>1</show_in_default>
|
153 |
<show_in_website>1</show_in_website>
|
154 |
<show_in_store>0</show_in_store>
|
@@ -156,16 +156,24 @@
|
|
156 |
<cgi_url>
|
157 |
<label>Gateway URL</label>
|
158 |
<frontend_type>text</frontend_type>
|
159 |
-
<sort_order>
|
160 |
<show_in_default>1</show_in_default>
|
161 |
<show_in_website>1</show_in_website>
|
162 |
<show_in_store>0</show_in_store>
|
163 |
</cgi_url>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
<currency translate="label">
|
165 |
<label>Accepted Currency</label>
|
166 |
<frontend_type>select</frontend_type>
|
167 |
<source_model>adminhtml/system_config_source_currency</source_model>
|
168 |
-
<sort_order>
|
169 |
<show_in_default>1</show_in_default>
|
170 |
<show_in_website>1</show_in_website>
|
171 |
<show_in_store>0</show_in_store>
|
@@ -173,7 +181,7 @@
|
|
173 |
<allowspecific translate="label">
|
174 |
<label>Payment from Applicable Countries</label>
|
175 |
<frontend_type>allowspecific</frontend_type>
|
176 |
-
<sort_order>
|
177 |
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
178 |
<show_in_default>1</show_in_default>
|
179 |
<show_in_website>1</show_in_website>
|
@@ -182,7 +190,7 @@
|
|
182 |
<specificcountry translate="label">
|
183 |
<label>Payment from Specific Countries</label>
|
184 |
<frontend_type>multiselect</frontend_type>
|
185 |
-
<sort_order>
|
186 |
<source_model>adminhtml/system_config_source_country</source_model>
|
187 |
<show_in_default>1</show_in_default>
|
188 |
<show_in_website>1</show_in_website>
|
@@ -191,7 +199,7 @@
|
|
191 |
<min_order_total translate="label">
|
192 |
<label>Minimum Order Total</label>
|
193 |
<frontend_type>text</frontend_type>
|
194 |
-
<sort_order>
|
195 |
<show_in_default>1</show_in_default>
|
196 |
<show_in_website>1</show_in_website>
|
197 |
<show_in_store>0</show_in_store>
|
@@ -199,7 +207,7 @@
|
|
199 |
<max_order_total translate="label">
|
200 |
<label>Maximum Order Total</label>
|
201 |
<frontend_type>text</frontend_type>
|
202 |
-
<sort_order>
|
203 |
<show_in_default>1</show_in_default>
|
204 |
<show_in_website>1</show_in_website>
|
205 |
<show_in_store>0</show_in_store>
|
@@ -208,7 +216,7 @@
|
|
208 |
<label>Allow Partial Authorization</label>
|
209 |
<frontend_type>select</frontend_type>
|
210 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
211 |
-
<sort_order>
|
212 |
<show_in_default>1</show_in_default>
|
213 |
<show_in_website>1</show_in_website>
|
214 |
<show_in_store>0</show_in_store>
|
@@ -216,7 +224,7 @@
|
|
216 |
<heading_3dsecure translate="label">
|
217 |
<label>3D Secure</label>
|
218 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
219 |
-
<sort_order>
|
220 |
<show_in_default>1</show_in_default>
|
221 |
<show_in_website>1</show_in_website>
|
222 |
</heading_3dsecure>
|
51 |
<label>Credit Card Types</label>
|
52 |
<frontend_type>multiselect</frontend_type>
|
53 |
<source_model>paygate/authorizenet_source_cctype</source_model>
|
54 |
+
<sort_order>65</sort_order>
|
55 |
<show_in_default>1</show_in_default>
|
56 |
<show_in_website>1</show_in_website>
|
57 |
<show_in_store>0</show_in_store>
|
60 |
<label>Credit Card Verification</label>
|
61 |
<frontend_type>select</frontend_type>
|
62 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
63 |
+
<sort_order>75</sort_order>
|
64 |
<show_in_default>1</show_in_default>
|
65 |
<show_in_website>1</show_in_website>
|
66 |
<show_in_store>0</show_in_store>
|
69 |
<label>Email Customer</label>
|
70 |
<frontend_type>select</frontend_type>
|
71 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
72 |
+
<sort_order>60</sort_order>
|
73 |
<show_in_default>1</show_in_default>
|
74 |
<show_in_website>1</show_in_website>
|
75 |
<show_in_store>0</show_in_store>
|
78 |
<label>API Login ID</label>
|
79 |
<frontend_type>obscure</frontend_type>
|
80 |
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
81 |
+
<sort_order>10</sort_order>
|
82 |
<show_in_default>1</show_in_default>
|
83 |
<show_in_website>1</show_in_website>
|
84 |
<show_in_store>0</show_in_store>
|
87 |
<label>Merchant's Email</label>
|
88 |
<frontend_type>text</frontend_type>
|
89 |
<validate>validate-email</validate>
|
90 |
+
<sort_order>15</sort_order>
|
91 |
<show_in_default>1</show_in_default>
|
92 |
<show_in_website>1</show_in_website>
|
93 |
<show_in_store>0</show_in_store>
|
96 |
<label>New Order Status</label>
|
97 |
<frontend_type>select</frontend_type>
|
98 |
<source_model>adminhtml/system_config_source_order_status_processing</source_model>
|
99 |
+
<sort_order>40</sort_order>
|
100 |
<show_in_default>1</show_in_default>
|
101 |
<show_in_website>1</show_in_website>
|
102 |
<show_in_store>0</show_in_store>
|
104 |
<sort_order translate="label">
|
105 |
<label>Sort Order</label>
|
106 |
<frontend_type>text</frontend_type>
|
107 |
+
<sort_order>95</sort_order>
|
108 |
<show_in_default>1</show_in_default>
|
109 |
<show_in_website>1</show_in_website>
|
110 |
<show_in_store>0</show_in_store>
|
113 |
<label>Test Mode</label>
|
114 |
<frontend_type>select</frontend_type>
|
115 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
116 |
+
<sort_order>45</sort_order>
|
117 |
<show_in_default>1</show_in_default>
|
118 |
<show_in_website>1</show_in_website>
|
119 |
<show_in_store>0</show_in_store>
|
122 |
<label>Debug</label>
|
123 |
<frontend_type>select</frontend_type>
|
124 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
125 |
+
<sort_order>50</sort_order>
|
126 |
<show_in_default>1</show_in_default>
|
127 |
<show_in_website>1</show_in_website>
|
128 |
<show_in_store>0</show_in_store>
|
130 |
<title translate="label">
|
131 |
<label>Title</label>
|
132 |
<frontend_type>text</frontend_type>
|
133 |
+
<sort_order>20</sort_order>
|
134 |
<show_in_default>1</show_in_default>
|
135 |
<show_in_website>1</show_in_website>
|
136 |
<show_in_store>1</show_in_store>
|
139 |
<label>Transaction Key</label>
|
140 |
<frontend_type>obscure</frontend_type>
|
141 |
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
142 |
+
<sort_order>25</sort_order>
|
143 |
<show_in_default>1</show_in_default>
|
144 |
<show_in_website>1</show_in_website>
|
145 |
<show_in_store>0</show_in_store>
|
148 |
<label>Payment Action</label>
|
149 |
<frontend_type>select</frontend_type>
|
150 |
<source_model>paygate/authorizenet_source_paymentAction</source_model>
|
151 |
+
<sort_order>5</sort_order>
|
152 |
<show_in_default>1</show_in_default>
|
153 |
<show_in_website>1</show_in_website>
|
154 |
<show_in_store>0</show_in_store>
|
156 |
<cgi_url>
|
157 |
<label>Gateway URL</label>
|
158 |
<frontend_type>text</frontend_type>
|
159 |
+
<sort_order>30</sort_order>
|
160 |
<show_in_default>1</show_in_default>
|
161 |
<show_in_website>1</show_in_website>
|
162 |
<show_in_store>0</show_in_store>
|
163 |
</cgi_url>
|
164 |
+
<cgi_url_td>
|
165 |
+
<label>Payment Update URL</label>
|
166 |
+
<frontend_type>text</frontend_type>
|
167 |
+
<sort_order>35</sort_order>
|
168 |
+
<show_in_default>1</show_in_default>
|
169 |
+
<show_in_website>1</show_in_website>
|
170 |
+
<show_in_store>0</show_in_store>
|
171 |
+
</cgi_url_td>
|
172 |
<currency translate="label">
|
173 |
<label>Accepted Currency</label>
|
174 |
<frontend_type>select</frontend_type>
|
175 |
<source_model>adminhtml/system_config_source_currency</source_model>
|
176 |
+
<sort_order>55</sort_order>
|
177 |
<show_in_default>1</show_in_default>
|
178 |
<show_in_website>1</show_in_website>
|
179 |
<show_in_store>0</show_in_store>
|
181 |
<allowspecific translate="label">
|
182 |
<label>Payment from Applicable Countries</label>
|
183 |
<frontend_type>allowspecific</frontend_type>
|
184 |
+
<sort_order>70</sort_order>
|
185 |
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
186 |
<show_in_default>1</show_in_default>
|
187 |
<show_in_website>1</show_in_website>
|
190 |
<specificcountry translate="label">
|
191 |
<label>Payment from Specific Countries</label>
|
192 |
<frontend_type>multiselect</frontend_type>
|
193 |
+
<sort_order>80</sort_order>
|
194 |
<source_model>adminhtml/system_config_source_country</source_model>
|
195 |
<show_in_default>1</show_in_default>
|
196 |
<show_in_website>1</show_in_website>
|
199 |
<min_order_total translate="label">
|
200 |
<label>Minimum Order Total</label>
|
201 |
<frontend_type>text</frontend_type>
|
202 |
+
<sort_order>85</sort_order>
|
203 |
<show_in_default>1</show_in_default>
|
204 |
<show_in_website>1</show_in_website>
|
205 |
<show_in_store>0</show_in_store>
|
207 |
<max_order_total translate="label">
|
208 |
<label>Maximum Order Total</label>
|
209 |
<frontend_type>text</frontend_type>
|
210 |
+
<sort_order>90</sort_order>
|
211 |
<show_in_default>1</show_in_default>
|
212 |
<show_in_website>1</show_in_website>
|
213 |
<show_in_store>0</show_in_store>
|
216 |
<label>Allow Partial Authorization</label>
|
217 |
<frontend_type>select</frontend_type>
|
218 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
219 |
+
<sort_order>100</sort_order>
|
220 |
<show_in_default>1</show_in_default>
|
221 |
<show_in_website>1</show_in_website>
|
222 |
<show_in_store>0</show_in_store>
|
224 |
<heading_3dsecure translate="label">
|
225 |
<label>3D Secure</label>
|
226 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
227 |
+
<sort_order>105</sort_order>
|
228 |
<show_in_default>1</show_in_default>
|
229 |
<show_in_website>1</show_in_website>
|
230 |
</heading_3dsecure>
|
app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Report.php
CHANGED
@@ -43,10 +43,13 @@ class Mage_Paypal_Block_Adminhtml_Settlement_Report extends Mage_Adminhtml_Block
|
|
43 |
$this->_headerText = Mage::helper('paypal')->__('PayPal Settlement Reports');
|
44 |
parent::__construct();
|
45 |
$this->_removeButton('add');
|
46 |
-
$
|
|
|
|
|
|
|
47 |
$this->_addButton('fetch', array(
|
48 |
'label' => Mage::helper('paypal')->__('Fetch Updates'),
|
49 |
-
'onclick' => "confirmSetLocation('{$
|
50 |
'class' => 'task'
|
51 |
));
|
52 |
}
|
43 |
$this->_headerText = Mage::helper('paypal')->__('PayPal Settlement Reports');
|
44 |
parent::__construct();
|
45 |
$this->_removeButton('add');
|
46 |
+
$confirmationMessage = Mage::helper('core')->jsQuoteEscape(
|
47 |
+
Mage::helper('paypal')
|
48 |
+
->__('Connecting to PayPal SFTP server to fetch new reports. Are you sure you want to proceed?')
|
49 |
+
);
|
50 |
$this->_addButton('fetch', array(
|
51 |
'label' => Mage::helper('paypal')->__('Fetch Updates'),
|
52 |
+
'onclick' => "confirmSetLocation('{$confirmationMessage}', '{$this->getUrl('*/*/fetch')}')",
|
53 |
'class' => 'task'
|
54 |
));
|
55 |
}
|
app/code/core/Mage/Paypal/Block/Express/Review/Billing.php
CHANGED
@@ -46,6 +46,9 @@ class Mage_Paypal_Block_Express_Review_Billing extends Mage_Checkout_Block_Onepa
|
|
46 |
if (!$this->_address->getFirstname()) {
|
47 |
$this->_address->setFirstname($this->getQuote()->getCustomer()->getFirstname());
|
48 |
}
|
|
|
|
|
|
|
49 |
if (!$this->_address->getLastname()) {
|
50 |
$this->_address->setLastname($this->getQuote()->getCustomer()->getLastname());
|
51 |
}
|
46 |
if (!$this->_address->getFirstname()) {
|
47 |
$this->_address->setFirstname($this->getQuote()->getCustomer()->getFirstname());
|
48 |
}
|
49 |
+
if (!$this->_address->getMiddlename()) {
|
50 |
+
$this->_address->setMiddlename($this->getQuote()->getCustomer()->getMiddlename());
|
51 |
+
}
|
52 |
if (!$this->_address->getLastname()) {
|
53 |
$this->_address->setLastname($this->getQuote()->getCustomer()->getLastname());
|
54 |
}
|
app/code/core/Mage/Paypal/controllers/Adminhtml/Paypal/ReportsController.php
CHANGED
@@ -127,7 +127,8 @@ class Mage_Paypal_Adminhtml_Paypal_ReportsController extends Mage_Adminhtml_Cont
|
|
127 |
*/
|
128 |
protected function _isAllowed()
|
129 |
{
|
130 |
-
|
|
|
131 |
case 'index':
|
132 |
case 'details':
|
133 |
return Mage::getSingleton('admin/session')->isAllowed('report/salesroot/paypal_settlement_reports/view');
|
127 |
*/
|
128 |
protected function _isAllowed()
|
129 |
{
|
130 |
+
$action = strtolower($this->getRequest()->getActionName());
|
131 |
+
switch ($action) {
|
132 |
case 'index':
|
133 |
case 'details':
|
134 |
return Mage::getSingleton('admin/session')->isAllowed('report/salesroot/paypal_settlement_reports/view');
|
app/code/core/Mage/Persistent/Model/Observer.php
CHANGED
@@ -93,19 +93,27 @@ class Mage_Persistent_Model_Observer
|
|
93 |
|
94 |
return $this;
|
95 |
}
|
96 |
-
|
97 |
/**
|
98 |
-
* Emulate
|
99 |
*
|
100 |
* @param Mage_Core_Block_Abstract $block
|
101 |
* @return Mage_Persistent_Model_Observer
|
102 |
*/
|
103 |
-
public function
|
104 |
{
|
105 |
$block->setWelcome(
|
106 |
Mage::helper('persistent')->__('Welcome, %s!', Mage::helper('core')->escapeHtml($this->_getPersistentCustomer()->getName(), null))
|
107 |
);
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
$this->_applyAccountLinksPersistentData();
|
110 |
$block->setAdditionalHtml(Mage::app()->getLayout()->getBlock('header.additional')->toHtml());
|
111 |
|
@@ -452,6 +460,7 @@ class Mage_Persistent_Model_Observer
|
|
452 |
->setCustomerId(null)
|
453 |
->setCustomerEmail(null)
|
454 |
->setCustomerFirstname(null)
|
|
|
455 |
->setCustomerLastname(null)
|
456 |
->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID)
|
457 |
->setIsPersistent(false)
|
93 |
|
94 |
return $this;
|
95 |
}
|
|
|
96 |
/**
|
97 |
+
* Emulate welcome message with persistent data
|
98 |
*
|
99 |
* @param Mage_Core_Block_Abstract $block
|
100 |
* @return Mage_Persistent_Model_Observer
|
101 |
*/
|
102 |
+
public function emulateWelcomeMessageBlock($block)
|
103 |
{
|
104 |
$block->setWelcome(
|
105 |
Mage::helper('persistent')->__('Welcome, %s!', Mage::helper('core')->escapeHtml($this->_getPersistentCustomer()->getName(), null))
|
106 |
);
|
107 |
+
return $this;
|
108 |
+
}
|
109 |
+
/**
|
110 |
+
* Emulate 'welcome' block with persistent data
|
111 |
+
*
|
112 |
+
* @param Mage_Core_Block_Abstract $block
|
113 |
+
* @return Mage_Persistent_Model_Observer
|
114 |
+
*/
|
115 |
+
public function emulateWelcomeBlock($block)
|
116 |
+
{
|
117 |
$this->_applyAccountLinksPersistentData();
|
118 |
$block->setAdditionalHtml(Mage::app()->getLayout()->getBlock('header.additional')->toHtml());
|
119 |
|
460 |
->setCustomerId(null)
|
461 |
->setCustomerEmail(null)
|
462 |
->setCustomerFirstname(null)
|
463 |
+
->setCustomerMiddlename(null)
|
464 |
->setCustomerLastname(null)
|
465 |
->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID)
|
466 |
->setIsPersistent(false)
|
app/code/core/Mage/Persistent/etc/persistent.xml
CHANGED
@@ -28,10 +28,16 @@
|
|
28 |
<config>
|
29 |
<instances>
|
30 |
<blocks>
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
<welcome>
|
32 |
<name_in_layout>welcome</name_in_layout>
|
33 |
<class>persistent/observer</class>
|
34 |
-
<method>
|
35 |
<block_type>Mage_Page_Block_Html_Welcome</block_type>
|
36 |
</welcome>
|
37 |
<account_links>
|
28 |
<config>
|
29 |
<instances>
|
30 |
<blocks>
|
31 |
+
<header>
|
32 |
+
<name_in_layout>header</name_in_layout>
|
33 |
+
<class>persistent/observer</class>
|
34 |
+
<method>emulateWelcomeBlock</method>
|
35 |
+
<block_type>Mage_Page_Block_Html_Header</block_type>
|
36 |
+
</header>
|
37 |
<welcome>
|
38 |
<name_in_layout>welcome</name_in_layout>
|
39 |
<class>persistent/observer</class>
|
40 |
+
<method>emulateWelcomeMessageBlock</method>
|
41 |
<block_type>Mage_Page_Block_Html_Welcome</block_type>
|
42 |
</welcome>
|
43 |
<account_links>
|
app/code/core/Mage/Poll/Model/Resource/Poll.php
CHANGED
@@ -148,13 +148,11 @@ class Mage_Poll_Model_Resource_Poll extends Mage_Core_Model_Resource_Db_Abstract
|
|
148 |
$select = $this->_getReadAdapter()->select()
|
149 |
->distinct()
|
150 |
->from($this->getTable('poll_vote'), 'poll_id')
|
151 |
-
->where('ip_address =
|
152 |
-
$bind = array(':ip_address' => ip2long($ipAddress));
|
153 |
if (!empty($pollId)) {
|
154 |
-
$select->where('poll_id =
|
155 |
-
$bind[':poll_id'] = $pollId;
|
156 |
}
|
157 |
-
$result = $this->_getReadAdapter()->fetchCol($select
|
158 |
if (empty($result)) {
|
159 |
$result = array();
|
160 |
}
|
148 |
$select = $this->_getReadAdapter()->select()
|
149 |
->distinct()
|
150 |
->from($this->getTable('poll_vote'), 'poll_id')
|
151 |
+
->where('ip_address = ?', inet_pton($ipAddress));
|
|
|
152 |
if (!empty($pollId)) {
|
153 |
+
$select->where('poll_id = ?', $pollId);
|
|
|
154 |
}
|
155 |
+
$result = $this->_getReadAdapter()->fetchCol($select);
|
156 |
if (empty($result)) {
|
157 |
$result = array();
|
158 |
}
|
app/code/core/Mage/Poll/etc/config.xml
CHANGED
@@ -28,7 +28,7 @@
|
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_Poll>
|
31 |
-
<version>1.6.0.
|
32 |
</Mage_Poll>
|
33 |
</modules>
|
34 |
<frontend>
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_Poll>
|
31 |
+
<version>1.6.0.1</version>
|
32 |
</Mage_Poll>
|
33 |
</modules>
|
34 |
<frontend>
|
app/code/core/Mage/Poll/sql/poll_setup/mysql4-upgrade-1.6.0.0-1.6.0.1.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Poll
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
28 |
+
$installer = $this;
|
29 |
+
$installer->startSetup();
|
30 |
+
|
31 |
+
$installer->getConnection()->changeColumn(
|
32 |
+
$installer->getTable('poll/poll_vote'),
|
33 |
+
'ip_address',
|
34 |
+
'ip_address',
|
35 |
+
'varbinary(16)'
|
36 |
+
);
|
37 |
+
|
38 |
+
$installer->getConnection()->update(
|
39 |
+
$installer->getTable('poll/poll_vote'),
|
40 |
+
array(
|
41 |
+
'ip_address' => new Zend_Db_Expr('UNHEX(HEX(CAST(ip_address as UNSIGNED INT)))')
|
42 |
+
)
|
43 |
+
);
|
44 |
+
|
45 |
+
$installer->endSetup();
|
app/code/core/Mage/ProductAlert/Model/Email.php
CHANGED
@@ -231,14 +231,16 @@ class Mage_ProductAlert_Model_Email extends Mage_Core_Model_Abstract
|
|
231 |
if (is_null($this->_website) || is_null($this->_customer)) {
|
232 |
return false;
|
233 |
}
|
234 |
-
if (($this->_type == 'price' && count($this->_priceProducts) == 0)
|
|
|
|
|
235 |
return false;
|
236 |
}
|
237 |
if (!$this->_website->getDefaultGroup() || !$this->_website->getDefaultGroup()->getDefaultStore()) {
|
238 |
return false;
|
239 |
}
|
240 |
|
241 |
-
$store = $this->
|
242 |
$storeId = $store->getId();
|
243 |
|
244 |
if ($this->_type == 'price' && !Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId)) {
|
@@ -253,6 +255,7 @@ class Mage_ProductAlert_Model_Email extends Mage_Core_Model_Abstract
|
|
253 |
|
254 |
$appEmulation = Mage::getSingleton('core/app_emulation');
|
255 |
$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
|
|
|
256 |
|
257 |
if ($this->_type == 'price') {
|
258 |
$this->_getPriceBlock()
|
231 |
if (is_null($this->_website) || is_null($this->_customer)) {
|
232 |
return false;
|
233 |
}
|
234 |
+
if (($this->_type == 'price' && count($this->_priceProducts) == 0)
|
235 |
+
|| ($this->_type == 'stock' && count($this->_stockProducts) == 0)
|
236 |
+
) {
|
237 |
return false;
|
238 |
}
|
239 |
if (!$this->_website->getDefaultGroup() || !$this->_website->getDefaultGroup()->getDefaultStore()) {
|
240 |
return false;
|
241 |
}
|
242 |
|
243 |
+
$store = Mage::getModel('core/store')->load($this->_customer->getStoreId());
|
244 |
$storeId = $store->getId();
|
245 |
|
246 |
if ($this->_type == 'price' && !Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId)) {
|
255 |
|
256 |
$appEmulation = Mage::getSingleton('core/app_emulation');
|
257 |
$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
|
258 |
+
Mage::app()->getTranslator()->init('frontend', true);
|
259 |
|
260 |
if ($this->_type == 'price') {
|
261 |
$this->_getPriceBlock()
|
app/code/core/Mage/ProductAlert/Model/Observer.php
CHANGED
@@ -102,6 +102,7 @@ class Mage_ProductAlert_Model_Observer
|
|
102 |
protected function _processPrice(Mage_ProductAlert_Model_Email $email)
|
103 |
{
|
104 |
$email->setType('price');
|
|
|
105 |
foreach ($this->_getWebsites() as $website) {
|
106 |
/* @var $website Mage_Core_Model_Website */
|
107 |
|
@@ -127,6 +128,7 @@ class Mage_ProductAlert_Model_Observer
|
|
127 |
|
128 |
$previousCustomer = null;
|
129 |
$email->setWebsite($website);
|
|
|
130 |
foreach ($collection as $alert) {
|
131 |
try {
|
132 |
if (!$previousCustomer || $previousCustomer->getId() != $alert->getCustomerId()) {
|
@@ -178,6 +180,7 @@ class Mage_ProductAlert_Model_Observer
|
|
178 |
}
|
179 |
}
|
180 |
}
|
|
|
181 |
return $this;
|
182 |
}
|
183 |
|
@@ -190,6 +193,7 @@ class Mage_ProductAlert_Model_Observer
|
|
190 |
protected function _processStock(Mage_ProductAlert_Model_Email $email)
|
191 |
{
|
192 |
$email->setType('stock');
|
|
|
193 |
|
194 |
foreach ($this->_getWebsites() as $website) {
|
195 |
/* @var $website Mage_Core_Model_Website */
|
@@ -217,6 +221,7 @@ class Mage_ProductAlert_Model_Observer
|
|
217 |
|
218 |
$previousCustomer = null;
|
219 |
$email->setWebsite($website);
|
|
|
220 |
foreach ($collection as $alert) {
|
221 |
try {
|
222 |
if (!$previousCustomer || $previousCustomer->getId() != $alert->getCustomerId()) {
|
@@ -268,6 +273,7 @@ class Mage_ProductAlert_Model_Observer
|
|
268 |
}
|
269 |
}
|
270 |
}
|
|
|
271 |
|
272 |
return $this;
|
273 |
}
|
102 |
protected function _processPrice(Mage_ProductAlert_Model_Email $email)
|
103 |
{
|
104 |
$email->setType('price');
|
105 |
+
$originalStore = Mage::app()->getStore();
|
106 |
foreach ($this->_getWebsites() as $website) {
|
107 |
/* @var $website Mage_Core_Model_Website */
|
108 |
|
128 |
|
129 |
$previousCustomer = null;
|
130 |
$email->setWebsite($website);
|
131 |
+
Mage::app()->setCurrentStore($website->getDefaultGroup()->getDefaultStore());
|
132 |
foreach ($collection as $alert) {
|
133 |
try {
|
134 |
if (!$previousCustomer || $previousCustomer->getId() != $alert->getCustomerId()) {
|
180 |
}
|
181 |
}
|
182 |
}
|
183 |
+
Mage::app()->setCurrentStore($originalStore);
|
184 |
return $this;
|
185 |
}
|
186 |
|
193 |
protected function _processStock(Mage_ProductAlert_Model_Email $email)
|
194 |
{
|
195 |
$email->setType('stock');
|
196 |
+
$originalStore = Mage::app()->getStore();
|
197 |
|
198 |
foreach ($this->_getWebsites() as $website) {
|
199 |
/* @var $website Mage_Core_Model_Website */
|
221 |
|
222 |
$previousCustomer = null;
|
223 |
$email->setWebsite($website);
|
224 |
+
Mage::app()->setCurrentStore($website->getDefaultGroup()->getDefaultStore());
|
225 |
foreach ($collection as $alert) {
|
226 |
try {
|
227 |
if (!$previousCustomer || $previousCustomer->getId() != $alert->getCustomerId()) {
|
273 |
}
|
274 |
}
|
275 |
}
|
276 |
+
Mage::app()->setCurrentStore($originalStore);
|
277 |
|
278 |
return $this;
|
279 |
}
|
app/code/core/Mage/Rating/etc/config.xml
CHANGED
@@ -28,7 +28,7 @@
|
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_Rating>
|
31 |
-
<version>1.6.0.
|
32 |
</Mage_Rating>
|
33 |
</modules>
|
34 |
<global>
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_Rating>
|
31 |
+
<version>1.6.0.1</version>
|
32 |
</Mage_Rating>
|
33 |
</modules>
|
34 |
<global>
|
app/code/core/Mage/Rating/sql/rating_setup/mysql4-upgrade-1.6.0.0-1.6.0.1.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Rating
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
28 |
+
$installer = $this;
|
29 |
+
$installer->startSetup();
|
30 |
+
|
31 |
+
|
32 |
+
$installer->getConnection()->changeColumn(
|
33 |
+
$installer->getTable('rating/rating_option_vote'),
|
34 |
+
'remote_ip_long',
|
35 |
+
'remote_ip_long',
|
36 |
+
'varbinary(16)'
|
37 |
+
);
|
38 |
+
|
39 |
+
$installer->getConnection()->changeColumn(
|
40 |
+
$installer->getTable('rating/rating_option_vote'),
|
41 |
+
'remote_ip',
|
42 |
+
'remote_ip',
|
43 |
+
'varchar(50)'
|
44 |
+
);
|
45 |
+
|
46 |
+
$installer->getConnection()->update(
|
47 |
+
$installer->getTable('rating/rating_option_vote'),
|
48 |
+
array(
|
49 |
+
'remote_ip_long' => new Zend_Db_Expr('UNHEX(HEX(CAST(remote_ip_long as UNSIGNED INT)))')
|
50 |
+
)
|
51 |
+
);
|
52 |
+
|
53 |
+
$installer->endSetup();
|
54 |
+
|
app/code/core/Mage/Reports/Helper/Data.php
CHANGED
@@ -32,6 +32,20 @@ class Mage_Reports_Helper_Data extends Mage_Core_Helper_Abstract
|
|
32 |
const REPORT_PERIOD_TYPE_DAY = 'day';
|
33 |
const REPORT_PERIOD_TYPE_MONTH = 'month';
|
34 |
const REPORT_PERIOD_TYPE_YEAR = 'year';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
/**
|
36 |
* Retrieve array of intervals
|
37 |
*
|
32 |
const REPORT_PERIOD_TYPE_DAY = 'day';
|
33 |
const REPORT_PERIOD_TYPE_MONTH = 'month';
|
34 |
const REPORT_PERIOD_TYPE_YEAR = 'year';
|
35 |
+
|
36 |
+
const XML_PATH_REPORTS_ENABLED = 'reports/general/enabled';
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Return reports flag enabled.
|
40 |
+
*
|
41 |
+
* @return boolean
|
42 |
+
*/
|
43 |
+
|
44 |
+
public function isReportsEnabled()
|
45 |
+
{
|
46 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_REPORTS_ENABLED);
|
47 |
+
}
|
48 |
+
|
49 |
/**
|
50 |
* Retrieve array of intervals
|
51 |
*
|
app/code/core/Mage/Reports/Model/Event/Observer.php
CHANGED
@@ -34,6 +34,16 @@
|
|
34 |
*/
|
35 |
class Mage_Reports_Model_Event_Observer
|
36 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
/**
|
38 |
* Abstract Event obeserver logic
|
39 |
*
|
@@ -79,7 +89,7 @@ class Mage_Reports_Model_Event_Observer
|
|
79 |
*/
|
80 |
public function customerLogin(Varien_Event_Observer $observer)
|
81 |
{
|
82 |
-
if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
|
83 |
return $this;
|
84 |
}
|
85 |
|
@@ -106,12 +116,15 @@ class Mage_Reports_Model_Event_Observer
|
|
106 |
*/
|
107 |
public function customerLogout(Varien_Event_Observer $observer)
|
108 |
{
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
|
|
|
|
|
|
115 |
return $this;
|
116 |
}
|
117 |
|
@@ -123,6 +136,10 @@ class Mage_Reports_Model_Event_Observer
|
|
123 |
*/
|
124 |
public function catalogProductView(Varien_Event_Observer $observer)
|
125 |
{
|
|
|
|
|
|
|
|
|
126 |
$productId = $observer->getEvent()->getProduct()->getId();
|
127 |
|
128 |
Mage::getModel('reports/product_index_viewed')
|
@@ -141,6 +158,10 @@ class Mage_Reports_Model_Event_Observer
|
|
141 |
*/
|
142 |
public function sendfriendProduct(Varien_Event_Observer $observer)
|
143 |
{
|
|
|
|
|
|
|
|
|
144 |
return $this->_event(Mage_Reports_Model_Event::EVENT_PRODUCT_SEND,
|
145 |
$observer->getEvent()->getProduct()->getId()
|
146 |
);
|
@@ -156,7 +177,9 @@ class Mage_Reports_Model_Event_Observer
|
|
156 |
*/
|
157 |
public function catalogProductCompareRemoveProduct(Varien_Event_Observer $observer)
|
158 |
{
|
159 |
-
|
|
|
|
|
160 |
|
161 |
return $this;
|
162 |
}
|
@@ -171,7 +194,9 @@ class Mage_Reports_Model_Event_Observer
|
|
171 |
*/
|
172 |
public function catalogProductCompareClear(Varien_Event_Observer $observer)
|
173 |
{
|
174 |
-
|
|
|
|
|
175 |
|
176 |
return $this;
|
177 |
}
|
@@ -186,6 +211,10 @@ class Mage_Reports_Model_Event_Observer
|
|
186 |
*/
|
187 |
public function catalogProductCompareAddProduct(Varien_Event_Observer $observer)
|
188 |
{
|
|
|
|
|
|
|
|
|
189 |
$productId = $observer->getEvent()->getProduct()->getId();
|
190 |
|
191 |
Mage::getModel('reports/product_index_compared')
|
@@ -204,11 +233,14 @@ class Mage_Reports_Model_Event_Observer
|
|
204 |
*/
|
205 |
public function checkoutCartAddProduct(Varien_Event_Observer $observer)
|
206 |
{
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
|
|
|
|
211 |
}
|
|
|
212 |
return $this;
|
213 |
}
|
214 |
|
@@ -220,6 +252,10 @@ class Mage_Reports_Model_Event_Observer
|
|
220 |
*/
|
221 |
public function wishlistAddProduct(Varien_Event_Observer $observer)
|
222 |
{
|
|
|
|
|
|
|
|
|
223 |
return $this->_event(Mage_Reports_Model_Event::EVENT_PRODUCT_TO_WISHLIST,
|
224 |
$observer->getEvent()->getProduct()->getId()
|
225 |
);
|
@@ -233,6 +269,10 @@ class Mage_Reports_Model_Event_Observer
|
|
233 |
*/
|
234 |
public function wishlistShare(Varien_Event_Observer $observer)
|
235 |
{
|
|
|
|
|
|
|
|
|
236 |
return $this->_event(Mage_Reports_Model_Event::EVENT_WISHLIST_SHARE,
|
237 |
$observer->getEvent()->getWishlist()->getId()
|
238 |
);
|
34 |
*/
|
35 |
class Mage_Reports_Model_Event_Observer
|
36 |
{
|
37 |
+
protected $_enabledReports = true;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Object initialization
|
41 |
+
*/
|
42 |
+
public function __construct()
|
43 |
+
{
|
44 |
+
$this->_enabledReports = Mage::helper('reports')->isReportsEnabled();
|
45 |
+
}
|
46 |
+
|
47 |
/**
|
48 |
* Abstract Event obeserver logic
|
49 |
*
|
89 |
*/
|
90 |
public function customerLogin(Varien_Event_Observer $observer)
|
91 |
{
|
92 |
+
if (!Mage::getSingleton('customer/session')->isLoggedIn() || !$this->_enabledReports) {
|
93 |
return $this;
|
94 |
}
|
95 |
|
116 |
*/
|
117 |
public function customerLogout(Varien_Event_Observer $observer)
|
118 |
{
|
119 |
+
if ($this->_enabledReports) {
|
120 |
+
Mage::getModel('reports/product_index_compared')
|
121 |
+
->purgeVisitorByCustomer()
|
122 |
+
->calculate();
|
123 |
+
Mage::getModel('reports/product_index_viewed')
|
124 |
+
->purgeVisitorByCustomer()
|
125 |
+
->calculate();
|
126 |
+
}
|
127 |
+
|
128 |
return $this;
|
129 |
}
|
130 |
|
136 |
*/
|
137 |
public function catalogProductView(Varien_Event_Observer $observer)
|
138 |
{
|
139 |
+
if (!$this->_enabledReports) {
|
140 |
+
return $this;
|
141 |
+
}
|
142 |
+
|
143 |
$productId = $observer->getEvent()->getProduct()->getId();
|
144 |
|
145 |
Mage::getModel('reports/product_index_viewed')
|
158 |
*/
|
159 |
public function sendfriendProduct(Varien_Event_Observer $observer)
|
160 |
{
|
161 |
+
if (!$this->_enabledReports) {
|
162 |
+
return $this;
|
163 |
+
}
|
164 |
+
|
165 |
return $this->_event(Mage_Reports_Model_Event::EVENT_PRODUCT_SEND,
|
166 |
$observer->getEvent()->getProduct()->getId()
|
167 |
);
|
177 |
*/
|
178 |
public function catalogProductCompareRemoveProduct(Varien_Event_Observer $observer)
|
179 |
{
|
180 |
+
if ($this->_enabledReports) {
|
181 |
+
Mage::getModel('reports/product_index_compared')->calculate();
|
182 |
+
}
|
183 |
|
184 |
return $this;
|
185 |
}
|
194 |
*/
|
195 |
public function catalogProductCompareClear(Varien_Event_Observer $observer)
|
196 |
{
|
197 |
+
if ($this->_enabledReports) {
|
198 |
+
Mage::getModel('reports/product_index_compared')->calculate();
|
199 |
+
}
|
200 |
|
201 |
return $this;
|
202 |
}
|
211 |
*/
|
212 |
public function catalogProductCompareAddProduct(Varien_Event_Observer $observer)
|
213 |
{
|
214 |
+
if (!$this->_enabledReports) {
|
215 |
+
return $this;
|
216 |
+
}
|
217 |
+
|
218 |
$productId = $observer->getEvent()->getProduct()->getId();
|
219 |
|
220 |
Mage::getModel('reports/product_index_compared')
|
233 |
*/
|
234 |
public function checkoutCartAddProduct(Varien_Event_Observer $observer)
|
235 |
{
|
236 |
+
if ($this->_enabledReports) {
|
237 |
+
$quoteItem = $observer->getEvent()->getItem();
|
238 |
+
if (!$quoteItem->getId() && !$quoteItem->getParentItem()) {
|
239 |
+
$productId = $quoteItem->getProductId();
|
240 |
+
$this->_event(Mage_Reports_Model_Event::EVENT_PRODUCT_TO_CART, $productId);
|
241 |
+
}
|
242 |
}
|
243 |
+
|
244 |
return $this;
|
245 |
}
|
246 |
|
252 |
*/
|
253 |
public function wishlistAddProduct(Varien_Event_Observer $observer)
|
254 |
{
|
255 |
+
if (!$this->_enabledReports) {
|
256 |
+
return $this;
|
257 |
+
}
|
258 |
+
|
259 |
return $this->_event(Mage_Reports_Model_Event::EVENT_PRODUCT_TO_WISHLIST,
|
260 |
$observer->getEvent()->getProduct()->getId()
|
261 |
);
|
269 |
*/
|
270 |
public function wishlistShare(Varien_Event_Observer $observer)
|
271 |
{
|
272 |
+
if (!$this->_enabledReports) {
|
273 |
+
return $this;
|
274 |
+
}
|
275 |
+
|
276 |
return $this->_event(Mage_Reports_Model_Event::EVENT_WISHLIST_SHARE,
|
277 |
$observer->getEvent()->getWishlist()->getId()
|
278 |
);
|
app/code/core/Mage/Reports/Model/Product/Index/Abstract.php
CHANGED
@@ -42,14 +42,13 @@ abstract class Mage_Reports_Model_Product_Index_Abstract extends Mage_Core_Model
|
|
42 |
protected $_countCacheKey;
|
43 |
|
44 |
/**
|
45 |
-
*
|
46 |
*
|
|
|
47 |
* @return Mage_Reports_Model_Product_Index_Abstract
|
48 |
*/
|
49 |
-
|
50 |
{
|
51 |
-
parent::_beforeSave();
|
52 |
-
|
53 |
if (!$this->hasVisitorId()) {
|
54 |
$this->setVisitorId($this->getVisitorId());
|
55 |
}
|
@@ -63,6 +62,12 @@ abstract class Mage_Reports_Model_Product_Index_Abstract extends Mage_Core_Model
|
|
63 |
$this->setAddedAt(now());
|
64 |
}
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
return $this;
|
67 |
}
|
68 |
|
42 |
protected $_countCacheKey;
|
43 |
|
44 |
/**
|
45 |
+
* Save object data
|
46 |
*
|
47 |
+
* @see Mage_Core_Model_Abstract::save()
|
48 |
* @return Mage_Reports_Model_Product_Index_Abstract
|
49 |
*/
|
50 |
+
public function save()
|
51 |
{
|
|
|
|
|
52 |
if (!$this->hasVisitorId()) {
|
53 |
$this->setVisitorId($this->getVisitorId());
|
54 |
}
|
62 |
$this->setAddedAt(now());
|
63 |
}
|
64 |
|
65 |
+
// Thanks to new performance tweaks it is possible to switch off visitor logging
|
66 |
+
// This check is needed to make sure report record has either visitor id or customer id
|
67 |
+
if ($this->hasVisitorId() || $this->hasCustomerId()) {
|
68 |
+
parent::save();
|
69 |
+
}
|
70 |
+
|
71 |
return $this;
|
72 |
}
|
73 |
|
app/code/core/Mage/Reports/Model/Resource/Customer/Collection.php
CHANGED
@@ -216,12 +216,12 @@ class Mage_Reports_Model_Resource_Customer_Collection extends Mage_Customer_Mode
|
|
216 |
$baseSubtotalRefunded = $adapter->getIfNullSql('orders.base_subtotal_refunded', 0);
|
217 |
$baseSubtotalCanceled = $adapter->getIfNullSql('orders.base_subtotal_canceled', 0);
|
218 |
|
219 |
-
$totalExpr = (
|
220 |
-
? "(orders.base_subtotal-{$baseSubtotalCanceled}-{$baseSubtotalRefunded})*orders.base_to_global_rate"
|
221 |
-
: "orders.base_subtotal-{$baseSubtotalCanceled}-{$baseSubtotalRefunded}";
|
222 |
|
223 |
$select = $this->getConnection()->select();
|
224 |
-
$select->from(array('orders'
|
225 |
'orders_avg_amount' => "AVG({$totalExpr})",
|
226 |
'orders_sum_amount' => "SUM({$totalExpr})",
|
227 |
'orders_count' => 'COUNT(orders.entity_id)',
|
216 |
$baseSubtotalRefunded = $adapter->getIfNullSql('orders.base_subtotal_refunded', 0);
|
217 |
$baseSubtotalCanceled = $adapter->getIfNullSql('orders.base_subtotal_canceled', 0);
|
218 |
|
219 |
+
$totalExpr = (!$this->_addOrderStatisticsIsFilter)
|
220 |
+
? "(orders.base_subtotal - {$baseSubtotalCanceled} - {$baseSubtotalRefunded}) * orders.base_to_global_rate"
|
221 |
+
: "orders.base_subtotal - {$baseSubtotalCanceled} - {$baseSubtotalRefunded}";
|
222 |
|
223 |
$select = $this->getConnection()->select();
|
224 |
+
$select->from(array('orders' => $this->getTable('sales/order')), array(
|
225 |
'orders_avg_amount' => "AVG({$totalExpr})",
|
226 |
'orders_sum_amount' => "SUM({$totalExpr})",
|
227 |
'orders_count' => 'COUNT(orders.entity_id)',
|
app/code/core/Mage/Reports/Model/Resource/Order/Collection.php
CHANGED
@@ -645,7 +645,11 @@ class Mage_Reports_Model_Resource_Order_Collection extends Mage_Sales_Model_Reso
|
|
645 |
*/
|
646 |
public function joinCustomerName($alias = 'name')
|
647 |
{
|
648 |
-
$fields
|
|
|
|
|
|
|
|
|
649 |
$fieldConcat = $this->getConnection()->getConcatSql($fields, ' ');
|
650 |
$this->getSelect()->columns(array($alias => $fieldConcat));
|
651 |
return $this;
|
645 |
*/
|
646 |
public function joinCustomerName($alias = 'name')
|
647 |
{
|
648 |
+
$fields = array(
|
649 |
+
'main_table.customer_firstname',
|
650 |
+
'main_table.customer_middlename',
|
651 |
+
'main_table.customer_lastname'
|
652 |
+
);
|
653 |
$fieldConcat = $this->getConnection()->getConcatSql($fields, ' ');
|
654 |
$this->getSelect()->columns(array($alias => $fieldConcat));
|
655 |
return $this;
|
app/code/core/Mage/Reports/Model/Resource/Quote/Collection.php
CHANGED
@@ -174,20 +174,24 @@ class Mage_Reports_Model_Resource_Quote_Collection extends Mage_Sales_Model_Reso
|
|
174 |
*/
|
175 |
public function addCustomerData($filter = null)
|
176 |
{
|
177 |
-
$customerEntity
|
178 |
-
$attrFirstname
|
179 |
-
$attrFirstnameId
|
180 |
-
$attrFirstnameTableName
|
181 |
|
182 |
-
$attrLastname
|
183 |
-
$attrLastnameId
|
184 |
-
$attrLastnameTableName
|
|
|
|
|
|
|
|
|
185 |
|
186 |
$attrEmail = $customerEntity->getAttribute('email');
|
187 |
$attrEmailTableName = $attrEmail->getBackend()->getTable();
|
188 |
|
189 |
$adapter = $this->getSelect()->getAdapter();
|
190 |
-
$customerName = $adapter->getConcatSql(array('cust_fname.value', 'cust_lname.value'), ' ');
|
191 |
$this->getSelect()
|
192 |
->joinInner(
|
193 |
array('cust_email' => $attrEmailTableName),
|
@@ -198,15 +202,23 @@ class Mage_Reports_Model_Resource_Quote_Collection extends Mage_Sales_Model_Reso
|
|
198 |
array('cust_fname' => $attrFirstnameTableName),
|
199 |
implode(' AND ', array(
|
200 |
'cust_fname.entity_id = main_table.customer_id',
|
201 |
-
$adapter->quoteInto('cust_fname.attribute_id = ?', (int)$attrFirstnameId),
|
202 |
)),
|
203 |
array('firstname' => 'cust_fname.value')
|
204 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
->joinInner(
|
206 |
array('cust_lname' => $attrLastnameTableName),
|
207 |
implode(' AND ', array(
|
208 |
'cust_lname.entity_id = main_table.customer_id',
|
209 |
-
$adapter->quoteInto('cust_lname.attribute_id = ?', (int)$attrLastnameId)
|
210 |
)),
|
211 |
array(
|
212 |
'lastname' => 'cust_lname.value',
|
174 |
*/
|
175 |
public function addCustomerData($filter = null)
|
176 |
{
|
177 |
+
$customerEntity = Mage::getResourceSingleton('customer/customer');
|
178 |
+
$attrFirstname = $customerEntity->getAttribute('firstname');
|
179 |
+
$attrFirstnameId = (int) $attrFirstname->getAttributeId();
|
180 |
+
$attrFirstnameTableName = $attrFirstname->getBackend()->getTable();
|
181 |
|
182 |
+
$attrLastname = $customerEntity->getAttribute('lastname');
|
183 |
+
$attrLastnameId = (int) $attrLastname->getAttributeId();
|
184 |
+
$attrLastnameTableName = $attrLastname->getBackend()->getTable();
|
185 |
+
|
186 |
+
$attrMiddlename = $customerEntity->getAttribute('middlename');
|
187 |
+
$attrMiddlenameId = (int) $attrMiddlename->getAttributeId();
|
188 |
+
$attrMiddlenameTableName = $attrMiddlename->getBackend()->getTable();
|
189 |
|
190 |
$attrEmail = $customerEntity->getAttribute('email');
|
191 |
$attrEmailTableName = $attrEmail->getBackend()->getTable();
|
192 |
|
193 |
$adapter = $this->getSelect()->getAdapter();
|
194 |
+
$customerName = $adapter->getConcatSql(array('cust_fname.value', 'cust_mname.value', 'cust_lname.value',), ' ');
|
195 |
$this->getSelect()
|
196 |
->joinInner(
|
197 |
array('cust_email' => $attrEmailTableName),
|
202 |
array('cust_fname' => $attrFirstnameTableName),
|
203 |
implode(' AND ', array(
|
204 |
'cust_fname.entity_id = main_table.customer_id',
|
205 |
+
$adapter->quoteInto('cust_fname.attribute_id = ?', (int) $attrFirstnameId),
|
206 |
)),
|
207 |
array('firstname' => 'cust_fname.value')
|
208 |
)
|
209 |
+
->joinInner(
|
210 |
+
array('cust_mname' => $attrMiddlenameTableName),
|
211 |
+
implode(' AND ', array(
|
212 |
+
'cust_mname.entity_id = main_table.customer_id',
|
213 |
+
$adapter->quoteInto('cust_mname.attribute_id = ?', (int) $attrMiddlenameId),
|
214 |
+
)),
|
215 |
+
array('middlename' => 'cust_mname.value')
|
216 |
+
)
|
217 |
->joinInner(
|
218 |
array('cust_lname' => $attrLastnameTableName),
|
219 |
implode(' AND ', array(
|
220 |
'cust_lname.entity_id = main_table.customer_id',
|
221 |
+
$adapter->quoteInto('cust_lname.attribute_id = ?', (int) $attrLastnameId)
|
222 |
)),
|
223 |
array(
|
224 |
'lastname' => 'cust_lname.value',
|
app/code/core/Mage/Reports/Model/Resource/Review/Customer/Collection.php
CHANGED
@@ -52,6 +52,8 @@ class Mage_Reports_Model_Resource_Review_Customer_Collection extends Mage_Review
|
|
52 |
$customer = Mage::getResourceSingleton('customer/customer');
|
53 |
/** @var $firstnameAttr Mage_Eav_Model_Entity_Attribute */
|
54 |
$firstnameAttr = $customer->getAttribute('firstname');
|
|
|
|
|
55 |
/** @var $lastnameAttr Mage_Eav_Model_Entity_Attribute */
|
56 |
$lastnameAttr = $customer->getAttribute('lastname');
|
57 |
|
@@ -61,28 +63,51 @@ class Mage_Reports_Model_Resource_Review_Customer_Collection extends Mage_Review
|
|
61 |
$firstnameField = 'firstname';
|
62 |
} else {
|
63 |
$firstnameField = 'value';
|
64 |
-
$firstnameCondition[] = $adapter->quoteInto(
|
65 |
-
|
|
|
|
|
66 |
}
|
67 |
|
68 |
$this->getSelect()->joinInner(
|
69 |
array('table_customer_firstname' => $firstnameAttr->getBackend()->getTable()),
|
70 |
implode(' AND ', $firstnameCondition),
|
71 |
-
array()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
$lastnameCondition = array('table_customer_lastname.entity_id = detail.customer_id');
|
75 |
if ($lastnameAttr->getBackend()->isStatic()) {
|
76 |
$lastnameField = 'lastname';
|
77 |
} else {
|
78 |
$lastnameField = 'value';
|
79 |
-
$lastnameCondition[] = $adapter->quoteInto(
|
80 |
-
|
|
|
|
|
81 |
}
|
82 |
|
83 |
//Prepare fullname field result
|
84 |
$customerFullname = $adapter->getConcatSql(array(
|
85 |
"table_customer_firstname.{$firstnameField}",
|
|
|
86 |
"table_customer_lastname.{$lastnameField}"
|
87 |
), ' ');
|
88 |
$this->getSelect()->reset(Zend_Db_Select::COLUMNS)
|
52 |
$customer = Mage::getResourceSingleton('customer/customer');
|
53 |
/** @var $firstnameAttr Mage_Eav_Model_Entity_Attribute */
|
54 |
$firstnameAttr = $customer->getAttribute('firstname');
|
55 |
+
/** @var $firstnameAttr Mage_Eav_Model_Entity_Attribute */
|
56 |
+
$middlenameAttr = $customer->getAttribute('middlename');
|
57 |
/** @var $lastnameAttr Mage_Eav_Model_Entity_Attribute */
|
58 |
$lastnameAttr = $customer->getAttribute('lastname');
|
59 |
|
63 |
$firstnameField = 'firstname';
|
64 |
} else {
|
65 |
$firstnameField = 'value';
|
66 |
+
$firstnameCondition[] = $adapter->quoteInto(
|
67 |
+
'table_customer_firstname.attribute_id = ?',
|
68 |
+
(int) $firstnameAttr->getAttributeId()
|
69 |
+
);
|
70 |
}
|
71 |
|
72 |
$this->getSelect()->joinInner(
|
73 |
array('table_customer_firstname' => $firstnameAttr->getBackend()->getTable()),
|
74 |
implode(' AND ', $firstnameCondition),
|
75 |
+
array()
|
76 |
+
);
|
77 |
+
|
78 |
+
$middlenameCondition = array('table_customer_middlename.entity_id = detail.customer_id');
|
79 |
+
|
80 |
+
if ($middlenameAttr->getBackend()->isStatic()) {
|
81 |
+
$middlenameField = 'middlename';
|
82 |
+
} else {
|
83 |
+
$middlenameField = 'value';
|
84 |
+
$middlenameCondition[] = $adapter->quoteInto(
|
85 |
+
'table_customer_middlename.attribute_id = ?',
|
86 |
+
(int) $middlenameAttr->getAttributeId()
|
87 |
+
);
|
88 |
+
}
|
89 |
|
90 |
+
$this->getSelect()->joinInner(
|
91 |
+
array('table_customer_middlename' => $middlenameAttr->getBackend()->getTable()),
|
92 |
+
implode(' AND ', $middlenameCondition),
|
93 |
+
array()
|
94 |
+
);
|
95 |
|
96 |
$lastnameCondition = array('table_customer_lastname.entity_id = detail.customer_id');
|
97 |
if ($lastnameAttr->getBackend()->isStatic()) {
|
98 |
$lastnameField = 'lastname';
|
99 |
} else {
|
100 |
$lastnameField = 'value';
|
101 |
+
$lastnameCondition[] = $adapter->quoteInto(
|
102 |
+
'table_customer_lastname.attribute_id = ?',
|
103 |
+
(int) $lastnameAttr->getAttributeId()
|
104 |
+
);
|
105 |
}
|
106 |
|
107 |
//Prepare fullname field result
|
108 |
$customerFullname = $adapter->getConcatSql(array(
|
109 |
"table_customer_firstname.{$firstnameField}",
|
110 |
+
"table_customer_middlename.{$middlenameField}",
|
111 |
"table_customer_lastname.{$lastnameField}"
|
112 |
), ' ');
|
113 |
$this->getSelect()->reset(Zend_Db_Select::COLUMNS)
|
app/code/core/Mage/Reports/etc/config.xml
CHANGED
@@ -203,6 +203,9 @@
|
|
203 |
</recently_products>
|
204 |
</catalog>
|
205 |
<reports>
|
|
|
|
|
|
|
206 |
<dashboard>
|
207 |
<ytd_start>1,1</ytd_start>
|
208 |
<mtd_start>1</mtd_start>
|
203 |
</recently_products>
|
204 |
</catalog>
|
205 |
<reports>
|
206 |
+
<general>
|
207 |
+
<enabled>1</enabled>
|
208 |
+
</general>
|
209 |
<dashboard>
|
210 |
<ytd_start>1,1</ytd_start>
|
211 |
<mtd_start>1</mtd_start>
|
app/code/core/Mage/Reports/etc/system.xml
CHANGED
@@ -75,10 +75,29 @@
|
|
75 |
<show_in_website>0</show_in_website>
|
76 |
<show_in_store>0</show_in_store>
|
77 |
<groups>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
<dashboard translate="label">
|
79 |
<label>Dashboard</label>
|
80 |
<frontend_type>text</frontend_type>
|
81 |
-
<sort_order>
|
82 |
<show_in_default>1</show_in_default>
|
83 |
<show_in_website>0</show_in_website>
|
84 |
<show_in_store>0</show_in_store>
|
75 |
<show_in_website>0</show_in_website>
|
76 |
<show_in_store>0</show_in_store>
|
77 |
<groups>
|
78 |
+
<general translate="label">
|
79 |
+
<label>General</label>
|
80 |
+
<frontend_type>text</frontend_type>
|
81 |
+
<sort_order>1</sort_order>
|
82 |
+
<show_in_default>1</show_in_default>
|
83 |
+
<show_in_website>0</show_in_website>
|
84 |
+
<show_in_store>0</show_in_store>
|
85 |
+
<fields>
|
86 |
+
<enabled translate="label">
|
87 |
+
<label>Enable Reports</label>
|
88 |
+
<frontend_type>select</frontend_type>
|
89 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
90 |
+
<sort_order>1</sort_order>
|
91 |
+
<show_in_default>1</show_in_default>
|
92 |
+
<show_in_website>0</show_in_website>
|
93 |
+
<show_in_store>0</show_in_store>
|
94 |
+
</enabled>
|
95 |
+
</fields>
|
96 |
+
</general>
|
97 |
<dashboard translate="label">
|
98 |
<label>Dashboard</label>
|
99 |
<frontend_type>text</frontend_type>
|
100 |
+
<sort_order>2</sort_order>
|
101 |
<show_in_default>1</show_in_default>
|
102 |
<show_in_website>0</show_in_website>
|
103 |
<show_in_store>0</show_in_store>
|
app/code/core/Mage/Review/Block/Form.php
CHANGED
@@ -50,7 +50,11 @@ class Mage_Review_Block_Form extends Mage_Core_Block_Template
|
|
50 |
}
|
51 |
}
|
52 |
|
53 |
-
$this->setAllowWriteReviewFlag(
|
|
|
|
|
|
|
|
|
54 |
if (!$this->getAllowWriteReviewFlag) {
|
55 |
$this->setLoginLink(
|
56 |
Mage::getUrl('customer/account/login/', array(
|
@@ -76,7 +80,7 @@ class Mage_Review_Block_Form extends Mage_Core_Block_Template
|
|
76 |
public function getAction()
|
77 |
{
|
78 |
$productId = Mage::app()->getRequest()->getParam('id', false);
|
79 |
-
return Mage::getUrl('review/product/post', array('id' => $productId));
|
80 |
}
|
81 |
|
82 |
public function getRatings()
|
50 |
}
|
51 |
}
|
52 |
|
53 |
+
$this->setAllowWriteReviewFlag(
|
54 |
+
$customerSession->isLoggedIn() ||
|
55 |
+
Mage::helper('review')->getIsGuestAllowToWrite()
|
56 |
+
);
|
57 |
+
|
58 |
if (!$this->getAllowWriteReviewFlag) {
|
59 |
$this->setLoginLink(
|
60 |
Mage::getUrl('customer/account/login/', array(
|
80 |
public function getAction()
|
81 |
{
|
82 |
$productId = Mage::app()->getRequest()->getParam('id', false);
|
83 |
+
return Mage::getUrl('review/product/post', array('id' => $productId, '_secure' => $this->_isSecure()));
|
84 |
}
|
85 |
|
86 |
public function getRatings()
|
app/code/core/Mage/Rss/Helper/Data.php
CHANGED
@@ -39,22 +39,31 @@ class Mage_Rss_Helper_Data extends Mage_Core_Helper_Abstract
|
|
39 |
*/
|
40 |
const XML_PATH_RSS_ACTIVE = 'rss/config/active';
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
/**
|
43 |
* Authenticate customer on frontend
|
44 |
*
|
45 |
*/
|
46 |
public function authFrontend()
|
47 |
{
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
} else {
|
57 |
-
$this->authFailed();
|
58 |
}
|
59 |
}
|
60 |
|
@@ -65,17 +74,15 @@ class Mage_Rss_Helper_Data extends Mage_Core_Helper_Abstract
|
|
65 |
*/
|
66 |
public function authAdmin($path)
|
67 |
{
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
71 |
}
|
72 |
-
|
73 |
-
|
74 |
-
$adminSession = Mage::getSingleton('admin/session');
|
75 |
-
$user = $adminSession->login($username, $password);
|
76 |
-
//$user = Mage::getModel('admin/user')->login($username, $password);
|
77 |
-
if ($user && $user->getId() && $user->getIsActive() == '1' && $adminSession->isAllowed($path)) {
|
78 |
-
$session->setAdmin($user);
|
79 |
} else {
|
80 |
$this->authFailed();
|
81 |
}
|
39 |
*/
|
40 |
const XML_PATH_RSS_ACTIVE = 'rss/config/active';
|
41 |
|
42 |
+
protected $_rssSession;
|
43 |
+
|
44 |
+
protected $_adminSession;
|
45 |
+
|
46 |
+
public function __construct(array $params = array())
|
47 |
+
{
|
48 |
+
$this->_rssSession = isset($params['rss_session']) ? $params['rss_session'] : Mage::getSingleton('rss/session');
|
49 |
+
$this->_adminSession = isset($params['admin_session'])
|
50 |
+
? $params['admin_session'] : Mage::getSingleton('admin/session');
|
51 |
+
}
|
52 |
+
|
53 |
/**
|
54 |
* Authenticate customer on frontend
|
55 |
*
|
56 |
*/
|
57 |
public function authFrontend()
|
58 |
{
|
59 |
+
if (!$this->_rssSession->isCustomerLoggedIn()) {
|
60 |
+
list($username, $password) = $this->authValidate();
|
61 |
+
$customer = Mage::getModel('customer/customer')->authenticate($username, $password);
|
62 |
+
if ($customer && $customer->getId()) {
|
63 |
+
$this->_rssSession->settCustomer($customer);
|
64 |
+
} else {
|
65 |
+
$this->authFailed();
|
66 |
+
}
|
|
|
|
|
67 |
}
|
68 |
}
|
69 |
|
74 |
*/
|
75 |
public function authAdmin($path)
|
76 |
{
|
77 |
+
if (!$this->_rssSession->isAdminLoggedIn()) {
|
78 |
+
list($username, $password) = $this->authValidate();
|
79 |
+
Mage::getSingleton('adminhtml/url')->setNoSecret(true);
|
80 |
+
$user = $this->_adminSession->login($username, $password);
|
81 |
+
} else {
|
82 |
+
$user = $this->_rssSession->getAdmin();
|
83 |
}
|
84 |
+
if ($user && $user->getId() && $user->getIsActive() == '1' && $this->_adminSession->isAllowed($path)) {
|
85 |
+
$this->_rssSession->setAdmin($user);
|
|
|
|
|
|
|
|
|
|
|
86 |
} else {
|
87 |
$this->authFailed();
|
88 |
}
|
app/code/core/Mage/Rss/controllers/CatalogController.php
CHANGED
@@ -118,11 +118,12 @@ class Mage_Rss_CatalogController extends Mage_Core_Controller_Front_Action
|
|
118 |
*/
|
119 |
public function preDispatch()
|
120 |
{
|
121 |
-
|
|
|
122 |
$this->_currentArea = 'adminhtml';
|
123 |
Mage::helper('rss')->authAdmin('catalog/products');
|
124 |
}
|
125 |
-
if ($
|
126 |
$this->_currentArea = 'adminhtml';
|
127 |
Mage::helper('rss')->authAdmin('catalog/reviews_ratings');
|
128 |
}
|
118 |
*/
|
119 |
public function preDispatch()
|
120 |
{
|
121 |
+
$action = strtolower($this->getRequest()->getActionName());
|
122 |
+
if ($action == 'notifystock') {
|
123 |
$this->_currentArea = 'adminhtml';
|
124 |
Mage::helper('rss')->authAdmin('catalog/products');
|
125 |
}
|
126 |
+
if ($action == 'review') {
|
127 |
$this->_currentArea = 'adminhtml';
|
128 |
Mage::helper('rss')->authAdmin('catalog/reviews_ratings');
|
129 |
}
|
app/code/core/Mage/Rss/controllers/OrderController.php
CHANGED
@@ -75,7 +75,8 @@ class Mage_Rss_OrderController extends Mage_Core_Controller_Front_Action
|
|
75 |
*/
|
76 |
public function preDispatch()
|
77 |
{
|
78 |
-
|
|
|
79 |
$this->_currentArea = 'adminhtml';
|
80 |
Mage::helper('rss')->authAdmin('sales/order');
|
81 |
}
|
75 |
*/
|
76 |
public function preDispatch()
|
77 |
{
|
78 |
+
$action = strtolower($this->getRequest()->getActionName());
|
79 |
+
if ($action == 'new') {
|
80 |
$this->_currentArea = 'adminhtml';
|
81 |
Mage::helper('rss')->authAdmin('sales/order');
|
82 |
}
|
app/code/core/Mage/Rule/Block/Editable.php
CHANGED
@@ -45,8 +45,10 @@ class Mage_Rule_Block_Editable extends Mage_Core_Block_Abstract
|
|
45 |
}
|
46 |
|
47 |
if ($element->getShowAsText()) {
|
48 |
-
$html = ' <input type="hidden" class="hidden" id="'
|
49 |
-
.
|
|
|
|
|
50 |
. htmlspecialchars($valueName) . ' ';
|
51 |
} else {
|
52 |
$html = ' <span class="rule-param"'
|
@@ -62,8 +64,12 @@ class Mage_Rule_Block_Editable extends Mage_Core_Block_Abstract
|
|
62 |
|
63 |
if ($element->getExplicitApply()) {
|
64 |
$html .= ' <a href="javascript:void(0)" class="rule-param-apply"><img src="'
|
65 |
-
. $this->getSkinUrl('images/rule_component_apply.gif')
|
66 |
-
.
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
|
69 |
$html .= '</span></span> ';
|
45 |
}
|
46 |
|
47 |
if ($element->getShowAsText()) {
|
48 |
+
$html = ' <input type="hidden" class="hidden" id="'
|
49 |
+
. $element->getHtmlId()
|
50 |
+
. '" name="' . $element->getName()
|
51 |
+
. '" value="' . $element->getValue() . '"/> '
|
52 |
. htmlspecialchars($valueName) . ' ';
|
53 |
} else {
|
54 |
$html = ' <span class="rule-param"'
|
64 |
|
65 |
if ($element->getExplicitApply()) {
|
66 |
$html .= ' <a href="javascript:void(0)" class="rule-param-apply"><img src="'
|
67 |
+
. $this->getSkinUrl('images/rule_component_apply.gif')
|
68 |
+
. '" class="v-middle" alt="'
|
69 |
+
. Mage::helper('core')->quoteEscape($this->__('Apply'))
|
70 |
+
. '" title="'
|
71 |
+
. Mage::helper('core')->quoteEscape($this->__('Apply'))
|
72 |
+
. '" /></a> ';
|
73 |
}
|
74 |
|
75 |
$html .= '</span></span> ';
|
app/code/core/Mage/Rule/Model/Condition/Abstract.php
CHANGED
@@ -97,9 +97,10 @@ abstract class Mage_Rule_Model_Condition_Abstract
|
|
97 |
'string' => array('==', '!=', '>=', '>', '<=', '<', '{}', '!{}', '()', '!()'),
|
98 |
'numeric' => array('==', '!=', '>=', '>', '<=', '<', '()', '!()'),
|
99 |
'date' => array('==', '>=', '<='),
|
|
|
100 |
'select' => array('==', '!='),
|
101 |
'boolean' => array('==', '!='),
|
102 |
-
'multiselect' => array('
|
103 |
'grid' => array('()', '!()'),
|
104 |
);
|
105 |
$this->_arrayInputTypes = array('multiselect', 'grid');
|
@@ -125,6 +126,8 @@ abstract class Mage_Rule_Model_Condition_Abstract
|
|
125 |
'<' => Mage::helper('rule')->__('less than'),
|
126 |
'{}' => Mage::helper('rule')->__('contains'),
|
127 |
'!{}' => Mage::helper('rule')->__('does not contain'),
|
|
|
|
|
128 |
'()' => Mage::helper('rule')->__('is one of'),
|
129 |
'!()' => Mage::helper('rule')->__('is not one of')
|
130 |
);
|
@@ -140,21 +143,21 @@ abstract class Mage_Rule_Model_Condition_Abstract
|
|
140 |
public function asArray(array $arrAttributes = array())
|
141 |
{
|
142 |
$out = array(
|
143 |
-
'type'
|
144 |
-
'attribute'
|
145 |
-
'operator'
|
146 |
-
'value'
|
147 |
-
'is_value_processed'
|
148 |
);
|
149 |
return $out;
|
150 |
}
|
151 |
|
152 |
public function asXml()
|
153 |
{
|
154 |
-
$xml =
|
155 |
-
.
|
156 |
-
.
|
157 |
-
.
|
158 |
return $xml;
|
159 |
}
|
160 |
|
@@ -195,8 +198,8 @@ abstract class Mage_Rule_Model_Condition_Abstract
|
|
195 |
public function getAttributeSelectOptions()
|
196 |
{
|
197 |
$opt = array();
|
198 |
-
foreach ($this->getAttributeOption() as $k
|
199 |
-
$opt[] = array('value'
|
200 |
}
|
201 |
return $opt;
|
202 |
}
|
@@ -300,13 +303,26 @@ abstract class Mage_Rule_Model_Condition_Abstract
|
|
300 |
|
301 |
public function getValue()
|
302 |
{
|
303 |
-
if (
|
304 |
// date format intentionally hard-coded
|
305 |
-
$
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
}
|
311 |
return $this->getData('value');
|
312 |
}
|
@@ -354,7 +370,7 @@ abstract class Mage_Rule_Model_Condition_Abstract
|
|
354 |
public function getNewChildSelectOptions()
|
355 |
{
|
356 |
return array(
|
357 |
-
array('value'=>'', 'label'=>Mage::helper('rule')->__('Please choose a condition to add...')),
|
358 |
);
|
359 |
}
|
360 |
|
@@ -403,11 +419,11 @@ abstract class Mage_Rule_Model_Condition_Abstract
|
|
403 |
break;
|
404 |
}
|
405 |
}
|
406 |
-
return $this->getForm()->addField($this->getPrefix().'__'
|
407 |
-
'name'=>'rule['
|
408 |
-
'values'
|
409 |
-
'value'
|
410 |
-
'value_name'
|
411 |
))->setRenderer(Mage::getBlockSingleton('rule/editable'));
|
412 |
}
|
413 |
|
@@ -472,19 +488,28 @@ abstract class Mage_Rule_Model_Condition_Abstract
|
|
472 |
public function getValueElement()
|
473 |
{
|
474 |
$elementParams = array(
|
475 |
-
'name' => 'rule['
|
476 |
'value' => $this->getValue(),
|
477 |
'values' => $this->getValueSelectOptions(),
|
478 |
'value_name' => $this->getValueName(),
|
479 |
'after_element_html' => $this->getValueAfterElementHtml(),
|
480 |
'explicit_apply' => $this->getExplicitApply(),
|
481 |
);
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
}
|
487 |
-
|
|
|
488 |
$this->getValueElementType(),
|
489 |
$elementParams
|
490 |
)->setRenderer($this->getValueElementRenderer());
|
@@ -498,14 +523,18 @@ abstract class Mage_Rule_Model_Condition_Abstract
|
|
498 |
public function getAddLinkHtml()
|
499 |
{
|
500 |
$src = Mage::getDesign()->getSkinUrl('images/rule_component_add.gif');
|
501 |
-
$html = '<img src="' . $src . '" class="rule-param-add v-middle" alt="" title="'
|
|
|
|
|
502 |
return $html;
|
503 |
}
|
504 |
|
505 |
public function getRemoveLinkHtml()
|
506 |
{
|
507 |
$src = Mage::getDesign()->getSkinUrl('images/rule_component_remove.gif');
|
508 |
-
$html = ' <span class="rule-param"><a href="javascript:void(0)" class="rule-param-remove" title="'
|
|
|
|
|
509 |
return $html;
|
510 |
}
|
511 |
|
@@ -618,9 +647,16 @@ abstract class Mage_Rule_Model_Condition_Abstract
|
|
618 |
}
|
619 |
break;
|
620 |
|
621 |
-
case '()': case '!()':
|
622 |
if (is_array($validatedValue)) {
|
623 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
624 |
} else {
|
625 |
$value = (array)$value;
|
626 |
foreach ($value as $item) {
|
@@ -633,7 +669,7 @@ abstract class Mage_Rule_Model_Condition_Abstract
|
|
633 |
break;
|
634 |
}
|
635 |
|
636 |
-
if ('!=' == $op || '>' == $op || '<' == $op || '!{}' == $op || '!()' == $op) {
|
637 |
$result = !$result;
|
638 |
}
|
639 |
|
97 |
'string' => array('==', '!=', '>=', '>', '<=', '<', '{}', '!{}', '()', '!()'),
|
98 |
'numeric' => array('==', '!=', '>=', '>', '<=', '<', '()', '!()'),
|
99 |
'date' => array('==', '>=', '<='),
|
100 |
+
'datetime' => array('==', '>=', '<='),
|
101 |
'select' => array('==', '!='),
|
102 |
'boolean' => array('==', '!='),
|
103 |
+
'multiselect' => array('[]', '![]', '()', '!()'),
|
104 |
'grid' => array('()', '!()'),
|
105 |
);
|
106 |
$this->_arrayInputTypes = array('multiselect', 'grid');
|
126 |
'<' => Mage::helper('rule')->__('less than'),
|
127 |
'{}' => Mage::helper('rule')->__('contains'),
|
128 |
'!{}' => Mage::helper('rule')->__('does not contain'),
|
129 |
+
'[]' => Mage::helper('rule')->__('contains'),
|
130 |
+
'![]' => Mage::helper('rule')->__('does not contain'),
|
131 |
'()' => Mage::helper('rule')->__('is one of'),
|
132 |
'!()' => Mage::helper('rule')->__('is not one of')
|
133 |
);
|
143 |
public function asArray(array $arrAttributes = array())
|
144 |
{
|
145 |
$out = array(
|
146 |
+
'type' => $this->getType(),
|
147 |
+
'attribute' => $this->getAttribute(),
|
148 |
+
'operator' => $this->getOperator(),
|
149 |
+
'value' => $this->getValue(),
|
150 |
+
'is_value_processed' => $this->getIsValueParsed(),
|
151 |
);
|
152 |
return $out;
|
153 |
}
|
154 |
|
155 |
public function asXml()
|
156 |
{
|
157 |
+
$xml = '<type>' . $this->getType() . '</type>'
|
158 |
+
. '<attribute>' . $this->getAttribute() . '</attribute>'
|
159 |
+
. '<operator>' . $this->getOperator() . '</operator>'
|
160 |
+
. '<value>' . $this->getValue() . '</value>';
|
161 |
return $xml;
|
162 |
}
|
163 |
|
198 |
public function getAttributeSelectOptions()
|
199 |
{
|
200 |
$opt = array();
|
201 |
+
foreach ($this->getAttributeOption() as $k => $v) {
|
202 |
+
$opt[] = array('value' => $k, 'label' => $v);
|
203 |
}
|
204 |
return $opt;
|
205 |
}
|
303 |
|
304 |
public function getValue()
|
305 |
{
|
306 |
+
if (!$this->getIsValueParsed()) {
|
307 |
// date format intentionally hard-coded
|
308 |
+
$format = null;
|
309 |
+
switch ($this->getInputType()) {
|
310 |
+
case 'date':
|
311 |
+
$format = Varien_Date::DATE_INTERNAL_FORMAT;
|
312 |
+
break;
|
313 |
+
|
314 |
+
case 'datetime':
|
315 |
+
$format = Varien_Date::DATETIME_INTERNAL_FORMAT;
|
316 |
+
break;
|
317 |
+
}
|
318 |
+
|
319 |
+
if ($format !== null) {
|
320 |
+
$this->setValue(
|
321 |
+
Mage::app()->getLocale()->date($this->getData('value'),
|
322 |
+
$format, null, false)->toString($format)
|
323 |
+
);
|
324 |
+
$this->setIsValueParsed(true);
|
325 |
+
}
|
326 |
}
|
327 |
return $this->getData('value');
|
328 |
}
|
370 |
public function getNewChildSelectOptions()
|
371 |
{
|
372 |
return array(
|
373 |
+
array('value' => '', 'label' => Mage::helper('rule')->__('Please choose a condition to add...')),
|
374 |
);
|
375 |
}
|
376 |
|
419 |
break;
|
420 |
}
|
421 |
}
|
422 |
+
return $this->getForm()->addField($this->getPrefix() . '__' . $this->getId() . '__attribute', 'select', array(
|
423 |
+
'name' => 'rule[' . $this->getPrefix() . '][' . $this->getId() . '][attribute]',
|
424 |
+
'values' => $this->getAttributeSelectOptions(),
|
425 |
+
'value' => $this->getAttribute(),
|
426 |
+
'value_name' => $this->getAttributeName(),
|
427 |
))->setRenderer(Mage::getBlockSingleton('rule/editable'));
|
428 |
}
|
429 |
|
488 |
public function getValueElement()
|
489 |
{
|
490 |
$elementParams = array(
|
491 |
+
'name' => 'rule[' . $this->getPrefix() . '][' . $this->getId() . '][value]',
|
492 |
'value' => $this->getValue(),
|
493 |
'values' => $this->getValueSelectOptions(),
|
494 |
'value_name' => $this->getValueName(),
|
495 |
'after_element_html' => $this->getValueAfterElementHtml(),
|
496 |
'explicit_apply' => $this->getExplicitApply(),
|
497 |
);
|
498 |
+
|
499 |
+
switch ($this->getInputType()) {
|
500 |
+
case 'date':
|
501 |
+
$elementParams['input_format'] = Varien_Date::DATE_INTERNAL_FORMAT;
|
502 |
+
$elementParams['format'] = Varien_Date::DATE_INTERNAL_FORMAT;
|
503 |
+
break;
|
504 |
+
|
505 |
+
case 'datetime':
|
506 |
+
$elementParams['input_format'] = Varien_Date::DATETIME_INTERNAL_FORMAT;
|
507 |
+
$elementParams['format'] = Varien_Date::DATETIME_INTERNAL_FORMAT;
|
508 |
+
$elementParams['time'] = true;
|
509 |
+
break;
|
510 |
}
|
511 |
+
|
512 |
+
return $this->getForm()->addField($this->getPrefix() . '__' . $this->getId() . '__value',
|
513 |
$this->getValueElementType(),
|
514 |
$elementParams
|
515 |
)->setRenderer($this->getValueElementRenderer());
|
523 |
public function getAddLinkHtml()
|
524 |
{
|
525 |
$src = Mage::getDesign()->getSkinUrl('images/rule_component_add.gif');
|
526 |
+
$html = '<img src="' . $src . '" class="rule-param-add v-middle" alt="" title="'
|
527 |
+
. Mage::helper('core')->quoteEscape(Mage::helper('rule')->__('Add'))
|
528 |
+
. '"/>';
|
529 |
return $html;
|
530 |
}
|
531 |
|
532 |
public function getRemoveLinkHtml()
|
533 |
{
|
534 |
$src = Mage::getDesign()->getSkinUrl('images/rule_component_remove.gif');
|
535 |
+
$html = ' <span class="rule-param"><a href="javascript:void(0)" class="rule-param-remove" title="'
|
536 |
+
. Mage::helper('core')->quoteEscape(Mage::helper('rule')->__('Remove'))
|
537 |
+
. '"><img src="' . $src . '" alt="" class="v-middle" /></a></span>';
|
538 |
return $html;
|
539 |
}
|
540 |
|
647 |
}
|
648 |
break;
|
649 |
|
650 |
+
case '()': case '!()': case '[]': case '![]':
|
651 |
if (is_array($validatedValue)) {
|
652 |
+
$value = (array)$value;
|
653 |
+
$match = count(array_intersect($validatedValue, $value));
|
654 |
+
|
655 |
+
if (in_array($op, array('[]', '![]'))) {
|
656 |
+
$result = $match == count($value);
|
657 |
+
} else {
|
658 |
+
$result = $match > 0;
|
659 |
+
}
|
660 |
} else {
|
661 |
$value = (array)$value;
|
662 |
foreach ($value as $item) {
|
669 |
break;
|
670 |
}
|
671 |
|
672 |
+
if ('!=' == $op || '>' == $op || '<' == $op || '!{}' == $op || '!()' == $op || '![]' == $op) {
|
673 |
$result = !$result;
|
674 |
}
|
675 |
|
app/code/core/Mage/Rule/Model/Condition/Product/Abstract.php
CHANGED
@@ -113,7 +113,7 @@ abstract class Mage_Rule_Model_Condition_Product_Abstract extends Mage_Rule_Mode
|
|
113 |
{
|
114 |
$alias = 'cpf';
|
115 |
$attribute = $this->getAttribute();
|
116 |
-
$value = $this->
|
117 |
$operator = $this->correctOperator($this->getOperator(), $this->getInputType());
|
118 |
if ($attribute == 'category_ids') {
|
119 |
$alias = 'ccp';
|
@@ -308,7 +308,11 @@ abstract class Mage_Rule_Model_Condition_Product_Abstract extends Mage_Rule_Mode
|
|
308 |
}
|
309 |
|
310 |
if (!empty($image)) {
|
311 |
-
$html = '<a href="javascript:void(0)" class="rule-chooser-trigger"><img src="'
|
|
|
|
|
|
|
|
|
312 |
}
|
313 |
return $html;
|
314 |
}
|
113 |
{
|
114 |
$alias = 'cpf';
|
115 |
$attribute = $this->getAttribute();
|
116 |
+
$value = $this->getValueParsed();
|
117 |
$operator = $this->correctOperator($this->getOperator(), $this->getInputType());
|
118 |
if ($attribute == 'category_ids') {
|
119 |
$alias = 'ccp';
|
308 |
}
|
309 |
|
310 |
if (!empty($image)) {
|
311 |
+
$html = '<a href="javascript:void(0)" class="rule-chooser-trigger"><img src="'
|
312 |
+
. $image
|
313 |
+
. '" alt="" class="v-middle rule-chooser-trigger" title="'
|
314 |
+
. Mage::helper('core')->quoteEscape(Mage::helper('rule')->__('Open Chooser'))
|
315 |
+
. '" /></a>';
|
316 |
}
|
317 |
return $html;
|
318 |
}
|
app/code/core/Mage/Rule/Model/Resource/Rule/Condition/SqlBuilder.php
CHANGED
@@ -69,19 +69,20 @@ class Mage_Rule_Model_Resource_Rule_Condition_SqlBuilder
|
|
69 |
$selectOperator = ' IN (?)';
|
70 |
} else {
|
71 |
$selectOperator = ' LIKE ?';
|
72 |
-
$value = '%' . $value . '%';
|
73 |
}
|
74 |
if (substr($operator, 0, 1) == '!') {
|
75 |
$selectOperator = ' NOT' . $selectOperator;
|
76 |
}
|
77 |
break;
|
78 |
|
|
|
|
|
79 |
case '()':
|
80 |
-
$selectOperator = ' IN(?)';
|
81 |
-
break;
|
82 |
-
|
83 |
case '!()':
|
84 |
-
$selectOperator = '
|
|
|
|
|
|
|
85 |
break;
|
86 |
|
87 |
default:
|
@@ -90,12 +91,22 @@ class Mage_Rule_Model_Resource_Rule_Condition_SqlBuilder
|
|
90 |
}
|
91 |
$field = $this->_adapter->quoteIdentifier($field);
|
92 |
|
93 |
-
if (is_array($value) && in_array($operator, array('==', '!=', '>=', '<=', '>', '<'))) {
|
94 |
$results = array();
|
95 |
foreach ($value as $v) {
|
96 |
$results[] = $this->_adapter->quoteInto("{$field}{$selectOperator}", $v);
|
97 |
}
|
98 |
$result = implode(' AND ', $results);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
} else {
|
100 |
$result = $this->_adapter->quoteInto("{$field}{$selectOperator}", $value);
|
101 |
}
|
69 |
$selectOperator = ' IN (?)';
|
70 |
} else {
|
71 |
$selectOperator = ' LIKE ?';
|
|
|
72 |
}
|
73 |
if (substr($operator, 0, 1) == '!') {
|
74 |
$selectOperator = ' NOT' . $selectOperator;
|
75 |
}
|
76 |
break;
|
77 |
|
78 |
+
case '[]':
|
79 |
+
case '![]':
|
80 |
case '()':
|
|
|
|
|
|
|
81 |
case '!()':
|
82 |
+
$selectOperator = 'FIND_IN_SET(?,' . $this->_adapter->quoteIdentifier($field) . ')';
|
83 |
+
if (substr($operator, 0, 1) == '!') {
|
84 |
+
$selectOperator = 'NOT ' . $selectOperator;
|
85 |
+
}
|
86 |
break;
|
87 |
|
88 |
default:
|
91 |
}
|
92 |
$field = $this->_adapter->quoteIdentifier($field);
|
93 |
|
94 |
+
if (is_array($value) && in_array($operator, array('==', '!=', '>=', '<=', '>', '<', '{}', '!{}'))) {
|
95 |
$results = array();
|
96 |
foreach ($value as $v) {
|
97 |
$results[] = $this->_adapter->quoteInto("{$field}{$selectOperator}", $v);
|
98 |
}
|
99 |
$result = implode(' AND ', $results);
|
100 |
+
} elseif (in_array($operator, array('()', '!()', '[]', '![]'))) {
|
101 |
+
if (!is_array($value)) {
|
102 |
+
$value = array($value);
|
103 |
+
}
|
104 |
+
|
105 |
+
$results = array();
|
106 |
+
foreach ($value as $v) {
|
107 |
+
$results[] = $this->_adapter->quoteInto("{$selectOperator}", $v);
|
108 |
+
}
|
109 |
+
$result = implode(in_array($operator, array('()', '!()')) ? ' OR ' : ' AND ', $results);
|
110 |
} else {
|
111 |
$result = $this->_adapter->quoteInto("{$field}{$selectOperator}", $value);
|
112 |
}
|
app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/Grid.php
CHANGED
@@ -104,6 +104,13 @@ class Mage_Sales_Block_Adminhtml_Billing_Agreement_Grid extends Mage_Adminhtml_B
|
|
104 |
'escape' => true
|
105 |
));
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
$this->addColumn('customer_lastname', array(
|
108 |
'header' => Mage::helper('sales')->__('Customer Last Name'),
|
109 |
'index' => 'customer_lastname',
|
104 |
'escape' => true
|
105 |
));
|
106 |
|
107 |
+
$this->addColumn('customer_middlename', array(
|
108 |
+
'header' => Mage::helper('sales')->__('Customer Middle Name'),
|
109 |
+
'index' => 'customer_middlename',
|
110 |
+
'type' => 'text',
|
111 |
+
'escape' => true
|
112 |
+
));
|
113 |
+
|
114 |
$this->addColumn('customer_lastname', array(
|
115 |
'header' => Mage::helper('sales')->__('Customer Last Name'),
|
116 |
'index' => 'customer_lastname',
|
app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View.php
CHANGED
@@ -58,11 +58,12 @@ class Mage_Sales_Block_Adminhtml_Billing_Agreement_View extends Mage_Adminhtml_B
|
|
58 |
), -1);
|
59 |
|
60 |
if ($this->_getBillingAgreement()->canCancel() && $this->_isAllowed('sales/billing_agreement/actions/manage')) {
|
|
|
|
|
|
|
61 |
$this->_addButton('cancel', array(
|
62 |
'label' => Mage::helper('adminhtml')->__('Cancel'),
|
63 |
-
'onclick' => "confirmSetLocation("
|
64 |
-
. "'{$this->__('Are you sure you want to do this?')}', '{$this->_getCancelUrl()}'"
|
65 |
-
. ")",
|
66 |
'class' => 'cancel',
|
67 |
), -1);
|
68 |
}
|
58 |
), -1);
|
59 |
|
60 |
if ($this->_getBillingAgreement()->canCancel() && $this->_isAllowed('sales/billing_agreement/actions/manage')) {
|
61 |
+
$confirmationMessage = Mage::helper('core')->jsQuoteEscape(
|
62 |
+
Mage::helper('sales')->__('Are you sure you want to do this?')
|
63 |
+
);
|
64 |
$this->_addButton('cancel', array(
|
65 |
'label' => Mage::helper('adminhtml')->__('Cancel'),
|
66 |
+
'onclick' => "confirmSetLocation('{$confirmationMessage}', '{$this->_getCancelUrl()}')",
|
|
|
|
|
67 |
'class' => 'cancel',
|
68 |
), -1);
|
69 |
}
|
app/code/core/Mage/Sales/Block/Adminhtml/Customer/Edit/Tab/Agreement.php
CHANGED
@@ -38,7 +38,12 @@ class Mage_Sales_Block_Adminhtml_Customer_Edit_Tab_Agreement
|
|
38 |
*
|
39 |
* @var array
|
40 |
*/
|
41 |
-
protected $_columnsToRemove = array(
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
/**
|
44 |
* Disable filters and paging
|
38 |
*
|
39 |
* @var array
|
40 |
*/
|
41 |
+
protected $_columnsToRemove = array(
|
42 |
+
'customer_email',
|
43 |
+
'customer_firstname',
|
44 |
+
'customer_middlename',
|
45 |
+
'customer_lastname'
|
46 |
+
);
|
47 |
|
48 |
/**
|
49 |
* Disable filters and paging
|
app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View.php
CHANGED
@@ -43,14 +43,16 @@ class Mage_Sales_Block_Adminhtml_Recurring_Profile_View extends Mage_Adminhtml_B
|
|
43 |
));
|
44 |
|
45 |
$profile = Mage::registry('current_recurring_profile');
|
46 |
-
$
|
|
|
|
|
47 |
|
48 |
// cancel
|
49 |
if ($profile->canCancel()) {
|
50 |
$url = $this->getUrl('*/*/updateState', array('profile' => $profile->getId(), 'action' => 'cancel'));
|
51 |
$this->_addButton('cancel', array(
|
52 |
'label' => Mage::helper('sales')->__('Cancel'),
|
53 |
-
'onclick' => "confirmSetLocation('{$
|
54 |
'class' => 'delete',
|
55 |
));
|
56 |
}
|
@@ -60,7 +62,7 @@ class Mage_Sales_Block_Adminhtml_Recurring_Profile_View extends Mage_Adminhtml_B
|
|
60 |
$url = $this->getUrl('*/*/updateState', array('profile' => $profile->getId(), 'action' => 'suspend'));
|
61 |
$this->_addButton('suspend', array(
|
62 |
'label' => Mage::helper('sales')->__('Suspend'),
|
63 |
-
'onclick' => "confirmSetLocation('{$
|
64 |
'class' => 'delete',
|
65 |
));
|
66 |
}
|
@@ -70,7 +72,7 @@ class Mage_Sales_Block_Adminhtml_Recurring_Profile_View extends Mage_Adminhtml_B
|
|
70 |
$url = $this->getUrl('*/*/updateState', array('profile' => $profile->getId(), 'action' => 'activate'));
|
71 |
$this->_addButton('activate', array(
|
72 |
'label' => Mage::helper('sales')->__('Activate'),
|
73 |
-
'onclick' => "confirmSetLocation('{$
|
74 |
'class' => 'add',
|
75 |
));
|
76 |
}
|
@@ -80,7 +82,7 @@ class Mage_Sales_Block_Adminhtml_Recurring_Profile_View extends Mage_Adminhtml_B
|
|
80 |
$url = $this->getUrl('*/*/updateProfile', array('profile' => $profile->getId(),));
|
81 |
$this->_addButton('update', array(
|
82 |
'label' => Mage::helper('sales')->__('Get Update'),
|
83 |
-
'onclick' => "confirmSetLocation('{$
|
84 |
'class' => 'add',
|
85 |
));
|
86 |
}
|
43 |
));
|
44 |
|
45 |
$profile = Mage::registry('current_recurring_profile');
|
46 |
+
$confirmationMessage = Mage::helper('core')->jsQuoteEscape(
|
47 |
+
Mage::helper('sales')->__('Are you sure you want to do this?')
|
48 |
+
);
|
49 |
|
50 |
// cancel
|
51 |
if ($profile->canCancel()) {
|
52 |
$url = $this->getUrl('*/*/updateState', array('profile' => $profile->getId(), 'action' => 'cancel'));
|
53 |
$this->_addButton('cancel', array(
|
54 |
'label' => Mage::helper('sales')->__('Cancel'),
|
55 |
+
'onclick' => "confirmSetLocation('{$confirmationMessage}', '{$url}')",
|
56 |
'class' => 'delete',
|
57 |
));
|
58 |
}
|
62 |
$url = $this->getUrl('*/*/updateState', array('profile' => $profile->getId(), 'action' => 'suspend'));
|
63 |
$this->_addButton('suspend', array(
|
64 |
'label' => Mage::helper('sales')->__('Suspend'),
|
65 |
+
'onclick' => "confirmSetLocation('{$confirmationMessage}', '{$url}')",
|
66 |
'class' => 'delete',
|
67 |
));
|
68 |
}
|
72 |
$url = $this->getUrl('*/*/updateState', array('profile' => $profile->getId(), 'action' => 'activate'));
|
73 |
$this->_addButton('activate', array(
|
74 |
'label' => Mage::helper('sales')->__('Activate'),
|
75 |
+
'onclick' => "confirmSetLocation('{$confirmationMessage}', '{$url}')",
|
76 |
'class' => 'add',
|
77 |
));
|
78 |
}
|
82 |
$url = $this->getUrl('*/*/updateProfile', array('profile' => $profile->getId(),));
|
83 |
$this->_addButton('update', array(
|
84 |
'label' => Mage::helper('sales')->__('Get Update'),
|
85 |
+
'onclick' => "confirmSetLocation('{$confirmationMessage}', '{$url}')",
|
86 |
'class' => 'add',
|
87 |
));
|
88 |
}
|
app/code/core/Mage/Sales/Block/Billing/Agreements.php
CHANGED
@@ -145,7 +145,7 @@ class Mage_Sales_Block_Billing_Agreements extends Mage_Core_Block_Template
|
|
145 |
*/
|
146 |
protected function _toHtml()
|
147 |
{
|
148 |
-
$this->setCreateUrl($this->getUrl('*/billing_agreement/startWizard'));
|
149 |
return parent::_toHtml();
|
150 |
}
|
151 |
}
|
145 |
*/
|
146 |
protected function _toHtml()
|
147 |
{
|
148 |
+
$this->setCreateUrl($this->getUrl('*/billing_agreement/startWizard', array('_secure' => $this->_isSecure())));
|
149 |
return parent::_toHtml();
|
150 |
}
|
151 |
}
|
app/code/core/Mage/Sales/Block/Order/Recent.php
CHANGED
@@ -42,10 +42,35 @@ class Mage_Sales_Block_Order_Recent extends Mage_Core_Block_Template
|
|
42 |
//TODO: add full name logic
|
43 |
$orders = Mage::getResourceModel('sales/order_collection')
|
44 |
->addAttributeToSelect('*')
|
45 |
-
->joinAttribute(
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
->addAttributeToSort('created_at', 'desc')
|
50 |
->setPageSize('5')
|
51 |
->load()
|
42 |
//TODO: add full name logic
|
43 |
$orders = Mage::getResourceModel('sales/order_collection')
|
44 |
->addAttributeToSelect('*')
|
45 |
+
->joinAttribute(
|
46 |
+
'shipping_firstname',
|
47 |
+
'order_address/firstname',
|
48 |
+
'shipping_address_id',
|
49 |
+
null,
|
50 |
+
'left'
|
51 |
+
)
|
52 |
+
->joinAttribute(
|
53 |
+
'shipping_middlename',
|
54 |
+
'order_address/middlename',
|
55 |
+
'shipping_address_id',
|
56 |
+
null,
|
57 |
+
'left'
|
58 |
+
)
|
59 |
+
->joinAttribute(
|
60 |
+
'shipping_lastname',
|
61 |
+
'order_address/lastname',
|
62 |
+
'shipping_address_id',
|
63 |
+
null,
|
64 |
+
'left'
|
65 |
+
)
|
66 |
+
->addAttributeToFilter(
|
67 |
+
'customer_id',
|
68 |
+
Mage::getSingleton('customer/session')->getCustomer()->getId()
|
69 |
+
)
|
70 |
+
->addAttributeToFilter(
|
71 |
+
'state',
|
72 |
+
array('in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates())
|
73 |
+
)
|
74 |
->addAttributeToSort('created_at', 'desc')
|
75 |
->setPageSize('5')
|
76 |
->load()
|
app/code/core/Mage/Sales/Block/Recurring/Profile/View.php
CHANGED
@@ -210,7 +210,15 @@ class Mage_Sales_Block_Recurring_Profile_View extends Mage_Core_Block_Template
|
|
210 |
'label' => $this->_profile->getFieldLabel('currency_code'),
|
211 |
'value' => $this->_profile->getCurrencyCode()
|
212 |
));
|
213 |
-
foreach (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
$value = $this->_profile->getData($key);
|
215 |
if ($value) {
|
216 |
$this->_addInfo(array(
|
@@ -251,7 +259,13 @@ class Mage_Sales_Block_Recurring_Profile_View extends Mage_Core_Block_Template
|
|
251 |
public function prepareRelatedOrdersFrontendGrid()
|
252 |
{
|
253 |
$this->_prepareRelatedOrders(array(
|
254 |
-
'increment_id',
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
));
|
256 |
$this->_relatedOrders->addFieldToFilter('state', array(
|
257 |
'in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates()
|
210 |
'label' => $this->_profile->getFieldLabel('currency_code'),
|
211 |
'value' => $this->_profile->getCurrencyCode()
|
212 |
));
|
213 |
+
foreach (
|
214 |
+
array(
|
215 |
+
'init_amount',
|
216 |
+
'trial_billing_amount',
|
217 |
+
'billing_amount',
|
218 |
+
'tax_amount',
|
219 |
+
'shipping_amount'
|
220 |
+
) as $key
|
221 |
+
) {
|
222 |
$value = $this->_profile->getData($key);
|
223 |
if ($value) {
|
224 |
$this->_addInfo(array(
|
259 |
public function prepareRelatedOrdersFrontendGrid()
|
260 |
{
|
261 |
$this->_prepareRelatedOrders(array(
|
262 |
+
'increment_id',
|
263 |
+
'created_at',
|
264 |
+
'customer_firstname',
|
265 |
+
'customer_middlename',
|
266 |
+
'customer_lastname',
|
267 |
+
'base_grand_total',
|
268 |
+
'status'
|
269 |
));
|
270 |
$this->_relatedOrders->addFieldToFilter('state', array(
|
271 |
'in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates()
|
app/code/core/Mage/Sales/Block/Widget/Guest/Form.php
CHANGED
@@ -95,6 +95,6 @@ class Mage_Sales_Block_Widget_Guest_Form
|
|
95 |
*/
|
96 |
public function getActionUrl()
|
97 |
{
|
98 |
-
return $this->getUrl('sales/guest/view');
|
99 |
}
|
100 |
}
|
95 |
*/
|
96 |
public function getActionUrl()
|
97 |
{
|
98 |
+
return $this->getUrl('sales/guest/view', array('_secure' => $this->_isSecure()));
|
99 |
}
|
100 |
}
|
app/code/core/Mage/Sales/Helper/Data.php
CHANGED
@@ -38,6 +38,11 @@ class Mage_Sales_Helper_Data extends Mage_Core_Helper_Data
|
|
38 |
*/
|
39 |
const MAXIMUM_AVAILABLE_NUMBER = 99999999;
|
40 |
|
|
|
|
|
|
|
|
|
|
|
41 |
/**
|
42 |
* Check quote amount
|
43 |
*
|
38 |
*/
|
39 |
const MAXIMUM_AVAILABLE_NUMBER = 99999999;
|
40 |
|
41 |
+
/**
|
42 |
+
* Default precision for price calculations
|
43 |
+
*/
|
44 |
+
const PRECISION_VALUE = 0.0001;
|
45 |
+
|
46 |
/**
|
47 |
* Check quote amount
|
48 |
*
|
app/code/core/Mage/Sales/Model/Api2/Order.php
CHANGED
@@ -103,6 +103,7 @@ class Mage_Sales_Model_Api2_Order extends Mage_Api2_Model_Resource
|
|
103 |
'main_table.entity_id = order_tax.order_id',
|
104 |
$taxInfoFields
|
105 |
);
|
|
|
106 |
}
|
107 |
return $this;
|
108 |
}
|
103 |
'main_table.entity_id = order_tax.order_id',
|
104 |
$taxInfoFields
|
105 |
);
|
106 |
+
$collection->getSelect()->group('main_table.entity_id');
|
107 |
}
|
108 |
return $this;
|
109 |
}
|
app/code/core/Mage/Sales/Model/Observer.php
CHANGED
@@ -115,7 +115,24 @@ class Mage_Sales_Model_Observer
|
|
115 |
*/
|
116 |
public function markQuotesRecollectOnCatalogRules($observer)
|
117 |
{
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
return $this;
|
120 |
}
|
121 |
|
115 |
*/
|
116 |
public function markQuotesRecollectOnCatalogRules($observer)
|
117 |
{
|
118 |
+
$product = $observer->getEvent()->getProduct();
|
119 |
+
|
120 |
+
if (is_numeric($product)) {
|
121 |
+
$product = Mage::getModel("catalog/product")->load($product);
|
122 |
+
}
|
123 |
+
if ($product instanceof Mage_Catalog_Model_Product) {
|
124 |
+
$childrenProductList = Mage::getSingleton('catalog/product_type')->factory($product)
|
125 |
+
->getChildrenIds($product->getId(), false);
|
126 |
+
|
127 |
+
$productIdList = array($product->getId());
|
128 |
+
foreach ($childrenProductList as $groupData) {
|
129 |
+
$productIdList = array_merge($productIdList, $groupData);
|
130 |
+
}
|
131 |
+
} else {
|
132 |
+
$productIdList = null;
|
133 |
+
}
|
134 |
+
|
135 |
+
Mage::getResourceSingleton('sales/quote')->markQuotesRecollectByAffectedProduct($productIdList);
|
136 |
return $this;
|
137 |
}
|
138 |
|
app/code/core/Mage/Sales/Model/Order.php
CHANGED
@@ -229,6 +229,8 @@
|
|
229 |
* @method Mage_Sales_Model_Order setCustomerEmail(string $value)
|
230 |
* @method string getCustomerFirstname()
|
231 |
* @method Mage_Sales_Model_Order setCustomerFirstname(string $value)
|
|
|
|
|
232 |
* @method string getCustomerLastname()
|
233 |
* @method Mage_Sales_Model_Order setCustomerLastname(string $value)
|
234 |
* @method string getCustomerMiddlename()
|
@@ -2047,12 +2049,16 @@ class Mage_Sales_Model_Order extends Mage_Sales_Model_Abstract
|
|
2047 |
return $this->_relatedObjects;
|
2048 |
}
|
2049 |
|
|
|
|
|
|
|
|
|
|
|
2050 |
public function getCustomerName()
|
2051 |
{
|
2052 |
if ($this->getCustomerFirstname()) {
|
2053 |
-
$customerName =
|
2054 |
-
}
|
2055 |
-
else {
|
2056 |
$customerName = Mage::helper('sales')->__('Guest');
|
2057 |
}
|
2058 |
return $customerName;
|
229 |
* @method Mage_Sales_Model_Order setCustomerEmail(string $value)
|
230 |
* @method string getCustomerFirstname()
|
231 |
* @method Mage_Sales_Model_Order setCustomerFirstname(string $value)
|
232 |
+
* @method string getCustomerMiddlename()
|
233 |
+
* @method Mage_Sales_Model_Order setCustomerMiddlename(string $value)
|
234 |
* @method string getCustomerLastname()
|
235 |
* @method Mage_Sales_Model_Order setCustomerLastname(string $value)
|
236 |
* @method string getCustomerMiddlename()
|
2049 |
return $this->_relatedObjects;
|
2050 |
}
|
2051 |
|
2052 |
+
/**
|
2053 |
+
* Retrieve customer name
|
2054 |
+
*
|
2055 |
+
* @return string
|
2056 |
+
*/
|
2057 |
public function getCustomerName()
|
2058 |
{
|
2059 |
if ($this->getCustomerFirstname()) {
|
2060 |
+
$customerName = Mage::helper('customer')->getFullCustomerName($this);
|
2061 |
+
} else {
|
|
|
2062 |
$customerName = Mage::helper('sales')->__('Guest');
|
2063 |
}
|
2064 |
return $customerName;
|
app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Cost.php
CHANGED
@@ -37,7 +37,7 @@ class Mage_Sales_Model_Order_Creditmemo_Total_Cost extends Mage_Sales_Model_Orde
|
|
37 |
{
|
38 |
$baseRefundTotalCost = 0;
|
39 |
foreach ($creditmemo->getAllItems() as $item) {
|
40 |
-
if (!$item->getHasChildren()){
|
41 |
$baseRefundTotalCost += $item->getBaseCost()*$item->getQty();
|
42 |
}
|
43 |
}
|
37 |
{
|
38 |
$baseRefundTotalCost = 0;
|
39 |
foreach ($creditmemo->getAllItems() as $item) {
|
40 |
+
if (!$item->getOrderItem()->getHasChildren()){
|
41 |
$baseRefundTotalCost += $item->getBaseCost()*$item->getQty();
|
42 |
}
|
43 |
}
|
app/code/core/Mage/Sales/Model/Order/Invoice.php
CHANGED
@@ -178,7 +178,16 @@ class Mage_Sales_Model_Order_Invoice extends Mage_Sales_Model_Abstract
|
|
178 |
*/
|
179 |
protected $_wasPayCalled = false;
|
180 |
|
181 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
{
|
183 |
if ($this->_saveBeforeDestruct) {
|
184 |
$this->save();
|
@@ -193,6 +202,7 @@ class Mage_Sales_Model_Order_Invoice extends Mage_Sales_Model_Abstract
|
|
193 |
$this->_init('sales/order_invoice');
|
194 |
}
|
195 |
|
|
|
196 |
/**
|
197 |
* Init mapping array of short fields to its full names
|
198 |
*
|
178 |
*/
|
179 |
protected $_wasPayCalled = false;
|
180 |
|
181 |
+
public function __construct()
|
182 |
+
{
|
183 |
+
register_shutdown_function(array($this, 'destruct'));
|
184 |
+
parent::__construct();
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Uploader clean on shutdown
|
189 |
+
*/
|
190 |
+
public function destruct()
|
191 |
{
|
192 |
if ($this->_saveBeforeDestruct) {
|
193 |
$this->save();
|
202 |
$this->_init('sales/order_invoice');
|
203 |
}
|
204 |
|
205 |
+
|
206 |
/**
|
207 |
* Init mapping array of short fields to its full names
|
208 |
*
|
app/code/core/Mage/Sales/Model/Order/Invoice/Total/Cost.php
CHANGED
@@ -37,7 +37,7 @@ class Mage_Sales_Model_Order_Invoice_Total_Cost extends Mage_Sales_Model_Order_I
|
|
37 |
{
|
38 |
$baseInvoiceTotalCost = 0;
|
39 |
foreach ($invoice->getAllItems() as $item) {
|
40 |
-
if (!$item->getHasChildren()){
|
41 |
$baseInvoiceTotalCost += $item->getBaseCost()*$item->getQty();
|
42 |
}
|
43 |
}
|
37 |
{
|
38 |
$baseInvoiceTotalCost = 0;
|
39 |
foreach ($invoice->getAllItems() as $item) {
|
40 |
+
if (!$item->getOrderItem()->getHasChildren()){
|
41 |
$baseInvoiceTotalCost += $item->getBaseCost()*$item->getQty();
|
42 |
}
|
43 |
}
|
app/code/core/Mage/Sales/Model/Order/Item.php
CHANGED
@@ -820,6 +820,9 @@ class Mage_Sales_Model_Order_Item extends Mage_Core_Model_Abstract
|
|
820 |
{
|
821 |
$weeeTaxAppliedAmounts = unserialize($this->getWeeeTaxApplied());
|
822 |
$totalDiscount = 0;
|
|
|
|
|
|
|
823 |
foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
|
824 |
if (isset($weeeTaxAppliedAmount['total_base_weee_discount'])) {
|
825 |
return $weeeTaxAppliedAmount['total_base_weee_discount'];
|
@@ -840,6 +843,9 @@ class Mage_Sales_Model_Order_Item extends Mage_Core_Model_Abstract
|
|
840 |
{
|
841 |
$weeeTaxAppliedAmounts = unserialize($this->getWeeeTaxApplied());
|
842 |
$totalDiscount = 0;
|
|
|
|
|
|
|
843 |
foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
|
844 |
if (isset($weeeTaxAppliedAmount['total_weee_discount'])) {
|
845 |
return $weeeTaxAppliedAmount['total_weee_discount'];
|
820 |
{
|
821 |
$weeeTaxAppliedAmounts = unserialize($this->getWeeeTaxApplied());
|
822 |
$totalDiscount = 0;
|
823 |
+
if (!is_array($weeeTaxAppliedAmounts)) {
|
824 |
+
return $totalDiscount;
|
825 |
+
}
|
826 |
foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
|
827 |
if (isset($weeeTaxAppliedAmount['total_base_weee_discount'])) {
|
828 |
return $weeeTaxAppliedAmount['total_base_weee_discount'];
|
843 |
{
|
844 |
$weeeTaxAppliedAmounts = unserialize($this->getWeeeTaxApplied());
|
845 |
$totalDiscount = 0;
|
846 |
+
if (!is_array($weeeTaxAppliedAmounts)) {
|
847 |
+
return $totalDiscount;
|
848 |
+
}
|
849 |
foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
|
850 |
if (isset($weeeTaxAppliedAmount['total_weee_discount'])) {
|
851 |
return $weeeTaxAppliedAmount['total_weee_discount'];
|
app/code/core/Mage/Sales/Model/Quote/Item.php
CHANGED
@@ -485,7 +485,9 @@ class Mage_Sales_Model_Quote_Item extends Mage_Sales_Model_Quote_Item_Abstract
|
|
485 |
return false;
|
486 |
}
|
487 |
foreach ($this->getOptions() as $option) {
|
488 |
-
if (in_array($option->getCode(), $this->_notRepresentOptions)
|
|
|
|
|
489 |
continue;
|
490 |
}
|
491 |
if ($itemOption = $item->getOptionByCode($option->getCode())) {
|
485 |
return false;
|
486 |
}
|
487 |
foreach ($this->getOptions() as $option) {
|
488 |
+
if (in_array($option->getCode(), $this->_notRepresentOptions)
|
489 |
+
&& !$item->getProduct()->hasCustomOptions()
|
490 |
+
) {
|
491 |
continue;
|
492 |
}
|
493 |
if ($itemOption = $item->getOptionByCode($option->getCode())) {
|
app/code/core/Mage/Sales/Model/Resource/Billing/Agreement/Collection.php
CHANGED
@@ -42,6 +42,7 @@ class Mage_Sales_Model_Resource_Billing_Agreement_Collection extends Mage_Core_M
|
|
42 |
protected $_map = array('fields' => array(
|
43 |
'customer_email' => 'ce.email',
|
44 |
'customer_firstname' => 'firstname.value',
|
|
|
45 |
'customer_lastname' => 'lastname.value',
|
46 |
'agreement_created_at' => 'main_table.created_at',
|
47 |
'agreement_updated_at' => 'main_table.updated_at',
|
@@ -74,7 +75,8 @@ class Mage_Sales_Model_Resource_Billing_Agreement_Collection extends Mage_Core_M
|
|
74 |
$attr = $customer->getAttribute('firstname');
|
75 |
$joinExpr = 'firstname.entity_id = main_table.customer_id AND '
|
76 |
. $adapter->quoteInto('firstname.entity_type_id = ?', $customer->getTypeId()) . ' AND '
|
77 |
-
. $adapter->quoteInto('firstname.attribute_id = ?', $attr->getAttributeId()
|
|
|
78 |
|
79 |
$select->joinLeft(
|
80 |
array('firstname' => $attr->getBackend()->getTable()),
|
@@ -82,6 +84,17 @@ class Mage_Sales_Model_Resource_Billing_Agreement_Collection extends Mage_Core_M
|
|
82 |
array('customer_firstname' => 'value')
|
83 |
);
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
$attr = $customer->getAttribute('lastname');
|
86 |
$joinExpr = 'lastname.entity_id = main_table.customer_id AND '
|
87 |
. $adapter->quoteInto('lastname.entity_type_id = ?', $customer->getTypeId()) . ' AND '
|
42 |
protected $_map = array('fields' => array(
|
43 |
'customer_email' => 'ce.email',
|
44 |
'customer_firstname' => 'firstname.value',
|
45 |
+
'customer_middlename' => 'middlename.value',
|
46 |
'customer_lastname' => 'lastname.value',
|
47 |
'agreement_created_at' => 'main_table.created_at',
|
48 |
'agreement_updated_at' => 'main_table.updated_at',
|
75 |
$attr = $customer->getAttribute('firstname');
|
76 |
$joinExpr = 'firstname.entity_id = main_table.customer_id AND '
|
77 |
. $adapter->quoteInto('firstname.entity_type_id = ?', $customer->getTypeId()) . ' AND '
|
78 |
+
. $adapter->quoteInto('firstname.attribute_id = ?', $attr->getAttributeId()
|
79 |
+
);
|
80 |
|
81 |
$select->joinLeft(
|
82 |
array('firstname' => $attr->getBackend()->getTable()),
|
84 |
array('customer_firstname' => 'value')
|
85 |
);
|
86 |
|
87 |
+
$attr = $customer->getAttribute('middlename');
|
88 |
+
$joinExpr = 'middlename.entity_id = main_table.customer_id AND '
|
89 |
+
. $adapter->quoteInto('middlename.entity_type_id = ?', $customer->getTypeId()) . ' AND '
|
90 |
+
. $adapter->quoteInto('middlename.attribute_id = ?', $attr->getAttributeId());
|
91 |
+
|
92 |
+
$select->joinLeft(
|
93 |
+
array('middlename' => $attr->getBackend()->getTable()),
|
94 |
+
$joinExpr,
|
95 |
+
array('customer_middlename' => 'value')
|
96 |
+
);
|
97 |
+
|
98 |
$attr = $customer->getAttribute('lastname');
|
99 |
$joinExpr = 'lastname.entity_id = main_table.customer_id AND '
|
100 |
. $adapter->quoteInto('lastname.entity_type_id = ?', $customer->getTypeId()) . ' AND '
|
app/code/core/Mage/Sales/Model/Resource/Order.php
CHANGED
@@ -88,8 +88,15 @@ class Mage_Sales_Model_Resource_Order extends Mage_Sales_Model_Resource_Order_Ab
|
|
88 |
parent::_initVirtualGridColumns();
|
89 |
$adapter = $this->getReadConnection();
|
90 |
$ifnullFirst = $adapter->getIfNullSql('{{table}}.firstname', $adapter->quote(''));
|
|
|
91 |
$ifnullLast = $adapter->getIfNullSql('{{table}}.lastname', $adapter->quote(''));
|
92 |
-
$concatAddress = $adapter->getConcatSql(array(
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
$this->addVirtualGridColumn(
|
94 |
'billing_name',
|
95 |
'sales/order_address',
|
88 |
parent::_initVirtualGridColumns();
|
89 |
$adapter = $this->getReadConnection();
|
90 |
$ifnullFirst = $adapter->getIfNullSql('{{table}}.firstname', $adapter->quote(''));
|
91 |
+
$ifnullMiddle = $adapter->getIfNullSql('{{table}}.middlename', $adapter->quote(''));
|
92 |
$ifnullLast = $adapter->getIfNullSql('{{table}}.lastname', $adapter->quote(''));
|
93 |
+
$concatAddress = $adapter->getConcatSql(array(
|
94 |
+
$ifnullFirst,
|
95 |
+
$adapter->quote(' '),
|
96 |
+
$ifnullMiddle,
|
97 |
+
$adapter->quote(' '),
|
98 |
+
$ifnullLast
|
99 |
+
));
|
100 |
$this->addVirtualGridColumn(
|
101 |
'billing_name',
|
102 |
'sales/order_address',
|
app/code/core/Mage/Sales/Model/Resource/Order/Address.php
CHANGED
@@ -63,11 +63,12 @@ class Mage_Sales_Model_Resource_Order_Address extends Mage_Sales_Model_Resource_
|
|
63 |
'country_id' => Mage::helper('sales')->__('Country'),
|
64 |
'email' => Mage::helper('sales')->__('Email'),
|
65 |
'firstname' => Mage::helper('sales')->__('First Name'),
|
|
|
66 |
'lastname' => Mage::helper('sales')->__('Last Name'),
|
67 |
'region_id' => Mage::helper('sales')->__('State/Province'),
|
68 |
'street' => Mage::helper('sales')->__('Street Address'),
|
69 |
'telephone' => Mage::helper('sales')->__('Telephone'),
|
70 |
-
'postcode' => Mage::helper('sales')->__('Zip/Postal Code')
|
71 |
);
|
72 |
asort($attributes);
|
73 |
return $attributes;
|
63 |
'country_id' => Mage::helper('sales')->__('Country'),
|
64 |
'email' => Mage::helper('sales')->__('Email'),
|
65 |
'firstname' => Mage::helper('sales')->__('First Name'),
|
66 |
+
'middlename' => Mage::helper('sales')->__('Middle Name'),
|
67 |
'lastname' => Mage::helper('sales')->__('Last Name'),
|
68 |
'region_id' => Mage::helper('sales')->__('State/Province'),
|
69 |
'street' => Mage::helper('sales')->__('Street Address'),
|
70 |
'telephone' => Mage::helper('sales')->__('Telephone'),
|
71 |
+
'postcode' => Mage::helper('sales')->__('Zip/Postal Code'),
|
72 |
);
|
73 |
asort($attributes);
|
74 |
return $attributes;
|
app/code/core/Mage/Sales/Model/Resource/Order/Collection.php
CHANGED
@@ -87,6 +87,7 @@ class Mage_Sales_Model_Resource_Order_Collection extends Mage_Sales_Model_Resour
|
|
87 |
/* @var $countSelect Varien_Db_Select */
|
88 |
$countSelect = parent::getSelectCountSql();
|
89 |
$countSelect->resetJoinLeft();
|
|
|
90 |
return $countSelect;
|
91 |
}
|
92 |
|
@@ -118,11 +119,13 @@ class Mage_Sales_Model_Resource_Order_Collection extends Mage_Sales_Model_Resour
|
|
118 |
|
119 |
$this
|
120 |
->addFilterToMap('billing_firstname', $billingAliasName . '.firstname')
|
|
|
121 |
->addFilterToMap('billing_lastname', $billingAliasName . '.lastname')
|
122 |
->addFilterToMap('billing_telephone', $billingAliasName . '.telephone')
|
123 |
->addFilterToMap('billing_postcode', $billingAliasName . '.postcode')
|
124 |
|
125 |
->addFilterToMap('shipping_firstname', $shippingAliasName . '.firstname')
|
|
|
126 |
->addFilterToMap('shipping_lastname', $shippingAliasName . '.lastname')
|
127 |
->addFilterToMap('shipping_telephone', $shippingAliasName . '.telephone')
|
128 |
->addFilterToMap('shipping_postcode', $shippingAliasName . '.postcode');
|
@@ -135,6 +138,7 @@ class Mage_Sales_Model_Resource_Order_Collection extends Mage_Sales_Model_Resour
|
|
135 |
. " AND {$billingAliasName}.address_type = 'billing')",
|
136 |
array(
|
137 |
$billingAliasName . '.firstname',
|
|
|
138 |
$billingAliasName . '.lastname',
|
139 |
$billingAliasName . '.telephone',
|
140 |
$billingAliasName . '.postcode'
|
@@ -146,6 +150,7 @@ class Mage_Sales_Model_Resource_Order_Collection extends Mage_Sales_Model_Resour
|
|
146 |
. " AND {$shippingAliasName}.address_type = 'shipping')",
|
147 |
array(
|
148 |
$shippingAliasName . '.firstname',
|
|
|
149 |
$shippingAliasName . '.lastname',
|
150 |
$shippingAliasName . '.telephone',
|
151 |
$shippingAliasName . '.postcode'
|
87 |
/* @var $countSelect Varien_Db_Select */
|
88 |
$countSelect = parent::getSelectCountSql();
|
89 |
$countSelect->resetJoinLeft();
|
90 |
+
$countSelect->reset(Zend_Db_Select::GROUP);
|
91 |
return $countSelect;
|
92 |
}
|
93 |
|
119 |
|
120 |
$this
|
121 |
->addFilterToMap('billing_firstname', $billingAliasName . '.firstname')
|
122 |
+
->addFilterToMap('billing_middlename', $billingAliasName . '.middlename')
|
123 |
->addFilterToMap('billing_lastname', $billingAliasName . '.lastname')
|
124 |
->addFilterToMap('billing_telephone', $billingAliasName . '.telephone')
|
125 |
->addFilterToMap('billing_postcode', $billingAliasName . '.postcode')
|
126 |
|
127 |
->addFilterToMap('shipping_firstname', $shippingAliasName . '.firstname')
|
128 |
+
->addFilterToMap('shipping_middlename', $shippingAliasName . '.middlename')
|
129 |
->addFilterToMap('shipping_lastname', $shippingAliasName . '.lastname')
|
130 |
->addFilterToMap('shipping_telephone', $shippingAliasName . '.telephone')
|
131 |
->addFilterToMap('shipping_postcode', $shippingAliasName . '.postcode');
|
138 |
. " AND {$billingAliasName}.address_type = 'billing')",
|
139 |
array(
|
140 |
$billingAliasName . '.firstname',
|
141 |
+
$billingAliasName . '.middlename',
|
142 |
$billingAliasName . '.lastname',
|
143 |
$billingAliasName . '.telephone',
|
144 |
$billingAliasName . '.postcode'
|
150 |
. " AND {$shippingAliasName}.address_type = 'shipping')",
|
151 |
array(
|
152 |
$shippingAliasName . '.firstname',
|
153 |
+
$shippingAliasName . '.middlename',
|
154 |
$shippingAliasName . '.lastname',
|
155 |
$shippingAliasName . '.telephone',
|
156 |
$shippingAliasName . '.postcode'
|
app/code/core/Mage/Sales/Model/Resource/Order/Creditmemo.php
CHANGED
@@ -79,10 +79,17 @@ class Mage_Sales_Model_Resource_Order_Creditmemo extends Mage_Sales_Model_Resour
|
|
79 |
protected function _initVirtualGridColumns()
|
80 |
{
|
81 |
parent::_initVirtualGridColumns();
|
82 |
-
$adapter
|
83 |
-
$checkedFirstname
|
84 |
-
$
|
85 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
$this->addVirtualGridColumn(
|
88 |
'billing_name',
|
79 |
protected function _initVirtualGridColumns()
|
80 |
{
|
81 |
parent::_initVirtualGridColumns();
|
82 |
+
$adapter = $this->getReadConnection();
|
83 |
+
$checkedFirstname = $adapter->getIfNullSql('{{table}}.firstname', $adapter->quote(''));
|
84 |
+
$checkedMiddlename = $adapter->getIfNullSql('{{table}}.middlename', $adapter->quote(''));
|
85 |
+
$checkedLastname = $adapter->getIfNullSql('{{table}}.lastname', $adapter->quote(''));
|
86 |
+
$concatName = $adapter->getConcatSql(array(
|
87 |
+
$checkedFirstname,
|
88 |
+
$adapter->quote(' '),
|
89 |
+
$checkedMiddlename,
|
90 |
+
$adapter->quote(' '),
|
91 |
+
$checkedLastname
|
92 |
+
));
|
93 |
|
94 |
$this->addVirtualGridColumn(
|
95 |
'billing_name',
|
app/code/core/Mage/Sales/Model/Resource/Order/Invoice.php
CHANGED
@@ -79,15 +79,22 @@ class Mage_Sales_Model_Resource_Order_Invoice extends Mage_Sales_Model_Resource_
|
|
79 |
protected function _initVirtualGridColumns()
|
80 |
{
|
81 |
parent::_initVirtualGridColumns();
|
82 |
-
$adapter
|
83 |
-
$checkedFirstname
|
84 |
-
$
|
85 |
-
|
|
|
86 |
$this->addVirtualGridColumn(
|
87 |
'billing_name',
|
88 |
'sales/order_address',
|
89 |
array('billing_address_id' => 'entity_id'),
|
90 |
-
$adapter->getConcatSql(array(
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
)
|
92 |
->addVirtualGridColumn(
|
93 |
'order_increment_id',
|
79 |
protected function _initVirtualGridColumns()
|
80 |
{
|
81 |
parent::_initVirtualGridColumns();
|
82 |
+
$adapter = $this->_getReadAdapter();
|
83 |
+
$checkedFirstname = $adapter->getIfNullSql('{{table}}.firstname', $adapter->quote(''));
|
84 |
+
$checkedMiddlename = $adapter->getIfNullSql('{{table}}.middlename', $adapter->quote(''));
|
85 |
+
$checkedLastname = $adapter->getIfNullSql('{{table}}.lastname', $adapter->quote(''));
|
86 |
+
|
87 |
$this->addVirtualGridColumn(
|
88 |
'billing_name',
|
89 |
'sales/order_address',
|
90 |
array('billing_address_id' => 'entity_id'),
|
91 |
+
$adapter->getConcatSql(array(
|
92 |
+
$checkedFirstname,
|
93 |
+
$adapter->quote(' '),
|
94 |
+
$checkedMiddlename,
|
95 |
+
$adapter->quote(' '),
|
96 |
+
$checkedLastname
|
97 |
+
))
|
98 |
)
|
99 |
->addVirtualGridColumn(
|
100 |
'order_increment_id',
|
app/code/core/Mage/Sales/Model/Resource/Order/Shipment.php
CHANGED
@@ -79,10 +79,17 @@ class Mage_Sales_Model_Resource_Order_Shipment extends Mage_Sales_Model_Resource
|
|
79 |
protected function _initVirtualGridColumns()
|
80 |
{
|
81 |
parent::_initVirtualGridColumns();
|
82 |
-
$adapter
|
83 |
-
$checkedFirstname
|
84 |
-
$
|
85 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
$this->addVirtualGridColumn(
|
88 |
'shipping_name',
|
79 |
protected function _initVirtualGridColumns()
|
80 |
{
|
81 |
parent::_initVirtualGridColumns();
|
82 |
+
$adapter = $this->getReadConnection();
|
83 |
+
$checkedFirstname = $adapter->getIfNullSql('{{table}}.firstname', $adapter->quote(''));
|
84 |
+
$checkedMidllename = $adapter->getIfNullSql('{{table}}.middlename', $adapter->quote(''));
|
85 |
+
$checkedLastname = $adapter->getIfNullSql('{{table}}.lastname', $adapter->quote(''));
|
86 |
+
$concatName = $adapter->getConcatSql(array(
|
87 |
+
$checkedFirstname,
|
88 |
+
$adapter->quote(' '),
|
89 |
+
$checkedMidllename,
|
90 |
+
$adapter->quote(' '),
|
91 |
+
$checkedLastname
|
92 |
+
));
|
93 |
|
94 |
$this->addVirtualGridColumn(
|
95 |
'shipping_name',
|
app/code/core/Mage/Sales/Model/Resource/Quote.php
CHANGED
@@ -177,29 +177,51 @@ class Mage_Sales_Model_Resource_Quote extends Mage_Sales_Model_Resource_Abstract
|
|
177 |
/**
|
178 |
* Mark quotes - that depend on catalog price rules - to be recollected on demand
|
179 |
*
|
|
|
|
|
180 |
* @return Mage_Sales_Model_Resource_Quote
|
181 |
*/
|
182 |
-
public function
|
183 |
{
|
184 |
-
$
|
185 |
-
$
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
|
|
198 |
}
|
199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
return $this;
|
201 |
}
|
202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
/**
|
204 |
* Subtract product from all quotes quantities
|
205 |
*
|
@@ -220,6 +242,7 @@ class Mage_Sales_Model_Resource_Quote extends Mage_Sales_Model_Resource_Abstract
|
|
220 |
$adapter->quoteIdentifier('q.items_qty') . ' - ' . $adapter->quoteIdentifier('qi.qty')),
|
221 |
'items_count' => new Zend_Db_Expr($adapter->quoteIdentifier('q.items_count') . ' - 1')
|
222 |
))
|
|
|
223 |
->join(
|
224 |
array('qi' => $this->getTable('sales/quote_item')),
|
225 |
implode(' AND ', array(
|
@@ -250,7 +273,7 @@ class Mage_Sales_Model_Resource_Quote extends Mage_Sales_Model_Resource_Abstract
|
|
250 |
$subSelect = $this->_getReadAdapter()
|
251 |
->select()
|
252 |
->from($tableItem, array('entity_id' => 'quote_id'))
|
253 |
-
->where('product_id IN (
|
254 |
->group('quote_id');
|
255 |
|
256 |
$select = $this->_getReadAdapter()->select()->join(
|
177 |
/**
|
178 |
* Mark quotes - that depend on catalog price rules - to be recollected on demand
|
179 |
*
|
180 |
+
* @param array|null $productIdList
|
181 |
+
*
|
182 |
* @return Mage_Sales_Model_Resource_Quote
|
183 |
*/
|
184 |
+
public function markQuotesRecollectByAffectedProduct($productIdList = null)
|
185 |
{
|
186 |
+
$writeAdapter = $this->_getWriteAdapter();
|
187 |
+
$select = $writeAdapter->select();
|
188 |
+
$subSelect = clone $select;
|
189 |
+
|
190 |
+
$subSelect
|
191 |
+
->distinct()
|
192 |
+
->from(
|
193 |
+
array('qi' => $this->getTable('sales/quote_item')),
|
194 |
+
array('entity_id' => 'quote_id'))
|
195 |
+
->join(
|
196 |
+
array('pp' => $this->getTable('catalogrule/rule_product_price')),
|
197 |
+
'qi.product_id = pp.product_id',
|
198 |
+
array());
|
199 |
+
if ($productIdList !== null) {
|
200 |
+
$subSelect->where('qi.product_id IN (?)', $productIdList);
|
201 |
}
|
202 |
|
203 |
+
$select
|
204 |
+
->join(
|
205 |
+
array('tmp' => $subSelect),
|
206 |
+
'q.entity_id = tmp.entity_id',
|
207 |
+
array('trigger_recollect' => new Zend_Db_Expr(1)))
|
208 |
+
->where('q.is_active = ?', 1);
|
209 |
+
$sql = $writeAdapter->updateFromSelect($select, array('q' => $this->getTable('sales/quote')));
|
210 |
+
$writeAdapter->query($sql);
|
211 |
+
|
212 |
return $this;
|
213 |
}
|
214 |
|
215 |
+
/**
|
216 |
+
* Mark quotes - that depend on catalog price rules - to be recollected on demand
|
217 |
+
*
|
218 |
+
* @return Mage_Sales_Model_Resource_Quote
|
219 |
+
*/
|
220 |
+
public function markQuotesRecollectOnCatalogRules()
|
221 |
+
{
|
222 |
+
return $this->markQuotesRecollectByAffectedProduct();
|
223 |
+
}
|
224 |
+
|
225 |
/**
|
226 |
* Subtract product from all quotes quantities
|
227 |
*
|
242 |
$adapter->quoteIdentifier('q.items_qty') . ' - ' . $adapter->quoteIdentifier('qi.qty')),
|
243 |
'items_count' => new Zend_Db_Expr($adapter->quoteIdentifier('q.items_count') . ' - 1')
|
244 |
))
|
245 |
+
->where('q.items_count > 0')
|
246 |
->join(
|
247 |
array('qi' => $this->getTable('sales/quote_item')),
|
248 |
implode(' AND ', array(
|
273 |
$subSelect = $this->_getReadAdapter()
|
274 |
->select()
|
275 |
->from($tableItem, array('entity_id' => 'quote_id'))
|
276 |
+
->where('product_id IN (?)', $productIds)
|
277 |
->group('quote_id');
|
278 |
|
279 |
$select = $this->_getReadAdapter()->select()->join(
|
app/code/core/Mage/Sales/Model/Resource/Report/Bestsellers.php
CHANGED
@@ -102,17 +102,11 @@ class Mage_Sales_Model_Resource_Report_Bestsellers extends Mage_Sales_Model_Reso
|
|
102 |
)
|
103 |
),
|
104 |
'product_price' => new Zend_Db_Expr(
|
105 |
-
|
106 |
$helper->prepareColumn(
|
107 |
sprintf('MIN(%s)',
|
108 |
$adapter->getIfNullSql(
|
109 |
-
$adapter->getIfNullSql('product_price.value','product_default_price.value'),0)
|
110 |
-
),
|
111 |
-
$select->getPart(Zend_Db_Select::GROUP)
|
112 |
-
),
|
113 |
-
$helper->prepareColumn(
|
114 |
-
sprintf('MIN(%s)',
|
115 |
-
$adapter->getIfNullSql('source_table.base_to_global_rate', '0')
|
116 |
),
|
117 |
$select->getPart(Zend_Db_Select::GROUP)
|
118 |
)
|
@@ -224,31 +218,7 @@ class Mage_Sales_Model_Resource_Report_Bestsellers extends Mage_Sales_Model_Reso
|
|
224 |
$adapter->query($insertQuery);
|
225 |
|
226 |
|
227 |
-
$
|
228 |
-
'period' => 'period',
|
229 |
-
'store_id' => new Zend_Db_Expr(Mage_Core_Model_App::ADMIN_STORE_ID),
|
230 |
-
'product_id' => 'product_id',
|
231 |
-
'product_name' => new Zend_Db_Expr('MIN(product_name)'),
|
232 |
-
'product_price' => new Zend_Db_Expr('MIN(product_price)'),
|
233 |
-
'qty_ordered' => new Zend_Db_Expr('SUM(qty_ordered)'),
|
234 |
-
);
|
235 |
-
|
236 |
-
$select->reset();
|
237 |
-
$select->from($this->getMainTable(), $columns)
|
238 |
-
->where('store_id <> ?', 0);
|
239 |
-
|
240 |
-
if ($subSelect !== null) {
|
241 |
-
$select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'period'));
|
242 |
-
}
|
243 |
-
|
244 |
-
$select->group(array(
|
245 |
-
'period',
|
246 |
-
'product_id'
|
247 |
-
));
|
248 |
-
|
249 |
-
$insertQuery = $helper->getInsertFromSelectUsingAnalytic($select, $this->getMainTable(),
|
250 |
-
array_keys($columns));
|
251 |
-
$adapter->query($insertQuery);
|
252 |
|
253 |
// update rating
|
254 |
$this->_updateRatingPos(self::AGGREGATION_DAILY);
|
@@ -266,6 +236,70 @@ class Mage_Sales_Model_Resource_Report_Bestsellers extends Mage_Sales_Model_Reso
|
|
266 |
return $this;
|
267 |
}
|
268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
/**
|
270 |
* Update rating position
|
271 |
*
|
102 |
)
|
103 |
),
|
104 |
'product_price' => new Zend_Db_Expr(
|
105 |
+
sprintf('%s',
|
106 |
$helper->prepareColumn(
|
107 |
sprintf('MIN(%s)',
|
108 |
$adapter->getIfNullSql(
|
109 |
+
$adapter->getIfNullSql('product_price.value','product_default_price.value'), 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
),
|
111 |
$select->getPart(Zend_Db_Select::GROUP)
|
112 |
)
|
218 |
$adapter->query($insertQuery);
|
219 |
|
220 |
|
221 |
+
$this->_aggregateDefault($subSelect);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
|
223 |
// update rating
|
224 |
$this->_updateRatingPos(self::AGGREGATION_DAILY);
|
236 |
return $this;
|
237 |
}
|
238 |
|
239 |
+
/**
|
240 |
+
* Aggregate Orders data for default store
|
241 |
+
*
|
242 |
+
* @param object Varien_Db_Select|null $subSelect
|
243 |
+
* @return Mage_Sales_Model_Resource_Report_Bestsellers
|
244 |
+
*/
|
245 |
+
protected function _aggregateDefault($subSelect = null)
|
246 |
+
{
|
247 |
+
$adapter = $this->_getWriteAdapter();
|
248 |
+
$select = $adapter->select();
|
249 |
+
/** @var Mage_Catalog_Model_Resource_Product $product */
|
250 |
+
$product = Mage::getResourceSingleton('catalog/product');
|
251 |
+
$attr = $product->getAttribute('price');
|
252 |
+
$helper = Mage::getResourceHelper('core');
|
253 |
+
|
254 |
+
$columns = array(
|
255 |
+
'period' => 'period',
|
256 |
+
'store_id' => new Zend_Db_Expr(Mage_Core_Model_App::ADMIN_STORE_ID),
|
257 |
+
'product_id' => 'product_id',
|
258 |
+
'product_name' => new Zend_Db_Expr('MIN(product_name)'),
|
259 |
+
'product_price' => new Zend_Db_Expr(
|
260 |
+
sprintf('%s',
|
261 |
+
$helper->prepareColumn(
|
262 |
+
sprintf('MIN(%s)',
|
263 |
+
$adapter->getIfNullSql('product_default_price.value', 0)
|
264 |
+
),
|
265 |
+
$select->getPart(Zend_Db_Select::GROUP)
|
266 |
+
)
|
267 |
+
)
|
268 |
+
),
|
269 |
+
'qty_ordered' => new Zend_Db_Expr('SUM(qty_ordered)'),
|
270 |
+
);
|
271 |
+
|
272 |
+
$select->from($this->getMainTable(), $columns)
|
273 |
+
->where($this->getMainTable() . '.store_id <> ?', 0);
|
274 |
+
$joinExprProductDefPrice = array(
|
275 |
+
'product_default_price.entity_id = ' . $this->getMainTable() . '.product_id',
|
276 |
+
'product_default_price.store_id = 0',
|
277 |
+
$adapter->quoteInto('product_default_price.entity_type_id = ?', $product->getTypeId()),
|
278 |
+
$adapter->quoteInto('product_default_price.attribute_id = ?', $attr->getAttributeId())
|
279 |
+
);
|
280 |
+
$joinExprProductDefPrice = implode(' AND ', $joinExprProductDefPrice);
|
281 |
+
$select->joinLeft(
|
282 |
+
array('product_default_price' => $attr->getBackend()->getTable()),
|
283 |
+
$joinExprProductDefPrice,
|
284 |
+
array()
|
285 |
+
);
|
286 |
+
|
287 |
+
if ($subSelect !== null) {
|
288 |
+
$select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'period'));
|
289 |
+
}
|
290 |
+
|
291 |
+
$select->group(array(
|
292 |
+
'period',
|
293 |
+
'product_id'
|
294 |
+
));
|
295 |
+
|
296 |
+
$insertQuery = $helper->getInsertFromSelectUsingAnalytic($select, $this->getMainTable(),
|
297 |
+
array_keys($columns));
|
298 |
+
$adapter->query($insertQuery);
|
299 |
+
|
300 |
+
return $this;
|
301 |
+
}
|
302 |
+
|
303 |
/**
|
304 |
* Update rating position
|
305 |
*
|
app/code/core/Mage/Sales/Model/Resource/Report/Order/Createdat.php
CHANGED
@@ -119,11 +119,13 @@ class Mage_Sales_Model_Resource_Report_Order_Createdat extends Mage_Sales_Model_
|
|
119 |
)
|
120 |
),
|
121 |
'total_profit_amount' => new Zend_Db_Expr(
|
122 |
-
sprintf('SUM((%s - %s - %s - %s - %s) * %s)',
|
123 |
$adapter->getIfNullSql('o.base_total_paid', 0),
|
124 |
$adapter->getIfNullSql('o.base_total_refunded', 0),
|
125 |
$adapter->getIfNullSql('o.base_tax_invoiced', 0),
|
|
|
126 |
$adapter->getIfNullSql('o.base_shipping_invoiced', 0),
|
|
|
127 |
$adapter->getIfNullSql('o.base_total_invoiced_cost', 0),
|
128 |
$adapter->getIfNullSql('o.base_to_global_rate', 0)
|
129 |
)
|
119 |
)
|
120 |
),
|
121 |
'total_profit_amount' => new Zend_Db_Expr(
|
122 |
+
sprintf('SUM(((%s - %s) - (%s - %s) - (%s - %s) - %s) * %s)',
|
123 |
$adapter->getIfNullSql('o.base_total_paid', 0),
|
124 |
$adapter->getIfNullSql('o.base_total_refunded', 0),
|
125 |
$adapter->getIfNullSql('o.base_tax_invoiced', 0),
|
126 |
+
$adapter->getIfNullSql('o.base_tax_refunded', 0),
|
127 |
$adapter->getIfNullSql('o.base_shipping_invoiced', 0),
|
128 |
+
$adapter->getIfNullSql('o.base_shipping_refunded', 0),
|
129 |
$adapter->getIfNullSql('o.base_total_invoiced_cost', 0),
|
130 |
$adapter->getIfNullSql('o.base_to_global_rate', 0)
|
131 |
)
|
app/code/core/Mage/Sales/Model/Service/Order.php
CHANGED
@@ -124,20 +124,25 @@ class Mage_Sales_Model_Service_Order
|
|
124 |
$item = $this->_convertor->itemToInvoiceItem($orderItem);
|
125 |
if ($orderItem->isDummy()) {
|
126 |
$qty = $orderItem->getQtyOrdered() ? $orderItem->getQtyOrdered() : 1;
|
127 |
-
} else
|
128 |
if (isset($qtys[$orderItem->getId()])) {
|
129 |
$qty = (float) $qtys[$orderItem->getId()];
|
|
|
|
|
|
|
|
|
130 |
}
|
131 |
-
} else {
|
132 |
-
$qty = $orderItem->getQtyToInvoice();
|
133 |
}
|
|
|
134 |
$totalQty += $qty;
|
135 |
$item->setQty($qty);
|
136 |
$invoice->addItem($item);
|
137 |
}
|
|
|
138 |
$invoice->setTotalQty($totalQty);
|
139 |
$invoice->collectTotals();
|
140 |
$this->_order->getInvoiceCollection()->addItem($invoice);
|
|
|
141 |
return $invoice;
|
142 |
}
|
143 |
|
124 |
$item = $this->_convertor->itemToInvoiceItem($orderItem);
|
125 |
if ($orderItem->isDummy()) {
|
126 |
$qty = $orderItem->getQtyOrdered() ? $orderItem->getQtyOrdered() : 1;
|
127 |
+
} else {
|
128 |
if (isset($qtys[$orderItem->getId()])) {
|
129 |
$qty = (float) $qtys[$orderItem->getId()];
|
130 |
+
} elseif (!count($qtys)) {
|
131 |
+
$qty = $orderItem->getQtyToInvoice();
|
132 |
+
} else {
|
133 |
+
$qty = 0;
|
134 |
}
|
|
|
|
|
135 |
}
|
136 |
+
|
137 |
$totalQty += $qty;
|
138 |
$item->setQty($qty);
|
139 |
$invoice->addItem($item);
|
140 |
}
|
141 |
+
|
142 |
$invoice->setTotalQty($totalQty);
|
143 |
$invoice->collectTotals();
|
144 |
$this->_order->getInvoiceCollection()->addItem($invoice);
|
145 |
+
|
146 |
return $invoice;
|
147 |
}
|
148 |
|
app/code/core/Mage/Sales/controllers/Recurring/ProfileController.php
CHANGED
@@ -190,8 +190,9 @@ class Mage_Sales_Recurring_ProfileController extends Mage_Core_Controller_Front_
|
|
190 |
*/
|
191 |
protected function _initProfile()
|
192 |
{
|
|
|
193 |
$profile = Mage::getModel('sales/recurring_profile')->load($this->getRequest()->getParam('profile'));
|
194 |
-
if (!$profile->getId()) {
|
195 |
Mage::throwException($this->__('Specified profile does not exist.'));
|
196 |
}
|
197 |
Mage::register('current_recurring_profile', $profile);
|
190 |
*/
|
191 |
protected function _initProfile()
|
192 |
{
|
193 |
+
/** @var Mage_Sales_Model_Recurring_Profile $profile */
|
194 |
$profile = Mage::getModel('sales/recurring_profile')->load($this->getRequest()->getParam('profile'));
|
195 |
+
if (!$profile->getId() || $this->_session->getCustomerId() != $profile->getCustomerId()) {
|
196 |
Mage::throwException($this->__('Specified profile does not exist.'));
|
197 |
}
|
198 |
Mage::register('current_recurring_profile', $profile);
|
app/code/core/Mage/Sales/etc/config.xml
CHANGED
@@ -28,7 +28,7 @@
|
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_Sales>
|
31 |
-
<version>1.6.0.
|
32 |
</Mage_Sales>
|
33 |
</modules>
|
34 |
<global>
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_Sales>
|
31 |
+
<version>1.6.0.9</version>
|
32 |
</Mage_Sales>
|
33 |
</modules>
|
34 |
<global>
|
app/code/core/Mage/Sales/sql/sales_setup/upgrade-1.6.0.8-1.6.0.9.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Sales
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/* @var $installer Mage_Sales_Model_Entity_Setup */
|
28 |
+
$installer = $this;
|
29 |
+
|
30 |
+
|
31 |
+
$installer->startSetup();
|
32 |
+
|
33 |
+
$installer->getConnection()->changeColumn(
|
34 |
+
$installer->getTable('sales/quote'),
|
35 |
+
'remote_ip',
|
36 |
+
'remote_ip',
|
37 |
+
'VARCHAR(255) default NULL COMMENT \'Remote Ip\''
|
38 |
+
);
|
39 |
+
|
40 |
+
$installer->endSetup();
|
app/code/core/Mage/Sendfriend/Block/Send.php
CHANGED
@@ -158,7 +158,8 @@ class Mage_Sendfriend_Block_Send extends Mage_Core_Block_Template
|
|
158 |
{
|
159 |
return Mage::getUrl('*/*/sendmail', array(
|
160 |
'id' => $this->getProductId(),
|
161 |
-
'cat_id' => $this->getCategoryId()
|
|
|
162 |
));
|
163 |
}
|
164 |
|
158 |
{
|
159 |
return Mage::getUrl('*/*/sendmail', array(
|
160 |
'id' => $this->getProductId(),
|
161 |
+
'cat_id' => $this->getCategoryId(),
|
162 |
+
'_secure' => $this->_isSecure()
|
163 |
));
|
164 |
}
|
165 |
|
app/code/core/Mage/Sendfriend/etc/config.xml
CHANGED
@@ -28,7 +28,7 @@
|
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_Sendfriend>
|
31 |
-
<version>1.6.0.
|
32 |
</Mage_Sendfriend>
|
33 |
</modules>
|
34 |
<global>
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_Sendfriend>
|
31 |
+
<version>1.6.0.1</version>
|
32 |
</Mage_Sendfriend>
|
33 |
</modules>
|
34 |
<global>
|
app/code/core/Mage/Sendfriend/sql/sendfriend_setup/mysql4-upgrade-1.6.0.0-1.6.0.1.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Sendfriend
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/* @var $installer Mage_Sendfriend_Model_Resource_Setup */
|
28 |
+
$installer = $this;
|
29 |
+
$installer->startSetup();
|
30 |
+
|
31 |
+
$installer->getConnection()->changeColumn(
|
32 |
+
$installer->getTable('sendfriend/sendfriend'),
|
33 |
+
'ip',
|
34 |
+
'ip',
|
35 |
+
'varbinary(16)'
|
36 |
+
);
|
37 |
+
|
38 |
+
$installer->getConnection()->update(
|
39 |
+
$installer->getTable('sendfriend/sendfriend'),
|
40 |
+
array(
|
41 |
+
'ip' => new Zend_Db_Expr('UNHEX(HEX(CAST(ip as UNSIGNED INT)))')
|
42 |
+
)
|
43 |
+
);
|
44 |
+
|
45 |
+
$installer->endSetup();
|
app/code/core/Mage/Tag/Block/Product/List.php
CHANGED
@@ -83,7 +83,8 @@ class Mage_Tag_Block_Product_List extends Mage_Core_Block_Template
|
|
83 |
{
|
84 |
return Mage::getUrl('tag/index/save', array(
|
85 |
'product' => $this->getProductId(),
|
86 |
-
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => Mage::helper('core/url')->getEncodedUrl()
|
|
|
87 |
));
|
88 |
}
|
89 |
|
83 |
{
|
84 |
return Mage::getUrl('tag/index/save', array(
|
85 |
'product' => $this->getProductId(),
|
86 |
+
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => Mage::helper('core/url')->getEncodedUrl(),
|
87 |
+
'_secure' => $this->_isSecure()
|
88 |
));
|
89 |
}
|
90 |
|
app/code/core/Mage/Tag/Model/Resource/Customer/Collection.php
CHANGED
@@ -243,6 +243,7 @@ class Mage_Tag_Model_Resource_Customer_Collection extends Mage_Customer_Model_Re
|
|
243 |
|
244 |
//TODO: add full name logic
|
245 |
$this->addAttributeToSelect('firstname')
|
|
|
246 |
->addAttributeToSelect('lastname')
|
247 |
->addAttributeToSelect('email');
|
248 |
|
243 |
|
244 |
//TODO: add full name logic
|
245 |
$this->addAttributeToSelect('firstname')
|
246 |
+
->addAttributeToSelect('middlename')
|
247 |
->addAttributeToSelect('lastname')
|
248 |
->addAttributeToSelect('email');
|
249 |
|
app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract.php
CHANGED
@@ -441,6 +441,17 @@ abstract class Mage_Usa_Model_Shipping_Carrier_Abstract extends Mage_Shipping_Mo
|
|
441 |
return false;
|
442 |
}
|
443 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
/**
|
445 |
* Check whether girth is allowed for the carrier
|
446 |
*
|
441 |
return false;
|
442 |
}
|
443 |
|
444 |
+
/**
|
445 |
+
* Check is Canada
|
446 |
+
*
|
447 |
+
* @param string $countryId
|
448 |
+
* @return boolean
|
449 |
+
*/
|
450 |
+
protected function _isCanada($countryId)
|
451 |
+
{
|
452 |
+
return $countryId == 'CA';
|
453 |
+
}
|
454 |
+
|
455 |
/**
|
456 |
* Check whether girth is allowed for the carrier
|
457 |
*
|
app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php
CHANGED
@@ -430,21 +430,47 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex
|
|
430 |
protected function _getQuotes()
|
431 |
{
|
432 |
$this->_result = Mage::getModel('shipping/rate_result');
|
433 |
-
// make separate request for Smart Post method
|
434 |
$allowedMethods = explode(',', $this->getConfigData('allowed_methods'));
|
435 |
if (in_array(self::RATE_REQUEST_SMARTPOST, $allowedMethods)) {
|
436 |
$response = $this->_doRatesRequest(self::RATE_REQUEST_SMARTPOST);
|
437 |
$preparedSmartpost = $this->_prepareRateResponse($response);
|
438 |
-
|
439 |
-
$this->_result->append($preparedSmartpost);
|
440 |
-
}
|
441 |
}
|
442 |
-
// make general request for all methods
|
443 |
$response = $this->_doRatesRequest(self::RATE_REQUEST_GENERAL);
|
444 |
$preparedGeneral = $this->_prepareRateResponse($response);
|
445 |
-
if (
|
446 |
-
$this->_result->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
447 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
return $this->_result;
|
449 |
}
|
450 |
|
430 |
protected function _getQuotes()
|
431 |
{
|
432 |
$this->_result = Mage::getModel('shipping/rate_result');
|
|
|
433 |
$allowedMethods = explode(',', $this->getConfigData('allowed_methods'));
|
434 |
if (in_array(self::RATE_REQUEST_SMARTPOST, $allowedMethods)) {
|
435 |
$response = $this->_doRatesRequest(self::RATE_REQUEST_SMARTPOST);
|
436 |
$preparedSmartpost = $this->_prepareRateResponse($response);
|
437 |
+
$this->_result->append($preparedSmartpost);
|
|
|
|
|
438 |
}
|
|
|
439 |
$response = $this->_doRatesRequest(self::RATE_REQUEST_GENERAL);
|
440 |
$preparedGeneral = $this->_prepareRateResponse($response);
|
441 |
+
if ($this->_result->getError() && $preparedGeneral->getError()) {
|
442 |
+
return $this->_result->getError();
|
443 |
+
}
|
444 |
+
$this->_result->append($preparedGeneral);
|
445 |
+
$this->_removeErrorsIfRateExist();
|
446 |
+
|
447 |
+
return $this->_result;
|
448 |
+
}
|
449 |
+
|
450 |
+
/**
|
451 |
+
* Remove Errors in Case When Rate Exist
|
452 |
+
*
|
453 |
+
* @return Mage_Shipping_Model_Rate_Result
|
454 |
+
*/
|
455 |
+
protected function _removeErrorsIfRateExist()
|
456 |
+
{
|
457 |
+
$rateResultExist = false;
|
458 |
+
$rates = array();
|
459 |
+
foreach ($this->_result->getAllRates() as $rate) {
|
460 |
+
if (!($rate instanceof Mage_Shipping_Model_Rate_Result_Error)) {
|
461 |
+
$rateResultExist = true;
|
462 |
+
$rates[] = $rate;
|
463 |
+
}
|
464 |
}
|
465 |
+
|
466 |
+
if ($rateResultExist) {
|
467 |
+
$this->_result->reset();
|
468 |
+
$this->_result->setError(false);
|
469 |
+
foreach ($rates as $rate) {
|
470 |
+
$this->_result->append($rate);
|
471 |
+
}
|
472 |
+
}
|
473 |
+
|
474 |
return $this->_result;
|
475 |
}
|
476 |
|
app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php
CHANGED
@@ -392,7 +392,10 @@ class Mage_Usa_Model_Shipping_Carrier_Usps
|
|
392 |
$package->addChild('Height', $height);
|
393 |
$package->addChild('Girth', $girth);
|
394 |
|
395 |
-
|
|
|
|
|
|
|
396 |
$api = 'IntlRateV2';
|
397 |
}
|
398 |
$request = $xml->asXML();
|
@@ -477,6 +480,9 @@ class Mage_Usa_Model_Shipping_Carrier_Usps
|
|
477 |
else {
|
478 |
if (is_object($xml->Package) && is_object($xml->Package->Service)) {
|
479 |
foreach ($xml->Package->Service as $service) {
|
|
|
|
|
|
|
480 |
$serviceName = $this->_filterServiceName((string)$service->SvcDescription);
|
481 |
$serviceCode = 'INT_' . (string)$service->attributes()->ID;
|
482 |
$serviceCodeToActualNameMap[$serviceCode] = $serviceName;
|
392 |
$package->addChild('Height', $height);
|
393 |
$package->addChild('Girth', $girth);
|
394 |
|
395 |
+
if ($this->_isCanada($r->getDestCountryId())) {
|
396 |
+
//only 5 chars available
|
397 |
+
$package->addChild('OriginZip', substr($r->getOrigPostal(), 0, 5));
|
398 |
+
}
|
399 |
$api = 'IntlRateV2';
|
400 |
}
|
401 |
$request = $xml->asXML();
|
480 |
else {
|
481 |
if (is_object($xml->Package) && is_object($xml->Package->Service)) {
|
482 |
foreach ($xml->Package->Service as $service) {
|
483 |
+
if ($service->ServiceErrors->count()) {
|
484 |
+
continue;
|
485 |
+
}
|
486 |
$serviceName = $this->_filterServiceName((string)$service->SvcDescription);
|
487 |
$serviceCode = 'INT_' . (string)$service->attributes()->ID;
|
488 |
$serviceCodeToActualNameMap[$serviceCode] = $serviceName;
|
app/code/core/Mage/Weee/Helper/Data.php
CHANGED
@@ -645,7 +645,8 @@ class Mage_Weee_Helper_Data extends Mage_Core_Helper_Abstract
|
|
645 |
foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
|
646 |
$weeeAmountInclDiscount += $weeeTaxAppliedAmount['row_amount'];
|
647 |
if (!$this->includeInSubtotal()) {
|
648 |
-
$weeeAmountInclDiscount -= $weeeTaxAppliedAmount['weee_discount']
|
|
|
649 |
}
|
650 |
}
|
651 |
return $weeeAmountInclDiscount;
|
@@ -666,7 +667,8 @@ class Mage_Weee_Helper_Data extends Mage_Core_Helper_Abstract
|
|
666 |
foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
|
667 |
$baseWeeeAmountInclDiscount += $weeeTaxAppliedAmount['base_row_amount'];
|
668 |
if (!$this->includeInSubtotal()) {
|
669 |
-
$baseWeeeAmountInclDiscount -= $weeeTaxAppliedAmount['base_weee_discount']
|
|
|
670 |
}
|
671 |
}
|
672 |
return $baseWeeeAmountInclDiscount;
|
645 |
foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
|
646 |
$weeeAmountInclDiscount += $weeeTaxAppliedAmount['row_amount'];
|
647 |
if (!$this->includeInSubtotal()) {
|
648 |
+
$weeeAmountInclDiscount -= isset($weeeTaxAppliedAmount['weee_discount'])
|
649 |
+
? $weeeTaxAppliedAmount['weee_discount'] : 0;
|
650 |
}
|
651 |
}
|
652 |
return $weeeAmountInclDiscount;
|
667 |
foreach ($weeeTaxAppliedAmounts as $weeeTaxAppliedAmount) {
|
668 |
$baseWeeeAmountInclDiscount += $weeeTaxAppliedAmount['base_row_amount'];
|
669 |
if (!$this->includeInSubtotal()) {
|
670 |
+
$baseWeeeAmountInclDiscount -= isset($weeeTaxAppliedAmount['base_weee_discount'])
|
671 |
+
? $weeeTaxAppliedAmount['base_weee_discount'] : 0;
|
672 |
}
|
673 |
}
|
674 |
return $baseWeeeAmountInclDiscount;
|
app/code/core/Mage/Widget/Block/Adminhtml/Widget/Chooser.php
CHANGED
@@ -178,7 +178,8 @@ class Mage_Widget_Block_Adminhtml_Widget_Chooser extends Mage_Adminhtml_Block_Te
|
|
178 |
$configJson = Mage::helper('core')->jsonEncode($config->getData());
|
179 |
return '
|
180 |
<label class="widget-option-label" id="' . $chooserId . 'label">'
|
181 |
-
. ($this->getLabel() ? $this->getLabel() : Mage::helper('widget')->__('Not Selected'))
|
|
|
182 |
<div id="' . $chooserId . 'advice-container" class="hidden"></div>
|
183 |
<script type="text/javascript">//<![CDATA[
|
184 |
(function() {
|
178 |
$configJson = Mage::helper('core')->jsonEncode($config->getData());
|
179 |
return '
|
180 |
<label class="widget-option-label" id="' . $chooserId . 'label">'
|
181 |
+
. $this->quoteEscape($this->getLabel() ? $this->getLabel() : Mage::helper('widget')->__('Not Selected'))
|
182 |
+
. '</label>
|
183 |
<div id="' . $chooserId . 'advice-container" class="hidden"></div>
|
184 |
<script type="text/javascript">//<![CDATA[
|
185 |
(function() {
|
app/code/core/Mage/Widget/controllers/Adminhtml/WidgetController.php
CHANGED
@@ -84,4 +84,14 @@ class Mage_Widget_Adminhtml_WidgetController extends Mage_Adminhtml_Controller_A
|
|
84 |
$html = Mage::getSingleton('widget/widget')->getWidgetDeclaration($type, $params, $asIs);
|
85 |
$this->getResponse()->setBody($html);
|
86 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
84 |
$html = Mage::getSingleton('widget/widget')->getWidgetDeclaration($type, $params, $asIs);
|
85 |
$this->getResponse()->setBody($html);
|
86 |
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Check is allowed access to action
|
90 |
+
*
|
91 |
+
* @return bool
|
92 |
+
*/
|
93 |
+
protected function _isAllowed()
|
94 |
+
{
|
95 |
+
return Mage::getSingleton('admin/session')->isAllowed('cms/widget_instance');
|
96 |
+
}
|
97 |
}
|
app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Column/Remove.php
CHANGED
@@ -42,7 +42,11 @@ class Mage_Wishlist_Block_Customer_Wishlist_Item_Column_Remove extends Mage_Wish
|
|
42 |
{
|
43 |
return parent::getJs() . "
|
44 |
function confirmRemoveWishlistItem() {
|
45 |
-
return confirm('"
|
|
|
|
|
|
|
|
|
46 |
}
|
47 |
";
|
48 |
}
|
42 |
{
|
43 |
return parent::getJs() . "
|
44 |
function confirmRemoveWishlistItem() {
|
45 |
+
return confirm('"
|
46 |
+
. Mage::helper('core')->jsQuoteEscape(
|
47 |
+
$this->__('Are you sure you want to remove this product from your wishlist?')
|
48 |
+
)
|
49 |
+
. "');
|
50 |
}
|
51 |
";
|
52 |
}
|
app/code/core/Mage/Wishlist/controllers/IndexController.php
CHANGED
@@ -524,10 +524,15 @@ class Mage_Wishlist_IndexController extends Mage_Wishlist_Controller_Abstract
|
|
524 |
|
525 |
if (Mage::helper('checkout/cart')->getShouldRedirectToCart()) {
|
526 |
$redirectUrl = Mage::helper('checkout/cart')->getCartUrl();
|
527 |
-
} else if ($this->_getRefererUrl()) {
|
528 |
-
$redirectUrl = $this->_getRefererUrl();
|
529 |
}
|
530 |
Mage::helper('wishlist')->calculate();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
531 |
} catch (Mage_Core_Exception $e) {
|
532 |
if ($e->getCode() == Mage_Wishlist_Model_Item::EXCEPTION_CODE_NOT_SALABLE) {
|
533 |
$session->addError($this->__('This product(s) is currently out of stock'));
|
524 |
|
525 |
if (Mage::helper('checkout/cart')->getShouldRedirectToCart()) {
|
526 |
$redirectUrl = Mage::helper('checkout/cart')->getCartUrl();
|
|
|
|
|
527 |
}
|
528 |
Mage::helper('wishlist')->calculate();
|
529 |
+
|
530 |
+
$product = Mage::getModel('catalog/product')
|
531 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
532 |
+
->load($item->getProductId());
|
533 |
+
$productName = Mage::helper('core')->escapeHtml($product->getName());
|
534 |
+
$message = $this->__('%s was added to your shopping cart.', $productName);
|
535 |
+
Mage::getSingleton('catalog/session')->addSuccess($message);
|
536 |
} catch (Mage_Core_Exception $e) {
|
537 |
if ($e->getCode() == Mage_Wishlist_Model_Item::EXCEPTION_CODE_NOT_SALABLE) {
|
538 |
$session->addError($this->__('This product(s) is currently out of stock'));
|
app/code/core/Zend/Date.php
CHANGED
@@ -14,9 +14,9 @@
|
|
14 |
*
|
15 |
* @category Zend
|
16 |
* @package Zend_Date
|
17 |
-
* @copyright Copyright (c) 2005-
|
18 |
* @license http://framework.zend.com/license/new-bsd New BSD License
|
19 |
-
* @version $Id
|
20 |
*/
|
21 |
|
22 |
/**
|
@@ -33,7 +33,7 @@
|
|
33 |
*
|
34 |
* @category Zend
|
35 |
* @package Zend_Date
|
36 |
-
* @copyright Copyright (c) 2005-
|
37 |
* @license http://framework.zend.com/license/new-bsd New BSD License
|
38 |
*/
|
39 |
class Zend_Date extends Zend_Date_DateObject
|
@@ -367,7 +367,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
367 |
* Sets a new timestamp
|
368 |
*
|
369 |
* @param integer|string|array|Zend_Date $timestamp Timestamp to set
|
370 |
-
* @return Zend_Date Provides
|
371 |
* @throws Zend_Date_Exception
|
372 |
*/
|
373 |
public function setTimestamp($timestamp)
|
@@ -379,7 +379,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
379 |
* Adds a timestamp
|
380 |
*
|
381 |
* @param integer|string|array|Zend_Date $timestamp Timestamp to add
|
382 |
-
* @return Zend_Date Provides
|
383 |
* @throws Zend_Date_Exception
|
384 |
*/
|
385 |
public function addTimestamp($timestamp)
|
@@ -391,7 +391,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
391 |
* Subtracts a timestamp
|
392 |
*
|
393 |
* @param integer|string|array|Zend_Date $timestamp Timestamp to sub
|
394 |
-
* @return Zend_Date Provides
|
395 |
* @throws Zend_Date_Exception
|
396 |
*/
|
397 |
public function subTimestamp($timestamp)
|
@@ -500,9 +500,9 @@ class Zend_Date extends Zend_Date_DateObject
|
|
500 |
{
|
501 |
$result = $this->get($part);
|
502 |
if (is_numeric($result)) {
|
503 |
-
|
504 |
} else {
|
505 |
-
|
506 |
}
|
507 |
}
|
508 |
|
@@ -514,17 +514,17 @@ class Zend_Date extends Zend_Date_DateObject
|
|
514 |
public function toArray()
|
515 |
{
|
516 |
return array('day' => $this->toString(self::DAY_SHORT, 'iso'),
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
}
|
529 |
|
530 |
/**
|
@@ -1076,7 +1076,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1076 |
* @param string|integer|array|Zend_Date $date Date or datepart to set
|
1077 |
* @param string $part OPTIONAL Part of the date to set, if null the timestamp is set
|
1078 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
1079 |
-
* @return Zend_Date Provides
|
1080 |
* @throws Zend_Date_Exception
|
1081 |
*/
|
1082 |
public function set($date, $part = null, $locale = null)
|
@@ -1104,7 +1104,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1104 |
* @param string|integer|array|Zend_Date $date Date or datepart to add
|
1105 |
* @param string $part OPTIONAL Part of the date to add, if null the timestamp is added
|
1106 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
1107 |
-
* @return Zend_Date Provides
|
1108 |
* @throws Zend_Date_Exception
|
1109 |
*/
|
1110 |
public function add($date, $part = self::TIMESTAMP, $locale = null)
|
@@ -1127,7 +1127,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1127 |
* @param string|integer|array|Zend_Date $date Date or datepart to subtract
|
1128 |
* @param string $part OPTIONAL Part of the date to sub, if null the timestamp is subtracted
|
1129 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
1130 |
-
* @return Zend_Date Provides
|
1131 |
* @throws Zend_Date_Exception
|
1132 |
*/
|
1133 |
public function sub($date, $part = self::TIMESTAMP, $locale = null)
|
@@ -1214,14 +1214,14 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1214 |
}
|
1215 |
|
1216 |
preg_match('/([+-]\d{2}):{0,1}\d{2}/', $zone, $match);
|
1217 |
-
if (!empty($match) and ($match[count($match) - 1] <=
|
1218 |
$zone = "Etc/GMT";
|
1219 |
$zone .= ($match[count($match) - 1] < 0) ? "+" : "-";
|
1220 |
$zone .= (int) abs($match[count($match) - 1]);
|
1221 |
return $zone;
|
1222 |
}
|
1223 |
|
1224 |
-
preg_match('/([[:alpha:]\/]{3,30})(?!.*([[:alpha:]\/]{3,30}))/', $zone, $match);
|
1225 |
try {
|
1226 |
if (!empty($match) and (!is_int($match[count($match) - 1]))) {
|
1227 |
$oldzone = $this->getTimezone();
|
@@ -1450,7 +1450,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1450 |
$years = $date['year'];
|
1451 |
}
|
1452 |
return $this->_assign($calc, $this->mktime($hours, $minutes, $seconds, $months, $days, $years, true),
|
1453 |
-
|
1454 |
}
|
1455 |
}
|
1456 |
|
@@ -1461,7 +1461,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1461 |
case self::DAY:
|
1462 |
if (is_numeric($date)) {
|
1463 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + intval($date), 1970, true),
|
1464 |
-
|
1465 |
}
|
1466 |
|
1467 |
#require_once 'Zend/Date/Exception.php';
|
@@ -1475,7 +1475,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1475 |
|
1476 |
foreach ($daylist as $key => $value) {
|
1477 |
if (strtoupper(iconv_substr($value, 0, 3, 'UTF-8')) == strtoupper($date)) {
|
1478 |
-
|
1479 |
break;
|
1480 |
}
|
1481 |
++$cnt;
|
@@ -1484,7 +1484,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1484 |
// Weekday found
|
1485 |
if ($cnt < 7) {
|
1486 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $found, 1970, true),
|
1487 |
-
|
1488 |
}
|
1489 |
|
1490 |
// Weekday not found
|
@@ -1495,7 +1495,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1495 |
case self::DAY_SHORT:
|
1496 |
if (is_numeric($date)) {
|
1497 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + intval($date), 1970, true),
|
1498 |
-
|
1499 |
}
|
1500 |
|
1501 |
#require_once 'Zend/Date/Exception.php';
|
@@ -1518,7 +1518,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1518 |
// Weekday found
|
1519 |
if ($cnt < 7) {
|
1520 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $found, 1970, true),
|
1521 |
-
|
1522 |
}
|
1523 |
|
1524 |
// Weekday not found
|
@@ -1530,7 +1530,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1530 |
$weekday = (int) $this->toString(self::WEEKDAY_8601, 'iso', $locale);
|
1531 |
if ((intval($date) > 0) and (intval($date) < 8)) {
|
1532 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + intval($date), 1970, true),
|
1533 |
-
|
1534 |
}
|
1535 |
|
1536 |
// Weekday not found
|
@@ -1547,7 +1547,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1547 |
$weekday = (int) $this->toString(self::WEEKDAY_DIGIT, 'iso', $locale);
|
1548 |
if (is_numeric($date) and (intval($date) >= 0) and (intval($date) < 7)) {
|
1549 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $date, 1970, true),
|
1550 |
-
|
1551 |
}
|
1552 |
|
1553 |
// Weekday not found
|
@@ -1564,7 +1564,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1564 |
}
|
1565 |
|
1566 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, $date, $year, true),
|
1567 |
-
|
1568 |
}
|
1569 |
|
1570 |
#require_once 'Zend/Date/Exception.php';
|
@@ -1586,7 +1586,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1586 |
// Weekday found
|
1587 |
if ($cnt < 7) {
|
1588 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $found, 1970, true),
|
1589 |
-
|
1590 |
}
|
1591 |
|
1592 |
// Weekday not found
|
@@ -1609,7 +1609,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1609 |
// Weekday found
|
1610 |
if ($cnt < 7) {
|
1611 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $found, 1970, true),
|
1612 |
-
|
1613 |
}
|
1614 |
|
1615 |
// Weekday not found
|
@@ -1622,7 +1622,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1622 |
if (is_numeric($date)) {
|
1623 |
$week = (int) $this->toString(self::WEEK, 'iso', $locale);
|
1624 |
return $this->_assign($calc, parent::mktime(0, 0, 0, 1, 1 + ($date * 7), 1970, true),
|
1625 |
-
|
1626 |
}
|
1627 |
|
1628 |
#require_once 'Zend/Date/Exception.php';
|
@@ -1665,7 +1665,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1665 |
}
|
1666 |
}
|
1667 |
return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true),
|
1668 |
-
|
1669 |
}
|
1670 |
|
1671 |
// Monthname not found
|
@@ -1696,7 +1696,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1696 |
}
|
1697 |
}
|
1698 |
return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true),
|
1699 |
-
|
1700 |
}
|
1701 |
|
1702 |
#require_once 'Zend/Date/Exception.php';
|
@@ -1738,7 +1738,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1738 |
}
|
1739 |
}
|
1740 |
return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true),
|
1741 |
-
|
1742 |
}
|
1743 |
|
1744 |
// Monthname not found
|
@@ -1770,7 +1770,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1770 |
}
|
1771 |
|
1772 |
return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true),
|
1773 |
-
|
1774 |
}
|
1775 |
|
1776 |
#require_once 'Zend/Date/Exception.php';
|
@@ -1817,7 +1817,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1817 |
}
|
1818 |
}
|
1819 |
return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true),
|
1820 |
-
|
1821 |
}
|
1822 |
|
1823 |
// Monthname not found
|
@@ -1842,7 +1842,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1842 |
}
|
1843 |
|
1844 |
return $this->_assign($calc, $this->mktime(0, 0, 0, $month, $day, intval($date), true),
|
1845 |
-
|
1846 |
}
|
1847 |
|
1848 |
#require_once 'Zend/Date/Exception.php';
|
@@ -1860,7 +1860,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1860 |
}
|
1861 |
|
1862 |
return $this->_assign($calc, $this->mktime(0, 0, 0, $month, $day, intval($date), true),
|
1863 |
-
|
1864 |
}
|
1865 |
|
1866 |
#require_once 'Zend/Date/Exception.php';
|
@@ -1882,7 +1882,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1882 |
}
|
1883 |
|
1884 |
return $this->_assign($calc, $this->mktime(0, 0, 0, $month, $day, $date, true),
|
1885 |
-
|
1886 |
}
|
1887 |
|
1888 |
#require_once 'Zend/Date/Exception.php';
|
@@ -1904,7 +1904,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1904 |
}
|
1905 |
|
1906 |
return $this->_assign($calc, $this->mktime(0, 0, 0, $month, $day, $date, true),
|
1907 |
-
|
1908 |
}
|
1909 |
|
1910 |
#require_once 'Zend/Date/Exception.php';
|
@@ -1926,7 +1926,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1926 |
$rest = $rest - ($minutes * 1000 / 1440);
|
1927 |
$seconds = floor($rest * 86400 / 1000);
|
1928 |
return $this->_assign($calc, $this->mktime($hours, $minutes, $seconds, 1, 1, 1970, true),
|
1929 |
-
|
1930 |
}
|
1931 |
|
1932 |
#require_once 'Zend/Date/Exception.php';
|
@@ -1936,7 +1936,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1936 |
case self::HOUR_SHORT_AM:
|
1937 |
if (is_numeric($date)) {
|
1938 |
return $this->_assign($calc, $this->mktime(intval($date), 0, 0, 1, 1, 1970, true),
|
1939 |
-
|
1940 |
}
|
1941 |
|
1942 |
#require_once 'Zend/Date/Exception.php';
|
@@ -1946,7 +1946,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1946 |
case self::HOUR_SHORT:
|
1947 |
if (is_numeric($date)) {
|
1948 |
return $this->_assign($calc, $this->mktime(intval($date), 0, 0, 1, 1, 1970, true),
|
1949 |
-
|
1950 |
}
|
1951 |
|
1952 |
#require_once 'Zend/Date/Exception.php';
|
@@ -1956,7 +1956,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1956 |
case self::HOUR_AM:
|
1957 |
if (is_numeric($date)) {
|
1958 |
return $this->_assign($calc, $this->mktime(intval($date), 0, 0, 1, 1, 1970, true),
|
1959 |
-
|
1960 |
}
|
1961 |
|
1962 |
#require_once 'Zend/Date/Exception.php';
|
@@ -1966,7 +1966,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1966 |
case self::HOUR:
|
1967 |
if (is_numeric($date)) {
|
1968 |
return $this->_assign($calc, $this->mktime(intval($date), 0, 0, 1, 1, 1970, true),
|
1969 |
-
|
1970 |
}
|
1971 |
|
1972 |
#require_once 'Zend/Date/Exception.php';
|
@@ -1976,7 +1976,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1976 |
case self::MINUTE:
|
1977 |
if (is_numeric($date)) {
|
1978 |
return $this->_assign($calc, $this->mktime(0, intval($date), 0, 1, 1, 1970, true),
|
1979 |
-
|
1980 |
}
|
1981 |
|
1982 |
#require_once 'Zend/Date/Exception.php';
|
@@ -1986,7 +1986,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
1986 |
case self::SECOND:
|
1987 |
if (is_numeric($date)) {
|
1988 |
return $this->_assign($calc, $this->mktime(0, 0, intval($date), 1, 1, 1970, true),
|
1989 |
-
|
1990 |
}
|
1991 |
|
1992 |
#require_once 'Zend/Date/Exception.php';
|
@@ -2017,7 +2017,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2017 |
case self::MINUTE_SHORT:
|
2018 |
if (is_numeric($date)) {
|
2019 |
return $this->_assign($calc, $this->mktime(0, intval($date), 0, 1, 1, 1970, true),
|
2020 |
-
|
2021 |
}
|
2022 |
|
2023 |
#require_once 'Zend/Date/Exception.php';
|
@@ -2027,7 +2027,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2027 |
case self::SECOND_SHORT:
|
2028 |
if (is_numeric($date)) {
|
2029 |
return $this->_assign($calc, $this->mktime(0, 0, intval($date), 1, 1, 1970, true),
|
2030 |
-
|
2031 |
}
|
2032 |
|
2033 |
#require_once 'Zend/Date/Exception.php';
|
@@ -2074,12 +2074,13 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2074 |
if (!empty($datematch)) {
|
2075 |
$dateMatchCharCount = iconv_strlen($datematch[0], 'UTF-8');
|
2076 |
$tmpdate = iconv_substr($date,
|
2077 |
-
|
2078 |
-
|
2079 |
-
|
2080 |
}
|
2081 |
// (T)hh:mm:ss
|
2082 |
preg_match('/[T,\s]{0,1}(\d{2}):(\d{2}):(\d{2})/', $tmpdate, $timematch);
|
|
|
2083 |
if (empty($timematch)) {
|
2084 |
preg_match('/[T,\s]{0,1}(\d{2})(\d{2})(\d{2})/', $tmpdate, $timematch);
|
2085 |
}
|
@@ -2090,9 +2091,9 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2090 |
if (!empty($timematch)) {
|
2091 |
$timeMatchCharCount = iconv_strlen($timematch[0], 'UTF-8');
|
2092 |
$tmpdate = iconv_substr($tmpdate,
|
2093 |
-
|
2094 |
-
|
2095 |
-
|
2096 |
}
|
2097 |
if (empty($datematch)) {
|
2098 |
$datematch[1] = 1970;
|
@@ -2106,6 +2107,9 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2106 |
$timematch[2] = 0;
|
2107 |
$timematch[3] = 0;
|
2108 |
}
|
|
|
|
|
|
|
2109 |
|
2110 |
if (($calc == 'set') || ($calc == 'cmp')) {
|
2111 |
--$datematch[2];
|
@@ -2116,11 +2120,14 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2116 |
$year -= 1970;
|
2117 |
}
|
2118 |
return $this->_assign($calc, $this->mktime($timematch[1], $timematch[2], $timematch[3], 1 + $datematch[2], 1 + $datematch[3], 1970 + $datematch[1], false),
|
2119 |
-
|
2120 |
break;
|
2121 |
|
2122 |
case self::RFC_2822:
|
2123 |
-
$result = preg_match('/^\w{3},\s(\d{1,2})\s(\w{3})\s(\d{4})\s
|
|
|
|
|
|
|
2124 |
if (!$result) {
|
2125 |
#require_once 'Zend/Date/Exception.php';
|
2126 |
throw new Zend_Date_Exception("no RFC 2822 format ($date)", 0, null, $date);
|
@@ -2137,7 +2144,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2137 |
$year -= 1970;
|
2138 |
}
|
2139 |
return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], false),
|
2140 |
-
|
2141 |
break;
|
2142 |
|
2143 |
case self::TIMESTAMP:
|
@@ -2171,7 +2178,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2171 |
}
|
2172 |
|
2173 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true),
|
2174 |
-
|
2175 |
} catch (Zend_Locale_Exception $e) {
|
2176 |
#require_once 'Zend/Date/Exception.php';
|
2177 |
throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date);
|
@@ -2192,7 +2199,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2192 |
$year -= 1970;
|
2193 |
}
|
2194 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true),
|
2195 |
-
|
2196 |
} catch (Zend_Locale_Exception $e) {
|
2197 |
#require_once 'Zend/Date/Exception.php';
|
2198 |
throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date);
|
@@ -2213,7 +2220,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2213 |
$year -= 1970;
|
2214 |
}
|
2215 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true),
|
2216 |
-
|
2217 |
} catch (Zend_Locale_Exception $e) {
|
2218 |
#require_once 'Zend/Date/Exception.php';
|
2219 |
throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date);
|
@@ -2234,7 +2241,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2234 |
$year -= 1970;
|
2235 |
}
|
2236 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true),
|
2237 |
-
|
2238 |
} catch (Zend_Locale_Exception $e) {
|
2239 |
#require_once 'Zend/Date/Exception.php';
|
2240 |
throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date);
|
@@ -2257,7 +2264,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2257 |
$year -= 1970;
|
2258 |
}
|
2259 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true),
|
2260 |
-
|
2261 |
} catch (Zend_Locale_Exception $e) {
|
2262 |
#require_once 'Zend/Date/Exception.php';
|
2263 |
throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date);
|
@@ -2273,7 +2280,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2273 |
}
|
2274 |
$parsed = Zend_Locale_Format::getTime($date, array('locale' => $locale, 'format_type' => 'iso', 'fix_date' => true));
|
2275 |
return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true),
|
2276 |
-
|
2277 |
} catch (Zend_Locale_Exception $e) {
|
2278 |
#require_once 'Zend/Date/Exception.php';
|
2279 |
throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date);
|
@@ -2295,7 +2302,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2295 |
}
|
2296 |
|
2297 |
return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true),
|
2298 |
-
|
2299 |
} catch (Zend_Locale_Exception $e) {
|
2300 |
#require_once 'Zend/Date/Exception.php';
|
2301 |
throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date);
|
@@ -2312,7 +2319,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2312 |
$year = 1970;
|
2313 |
}
|
2314 |
return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true),
|
2315 |
-
|
2316 |
} catch (Zend_Locale_Exception $e) {
|
2317 |
#require_once 'Zend/Date/Exception.php';
|
2318 |
throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date);
|
@@ -2329,7 +2336,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2329 |
$year = 1970;
|
2330 |
}
|
2331 |
return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true),
|
2332 |
-
|
2333 |
} catch (Zend_Locale_Exception $e) {
|
2334 |
#require_once 'Zend/Date/Exception.php';
|
2335 |
throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date);
|
@@ -2351,7 +2358,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2351 |
}
|
2352 |
|
2353 |
return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true),
|
2354 |
-
|
2355 |
} catch (Zend_Locale_Exception $e) {
|
2356 |
#require_once 'Zend/Date/Exception.php';
|
2357 |
throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date);
|
@@ -2370,7 +2377,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2370 |
$year -= 1970;
|
2371 |
}
|
2372 |
return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true),
|
2373 |
-
|
2374 |
} catch (Zend_Locale_Exception $e) {
|
2375 |
#require_once 'Zend/Date/Exception.php';
|
2376 |
throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date);
|
@@ -2396,7 +2403,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2396 |
}
|
2397 |
|
2398 |
return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true),
|
2399 |
-
|
2400 |
} catch (Zend_Locale_Exception $e) {
|
2401 |
#require_once 'Zend/Date/Exception.php';
|
2402 |
throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date);
|
@@ -2417,7 +2424,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2417 |
$year -= 1970;
|
2418 |
}
|
2419 |
return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true),
|
2420 |
-
|
2421 |
} catch (Zend_Locale_Exception $e) {
|
2422 |
#require_once 'Zend/Date/Exception.php';
|
2423 |
throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date);
|
@@ -2437,7 +2444,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2437 |
$year -= 1970;
|
2438 |
}
|
2439 |
return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true),
|
2440 |
-
|
2441 |
} catch (Zend_Locale_Exception $e) {
|
2442 |
#require_once 'Zend/Date/Exception.php';
|
2443 |
throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date);
|
@@ -2465,7 +2472,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2465 |
}
|
2466 |
|
2467 |
return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true),
|
2468 |
-
|
2469 |
} catch (Zend_Locale_Exception $e) {
|
2470 |
#require_once 'Zend/Date/Exception.php';
|
2471 |
throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date);
|
@@ -2490,7 +2497,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2490 |
$year -= 1970;
|
2491 |
}
|
2492 |
return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $match[2], 1 + $match[3], 1970 + $match[1], true),
|
2493 |
-
|
2494 |
break;
|
2495 |
|
2496 |
case self::COOKIE:
|
@@ -2501,9 +2508,9 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2501 |
}
|
2502 |
$matchStartPos = iconv_strpos($match[0], ' ', 0, 'UTF-8') + 1;
|
2503 |
$match[0] = iconv_substr($match[0],
|
2504 |
-
|
2505 |
-
|
2506 |
-
|
2507 |
|
2508 |
$months = $this->_getDigitFromName($match[2]);
|
2509 |
$match[3] = self::getFullYear($match[3]);
|
@@ -2517,7 +2524,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2517 |
$year -= 1970;
|
2518 |
}
|
2519 |
return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], true),
|
2520 |
-
|
2521 |
break;
|
2522 |
|
2523 |
case self::RFC_822:
|
@@ -2541,7 +2548,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2541 |
$year -= 1970;
|
2542 |
}
|
2543 |
return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], false),
|
2544 |
-
|
2545 |
break;
|
2546 |
|
2547 |
case self::RFC_850:
|
@@ -2563,7 +2570,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2563 |
$year -= 1970;
|
2564 |
}
|
2565 |
return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], true),
|
2566 |
-
|
2567 |
break;
|
2568 |
|
2569 |
case self::RFC_1123:
|
@@ -2584,7 +2591,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2584 |
$year -= 1970;
|
2585 |
}
|
2586 |
return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], true),
|
2587 |
-
|
2588 |
break;
|
2589 |
|
2590 |
case self::RSS:
|
@@ -2606,7 +2613,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2606 |
$year -= 1970;
|
2607 |
}
|
2608 |
return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], true),
|
2609 |
-
|
2610 |
break;
|
2611 |
|
2612 |
case self::W3C:
|
@@ -2625,7 +2632,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2625 |
$year -= 1970;
|
2626 |
}
|
2627 |
return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $match[2], 1 + $match[3], 1970 + $match[1], true),
|
2628 |
-
|
2629 |
break;
|
2630 |
|
2631 |
default:
|
@@ -2654,10 +2661,8 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2654 |
$parsed['day'] = 0;
|
2655 |
}
|
2656 |
|
2657 |
-
if (isset($parsed['year'])) {
|
2658 |
-
$parsed['year']
|
2659 |
-
} else {
|
2660 |
-
$parsed['year'] = 0;
|
2661 |
}
|
2662 |
}
|
2663 |
|
@@ -2667,7 +2672,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2667 |
isset($parsed['second']) ? $parsed['second'] : 0,
|
2668 |
isset($parsed['month']) ? (1 + $parsed['month']) : 1,
|
2669 |
isset($parsed['day']) ? (1 + $parsed['day']) : 1,
|
2670 |
-
|
2671 |
false), $this->getUnixTimestamp(), false);
|
2672 |
} catch (Zend_Locale_Exception $e) {
|
2673 |
if (!is_numeric($date)) {
|
@@ -2848,7 +2853,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2848 |
* @param string|integer|array|Zend_Date $time Time to set
|
2849 |
* @param string $format OPTIONAL Timeformat for parsing input
|
2850 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
2851 |
-
* @return Zend_Date Provides
|
2852 |
* @throws Zend_Date_Exception
|
2853 |
*/
|
2854 |
public function setTime($time, $format = null, $locale = null)
|
@@ -2866,7 +2871,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2866 |
* @param string|integer|array|Zend_Date $time Time to add
|
2867 |
* @param string $format OPTIONAL Timeformat for parsing input
|
2868 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
2869 |
-
* @return Zend_Date Provides
|
2870 |
* @throws Zend_Date_Exception
|
2871 |
*/
|
2872 |
public function addTime($time, $format = null, $locale = null)
|
@@ -2884,7 +2889,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
2884 |
* @param string|integer|array|Zend_Date $time Time to sub
|
2885 |
* @param string $format OPTIONAL Timeformat for parsing input
|
2886 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
2887 |
-
* @return Zend_Date Provides
|
2888 |
* @throws Zend_Date_Exception
|
2889 |
*/
|
2890 |
public function subTime($time, $format = null, $locale = null)
|
@@ -3010,7 +3015,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3010 |
* @param string|integer|array|Zend_Date $date Date to set
|
3011 |
* @param string $format OPTIONAL Date format for parsing
|
3012 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
3013 |
-
* @return Zend_Date Provides
|
3014 |
* @throws Zend_Date_Exception
|
3015 |
*/
|
3016 |
public function setDate($date, $format = null, $locale = null)
|
@@ -3028,7 +3033,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3028 |
* @param string|integer|array|Zend_Date $date Date to add
|
3029 |
* @param string $format OPTIONAL Date format for parsing input
|
3030 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
3031 |
-
* @return Zend_Date Provides
|
3032 |
* @throws Zend_Date_Exception
|
3033 |
*/
|
3034 |
public function addDate($date, $format = null, $locale = null)
|
@@ -3047,7 +3052,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3047 |
* @param string|integer|array|Zend_Date $date Date to sub
|
3048 |
* @param string $format OPTIONAL Date format for parsing input
|
3049 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
3050 |
-
* @return Zend_Date Provides
|
3051 |
* @throws Zend_Date_Exception
|
3052 |
*/
|
3053 |
public function subDate($date, $format = null, $locale = null)
|
@@ -3098,7 +3103,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3098 |
*
|
3099 |
* @param string|integer|Zend_Date $date ISO Date to set
|
3100 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
3101 |
-
* @return Zend_Date Provides
|
3102 |
* @throws Zend_Date_Exception
|
3103 |
*/
|
3104 |
public function setIso($date, $locale = null)
|
@@ -3115,7 +3120,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3115 |
*
|
3116 |
* @param string|integer|Zend_Date $date ISO Date to add
|
3117 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
3118 |
-
* @return Zend_Date Provides
|
3119 |
* @throws Zend_Date_Exception
|
3120 |
*/
|
3121 |
public function addIso($date, $locale = null)
|
@@ -3132,7 +3137,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3132 |
*
|
3133 |
* @param string|integer|Zend_Date $date ISO Date to sub
|
3134 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
3135 |
-
* @return Zend_Date Provides
|
3136 |
* @throws Zend_Date_Exception
|
3137 |
*/
|
3138 |
public function subIso($date, $locale = null)
|
@@ -3185,7 +3190,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3185 |
*
|
3186 |
* @param string|integer|Zend_Date $date RFC 822 to set
|
3187 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
3188 |
-
* @return Zend_Date Provides
|
3189 |
* @throws Zend_Date_Exception
|
3190 |
*/
|
3191 |
public function setArpa($date, $locale = null)
|
@@ -3203,7 +3208,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3203 |
*
|
3204 |
* @param string|integer|Zend_Date $date RFC 822 Date to add
|
3205 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
3206 |
-
* @return Zend_Date Provides
|
3207 |
* @throws Zend_Date_Exception
|
3208 |
*/
|
3209 |
public function addArpa($date, $locale = null)
|
@@ -3221,7 +3226,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3221 |
*
|
3222 |
* @param string|integer|Zend_Date $date RFC 822 Date to sub
|
3223 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
3224 |
-
* @return Zend_Date Provides
|
3225 |
* @throws Zend_Date_Exception
|
3226 |
*/
|
3227 |
public function subArpa($date, $locale = null)
|
@@ -3247,12 +3252,12 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3247 |
return $this->_calcvalue('cmp', $date, 'arpa', self::RFC_822, $locale);
|
3248 |
}
|
3249 |
|
3250 |
-
|
3251 |
/**
|
3252 |
* Check if location is supported
|
3253 |
*
|
3254 |
-
* @param $location
|
3255 |
-
* @
|
|
|
3256 |
*/
|
3257 |
private function _checkLocation($location)
|
3258 |
{
|
@@ -3294,7 +3299,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3294 |
* Returns the time of sunrise for this date and a given location as new date object
|
3295 |
* For a list of cities and correct locations use the class Zend_Date_Cities
|
3296 |
*
|
3297 |
-
* @param
|
3298 |
* ['horizon'] -> civil, nautic, astronomical, effective (default)
|
3299 |
* ['longitude'] -> longitude of location
|
3300 |
* ['latitude'] -> latitude of location
|
@@ -3314,7 +3319,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3314 |
* Returns the time of sunset for this date and a given location as new date object
|
3315 |
* For a list of cities and correct locations use the class Zend_Date_Cities
|
3316 |
*
|
3317 |
-
* @param
|
3318 |
* ['horizon'] -> civil, nautic, astronomical, effective (default)
|
3319 |
* ['longitude'] -> longitude of location
|
3320 |
* ['latitude'] -> latitude of location
|
@@ -3334,7 +3339,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3334 |
* Returns an array with the sunset and sunrise dates for all horizon types
|
3335 |
* For a list of cities and correct locations use the class Zend_Date_Cities
|
3336 |
*
|
3337 |
-
* @param
|
3338 |
* ['horizon'] -> civil, nautic, astronomical, effective (default)
|
3339 |
* ['longitude'] -> longitude of location
|
3340 |
* ['latitude'] -> latitude of location
|
@@ -3370,11 +3375,11 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3370 |
return $suninfo;
|
3371 |
}
|
3372 |
|
3373 |
-
|
3374 |
/**
|
3375 |
* Check a given year for leap year.
|
3376 |
*
|
3377 |
-
* @param integer|array|Zend_Date
|
|
|
3378 |
* @return boolean
|
3379 |
*/
|
3380 |
public static function checkLeapYear($year)
|
@@ -3470,7 +3475,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3470 |
*
|
3471 |
* @param string $calc Calculation to make
|
3472 |
* @param string|integer|array|Zend_Date $date Date or Part to calculate
|
3473 |
-
* @param string $
|
3474 |
* @param string|Zend_Locale $locale Locale for parsing input
|
3475 |
* @return integer|string new date
|
3476 |
* @throws Zend_Date_Exception
|
@@ -3508,11 +3513,13 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3508 |
/**
|
3509 |
* Internal calculation, returns the requested date type
|
3510 |
*
|
3511 |
-
* @param string
|
3512 |
-
* @param string|integer|Zend_Date
|
3513 |
-
* @param string
|
3514 |
-
* @
|
|
|
3515 |
* @throws Zend_Date_Exception
|
|
|
3516 |
*/
|
3517 |
private function _calcvalue($calc, $value, $type, $parameter, $locale)
|
3518 |
{
|
@@ -3568,9 +3575,9 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3568 |
* use set() instead.
|
3569 |
* Returned is the new date object
|
3570 |
*
|
3571 |
-
* @param string|integer|array|Zend_Date $
|
3572 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
3573 |
-
* @return Zend_Date Provides
|
3574 |
* @throws Zend_Date_Exception
|
3575 |
*/
|
3576 |
public function setYear($year, $locale = null)
|
@@ -3587,9 +3594,9 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3587 |
* use add() instead.
|
3588 |
* Returned is the new date object
|
3589 |
*
|
3590 |
-
* @param string|integer|array|Zend_Date $
|
3591 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
3592 |
-
* @return Zend_Date Provides
|
3593 |
* @throws Zend_Date_Exception
|
3594 |
*/
|
3595 |
public function addYear($year, $locale = null)
|
@@ -3606,9 +3613,9 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3606 |
* use sub() instead.
|
3607 |
* Returned is the new date object
|
3608 |
*
|
3609 |
-
* @param string|integer|array|Zend_Date $
|
3610 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
3611 |
-
* @return Zend_Date Provides
|
3612 |
* @throws Zend_Date_Exception
|
3613 |
*/
|
3614 |
public function subYear($year, $locale = null)
|
@@ -3732,7 +3739,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3732 |
*
|
3733 |
* @param string|integer|array|Zend_Date $month Month to set
|
3734 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
3735 |
-
* @return Zend_Date Provides
|
3736 |
* @throws Zend_Date_Exception
|
3737 |
*/
|
3738 |
public function setMonth($month, $locale = null)
|
@@ -3751,7 +3758,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3751 |
*
|
3752 |
* @param string|integer|array|Zend_Date $month Month to add
|
3753 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
3754 |
-
* @return Zend_Date Provides
|
3755 |
* @throws Zend_Date_Exception
|
3756 |
*/
|
3757 |
public function addMonth($month, $locale = null)
|
@@ -3770,7 +3777,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3770 |
*
|
3771 |
* @param string|integer|array|Zend_Date $month Month to sub
|
3772 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
3773 |
-
* @return Zend_Date Provides
|
3774 |
* @throws Zend_Date_Exception
|
3775 |
*/
|
3776 |
public function subMonth($month, $locale = null)
|
@@ -3799,7 +3806,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3799 |
* Returns the day as new date object
|
3800 |
* Example: 20.May.1986 -> 20.Jan.1970 00:00:00
|
3801 |
*
|
3802 |
-
* @param $locale
|
3803 |
* @return Zend_Date
|
3804 |
*/
|
3805 |
public function getDay($locale = null)
|
@@ -3807,13 +3814,13 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3807 |
return $this->copyPart(self::DAY_SHORT, $locale);
|
3808 |
}
|
3809 |
|
3810 |
-
|
3811 |
/**
|
3812 |
* Returns the calculated day
|
3813 |
*
|
3814 |
-
* @param $calc
|
3815 |
-
* @param $day
|
3816 |
-
* @param $locale
|
|
|
3817 |
* @return Zend_Date|integer
|
3818 |
*/
|
3819 |
private function _day($calc, $day, $locale)
|
@@ -3844,7 +3851,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3844 |
} else {
|
3845 |
switch (iconv_strlen($day, 'UTF-8')) {
|
3846 |
case 1 :
|
3847 |
-
|
3848 |
break;
|
3849 |
case 2:
|
3850 |
$type = self::WEEKDAY_NAME;
|
@@ -3874,9 +3881,9 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3874 |
* Returned is the new date object
|
3875 |
* Example: setDay('Montag', 'de_AT'); will set the monday of this week as day.
|
3876 |
*
|
3877 |
-
* @param string|integer|array|Zend_Date $
|
3878 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
3879 |
-
* @return Zend_Date Provides
|
3880 |
* @throws Zend_Date_Exception
|
3881 |
*/
|
3882 |
public function setDay($day, $locale = null)
|
@@ -3892,9 +3899,9 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3892 |
* If a localized dayname is given it will be parsed with the default locale or the optional
|
3893 |
* set locale.
|
3894 |
*
|
3895 |
-
* @param string|integer|array|Zend_Date $
|
3896 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
3897 |
-
* @return Zend_Date Provides
|
3898 |
* @throws Zend_Date_Exception
|
3899 |
*/
|
3900 |
public function addDay($day, $locale = null)
|
@@ -3910,9 +3917,9 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3910 |
* If a localized dayname is given it will be parsed with the default locale or the optional
|
3911 |
* set locale.
|
3912 |
*
|
3913 |
-
* @param string|integer|array|Zend_Date $
|
3914 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
3915 |
-
* @return Zend_Date Provides
|
3916 |
* @throws Zend_Date_Exception
|
3917 |
*/
|
3918 |
public function subDay($day, $locale = null)
|
@@ -3942,7 +3949,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3942 |
* Weekday is always from 1-7
|
3943 |
* Example: 09-Jan-2007 -> 2 = Tuesday -> 02-Jan-1970 (when 02.01.1970 is also Tuesday)
|
3944 |
*
|
3945 |
-
* @param $locale
|
3946 |
* @return Zend_Date
|
3947 |
*/
|
3948 |
public function getWeekday($locale = null)
|
@@ -3960,9 +3967,9 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3960 |
/**
|
3961 |
* Returns the calculated weekday
|
3962 |
*
|
3963 |
-
* @param $calc
|
3964 |
-
* @param $weekday
|
3965 |
-
* @param $locale
|
3966 |
* @return Zend_Date|integer
|
3967 |
* @throws Zend_Date_Exception
|
3968 |
*/
|
@@ -3994,7 +4001,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
3994 |
} else {
|
3995 |
switch(iconv_strlen($weekday, 'UTF-8')) {
|
3996 |
case 1:
|
3997 |
-
|
3998 |
break;
|
3999 |
case 2:
|
4000 |
$type = self::WEEKDAY_NAME;
|
@@ -4022,9 +4029,9 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4022 |
* Returned is the new date object.
|
4023 |
* Example: setWeekday(3); will set the wednesday of this week as day.
|
4024 |
*
|
4025 |
-
* @param string|integer|array|Zend_Date $
|
4026 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
4027 |
-
* @return Zend_Date Provides
|
4028 |
* @throws Zend_Date_Exception
|
4029 |
*/
|
4030 |
public function setWeekday($weekday, $locale = null)
|
@@ -4042,9 +4049,9 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4042 |
* Example: addWeekday(3); will add the difference of days from the begining of the month until
|
4043 |
* wednesday.
|
4044 |
*
|
4045 |
-
* @param string|integer|array|Zend_Date $
|
4046 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
4047 |
-
* @return Zend_Date Provides
|
4048 |
* @throws Zend_Date_Exception
|
4049 |
*/
|
4050 |
public function addWeekday($weekday, $locale = null)
|
@@ -4062,9 +4069,9 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4062 |
* Example: subWeekday(3); will subtract the difference of days from the begining of the month until
|
4063 |
* wednesday.
|
4064 |
*
|
4065 |
-
* @param string|integer|array|Zend_Date $
|
4066 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
4067 |
-
* @return Zend_Date Provides
|
4068 |
* @throws Zend_Date_Exception
|
4069 |
*/
|
4070 |
public function subWeekday($weekday, $locale = null)
|
@@ -4116,7 +4123,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4116 |
*
|
4117 |
* @param string|integer|array|Zend_Date $day Day of Year to set
|
4118 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
4119 |
-
* @return Zend_Date Provides
|
4120 |
* @throws Zend_Date_Exception
|
4121 |
*/
|
4122 |
public function setDayOfYear($day, $locale = null)
|
@@ -4133,7 +4140,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4133 |
*
|
4134 |
* @param string|integer|array|Zend_Date $day Day of Year to add
|
4135 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
4136 |
-
* @return Zend_Date Provides
|
4137 |
* @throws Zend_Date_Exception
|
4138 |
*/
|
4139 |
public function addDayOfYear($day, $locale = null)
|
@@ -4150,7 +4157,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4150 |
*
|
4151 |
* @param string|integer|array|Zend_Date $day Day of Year to sub
|
4152 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
4153 |
-
* @return Zend_Date Provides
|
4154 |
* @throws Zend_Date_Exception
|
4155 |
*/
|
4156 |
public function subDayOfYear($day, $locale = null)
|
@@ -4179,7 +4186,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4179 |
* Returns the hour as new date object
|
4180 |
* Example: 02.Feb.1986 10:30:25 -> 01.Jan.1970 10:00:00
|
4181 |
*
|
4182 |
-
* @param $locale
|
4183 |
* @return Zend_Date
|
4184 |
*/
|
4185 |
public function getHour($locale = null)
|
@@ -4196,7 +4203,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4196 |
*
|
4197 |
* @param string|integer|array|Zend_Date $hour Hour to set
|
4198 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
4199 |
-
* @return Zend_Date Provides
|
4200 |
* @throws Zend_Date_Exception
|
4201 |
*/
|
4202 |
public function setHour($hour, $locale = null)
|
@@ -4213,7 +4220,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4213 |
*
|
4214 |
* @param string|integer|array|Zend_Date $hour Hour to add
|
4215 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
4216 |
-
* @return Zend_Date Provides
|
4217 |
* @throws Zend_Date_Exception
|
4218 |
*/
|
4219 |
public function addHour($hour, $locale = null)
|
@@ -4230,7 +4237,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4230 |
*
|
4231 |
* @param string|integer|array|Zend_Date $hour Hour to sub
|
4232 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
4233 |
-
* @return Zend_Date Provides
|
4234 |
* @throws Zend_Date_Exception
|
4235 |
*/
|
4236 |
public function subHour($hour, $locale = null)
|
@@ -4282,7 +4289,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4282 |
*
|
4283 |
* @param string|integer|array|Zend_Date $minute Minute to set
|
4284 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
4285 |
-
* @return Zend_Date Provides
|
4286 |
* @throws Zend_Date_Exception
|
4287 |
*/
|
4288 |
public function setMinute($minute, $locale = null)
|
@@ -4299,7 +4306,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4299 |
*
|
4300 |
* @param string|integer|array|Zend_Date $minute Minute to add
|
4301 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
4302 |
-
* @return Zend_Date Provides
|
4303 |
* @throws Zend_Date_Exception
|
4304 |
*/
|
4305 |
public function addMinute($minute, $locale = null)
|
@@ -4316,7 +4323,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4316 |
*
|
4317 |
* @param string|integer|array|Zend_Date $minute Minute to sub
|
4318 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
4319 |
-
* @return Zend_Date Provides
|
4320 |
* @throws Zend_Date_Exception
|
4321 |
*/
|
4322 |
public function subMinute($minute, $locale = null)
|
@@ -4368,7 +4375,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4368 |
*
|
4369 |
* @param string|integer|array|Zend_Date $second Second to set
|
4370 |
* @param string|Zend_Locale $locale (Optional) Locale for parsing input
|
4371 |
-
* @return Zend_Date Provides
|
4372 |
* @throws Zend_Date_Exception
|
4373 |
*/
|
4374 |
public function setSecond($second, $locale = null)
|
@@ -4385,7 +4392,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4385 |
*
|
4386 |
* @param string|integer|array|Zend_Date $second Second to add
|
4387 |
* @param string|Zend_Locale $locale (Optional) Locale for parsing input
|
4388 |
-
* @return Zend_Date Provides
|
4389 |
* @throws Zend_Date_Exception
|
4390 |
*/
|
4391 |
public function addSecond($second, $locale = null)
|
@@ -4402,7 +4409,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4402 |
*
|
4403 |
* @param string|integer|array|Zend_Date $second Second to sub
|
4404 |
* @param string|Zend_Locale $locale (Optional) Locale for parsing input
|
4405 |
-
* @return Zend_Date Provides
|
4406 |
* @throws Zend_Date_Exception
|
4407 |
*/
|
4408 |
public function subSecond($second, $locale = null)
|
@@ -4443,7 +4450,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4443 |
*
|
4444 |
* @param integer $precision Precision for the fractional datepart 3 = milliseconds
|
4445 |
* @throws Zend_Date_Exception
|
4446 |
-
* @return Zend_Date Provides
|
4447 |
*/
|
4448 |
public function setFractionalPrecision($precision)
|
4449 |
{
|
@@ -4473,14 +4480,14 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4473 |
return $this->_fractional;
|
4474 |
}
|
4475 |
|
4476 |
-
|
4477 |
/**
|
4478 |
* Sets new milliseconds for the date object
|
4479 |
* Example: setMilliSecond(550, 2) -> equals +5 Sec +50 MilliSec
|
4480 |
*
|
4481 |
* @param integer|Zend_Date $milli (Optional) Millisecond to set, when null the actual millisecond is set
|
4482 |
* @param integer $precision (Optional) Fraction precision of the given milliseconds
|
4483 |
-
* @
|
|
|
4484 |
*/
|
4485 |
public function setMilliSecond($milli = null, $precision = null)
|
4486 |
{
|
@@ -4507,13 +4514,13 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4507 |
return $this;
|
4508 |
}
|
4509 |
|
4510 |
-
|
4511 |
/**
|
4512 |
* Adds milliseconds to the date object
|
4513 |
*
|
4514 |
* @param integer|Zend_Date $milli (Optional) Millisecond to add, when null the actual millisecond is added
|
4515 |
* @param integer $precision (Optional) Fractional precision for the given milliseconds
|
4516 |
-
* @
|
|
|
4517 |
*/
|
4518 |
public function addMilliSecond($milli = null, $precision = null)
|
4519 |
{
|
@@ -4526,15 +4533,24 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4526 |
}
|
4527 |
|
4528 |
if ($precision === null) {
|
4529 |
-
|
4530 |
-
|
4531 |
-
|
4532 |
-
|
|
|
4533 |
}
|
4534 |
|
4535 |
if (!is_int($precision) || $precision < 1 || $precision > 9) {
|
4536 |
#require_once 'Zend/Date/Exception.php';
|
4537 |
-
throw new Zend_Date_Exception(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4538 |
}
|
4539 |
|
4540 |
$this->_fractional += $milli;
|
@@ -4569,7 +4585,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4569 |
*
|
4570 |
* @param integer|Zend_Date $milli (Optional) Millisecond to sub, when null the actual millisecond is subtracted
|
4571 |
* @param integer $precision (Optional) Fractional precision for the given milliseconds
|
4572 |
-
* @return Zend_Date Provides
|
4573 |
*/
|
4574 |
public function subMilliSecond($milli = null, $precision = null)
|
4575 |
{
|
@@ -4630,7 +4646,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4630 |
* Returns the week as new date object using monday as begining of the week
|
4631 |
* Example: 12.Jan.2007 -> 08.Jan.1970 00:00:00
|
4632 |
*
|
4633 |
-
* @param $locale
|
4634 |
* @return Zend_Date
|
4635 |
*/
|
4636 |
public function getWeek($locale = null)
|
@@ -4651,7 +4667,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4651 |
*
|
4652 |
* @param string|integer|array|Zend_Date $week Week to set
|
4653 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
4654 |
-
* @return Zend_Date Provides
|
4655 |
* @throws Zend_Date_Exception
|
4656 |
*/
|
4657 |
public function setWeek($week, $locale = null)
|
@@ -4666,7 +4682,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4666 |
*
|
4667 |
* @param string|integer|array|Zend_Date $week Week to add
|
4668 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
4669 |
-
* @return Zend_Date Provides
|
4670 |
* @throws Zend_Date_Exception
|
4671 |
*/
|
4672 |
public function addWeek($week, $locale = null)
|
@@ -4681,7 +4697,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4681 |
*
|
4682 |
* @param string|integer|array|Zend_Date $week Week to sub
|
4683 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
4684 |
-
* @return Zend_Date Provides
|
4685 |
* @throws Zend_Date_Exception
|
4686 |
*/
|
4687 |
public function subWeek($week, $locale = null)
|
@@ -4774,8 +4790,8 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4774 |
if (!is_array($date)) {
|
4775 |
try {
|
4776 |
$parsed = Zend_Locale_Format::getDate($date, array('locale' => $locale,
|
4777 |
-
|
4778 |
-
|
4779 |
} catch (Zend_Locale_Exception $e) {
|
4780 |
// Date can not be parsed
|
4781 |
return false;
|
@@ -4787,7 +4803,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4787 |
if (((strpos($format, 'Y') !== false) or (strpos($format, 'y') !== false)) and
|
4788 |
(!isset($parsed['year']))) {
|
4789 |
// Year expected but not found
|
4790 |
-
|
4791 |
}
|
4792 |
|
4793 |
if ((strpos($format, 'M') !== false) and (!isset($parsed['month']))) {
|
@@ -4803,7 +4819,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4803 |
if (((strpos($format, 'H') !== false) or (strpos($format, 'h') !== false)) and
|
4804 |
(!isset($parsed['hour']))) {
|
4805 |
// Hour expected but not found
|
4806 |
-
|
4807 |
}
|
4808 |
|
4809 |
if ((strpos($format, 'm') !== false) and (!isset($parsed['minute']))) {
|
@@ -4849,7 +4865,7 @@ class Zend_Date extends Zend_Date_DateObject
|
|
4849 |
|
4850 |
$date = new self($parsed, null, $locale);
|
4851 |
$timestamp = $date->mktime($parsed['hour'], $parsed['minute'], $parsed['second'],
|
4852 |
-
|
4853 |
|
4854 |
if ($parsed['year'] != $date->date('Y', $timestamp)) {
|
4855 |
// Given year differs from parsed year
|
14 |
*
|
15 |
* @category Zend
|
16 |
* @package Zend_Date
|
17 |
+
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
18 |
* @license http://framework.zend.com/license/new-bsd New BSD License
|
19 |
+
* @version $Id$
|
20 |
*/
|
21 |
|
22 |
/**
|
33 |
*
|
34 |
* @category Zend
|
35 |
* @package Zend_Date
|
36 |
+
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
37 |
* @license http://framework.zend.com/license/new-bsd New BSD License
|
38 |
*/
|
39 |
class Zend_Date extends Zend_Date_DateObject
|
367 |
* Sets a new timestamp
|
368 |
*
|
369 |
* @param integer|string|array|Zend_Date $timestamp Timestamp to set
|
370 |
+
* @return Zend_Date Provides a fluent interface
|
371 |
* @throws Zend_Date_Exception
|
372 |
*/
|
373 |
public function setTimestamp($timestamp)
|
379 |
* Adds a timestamp
|
380 |
*
|
381 |
* @param integer|string|array|Zend_Date $timestamp Timestamp to add
|
382 |
+
* @return Zend_Date Provides a fluent interface
|
383 |
* @throws Zend_Date_Exception
|
384 |
*/
|
385 |
public function addTimestamp($timestamp)
|
391 |
* Subtracts a timestamp
|
392 |
*
|
393 |
* @param integer|string|array|Zend_Date $timestamp Timestamp to sub
|
394 |
+
* @return Zend_Date Provides a fluent interface
|
395 |
* @throws Zend_Date_Exception
|
396 |
*/
|
397 |
public function subTimestamp($timestamp)
|
500 |
{
|
501 |
$result = $this->get($part);
|
502 |
if (is_numeric($result)) {
|
503 |
+
return intval("$result");
|
504 |
} else {
|
505 |
+
return false;
|
506 |
}
|
507 |
}
|
508 |
|
514 |
public function toArray()
|
515 |
{
|
516 |
return array('day' => $this->toString(self::DAY_SHORT, 'iso'),
|
517 |
+
'month' => $this->toString(self::MONTH_SHORT, 'iso'),
|
518 |
+
'year' => $this->toString(self::YEAR, 'iso'),
|
519 |
+
'hour' => $this->toString(self::HOUR_SHORT, 'iso'),
|
520 |
+
'minute' => $this->toString(self::MINUTE_SHORT, 'iso'),
|
521 |
+
'second' => $this->toString(self::SECOND_SHORT, 'iso'),
|
522 |
+
'timezone' => $this->toString(self::TIMEZONE, 'iso'),
|
523 |
+
'timestamp' => $this->toString(self::TIMESTAMP, 'iso'),
|
524 |
+
'weekday' => $this->toString(self::WEEKDAY_8601, 'iso'),
|
525 |
+
'dayofyear' => $this->toString(self::DAY_OF_YEAR, 'iso'),
|
526 |
+
'week' => $this->toString(self::WEEK, 'iso'),
|
527 |
+
'gmtsecs' => $this->toString(self::TIMEZONE_SECS, 'iso'));
|
528 |
}
|
529 |
|
530 |
/**
|
1076 |
* @param string|integer|array|Zend_Date $date Date or datepart to set
|
1077 |
* @param string $part OPTIONAL Part of the date to set, if null the timestamp is set
|
1078 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
1079 |
+
* @return Zend_Date Provides a fluent interface
|
1080 |
* @throws Zend_Date_Exception
|
1081 |
*/
|
1082 |
public function set($date, $part = null, $locale = null)
|
1104 |
* @param string|integer|array|Zend_Date $date Date or datepart to add
|
1105 |
* @param string $part OPTIONAL Part of the date to add, if null the timestamp is added
|
1106 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
1107 |
+
* @return Zend_Date Provides a fluent interface
|
1108 |
* @throws Zend_Date_Exception
|
1109 |
*/
|
1110 |
public function add($date, $part = self::TIMESTAMP, $locale = null)
|
1127 |
* @param string|integer|array|Zend_Date $date Date or datepart to subtract
|
1128 |
* @param string $part OPTIONAL Part of the date to sub, if null the timestamp is subtracted
|
1129 |
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
|
1130 |
+
* @return Zend_Date Provides a fluent interface
|
1131 |
* @throws Zend_Date_Exception
|
1132 |
*/
|
1133 |
public function sub($date, $part = self::TIMESTAMP, $locale = null)
|
1214 |
}
|
1215 |
|
1216 |
preg_match('/([+-]\d{2}):{0,1}\d{2}/', $zone, $match);
|
1217 |
+
if (!empty($match) and ($match[count($match) - 1] <= 14) and ($match[count($match) - 1] >= -12)) {
|
1218 |
$zone = "Etc/GMT";
|
1219 |
$zone .= ($match[count($match) - 1] < 0) ? "+" : "-";
|
1220 |
$zone .= (int) abs($match[count($match) - 1]);
|
1221 |
return $zone;
|
1222 |
}
|
1223 |
|
1224 |
+
preg_match('/([[:alpha:]\/_]{3,30})(?!.*([[:alpha:]\/]{3,30}))/', $zone, $match);
|
1225 |
try {
|
1226 |
if (!empty($match) and (!is_int($match[count($match) - 1]))) {
|
1227 |
$oldzone = $this->getTimezone();
|
1450 |
$years = $date['year'];
|
1451 |
}
|
1452 |
return $this->_assign($calc, $this->mktime($hours, $minutes, $seconds, $months, $days, $years, true),
|
1453 |
+
$this->mktime($hour, $minute, $second, $month, $day, $year, true), $hour);
|
1454 |
}
|
1455 |
}
|
1456 |
|
1461 |
case self::DAY:
|
1462 |
if (is_numeric($date)) {
|
1463 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + intval($date), 1970, true),
|
1464 |
+
$this->mktime(0, 0, 0, 1, 1 + intval($day), 1970, true), $hour);
|
1465 |
}
|
1466 |
|
1467 |
#require_once 'Zend/Date/Exception.php';
|
1475 |
|
1476 |
foreach ($daylist as $key => $value) {
|
1477 |
if (strtoupper(iconv_substr($value, 0, 3, 'UTF-8')) == strtoupper($date)) {
|
1478 |
+
$found = $cnt;
|
1479 |
break;
|
1480 |
}
|
1481 |
++$cnt;
|
1484 |
// Weekday found
|
1485 |
if ($cnt < 7) {
|
1486 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $found, 1970, true),
|
1487 |
+
$this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour);
|
1488 |
}
|
1489 |
|
1490 |
// Weekday not found
|
1495 |
case self::DAY_SHORT:
|
1496 |
if (is_numeric($date)) {
|
1497 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + intval($date), 1970, true),
|
1498 |
+
$this->mktime(0, 0, 0, 1, 1 + intval($day), 1970, true), $hour);
|
1499 |
}
|
1500 |
|
1501 |
#require_once 'Zend/Date/Exception.php';
|
1518 |
// Weekday found
|
1519 |
if ($cnt < 7) {
|
1520 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $found, 1970, true),
|
1521 |
+
$this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour);
|
1522 |
}
|
1523 |
|
1524 |
// Weekday not found
|
1530 |
$weekday = (int) $this->toString(self::WEEKDAY_8601, 'iso', $locale);
|
1531 |
if ((intval($date) > 0) and (intval($date) < 8)) {
|
1532 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + intval($date), 1970, true),
|
1533 |
+
$this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour);
|
1534 |
}
|
1535 |
|
1536 |
// Weekday not found
|
1547 |
$weekday = (int) $this->toString(self::WEEKDAY_DIGIT, 'iso', $locale);
|
1548 |
if (is_numeric($date) and (intval($date) >= 0) and (intval($date) < 7)) {
|
1549 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $date, 1970, true),
|
1550 |
+
$this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour);
|
1551 |
}
|
1552 |
|
1553 |
// Weekday not found
|
1564 |
}
|
1565 |
|
1566 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, $date, $year, true),
|
1567 |
+
$this->mktime(0, 0, 0, $month, $day, $year, true), $hour);
|
1568 |
}
|
1569 |
|
1570 |
#require_once 'Zend/Date/Exception.php';
|
1586 |
// Weekday found
|
1587 |
if ($cnt < 7) {
|
1588 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $found, 1970, true),
|
1589 |
+
$this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour);
|
1590 |
}
|
1591 |
|
1592 |
// Weekday not found
|
1609 |
// Weekday found
|
1610 |
if ($cnt < 7) {
|
1611 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $found, 1970, true),
|
1612 |
+
$this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour);
|
1613 |
}
|
1614 |
|
1615 |
// Weekday not found
|
1622 |
if (is_numeric($date)) {
|
1623 |
$week = (int) $this->toString(self::WEEK, 'iso', $locale);
|
1624 |
return $this->_assign($calc, parent::mktime(0, 0, 0, 1, 1 + ($date * 7), 1970, true),
|
1625 |
+
parent::mktime(0, 0, 0, 1, 1 + ($week * 7), 1970, true), $hour);
|
1626 |
}
|
1627 |
|
1628 |
#require_once 'Zend/Date/Exception.php';
|
1665 |
}
|
1666 |
}
|
1667 |
return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true),
|
1668 |
+
$this->mktime(0, 0, 0, $month, $day, $year, true), $hour);
|
1669 |
}
|
1670 |
|
1671 |
// Monthname not found
|
1696 |
}
|
1697 |
}
|
1698 |
return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true),
|
1699 |
+
$this->mktime(0, 0, 0, $month, $day, $year, true), $hour);
|
1700 |
}
|
1701 |
|
1702 |
#require_once 'Zend/Date/Exception.php';
|
1738 |
}
|
1739 |
}
|
1740 |
return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true),
|
1741 |
+
$this->mktime(0, 0, 0, $month, $day, $year, true), $hour);
|
1742 |
}
|
1743 |
|
1744 |
// Monthname not found
|
1770 |
}
|
1771 |
|
1772 |
return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true),
|
1773 |
+
$this->mktime(0, 0, 0, $month, $day, $year, true), $hour);
|
1774 |
}
|
1775 |
|
1776 |
#require_once 'Zend/Date/Exception.php';
|
1817 |
}
|
1818 |
}
|
1819 |
return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true),
|
1820 |
+
$this->mktime(0, 0, 0, $month, $day, $year, true), $hour);
|
1821 |
}
|
1822 |
|
1823 |
// Monthname not found
|
1842 |
}
|
1843 |
|
1844 |
return $this->_assign($calc, $this->mktime(0, 0, 0, $month, $day, intval($date), true),
|
1845 |
+
$this->mktime(0, 0, 0, $month, $day, $year, true), false);
|
1846 |
}
|
1847 |
|
1848 |
#require_once 'Zend/Date/Exception.php';
|
1860 |
}
|
1861 |
|
1862 |
return $this->_assign($calc, $this->mktime(0, 0, 0, $month, $day, intval($date), true),
|
1863 |
+
$this->mktime(0, 0, 0, $month, $day, $year, true), false);
|
1864 |
}
|
1865 |
|
1866 |
#require_once 'Zend/Date/Exception.php';
|
1882 |
}
|
1883 |
|
1884 |
return $this->_assign($calc, $this->mktime(0, 0, 0, $month, $day, $date, true),
|
1885 |
+
$this->mktime(0, 0, 0, $month, $day, $year, true), false);
|
1886 |
}
|
1887 |
|
1888 |
#require_once 'Zend/Date/Exception.php';
|
1904 |
}
|
1905 |
|
1906 |
return $this->_assign($calc, $this->mktime(0, 0, 0, $month, $day, $date, true),
|
1907 |
+
$this->mktime(0, 0, 0, $month, $day, $year, true), false);
|
1908 |
}
|
1909 |
|
1910 |
#require_once 'Zend/Date/Exception.php';
|
1926 |
$rest = $rest - ($minutes * 1000 / 1440);
|
1927 |
$seconds = floor($rest * 86400 / 1000);
|
1928 |
return $this->_assign($calc, $this->mktime($hours, $minutes, $seconds, 1, 1, 1970, true),
|
1929 |
+
$this->mktime($hour, $minute, $second, 1, 1, 1970, true), false);
|
1930 |
}
|
1931 |
|
1932 |
#require_once 'Zend/Date/Exception.php';
|
1936 |
case self::HOUR_SHORT_AM:
|
1937 |
if (is_numeric($date)) {
|
1938 |
return $this->_assign($calc, $this->mktime(intval($date), 0, 0, 1, 1, 1970, true),
|
1939 |
+
$this->mktime($hour, 0, 0, 1, 1, 1970, true), false);
|
1940 |
}
|
1941 |
|
1942 |
#require_once 'Zend/Date/Exception.php';
|
1946 |
case self::HOUR_SHORT:
|
1947 |
if (is_numeric($date)) {
|
1948 |
return $this->_assign($calc, $this->mktime(intval($date), 0, 0, 1, 1, 1970, true),
|
1949 |
+
$this->mktime($hour, 0, 0, 1, 1, 1970, true), false);
|
1950 |
}
|
1951 |
|
1952 |
#require_once 'Zend/Date/Exception.php';
|
1956 |
case self::HOUR_AM:
|
1957 |
if (is_numeric($date)) {
|
1958 |
return $this->_assign($calc, $this->mktime(intval($date), 0, 0, 1, 1, 1970, true),
|
1959 |
+
$this->mktime($hour, 0, 0, 1, 1, 1970, true), false);
|
1960 |
}
|
1961 |
|
1962 |
#require_once 'Zend/Date/Exception.php';
|
1966 |
case self::HOUR:
|
1967 |
if (is_numeric($date)) {
|
1968 |
return $this->_assign($calc, $this->mktime(intval($date), 0, 0, 1, 1, 1970, true),
|
1969 |
+
$this->mktime($hour, 0, 0, 1, 1, 1970, true), false);
|
1970 |
}
|
1971 |
|
1972 |
#require_once 'Zend/Date/Exception.php';
|
1976 |
case self::MINUTE:
|
1977 |
if (is_numeric($date)) {
|
1978 |
return $this->_assign($calc, $this->mktime(0, intval($date), 0, 1, 1, 1970, true),
|
1979 |
+
$this->mktime(0, $minute, 0, 1, 1, 1970, true), false);
|
1980 |
}
|
1981 |
|
1982 |
#require_once 'Zend/Date/Exception.php';
|
1986 |
case self::SECOND:
|
1987 |
if (is_numeric($date)) {
|
1988 |
return $this->_assign($calc, $this->mktime(0, 0, intval($date), 1, 1, 1970, true),
|
1989 |
+
$this->mktime(0, 0, $second, 1, 1, 1970, true), false);
|
1990 |
}
|
1991 |
|
1992 |
#require_once 'Zend/Date/Exception.php';
|
2017 |
case self::MINUTE_SHORT:
|
2018 |
if (is_numeric($date)) {
|
2019 |
return $this->_assign($calc, $this->mktime(0, intval($date), 0, 1, 1, 1970, true),
|
2020 |
+
$this->mktime(0, $minute, 0, 1, 1, 1970, true), false);
|
2021 |
}
|
2022 |
|
2023 |
#require_once 'Zend/Date/Exception.php';
|
2027 |
case self::SECOND_SHORT:
|
2028 |
if (is_numeric($date)) {
|
2029 |
return $this->_assign($calc, $this->mktime(0, 0, intval($date), 1, 1, 1970, true),
|
2030 |
+
$this->mktime(0, 0, $second, 1, 1, 1970, true), false);
|
2031 |
}
|
2032 |
|
2033 |
#require_once 'Zend/Date/Exception.php';
|
2074 |
if (!empty($datematch)) {
|
2075 |
$dateMatchCharCount = iconv_strlen($datematch[0], 'UTF-8');
|
2076 |
$tmpdate = iconv_substr($date,
|
2077 |
+
$dateMatchCharCount,
|
2078 |
+
iconv_strlen($date, 'UTF-8') - $dateMatchCharCount,
|
2079 |
+
'UTF-8');
|
2080 |
}
|
2081 |
// (T)hh:mm:ss
|
2082 |
preg_match('/[T,\s]{0,1}(\d{2}):(\d{2}):(\d{2})/', $tmpdate, $timematch);
|
2083 |
+
// (T)hhmmss
|
2084 |
if (empty($timematch)) {
|
2085 |
preg_match('/[T,\s]{0,1}(\d{2})(\d{2})(\d{2})/', $tmpdate, $timematch);
|
2086 |
}
|
2091 |
if (!empty($timematch)) {
|
2092 |
$timeMatchCharCount = iconv_strlen($timematch[0], 'UTF-8');
|
2093 |
$tmpdate = iconv_substr($tmpdate,
|
2094 |
+
$timeMatchCharCount,
|
2095 |
+
iconv_strlen($tmpdate, 'UTF-8') - $timeMatchCharCount,
|
2096 |
+
'UTF-8');
|
2097 |
}
|
2098 |
if (empty($datematch)) {
|
2099 |
$datematch[1] = 1970;
|
2107 |
$timematch[2] = 0;
|
2108 |
$timematch[3] = 0;
|
2109 |
}
|
2110 |
+
if (!isset($timematch[3])) {
|
2111 |
+
$timematch[3] = 0;
|
2112 |
+
}
|
2113 |
|
2114 |
if (($calc == 'set') || ($calc == 'cmp')) {
|
2115 |
--$datematch[2];
|
2120 |
$year -= 1970;
|
2121 |
}
|
2122 |
return $this->_assign($calc, $this->mktime($timematch[1], $timematch[2], $timematch[3], 1 + $datematch[2], 1 + $datematch[3], 1970 + $datematch[1], false),
|
2123 |
+
$this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, false), false);
|
2124 |
break;
|
2125 |
|
2126 |
case self::RFC_2822:
|
2127 |
+
$result = preg_match('/^\w{3},\s(\d{1,2})\s(\w{3})\s(\d{4})\s'
|
2128 |
+
. '(\d{2}):(\d{2}):{0,1}(\d{0,2})\s([+-]'
|
2129 |
+
. '{1}\d{4}|\w{1,20})$/', $date, $match);
|
2130 |
+
|
2131 |
if (!$result) {
|
2132 |
#require_once 'Zend/Date/Exception.php';
|
2133 |
throw new Zend_Date_Exception("no RFC 2822 format ($date)", 0, null, $date);
|
2144 |
$year -= 1970;
|
2145 |
}
|
2146 |
return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], false),
|
2147 |
+
$this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, false), false);
|
2148 |
break;
|
2149 |
|
2150 |
case self::TIMESTAMP:
|
2178 |
}
|
2179 |
|
2180 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true),
|
2181 |
+
$this->mktime(0, 0, 0, 1 + $month, 1 + $day, 1970 + $year, true), $hour);
|
2182 |
} catch (Zend_Locale_Exception $e) {
|
2183 |
#require_once 'Zend/Date/Exception.php';
|
2184 |
throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date);
|
2199 |
$year -= 1970;
|
2200 |
}
|
2201 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true),
|
2202 |
+
$this->mktime(0, 0, 0, 1 + $month, 1 + $day, 1970 + $year, true), $hour);
|
2203 |
} catch (Zend_Locale_Exception $e) {
|
2204 |
#require_once 'Zend/Date/Exception.php';
|
2205 |
throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date);
|
2220 |
$year -= 1970;
|
2221 |
}
|
2222 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true),
|
2223 |
+
$this->mktime(0, 0, 0, 1 + $month, 1 + $day, 1970 + $year, true), $hour);
|
2224 |
} catch (Zend_Locale_Exception $e) {
|
2225 |
#require_once 'Zend/Date/Exception.php';
|
2226 |
throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date);
|
2241 |
$year -= 1970;
|
2242 |
}
|
2243 |
return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true),
|