From 960045c285e98c6820fecf54ea552039d516d821 Mon Sep 17 00:00:00 2001 From: Lee Saferite Date: Thu, 10 Jun 2010 18:17:45 -0400 Subject: [PATCH] Import Magento Release 1.4.1.0 --- RELEASE_NOTES.txt | 642 ++ app/Mage.php | 19 +- .../Phoenix/Moneybookers/Helper/Data.php | 20 +- .../Phoenix/Moneybookers/Model/Abstract.php | 2 +- .../Phoenix/Moneybookers/Model/Event.php | 14 +- .../controllers/ProcessingController.php | 2 +- .../Phoenix/Moneybookers/etc/config.xml | 56 +- .../Phoenix/Moneybookers/etc/system.xml | 210 +- app/code/core/Mage/Admin/Model/Acl.php | 2 +- .../core/Mage/Admin/Model/Acl/Assert/Ip.php | 2 +- .../core/Mage/Admin/Model/Acl/Assert/Time.php | 2 +- .../core/Mage/Admin/Model/Acl/Resource.php | 2 +- app/code/core/Mage/Admin/Model/Acl/Role.php | 2 +- .../Mage/Admin/Model/Acl/Role/Generic.php | 2 +- .../core/Mage/Admin/Model/Acl/Role/Group.php | 2 +- .../Mage/Admin/Model/Acl/Role/Registry.php | 2 +- .../core/Mage/Admin/Model/Acl/Role/User.php | 2 +- app/code/core/Mage/Admin/Model/Config.php | 2 +- app/code/core/Mage/Admin/Model/Mysql4/Acl.php | 2 +- .../core/Mage/Admin/Model/Mysql4/Acl/Role.php | 2 +- .../Model/Mysql4/Acl/Role/Collection.php | 2 +- .../Model/Mysql4/Permissions/Collection.php | 2 +- .../core/Mage/Admin/Model/Mysql4/Role.php | 2 +- .../Admin/Model/Mysql4/Role/Collection.php | 2 +- .../core/Mage/Admin/Model/Mysql4/Roles.php | 2 +- .../Admin/Model/Mysql4/Roles/Collection.php | 2 +- .../Model/Mysql4/Roles/User/Collection.php | 2 +- .../core/Mage/Admin/Model/Mysql4/Rules.php | 2 +- .../Admin/Model/Mysql4/Rules/Collection.php | 2 +- .../core/Mage/Admin/Model/Mysql4/User.php | 2 +- .../Admin/Model/Mysql4/User/Collection.php | 2 +- app/code/core/Mage/Admin/Model/Observer.php | 12 +- app/code/core/Mage/Admin/Model/Role.php | 2 +- app/code/core/Mage/Admin/Model/Roles.php | 2 +- app/code/core/Mage/Admin/Model/Rules.php | 2 +- app/code/core/Mage/Admin/Model/Session.php | 2 +- app/code/core/Mage/Admin/Model/User.php | 6 +- app/code/core/Mage/Admin/etc/config.xml | 2 +- .../sql/admin_setup/mysql4-install-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../Mage/AdminNotification/Helper/Data.php | 2 +- .../Mage/AdminNotification/Model/Feed.php | 2 +- .../Mage/AdminNotification/Model/Inbox.php | 2 +- .../AdminNotification/Model/Mysql4/Inbox.php | 2 +- .../Model/Mysql4/Inbox/Collection.php | 2 +- .../Mage/AdminNotification/Model/Observer.php | 2 +- .../Mage/AdminNotification/Model/Survey.php | 2 +- .../Mage/AdminNotification/etc/adminhtml.xml | 10 +- .../Mage/AdminNotification/etc/config.xml | 10 +- .../Mage/AdminNotification/etc/system.xml | 8 +- .../mysql4-install-1.0.0.php | 2 +- .../core/Mage/Adminhtml/Block/Abstract.php | 2 +- .../core/Mage/Adminhtml/Block/Api/Buttons.php | 2 +- .../Mage/Adminhtml/Block/Api/Editroles.php | 2 +- .../Mage/Adminhtml/Block/Api/Edituser.php | 2 +- .../Mage/Adminhtml/Block/Api/Grid/Role.php | 2 +- .../core/Mage/Adminhtml/Block/Api/Role.php | 2 +- .../Adminhtml/Block/Api/Role/Grid/User.php | 2 +- .../core/Mage/Adminhtml/Block/Api/Roles.php | 2 +- .../Mage/Adminhtml/Block/Api/Tab/Roleinfo.php | 2 +- .../Adminhtml/Block/Api/Tab/Rolesedit.php | 2 +- .../Adminhtml/Block/Api/Tab/Rolesusers.php | 2 +- .../Adminhtml/Block/Api/Tab/Userroles.php | 2 +- .../core/Mage/Adminhtml/Block/Api/User.php | 2 +- .../Mage/Adminhtml/Block/Api/User/Edit.php | 2 +- .../Adminhtml/Block/Api/User/Edit/Form.php | 2 +- .../Block/Api/User/Edit/Tab/Main.php | 16 +- .../Block/Api/User/Edit/Tab/Roles.php | 2 +- .../Adminhtml/Block/Api/User/Edit/Tabs.php | 2 +- .../Mage/Adminhtml/Block/Api/User/Grid.php | 2 +- .../core/Mage/Adminhtml/Block/Api/Users.php | 2 +- app/code/core/Mage/Adminhtml/Block/Backup.php | 2 +- .../core/Mage/Adminhtml/Block/Backup/Grid.php | 4 +- app/code/core/Mage/Adminhtml/Block/Cache.php | 4 +- .../Mage/Adminhtml/Block/Cache/Additional.php | 2 +- .../core/Mage/Adminhtml/Block/Cache/Grid.php | 3 +- .../Adminhtml/Block/Cache/Notifications.php | 2 +- .../core/Mage/Adminhtml/Block/Catalog.php | 2 +- .../Block/Catalog/Category/Abstract.php | 7 +- .../Catalog/Category/Checkboxes/Tree.php | 2 +- .../Adminhtml/Block/Catalog/Category/Edit.php | 2 +- .../Block/Catalog/Category/Edit/Form.php | 4 +- .../Block/Catalog/Category/Helper/Image.php | 2 +- .../Category/Helper/Sortby/Available.php | 4 +- .../Category/Helper/Sortby/Default.php | 4 +- .../Block/Catalog/Category/Tab/Attributes.php | 12 +- .../Block/Catalog/Category/Tab/Design.php | 2 +- .../Block/Catalog/Category/Tab/General.php | 2 +- .../Block/Catalog/Category/Tab/Product.php | 2 +- .../Adminhtml/Block/Catalog/Category/Tabs.php | 2 +- .../Adminhtml/Block/Catalog/Category/Tree.php | 2 +- .../Block/Catalog/Category/Widget/Chooser.php | 6 +- .../Mage/Adminhtml/Block/Catalog/Form.php | 2 +- .../Form/Renderer/Attribute/Urlkey.php | 65 + .../Form/Renderer/Config/DateFieldsOrder.php | 2 +- .../Form/Renderer/Config/YearRange.php | 2 +- .../Form/Renderer/Fieldset/Element.php | 2 +- .../Form/Renderer/Googleoptimizer/Import.php | 2 +- .../Block/Catalog/Helper/Form/Wysiwyg.php | 5 +- .../Catalog/Helper/Form/Wysiwyg/Content.php | 11 +- .../Mage/Adminhtml/Block/Catalog/Product.php | 2 +- .../Block/Catalog/Product/Attribute.php | 2 +- .../Block/Catalog/Product/Attribute/Edit.php | 4 +- .../Catalog/Product/Attribute/Edit/Form.php | 2 +- .../Product/Attribute/Edit/Tab/Front.php | 16 +- .../Product/Attribute/Edit/Tab/Main.php | 34 +- .../Product/Attribute/Edit/Tab/Options.php | 2 +- .../Product/Attribute/Edit/Tab/System.php | 2 +- .../Catalog/Product/Attribute/Edit/Tabs.php | 2 +- .../Block/Catalog/Product/Attribute/Grid.php | 4 +- .../Attribute/New/Product/Attributes.php | 2 +- .../Product/Attribute/New/Product/Created.php | 2 +- .../Catalog/Product/Attribute/Set/Grid.php | 2 +- .../Catalog/Product/Attribute/Set/Main.php | 2 +- .../Attribute/Set/Main/Formattribute.php | 2 +- .../Product/Attribute/Set/Main/Formgroup.php | 2 +- .../Product/Attribute/Set/Main/Formset.php | 5 +- .../Attribute/Set/Main/Tree/Attribute.php | 2 +- .../Product/Attribute/Set/Main/Tree/Group.php | 2 +- .../Product/Attribute/Set/Toolbar/Add.php | 2 +- .../Product/Attribute/Set/Toolbar/Main.php | 2 +- .../Attribute/Set/Toolbar/Main/Filter.php | 2 +- .../Block/Catalog/Product/Created.php | 2 +- .../Adminhtml/Block/Catalog/Product/Edit.php | 4 +- .../Catalog/Product/Edit/Action/Attribute.php | 2 +- .../Edit/Action/Attribute/Tab/Attributes.php | 4 +- .../Edit/Action/Attribute/Tab/Inventory.php | 2 +- .../Edit/Action/Attribute/Tab/Websites.php | 2 +- .../Product/Edit/Action/Attribute/Tabs.php | 2 +- .../Block/Catalog/Product/Edit/Js.php | 2 +- .../Product/Edit/Tab/Ajax/Serializer.php | 2 +- .../Block/Catalog/Product/Edit/Tab/Alerts.php | 6 +- .../Catalog/Product/Edit/Tab/Alerts/Price.php | 2 +- .../Catalog/Product/Edit/Tab/Alerts/Stock.php | 4 +- .../Catalog/Product/Edit/Tab/Attributes.php | 14 +- .../Product/Edit/Tab/Attributes/Create.php | 2 +- .../Catalog/Product/Edit/Tab/Categories.php | 2 +- .../Catalog/Product/Edit/Tab/Crosssell.php | 5 +- .../Catalog/Product/Edit/Tab/Inventory.php | 2 +- .../Catalog/Product/Edit/Tab/Options.php | 2 +- .../Product/Edit/Tab/Options/Option.php | 2 +- .../Edit/Tab/Options/Type/Abstract.php | 2 +- .../Product/Edit/Tab/Options/Type/Date.php | 2 +- .../Product/Edit/Tab/Options/Type/File.php | 2 +- .../Product/Edit/Tab/Options/Type/Select.php | 2 +- .../Product/Edit/Tab/Options/Type/Text.php | 2 +- .../Block/Catalog/Product/Edit/Tab/Price.php | 6 +- .../Product/Edit/Tab/Price/Recurring.php | 49 + .../Catalog/Product/Edit/Tab/Price/Tier.php | 2 +- .../Catalog/Product/Edit/Tab/Related.php | 2 +- .../Catalog/Product/Edit/Tab/Reviews.php | 2 +- .../Catalog/Product/Edit/Tab/Settings.php | 2 +- .../Catalog/Product/Edit/Tab/Super/Config.php | 2 +- .../Product/Edit/Tab/Super/Config/Grid.php | 2 +- .../Super/Config/Grid/Filter/Inventory.php | 6 +- .../Super/Config/Grid/Renderer/Checkbox.php | 2 +- .../Super/Config/Grid/Renderer/Inventory.php | 2 +- .../Product/Edit/Tab/Super/Config/Simple.php | 2 +- .../Catalog/Product/Edit/Tab/Super/Group.php | 2 +- .../Product/Edit/Tab/Super/Settings.php | 4 +- .../Block/Catalog/Product/Edit/Tab/Tag.php | 2 +- .../Catalog/Product/Edit/Tab/Tag/Customer.php | 2 +- .../Block/Catalog/Product/Edit/Tab/Upsell.php | 2 +- .../Catalog/Product/Edit/Tab/Websites.php | 2 +- .../Block/Catalog/Product/Edit/Tabs.php | 2 +- .../Product/Edit/Tabs/Configurable.php | 2 +- .../Catalog/Product/Edit/Tabs/Grouped.php | 2 +- .../Product/Frontend/Product/Watermark.php | 2 +- .../Adminhtml/Block/Catalog/Product/Grid.php | 8 +- .../Catalog/Product/Helper/Form/Apply.php | 2 +- .../Catalog/Product/Helper/Form/Boolean.php | 2 +- .../Catalog/Product/Helper/Form/Gallery.php | 2 +- .../Product/Helper/Form/Gallery/Content.php | 2 +- .../Catalog/Product/Helper/Form/Image.php | 2 +- .../Catalog/Product/Helper/Form/Price.php | 4 +- .../Block/Catalog/Product/Widget/Chooser.php | 2 +- .../Product/Widget/Chooser/Container.php | 2 +- .../Mage/Adminhtml/Block/Catalog/Search.php | 2 +- .../Adminhtml/Block/Catalog/Search/Edit.php | 2 +- .../Block/Catalog/Search/Edit/Form.php | 6 +- .../Adminhtml/Block/Catalog/Search/Grid.php | 4 +- .../Adminhtml/Block/Checkout/Agreement.php | 2 +- .../Block/Checkout/Agreement/Edit.php | 2 +- .../Block/Checkout/Agreement/Edit/Form.php | 6 +- .../Block/Checkout/Agreement/Grid.php | 2 +- .../core/Mage/Adminhtml/Block/Cms/Block.php | 2 +- .../Mage/Adminhtml/Block/Cms/Block/Edit.php | 4 +- .../Adminhtml/Block/Cms/Block/Edit/Form.php | 2 +- .../Mage/Adminhtml/Block/Cms/Block/Grid.php | 2 +- .../Block/Cms/Block/Widget/Chooser.php | 2 +- .../core/Mage/Adminhtml/Block/Cms/Page.php | 2 +- .../Mage/Adminhtml/Block/Cms/Page/Edit.php | 4 +- .../Adminhtml/Block/Cms/Page/Edit/Form.php | 2 +- .../Block/Cms/Page/Edit/Tab/Content.php | 2 +- .../Block/Cms/Page/Edit/Tab/Design.php | 2 +- .../Block/Cms/Page/Edit/Tab/Main.php | 2 +- .../Block/Cms/Page/Edit/Tab/Meta.php | 2 +- .../Adminhtml/Block/Cms/Page/Edit/Tabs.php | 2 +- .../Mage/Adminhtml/Block/Cms/Page/Grid.php | 2 +- .../Block/Cms/Page/Grid/Renderer/Action.php | 2 +- .../Block/Cms/Page/Widget/Chooser.php | 2 +- .../Block/Cms/Wysiwyg/Images/Content.php | 2 +- .../Cms/Wysiwyg/Images/Content/Files.php | 2 +- .../Cms/Wysiwyg/Images/Content/Newfolder.php | 2 +- .../Cms/Wysiwyg/Images/Content/Uploader.php | 2 +- .../Block/Cms/Wysiwyg/Images/Tree.php | 2 +- .../core/Mage/Adminhtml/Block/Customer.php | 2 +- .../Mage/Adminhtml/Block/Customer/Edit.php | 4 +- .../Adminhtml/Block/Customer/Edit/Form.php | 2 +- .../Block/Customer/Edit/Renderer/Newpass.php | 2 +- .../Block/Customer/Edit/Renderer/Region.php | 2 +- .../Block/Customer/Edit/Tab/Account.php | 4 +- .../Block/Customer/Edit/Tab/Addresses.php | 2 +- .../Block/Customer/Edit/Tab/Cart.php | 2 +- .../Block/Customer/Edit/Tab/Carts.php | 2 +- .../Block/Customer/Edit/Tab/Newsletter.php | 4 +- .../Customer/Edit/Tab/Newsletter/Grid.php | 2 +- .../Tab/Newsletter/Grid/Filter/Status.php | 2 +- .../Tab/Newsletter/Grid/Renderer/Action.php | 2 +- .../Tab/Newsletter/Grid/Renderer/Status.php | 2 +- .../Block/Customer/Edit/Tab/Orders.php | 32 +- .../Block/Customer/Edit/Tab/Reviews.php | 2 +- .../Adminhtml/Block/Customer/Edit/Tab/Tag.php | 2 +- .../Block/Customer/Edit/Tab/Tags.php | 2 +- .../Block/Customer/Edit/Tab/View.php | 4 +- .../Customer/Edit/Tab/View/Accordion.php | 2 +- .../Block/Customer/Edit/Tab/View/Cart.php | 2 +- .../Block/Customer/Edit/Tab/View/Orders.php | 24 +- .../Block/Customer/Edit/Tab/View/Sales.php | 2 +- .../Block/Customer/Edit/Tab/View/Wishlist.php | 2 +- .../Block/Customer/Edit/Tab/Wishlist.php | 2 +- .../Wishlist/Grid/Renderer/Description.php | 2 +- .../Adminhtml/Block/Customer/Edit/Tabs.php | 2 +- .../Mage/Adminhtml/Block/Customer/Grid.php | 8 +- .../Block/Customer/Grid/Filter/Country.php | 2 +- .../Mage/Adminhtml/Block/Customer/Group.php | 2 +- .../Adminhtml/Block/Customer/Group/Edit.php | 2 +- .../Block/Customer/Group/Edit/Form.php | 6 +- .../Adminhtml/Block/Customer/Group/Grid.php | 2 +- .../Mage/Adminhtml/Block/Customer/Online.php | 2 +- .../Block/Customer/Online/Filter.php | 2 +- .../Adminhtml/Block/Customer/Online/Grid.php | 4 +- .../Customer/Online/Grid/Renderer/Ip.php | 2 +- .../Customer/Online/Grid/Renderer/Type.php | 2 +- .../Customer/Online/Grid/Renderer/Url.php | 2 +- .../core/Mage/Adminhtml/Block/Dashboard.php | 2 +- .../Adminhtml/Block/Dashboard/Abstract.php | 2 +- .../Mage/Adminhtml/Block/Dashboard/Bar.php | 2 +- .../Adminhtml/Block/Dashboard/Diagrams.php | 2 +- .../Mage/Adminhtml/Block/Dashboard/Graph.php | 2 +- .../Mage/Adminhtml/Block/Dashboard/Grid.php | 2 +- .../Mage/Adminhtml/Block/Dashboard/Grids.php | 2 +- .../Adminhtml/Block/Dashboard/Orders/Grid.php | 33 +- .../Mage/Adminhtml/Block/Dashboard/Sales.php | 15 +- .../Block/Dashboard/Searches/Last.php | 2 +- .../Searches/Renderer/Searchquery.php | 2 +- .../Block/Dashboard/Searches/Top.php | 2 +- .../Adminhtml/Block/Dashboard/Tab/Amounts.php | 2 +- .../Block/Dashboard/Tab/Customers/Most.php | 2 +- .../Block/Dashboard/Tab/Customers/Newest.php | 8 +- .../Adminhtml/Block/Dashboard/Tab/Orders.php | 2 +- .../Block/Dashboard/Tab/Products/Ordered.php | 32 +- .../Block/Dashboard/Tab/Products/Viewed.php | 2 +- .../Mage/Adminhtml/Block/Dashboard/Totals.php | 24 +- app/code/core/Mage/Adminhtml/Block/Denied.php | 2 +- .../core/Mage/Adminhtml/Block/Html/Date.php | 2 +- .../core/Mage/Adminhtml/Block/Html/Select.php | 2 +- .../Mage/Adminhtml/Block/Media/Editor.php | 2 +- .../Mage/Adminhtml/Block/Media/Uploader.php | 2 +- .../core/Mage/Adminhtml/Block/Messages.php | 2 +- .../Adminhtml/Block/Newsletter/Problem.php | 2 +- .../Block/Newsletter/Problem/Grid.php | 4 +- .../Problem/Grid/Filter/Checkbox.php | 2 +- .../Problem/Grid/Renderer/Checkbox.php | 2 +- .../Mage/Adminhtml/Block/Newsletter/Queue.php | 2 +- .../Adminhtml/Block/Newsletter/Queue/Edit.php | 4 +- .../Block/Newsletter/Queue/Edit/Form.php | 2 +- .../Adminhtml/Block/Newsletter/Queue/Grid.php | 2 +- .../Newsletter/Queue/Grid/Renderer/Action.php | 2 +- .../Adminhtml/Block/Newsletter/Subscriber.php | 4 +- .../Block/Newsletter/Subscriber/Grid.php | 8 +- .../Subscriber/Grid/Filter/Checkbox.php | 2 +- .../Subscriber/Grid/Filter/Website.php | 2 +- .../Subscriber/Grid/Renderer/Checkbox.php | 2 +- .../Adminhtml/Block/Newsletter/Template.php | 2 +- .../Block/Newsletter/Template/Edit.php | 4 +- .../Block/Newsletter/Template/Edit/Form.php | 2 +- .../Block/Newsletter/Template/Grid.php | 2 +- .../Template/Grid/Renderer/Action.php | 2 +- .../Template/Grid/Renderer/Sender.php | 2 +- .../Block/Newsletter/Template/Preview.php | 2 +- .../Adminhtml/Block/Notification/Baseurl.php | 2 +- .../Adminhtml/Block/Notification/Grid.php | 2 +- .../Notification/Grid/Renderer/Actions.php | 2 +- .../Notification/Grid/Renderer/Notice.php | 2 +- .../Notification/Grid/Renderer/Severity.php | 2 +- .../Adminhtml/Block/Notification/Inbox.php | 2 +- .../Adminhtml/Block/Notification/Survey.php | 2 +- .../Adminhtml/Block/Notification/Toolbar.php | 2 +- .../Adminhtml/Block/Notification/Window.php | 2 +- app/code/core/Mage/Adminhtml/Block/Page.php | 2 +- .../core/Mage/Adminhtml/Block/Page/Footer.php | 2 +- .../core/Mage/Adminhtml/Block/Page/Head.php | 2 +- .../core/Mage/Adminhtml/Block/Page/Header.php | 2 +- .../core/Mage/Adminhtml/Block/Page/Menu.php | 17 +- .../Mage/Adminhtml/Block/Page/Notices.php | 2 +- .../Adminhtml/Block/Permissions/Buttons.php | 2 +- .../Adminhtml/Block/Permissions/Editroles.php | 2 +- .../Adminhtml/Block/Permissions/Edituser.php | 2 +- .../Adminhtml/Block/Permissions/Grid/Role.php | 2 +- .../Adminhtml/Block/Permissions/Grid/User.php | 2 +- .../Mage/Adminhtml/Block/Permissions/Role.php | 2 +- .../Block/Permissions/Role/Grid/User.php | 2 +- .../Adminhtml/Block/Permissions/Roles.php | 2 +- .../Block/Permissions/Tab/Roleinfo.php | 2 +- .../Block/Permissions/Tab/Rolesedit.php | 2 +- .../Block/Permissions/Tab/Rolesusers.php | 2 +- .../Block/Permissions/Tab/Useredit.php | 6 +- .../Block/Permissions/Tab/Userroles.php | 2 +- .../Mage/Adminhtml/Block/Permissions/User.php | 2 +- .../Adminhtml/Block/Permissions/User/Edit.php | 2 +- .../Block/Permissions/User/Edit/Form.php | 2 +- .../Block/Permissions/User/Edit/Tab/Main.php | 4 +- .../Block/Permissions/User/Edit/Tab/Roles.php | 2 +- .../Block/Permissions/User/Edit/Tabs.php | 2 +- .../Adminhtml/Block/Permissions/User/Grid.php | 2 +- .../Block/Permissions/Usernroles.php | 2 +- .../Adminhtml/Block/Permissions/Users.php | 2 +- .../Mage/Adminhtml/Block/Poll/Answer/Edit.php | 2 +- .../Adminhtml/Block/Poll/Answer/Edit/Form.php | 2 +- .../core/Mage/Adminhtml/Block/Poll/Edit.php | 2 +- .../Mage/Adminhtml/Block/Poll/Edit/Form.php | 2 +- .../Adminhtml/Block/Poll/Edit/Tab/Answers.php | 2 +- .../Block/Poll/Edit/Tab/Answers/Form.php | 2 +- .../Block/Poll/Edit/Tab/Answers/Grid.php | 2 +- .../Block/Poll/Edit/Tab/Answers/List.php | 2 +- .../Adminhtml/Block/Poll/Edit/Tab/Form.php | 2 +- .../Mage/Adminhtml/Block/Poll/Edit/Tabs.php | 2 +- .../core/Mage/Adminhtml/Block/Poll/Grid.php | 2 +- .../core/Mage/Adminhtml/Block/Poll/Poll.php | 2 +- .../Mage/Adminhtml/Block/Promo/Catalog.php | 2 +- .../Adminhtml/Block/Promo/Catalog/Edit.php | 4 +- .../Block/Promo/Catalog/Edit/Form.php | 2 +- .../Block/Promo/Catalog/Edit/Tab/Actions.php | 14 +- .../Promo/Catalog/Edit/Tab/Conditions.php | 6 +- .../Block/Promo/Catalog/Edit/Tab/Main.php | 2 +- .../Block/Promo/Catalog/Edit/Tabs.php | 2 +- .../Adminhtml/Block/Promo/Catalog/Grid.php | 2 +- .../core/Mage/Adminhtml/Block/Promo/Quote.php | 2 +- .../Mage/Adminhtml/Block/Promo/Quote/Edit.php | 4 +- .../Adminhtml/Block/Promo/Quote/Edit/Form.php | 2 +- .../Block/Promo/Quote/Edit/Tab/Actions.php | 18 +- .../Block/Promo/Quote/Edit/Tab/Conditions.php | 6 +- .../Block/Promo/Quote/Edit/Tab/Labels.php | 2 +- .../Block/Promo/Quote/Edit/Tab/Main.php | 37 +- .../Adminhtml/Block/Promo/Quote/Edit/Tabs.php | 2 +- .../Mage/Adminhtml/Block/Promo/Quote/Grid.php | 6 +- .../Adminhtml/Block/Promo/Widget/Chooser.php | 177 + .../Block/Promo/Widget/Chooser/Daterange.php | 2 +- .../Block/Promo/Widget/Chooser/Sku.php | 2 +- .../core/Mage/Adminhtml/Block/Rating/Edit.php | 2 +- .../Mage/Adminhtml/Block/Rating/Edit/Form.php | 2 +- .../Adminhtml/Block/Rating/Edit/Tab/Form.php | 2 +- .../Block/Rating/Edit/Tab/Options.php | 2 +- .../Mage/Adminhtml/Block/Rating/Edit/Tabs.php | 2 +- .../core/Mage/Adminhtml/Block/Rating/Grid.php | 2 +- .../Mage/Adminhtml/Block/Rating/Rating.php | 2 +- .../Report/Config/Form/Field/MtdStart.php | 2 +- .../Report/Config/Form/Field/YtdStart.php | 2 +- .../Block/Report/Customer/Accounts.php | 2 +- .../Block/Report/Customer/Accounts/Grid.php | 2 +- .../Block/Report/Customer/Orders.php | 2 +- .../Block/Report/Customer/Orders/Grid.php | 2 +- .../Block/Report/Customer/Totals.php | 4 +- .../Block/Report/Customer/Totals/Grid.php | 2 +- .../Adminhtml/Block/Report/Filter/Form.php | 155 +- .../core/Mage/Adminhtml/Block/Report/Grid.php | 4 +- .../Adminhtml/Block/Report/Grid/Abstract.php | 36 +- .../Grid/Column/Renderer/Blanknumber.php | 2 +- .../Report/Grid/Column/Renderer/Currency.php | 2 +- .../Report/Grid/Column/Renderer/Customer.php | 4 +- .../Report/Grid/Column/Renderer/Product.php | 4 +- .../Mage/Adminhtml/Block/Report/Product.php | 2 +- .../Block/Report/Product/Downloads.php | 2 +- .../Block/Report/Product/Downloads/Grid.php | 2 +- .../Product/Downloads/Renderer/Purchases.php | 2 +- .../Adminhtml/Block/Report/Product/Grid.php | 2 +- .../Block/Report/Product/Lowstock.php | 2 +- .../Block/Report/Product/Lowstock/Grid.php | 2 +- .../Block/Report/Product/Ordered.php | 7 +- .../Block/Report/Product/Ordered/Grid.php | 6 +- .../Adminhtml/Block/Report/Product/Sold.php | 2 +- .../Block/Report/Product/Sold/Grid.php | 2 +- .../Adminhtml/Block/Report/Product/Viewed.php | 2 +- .../Block/Report/Product/Viewed/Grid.php | 2 +- .../Block/Report/Refresh/Statistics.php | 2 +- .../Block/Report/Refresh/Statistics/Grid.php | 37 +- .../Block/Report/Review/Customer.php | 2 +- .../Block/Report/Review/Customer/Grid.php | 2 +- .../Adminhtml/Block/Report/Review/Detail.php | 2 +- .../Block/Report/Review/Detail/Grid.php | 4 +- .../Adminhtml/Block/Report/Review/Product.php | 2 +- .../Block/Report/Review/Product/Grid.php | 6 +- .../Block/Report/Sales/Bestsellers.php | 56 + .../Block/Report/Sales/Bestsellers/Grid.php | 96 + .../Adminhtml/Block/Report/Sales/Coupons.php | 2 +- .../Block/Report/Sales/Coupons/Grid.php | 58 +- .../Sales/Grid/Column/Renderer/Date.php | 2 +- .../Adminhtml/Block/Report/Sales/Invoiced.php | 4 +- .../Block/Report/Sales/Invoiced/Grid.php | 27 +- .../Adminhtml/Block/Report/Sales/Refunded.php | 2 +- .../Block/Report/Sales/Refunded/Grid.php | 25 +- .../Adminhtml/Block/Report/Sales/Sales.php | 2 +- .../Block/Report/Sales/Sales/Grid.php | 140 +- .../Adminhtml/Block/Report/Sales/Shipping.php | 2 +- .../Block/Report/Sales/Shipping/Grid.php | 24 +- .../Mage/Adminhtml/Block/Report/Sales/Tax.php | 2 +- .../Adminhtml/Block/Report/Sales/Tax/Grid.php | 11 +- .../Mage/Adminhtml/Block/Report/Search.php | 2 +- .../Adminhtml/Block/Report/Search/Grid.php | 2 +- .../Block/Report/Shopcart/Abandoned.php | 2 +- .../Block/Report/Shopcart/Abandoned/Grid.php | 13 +- .../Block/Report/Shopcart/Customer.php | 2 +- .../Block/Report/Shopcart/Customer/Grid.php | 2 +- .../Block/Report/Shopcart/Product.php | 2 +- .../Block/Report/Shopcart/Product/Grid.php | 2 +- .../Adminhtml/Block/Report/Tag/Customer.php | 2 +- .../Block/Report/Tag/Customer/Detail.php | 4 +- .../Block/Report/Tag/Customer/Detail/Grid.php | 4 +- .../Block/Report/Tag/Customer/Grid.php | 4 +- .../Adminhtml/Block/Report/Tag/Popular.php | 2 +- .../Block/Report/Tag/Popular/Detail.php | 2 +- .../Block/Report/Tag/Popular/Detail/Grid.php | 2 +- .../Block/Report/Tag/Popular/Grid.php | 26 +- .../Adminhtml/Block/Report/Tag/Product.php | 2 +- .../Block/Report/Tag/Product/Detail.php | 2 +- .../Block/Report/Tag/Product/Detail/Grid.php | 4 +- .../Block/Report/Tag/Product/Grid.php | 2 +- .../Mage/Adminhtml/Block/Report/Wishlist.php | 2 +- .../Adminhtml/Block/Report/Wishlist/Grid.php | 4 +- .../core/Mage/Adminhtml/Block/Review/Add.php | 4 +- .../Mage/Adminhtml/Block/Review/Add/Form.php | 2 +- .../core/Mage/Adminhtml/Block/Review/Edit.php | 2 +- .../Mage/Adminhtml/Block/Review/Edit/Form.php | 4 +- .../core/Mage/Adminhtml/Block/Review/Grid.php | 4 +- .../Block/Review/Grid/Filter/Type.php | 2 +- .../Block/Review/Grid/Renderer/Type.php | 2 +- .../core/Mage/Adminhtml/Block/Review/Main.php | 8 +- .../Adminhtml/Block/Review/Product/Grid.php | 4 +- .../Block/Review/Rating/Detailed.php | 2 +- .../Adminhtml/Block/Review/Rating/Summary.php | 2 +- app/code/core/Mage/Adminhtml/Block/Sales.php | 2 +- .../Mage/Adminhtml/Block/Sales/Creditmemo.php | 2 +- .../Adminhtml/Block/Sales/Creditmemo/Grid.php | 53 +- .../Mage/Adminhtml/Block/Sales/Invoice.php | 2 +- .../Adminhtml/Block/Sales/Invoice/Grid.php | 51 +- .../Adminhtml/Block/Sales/Items/Abstract.php | 4 +- .../Block/Sales/Items/Column/Default.php | 6 +- .../Block/Sales/Items/Column/Name.php | 2 +- .../Block/Sales/Items/Column/Name/Grouped.php | 2 +- .../Block/Sales/Items/Column/Qty.php | 2 +- .../Sales/Items/Renderer/Configurable.php | 2 +- .../Block/Sales/Items/Renderer/Default.php | 2 +- .../core/Mage/Adminhtml/Block/Sales/Order.php | 2 +- .../Adminhtml/Block/Sales/Order/Abstract.php | 21 +- .../Block/Sales/Order/Comments/View.php | 4 +- .../Adminhtml/Block/Sales/Order/Create.php | 2 +- .../Block/Sales/Order/Create/Abstract.php | 2 +- .../Sales/Order/Create/Billing/Address.php | 2 +- .../Sales/Order/Create/Billing/Method.php | 2 +- .../Order/Create/Billing/Method/Form.php | 2 +- .../Block/Sales/Order/Create/Comment.php | 2 +- .../Block/Sales/Order/Create/Coupons.php | 2 +- .../Block/Sales/Order/Create/Coupons/Form.php | 2 +- .../Block/Sales/Order/Create/Customer.php | 4 +- .../Sales/Order/Create/Customer/Grid.php | 2 +- .../Block/Sales/Order/Create/Data.php | 2 +- .../Block/Sales/Order/Create/Form.php | 2 +- .../Block/Sales/Order/Create/Form/Account.php | 2 +- .../Block/Sales/Order/Create/Form/Address.php | 2 +- .../Block/Sales/Order/Create/Giftmessage.php | 2 +- .../Sales/Order/Create/Giftmessage/Form.php | 2 +- .../Block/Sales/Order/Create/Header.php | 2 +- .../Block/Sales/Order/Create/Items.php | 2 +- .../Block/Sales/Order/Create/Items/Grid.php | 22 +- .../Block/Sales/Order/Create/Load.php | 4 +- .../Block/Sales/Order/Create/Messages.php | 2 +- .../Block/Sales/Order/Create/Newsletter.php | 2 +- .../Sales/Order/Create/Newsletter/Form.php | 2 +- .../Block/Sales/Order/Create/Search.php | 4 +- .../Block/Sales/Order/Create/Search/Grid.php | 6 +- .../Search/Grid/Renderer/Giftmessage.php | 2 +- .../Create/Search/Grid/Renderer/Price.php | 50 + .../Sales/Order/Create/Shipping/Address.php | 2 +- .../Sales/Order/Create/Shipping/Method.php | 2 +- .../Order/Create/Shipping/Method/Form.php | 2 +- .../Block/Sales/Order/Create/Sidebar.php | 2 +- .../Sales/Order/Create/Sidebar/Abstract.php | 2 +- .../Block/Sales/Order/Create/Sidebar/Cart.php | 2 +- .../Sales/Order/Create/Sidebar/Compared.php | 4 +- .../Sales/Order/Create/Sidebar/Pcompared.php | 2 +- .../Sales/Order/Create/Sidebar/Pviewed.php | 2 +- .../Sales/Order/Create/Sidebar/Reorder.php | 13 +- .../Sales/Order/Create/Sidebar/Viewed.php | 2 +- .../Sales/Order/Create/Sidebar/Wishlist.php | 2 +- .../Block/Sales/Order/Create/Store.php | 4 +- .../Block/Sales/Order/Create/Store/Select.php | 2 +- .../Block/Sales/Order/Create/Totals.php | 2 +- .../Sales/Order/Create/Totals/Default.php | 2 +- .../Sales/Order/Create/Totals/Discount.php | 2 +- .../Sales/Order/Create/Totals/Grandtotal.php | 2 +- .../Sales/Order/Create/Totals/Shipping.php | 2 +- .../Sales/Order/Create/Totals/Subtotal.php | 2 +- .../Block/Sales/Order/Create/Totals/Table.php | 2 +- .../Block/Sales/Order/Create/Totals/Tax.php | 2 +- .../Block/Sales/Order/Creditmemo/Create.php | 2 +- .../Order/Creditmemo/Create/Adjustments.php | 36 +- .../Sales/Order/Creditmemo/Create/Form.php | 2 +- .../Sales/Order/Creditmemo/Create/Items.php | 2 +- .../Block/Sales/Order/Creditmemo/Totals.php | 158 +- .../Block/Sales/Order/Creditmemo/View.php | 19 +- .../Sales/Order/Creditmemo/View/Comments.php | 2 +- .../Sales/Order/Creditmemo/View/Form.php | 2 +- .../Sales/Order/Creditmemo/View/Items.php | 2 +- .../Mage/Adminhtml/Block/Sales/Order/Grid.php | 105 +- .../Block/Sales/Order/Invoice/Create.php | 2 +- .../Block/Sales/Order/Invoice/Create/Form.php | 2 +- .../Sales/Order/Invoice/Create/Items.php | 2 +- .../Sales/Order/Invoice/Create/Tracking.php | 2 +- .../Block/Sales/Order/Invoice/Totals.php | 2 +- .../Block/Sales/Order/Invoice/View.php | 26 +- .../Sales/Order/Invoice/View/Comments.php | 2 +- .../Block/Sales/Order/Invoice/View/Form.php | 2 +- .../Block/Sales/Order/Invoice/View/Items.php | 2 +- .../Adminhtml/Block/Sales/Order/Payment.php | 4 +- .../Block/Sales/Order/Shipment/Create.php | 2 +- .../Sales/Order/Shipment/Create/Form.php | 2 +- .../Sales/Order/Shipment/Create/Items.php | 2 +- .../Sales/Order/Shipment/Create/Tracking.php | 2 +- .../Sales/Order/Shipment/Tracking/Info.php | 2 +- .../Block/Sales/Order/Shipment/View.php | 13 +- .../Sales/Order/Shipment/View/Comments.php | 2 +- .../Block/Sales/Order/Shipment/View/Form.php | 2 +- .../Block/Sales/Order/Shipment/View/Items.php | 2 +- .../Sales/Order/Shipment/View/Tracking.php | 2 +- .../Adminhtml/Block/Sales/Order/Totalbar.php | 4 +- .../Adminhtml/Block/Sales/Order/Totals.php | 2 +- .../Block/Sales/Order/Totals/Item.php | 2 +- .../Block/Sales/Order/Totals/Tax.php | 2 +- .../Mage/Adminhtml/Block/Sales/Order/View.php | 97 +- .../Adminhtml/Block/Sales/Order/View/Form.php | 2 +- .../Block/Sales/Order/View/Giftmessage.php | 2 +- .../Block/Sales/Order/View/History.php | 2 +- .../Adminhtml/Block/Sales/Order/View/Info.php | 4 +- .../Block/Sales/Order/View/Items.php | 4 +- .../Order/View/Items/Renderer/Default.php | 2 +- .../Block/Sales/Order/View/Messages.php | 16 +- .../Sales/Order/View/Tab/Creditmemos.php | 48 +- .../Block/Sales/Order/View/Tab/History.php | 11 +- .../Block/Sales/Order/View/Tab/Info.php | 2 +- .../Block/Sales/Order/View/Tab/Invoices.php | 40 +- .../Block/Sales/Order/View/Tab/Shipments.php | 28 +- .../Sales/Order/View/Tab/Transactions.php | 98 + .../Adminhtml/Block/Sales/Order/View/Tabs.php | 46 +- .../Block/Sales/Reorder/Renderer/Action.php | 2 +- .../Mage/Adminhtml/Block/Sales/Shipment.php | 2 +- .../Adminhtml/Block/Sales/Shipment/Grid.php | 50 +- .../Mage/Adminhtml/Block/Sales/Totals.php | 2 +- .../Adminhtml/Block/Sales/Transactions.php | 44 + .../Block/Sales/Transactions/Child/Grid.php | 86 + .../Block/Sales/Transactions/Detail.php | 115 + .../Block/Sales/Transactions/Detail/Grid.php | 100 + .../Block/Sales/Transactions/Grid.php | 159 + .../core/Mage/Adminhtml/Block/Sitemap.php | 2 +- .../Mage/Adminhtml/Block/Sitemap/Edit.php | 2 +- .../Adminhtml/Block/Sitemap/Edit/Form.php | 2 +- .../Mage/Adminhtml/Block/Sitemap/Grid.php | 2 +- .../Block/Sitemap/Grid/Renderer/Action.php | 2 +- .../Block/Sitemap/Grid/Renderer/Link.php | 2 +- .../Block/Sitemap/Grid/Renderer/Time.php | 2 +- .../Mage/Adminhtml/Block/Store/Switcher.php | 2 +- .../Adminhtml/Block/System/Account/Edit.php | 2 +- .../Block/System/Account/Edit/Form.php | 2 +- .../Adminhtml/Block/System/Cache/Edit.php | 6 +- .../Adminhtml/Block/System/Cache/Form.php | 2 +- .../Adminhtml/Block/System/Config/Dwstree.php | 2 +- .../Adminhtml/Block/System/Config/Edit.php | 3 +- .../Adminhtml/Block/System/Config/Form.php | 125 +- .../Block/System/Config/Form/Field.php | 10 +- .../Config/Form/Field/Array/Abstract.php | 53 +- .../System/Config/Form/Field/Datetime.php | 2 +- .../Block/System/Config/Form/Field/Export.php | 2 +- .../System/Config/Form/Field/Heading.php | 49 + .../Block/System/Config/Form/Field/Image.php | 2 +- .../Block/System/Config/Form/Field/Import.php | 2 +- .../System/Config/Form/Field/Notification.php | 2 +- .../Config/Form/Field/Regexceptions.php | 4 +- .../Form/Field/Select/Allowspecific.php | 2 +- .../Config/Form/Field/Select/Flatcatalog.php | 2 +- .../Config/Form/Field/Select/Flatproduct.php | 2 +- .../Block/System/Config/Form/Fieldset.php | 107 +- .../Form/Fieldset/Modules/DisableOutput.php | 2 +- .../Config/Form/Fieldset/Order/Statuses.php | 2 +- .../Block/System/Config/Switcher.php | 2 +- .../Adminhtml/Block/System/Config/Tabs.php | 2 +- .../Adminhtml/Block/System/Convert/Gui.php | 2 +- .../Block/System/Convert/Gui/Edit.php | 6 +- .../Block/System/Convert/Gui/Edit/Form.php | 2 +- .../System/Convert/Gui/Edit/Tab/Upload.php | 2 +- .../System/Convert/Gui/Edit/Tab/View.php | 2 +- .../System/Convert/Gui/Edit/Tab/Wizard.php | 2 +- .../Block/System/Convert/Gui/Edit/Tabs.php | 2 +- .../Block/System/Convert/Gui/Grid.php | 17 +- .../Block/System/Convert/Profile.php | 2 +- .../Block/System/Convert/Profile/Edit.php | 6 +- .../Convert/Profile/Edit/Filter/Action.php | 2 +- .../System/Convert/Profile/Edit/Form.php | 2 +- .../Convert/Profile/Edit/Renderer/Action.php | 2 +- .../System/Convert/Profile/Edit/Tab/Edit.php | 2 +- .../Convert/Profile/Edit/Tab/History.php | 6 +- .../System/Convert/Profile/Edit/Tab/Run.php | 4 +- .../System/Convert/Profile/Edit/Tabs.php | 2 +- .../Block/System/Convert/Profile/Grid.php | 17 +- .../Block/System/Convert/Profile/Run.php | 6 +- .../Mage/Adminhtml/Block/System/Currency.php | 2 +- .../Block/System/Currency/Edit/Form.php | 2 +- .../Block/System/Currency/Edit/Tab/Main.php | 2 +- .../Block/System/Currency/Edit/Tab/Rates.php | 2 +- .../Block/System/Currency/Edit/Tabs.php | 2 +- .../Block/System/Currency/Rate/Matrix.php | 2 +- .../Block/System/Currency/Rate/Services.php | 2 +- .../Mage/Adminhtml/Block/System/Design.php | 2 +- .../Adminhtml/Block/System/Design/Edit.php | 2 +- .../Block/System/Design/Edit/Tab/General.php | 2 +- .../Block/System/Design/Edit/Tabs.php | 2 +- .../Adminhtml/Block/System/Design/Grid.php | 4 +- .../Adminhtml/Block/System/Email/Template.php | 2 +- .../Block/System/Email/Template/Edit.php | 2 +- .../Block/System/Email/Template/Edit/Form.php | 6 +- .../Block/System/Email/Template/Grid.php | 2 +- .../Email/Template/Grid/Filter/Type.php | 2 +- .../Email/Template/Grid/Renderer/Action.php | 2 +- .../Email/Template/Grid/Renderer/Sender.php | 2 +- .../Email/Template/Grid/Renderer/Type.php | 2 +- .../Block/System/Email/Template/Preview.php | 2 +- .../Adminhtml/Block/System/Store/Delete.php | 2 +- .../Block/System/Store/Delete/Form.php | 4 +- .../Block/System/Store/Delete/Group.php | 2 +- .../Block/System/Store/Delete/Website.php | 2 +- .../Adminhtml/Block/System/Store/Edit.php | 2 +- .../Block/System/Store/Edit/Form.php | 8 +- .../Adminhtml/Block/System/Store/Grid.php | 2 +- .../Block/System/Store/Grid/Render/Group.php | 2 +- .../Block/System/Store/Grid/Render/Store.php | 2 +- .../System/Store/Grid/Render/Website.php | 2 +- .../Adminhtml/Block/System/Store/Store.php | 2 +- .../Mage/Adminhtml/Block/System/Variable.php | 2 +- .../Adminhtml/Block/System/Variable/Edit.php | 2 +- .../Block/System/Variable/Edit/Form.php | 2 +- .../Adminhtml/Block/System/Variable/Grid.php | 2 +- app/code/core/Mage/Adminhtml/Block/Tag.php | 2 +- .../Adminhtml/Block/Tag/Assigned/Grid.php | 4 +- .../Mage/Adminhtml/Block/Tag/Customer.php | 2 +- .../Adminhtml/Block/Tag/Customer/Grid.php | 2 +- .../core/Mage/Adminhtml/Block/Tag/Edit.php | 4 +- .../Adminhtml/Block/Tag/Edit/Accordion.php | 2 +- .../Adminhtml/Block/Tag/Edit/Assigned.php | 2 +- .../Mage/Adminhtml/Block/Tag/Edit/Form.php | 2 +- .../Mage/Adminhtml/Block/Tag/Grid/All.php | 2 +- .../Adminhtml/Block/Tag/Grid/Customers.php | 2 +- .../Mage/Adminhtml/Block/Tag/Grid/Pending.php | 19 +- .../Adminhtml/Block/Tag/Grid/Products.php | 2 +- .../core/Mage/Adminhtml/Block/Tag/Pending.php | 2 +- .../core/Mage/Adminhtml/Block/Tag/Product.php | 2 +- .../Mage/Adminhtml/Block/Tag/Product/Grid.php | 2 +- .../Adminhtml/Block/Tag/Store/Switcher.php | 2 +- .../core/Mage/Adminhtml/Block/Tag/Tag.php | 2 +- .../Mage/Adminhtml/Block/Tag/Tag/Edit.php | 2 +- .../Adminhtml/Block/Tag/Tag/Edit/Form.php | 2 +- .../Mage/Adminhtml/Block/Tag/Tag/Grid.php | 20 +- .../core/Mage/Adminhtml/Block/Tax/Class.php | 2 +- .../Mage/Adminhtml/Block/Tax/Class/Edit.php | 2 +- .../Adminhtml/Block/Tax/Class/Edit/Form.php | 2 +- .../Mage/Adminhtml/Block/Tax/Class/Grid.php | 2 +- .../Mage/Adminhtml/Block/Tax/Rate/Form.php | 23 +- .../Mage/Adminhtml/Block/Tax/Rate/Grid.php | 2 +- .../Block/Tax/Rate/Grid/Renderer/Country.php | 2 +- .../Block/Tax/Rate/Grid/Renderer/Data.php | 2 +- .../Adminhtml/Block/Tax/Rate/ImportExport.php | 2 +- .../Mage/Adminhtml/Block/Tax/Rate/Title.php | 2 +- .../Block/Tax/Rate/Title/Fieldset.php | 2 +- .../Adminhtml/Block/Tax/Rate/Toolbar/Add.php | 2 +- .../Adminhtml/Block/Tax/Rate/Toolbar/Save.php | 2 +- .../core/Mage/Adminhtml/Block/Tax/Rule.php | 2 +- .../Mage/Adminhtml/Block/Tax/Rule/Edit.php | 4 +- .../Adminhtml/Block/Tax/Rule/Edit/Form.php | 2 +- .../Mage/Adminhtml/Block/Tax/Rule/Grid.php | 2 +- .../core/Mage/Adminhtml/Block/Template.php | 2 +- .../core/Mage/Adminhtml/Block/Text/List.php | 2 +- .../core/Mage/Adminhtml/Block/Urlrewrite.php | 2 +- .../Block/Urlrewrite/Category/Tree.php | 2 +- .../Mage/Adminhtml/Block/Urlrewrite/Edit.php | 4 +- .../Adminhtml/Block/Urlrewrite/Edit/Form.php | 2 +- .../Mage/Adminhtml/Block/Urlrewrite/Grid.php | 2 +- .../Mage/Adminhtml/Block/Urlrewrite/Link.php | 2 +- .../Block/Urlrewrite/Product/Grid.php | 2 +- .../Adminhtml/Block/Urlrewrite/Selector.php | 2 +- app/code/core/Mage/Adminhtml/Block/Widget.php | 2 +- .../Mage/Adminhtml/Block/Widget/Accordion.php | 2 +- .../Adminhtml/Block/Widget/Accordion/Item.php | 2 +- .../Adminhtml/Block/Widget/Breadcrumbs.php | 2 +- .../Mage/Adminhtml/Block/Widget/Button.php | 2 +- .../Mage/Adminhtml/Block/Widget/Container.php | 2 +- .../core/Mage/Adminhtml/Block/Widget/Form.php | 2 +- .../Adminhtml/Block/Widget/Form/Container.php | 2 +- .../Adminhtml/Block/Widget/Form/Element.php | 2 +- .../Block/Widget/Form/Element/Dependence.php | 25 +- .../Block/Widget/Form/Element/Gallery.php | 2 +- .../Block/Widget/Form/Renderer/Element.php | 2 +- .../Block/Widget/Form/Renderer/Fieldset.php | 2 +- .../Widget/Form/Renderer/Fieldset/Element.php | 2 +- .../core/Mage/Adminhtml/Block/Widget/Grid.php | 4 +- .../Adminhtml/Block/Widget/Grid/Block.php | 2 +- .../Adminhtml/Block/Widget/Grid/Column.php | 2 +- .../Widget/Grid/Column/Filter/Abstract.php | 2 +- .../Widget/Grid/Column/Filter/Checkbox.php | 2 +- .../Widget/Grid/Column/Filter/Country.php | 4 +- .../Block/Widget/Grid/Column/Filter/Date.php | 25 +- .../Widget/Grid/Column/Filter/Datetime.php | 2 +- .../Widget/Grid/Column/Filter/Interface.php | 2 +- .../Widget/Grid/Column/Filter/Massaction.php | 2 +- .../Block/Widget/Grid/Column/Filter/Price.php | 2 +- .../Block/Widget/Grid/Column/Filter/Radio.php | 2 +- .../Block/Widget/Grid/Column/Filter/Range.php | 2 +- .../Widget/Grid/Column/Filter/Select.php | 38 +- .../Block/Widget/Grid/Column/Filter/Store.php | 2 +- .../Block/Widget/Grid/Column/Filter/Text.php | 2 +- .../Block/Widget/Grid/Column/Filter/Theme.php | 2 +- .../Widget/Grid/Column/Renderer/Abstract.php | 2 +- .../Widget/Grid/Column/Renderer/Action.php | 4 +- .../Widget/Grid/Column/Renderer/Checkbox.php | 2 +- .../Widget/Grid/Column/Renderer/Concat.php | 2 +- .../Widget/Grid/Column/Renderer/Country.php | 2 +- .../Widget/Grid/Column/Renderer/Currency.php | 2 +- .../Widget/Grid/Column/Renderer/Date.php | 2 +- .../Widget/Grid/Column/Renderer/Datetime.php | 2 +- .../Widget/Grid/Column/Renderer/Input.php | 2 +- .../Widget/Grid/Column/Renderer/Interface.php | 2 +- .../Block/Widget/Grid/Column/Renderer/Ip.php | 2 +- .../Widget/Grid/Column/Renderer/Longtext.php | 2 +- .../Grid/Column/Renderer/Massaction.php | 2 +- .../Widget/Grid/Column/Renderer/Number.php | 2 +- .../Widget/Grid/Column/Renderer/Options.php | 2 +- .../Widget/Grid/Column/Renderer/Price.php | 2 +- .../Widget/Grid/Column/Renderer/Radio.php | 2 +- .../Widget/Grid/Column/Renderer/Select.php | 4 +- .../Widget/Grid/Column/Renderer/Store.php | 24 +- .../Widget/Grid/Column/Renderer/Text.php | 2 +- .../Widget/Grid/Column/Renderer/Theme.php | 2 +- .../Widget/Grid/Column/Renderer/Wrapline.php | 2 +- .../Adminhtml/Block/Widget/Grid/Container.php | 2 +- .../Block/Widget/Grid/Massaction.php | 2 +- .../Block/Widget/Grid/Massaction/Abstract.php | 33 +- .../Block/Widget/Grid/Massaction/Item.php | 2 +- .../Massaction/Item/Additional/Default.php | 2 +- .../Massaction/Item/Additional/Interface.php | 2 +- .../Block/Widget/Grid/Serializer.php | 2 +- .../Adminhtml/Block/Widget/Tab/Interface.php | 2 +- .../core/Mage/Adminhtml/Block/Widget/Tabs.php | 10 +- .../core/Mage/Adminhtml/Block/Widget/Tree.php | 2 +- .../Adminhtml/Block/Widget/View/Container.php | 2 +- .../core/Mage/Adminhtml/Controller/Action.php | 2 +- .../Adminhtml/Controller/Sales/Creditmemo.php | 4 +- .../Adminhtml/Controller/Sales/Invoice.php | 4 +- .../Adminhtml/Controller/Sales/Shipment.php | 2 +- app/code/core/Mage/Adminhtml/Exception.php | 2 +- .../core/Mage/Adminhtml/Helper/Catalog.php | 2 +- .../Catalog/Product/Edit/Action/Attribute.php | 2 +- .../Adminhtml/Helper/Dashboard/Abstract.php | 2 +- .../Mage/Adminhtml/Helper/Dashboard/Data.php | 6 +- .../Mage/Adminhtml/Helper/Dashboard/Order.php | 14 +- app/code/core/Mage/Adminhtml/Helper/Data.php | 2 +- app/code/core/Mage/Adminhtml/Helper/Js.php | 2 +- .../core/Mage/Adminhtml/Helper/Media/Js.php | 2 +- app/code/core/Mage/Adminhtml/Helper/Rss.php | 2 +- app/code/core/Mage/Adminhtml/Helper/Sales.php | 28 +- app/code/core/Mage/Adminhtml/Model/Config.php | 4 +- .../core/Mage/Adminhtml/Model/Config/Data.php | 69 +- .../Model/Customer/Renderer/Region.php | 2 +- .../Mage/Adminhtml/Model/Email/Template.php | 2 +- .../core/Mage/Adminhtml/Model/Extension.php | 4 +- .../Mage/Adminhtml/Model/Giftmessage/Save.php | 2 +- .../Model/Newsletter/Renderer/Text.php | 2 +- .../core/Mage/Adminhtml/Model/Observer.php | 2 +- .../core/Mage/Adminhtml/Model/Report/Item.php | 2 +- .../core/Mage/Adminhtml/Model/Sales/Order.php | 8 +- .../Adminhtml/Model/Sales/Order/Create.php | 45 +- .../Adminhtml/Model/Sales/Order/Random.php | 2 +- .../Mage/Adminhtml/Model/Search/Catalog.php | 2 +- .../Mage/Adminhtml/Model/Search/Customer.php | 2 +- .../Mage/Adminhtml/Model/Search/Order.php | 17 +- .../core/Mage/Adminhtml/Model/Session.php | 2 +- .../Mage/Adminhtml/Model/Session/Quote.php | 2 +- .../System/Config/Backend/Admin/Custom.php | 2 +- .../System/Config/Backend/Admin/Usecustom.php | 4 +- .../Config/Backend/Admin/Usesecretkey.php | 2 +- .../Model/System/Config/Backend/Baseurl.php | 21 +- .../Model/System/Config/Backend/Cache.php | 2 +- .../Backend/Catalog/Inventory/Managestock.php | 2 +- .../Config/Backend/Catalog/Search/Type.php | 2 +- .../Model/System/Config/Backend/Category.php | 2 +- .../Config/Backend/Currency/Abstract.php | 2 +- .../System/Config/Backend/Currency/Allow.php | 6 +- .../System/Config/Backend/Currency/Base.php | 4 +- .../System/Config/Backend/Currency/Cron.php | 4 +- .../Config/Backend/Currency/Default.php | 6 +- .../Model/System/Config/Backend/Datashare.php | 2 +- .../System/Config/Backend/Design/Package.php | 2 +- .../System/Config/Backend/Email/Address.php | 4 +- .../System/Config/Backend/Email/Sender.php | 2 +- .../Model/System/Config/Backend/Encrypted.php | 2 +- .../Model/System/Config/Backend/Image.php | 4 +- .../Model/System/Config/Backend/Image/Pdf.php | 2 +- .../System/Config/Backend/Layer/Children.php | 2 +- .../Model/System/Config/Backend/Locale.php | 4 +- .../Model/System/Config/Backend/Log/Cron.php | 4 +- .../System/Config/Backend/Price/Scope.php | 2 +- .../Config/Backend/Product/Alert/Cron.php | 4 +- .../System/Config/Backend/Seo/Product.php | 2 +- .../System/Config/Backend/Serialized.php | 2 +- .../Config/Backend/Serialized/Array.php | 2 +- .../Config/Backend/Shipping/Tablerate.php | 2 +- .../Model/System/Config/Backend/Sitemap.php | 6 +- .../System/Config/Backend/Sitemap/Cron.php | 4 +- .../Model/System/Config/Backend/Store.php | 2 +- .../Model/System/Config/Clone/Media/Image.php | 2 +- .../Model/System/Config/Source/Admin/Page.php | 7 +- .../Model/System/Config/Source/Allregion.php | 2 +- .../Config/Source/Catalog/GridPerPage.php | 2 +- .../System/Config/Source/Catalog/ListMode.php | 6 +- .../Config/Source/Catalog/ListPerPage.php | 2 +- .../System/Config/Source/Catalog/ListSort.php | 2 +- .../Config/Source/Catalog/Search/Type.php | 2 +- .../Config/Source/Catalog/TimeFormat.php | 2 +- .../Model/System/Config/Source/Category.php | 4 +- .../Model/System/Config/Source/Checktype.php | 4 +- .../Model/System/Config/Source/Cms/Page.php | 4 +- .../Config/Source/Cms/Wysiwyg/Enabled.php | 2 +- .../Model/System/Config/Source/Country.php | 2 +- .../System/Config/Source/Country/Full.php | 2 +- .../System/Config/Source/Cron/Frequency.php | 2 +- .../Model/System/Config/Source/Currency.php | 2 +- .../System/Config/Source/Currency/Service.php | 2 +- .../System/Config/Source/Customer/Group.php | 2 +- .../Model/System/Config/Source/Date/Short.php | 2 +- .../System/Config/Source/Design/Package.php | 2 +- .../System/Config/Source/Design/Robots.php | 2 +- .../System/Config/Source/Dev/Dbautoup.php | 4 +- .../System/Config/Source/Email/Identity.php | 2 +- .../System/Config/Source/Email/Method.php | 4 +- .../System/Config/Source/Email/Smtpauth.php | 2 +- .../System/Config/Source/Email/Template.php | 2 +- .../System/Config/Source/Enabledisable.php | 2 +- .../Model/System/Config/Source/Frequency.php | 2 +- .../Model/System/Config/Source/Language.php | 2 +- .../Model/System/Config/Source/Locale.php | 2 +- .../System/Config/Source/Locale/Country.php | 2 +- .../System/Config/Source/Locale/Currency.php | 2 +- .../Config/Source/Locale/Currency/All.php | 2 +- .../System/Config/Source/Locale/Timezone.php | 2 +- .../System/Config/Source/Locale/Weekdays.php | 2 +- .../Model/System/Config/Source/Nooptreq.php | 2 +- .../Config/Source/Notification/Frequency.php | 2 +- .../System/Config/Source/Order/Status.php | 2 +- .../System/Config/Source/Order/Status/New.php | 2 +- .../Source/Order/Status/Newprocessing.php | 2 +- .../Config/Source/Order/Status/Processing.php | 2 +- .../Config/Source/Payment/Allmethods.php | 2 +- .../Config/Source/Payment/Allowedmethods.php | 2 +- .../Source/Payment/Allspecificcountries.php | 2 +- .../System/Config/Source/Payment/Cctype.php | 2 +- .../System/Config/Source/Price/Scope.php | 2 +- .../Config/Source/Product/Options/Price.php | 2 +- .../Config/Source/Product/Options/Type.php | 2 +- .../Config/Source/Product/Thumbnail.php | 2 +- .../System/Config/Source/Reports/Scope.php | 2 +- .../Config/Source/Shipping/Allmethods.php | 2 +- .../Config/Source/Shipping/Allowedmethods.php | 2 +- .../Source/Shipping/Allspecificcountries.php | 2 +- .../Config/Source/Shipping/Flatrate.php | 2 +- .../Config/Source/Shipping/Tablerate.php | 2 +- .../Config/Source/Shipping/Taxclass.php | 2 +- .../Model/System/Config/Source/Store.php | 2 +- .../System/Config/Source/Tax/Apply/On.php | 2 +- .../System/Config/Source/Tax/Basedon.php | 8 +- .../System/Config/Source/Tax/Catalog.php | 2 +- .../Config/Source/Watermark/Position.php | 2 +- .../System/Config/Source/Web/Protocol.php | 2 +- .../Model/System/Config/Source/Website.php | 2 +- .../Model/System/Config/Source/Yesno.php | 2 +- .../System/Config/Source/Yesnocustom.php | 2 +- .../Mage/Adminhtml/Model/System/Store.php | 2 +- app/code/core/Mage/Adminhtml/Model/Url.php | 2 +- .../controllers/Api/RoleController.php | 14 +- .../controllers/Api/UserController.php | 12 +- .../Adminhtml/controllers/CacheController.php | 14 +- .../Catalog/Category/WidgetController.php | 2 +- .../Catalog/CategoryController.php | 44 +- .../Product/Action/AttributeController.php | 8 +- .../Catalog/Product/AttributeController.php | 14 +- .../Catalog/Product/DatafeedsController.php | 2 +- .../Catalog/Product/GalleryController.php | 2 +- .../Catalog/Product/GroupController.php | 6 +- .../Catalog/Product/ReviewController.php | 28 +- .../Catalog/Product/SetController.php | 12 +- .../Catalog/Product/WidgetController.php | 2 +- .../controllers/Catalog/ProductController.php | 90 +- .../controllers/Catalog/SearchController.php | 16 +- .../controllers/CatalogController.php | 2 +- .../Checkout/AgreementController.php | 14 +- .../Cms/Block/WidgetController.php | 2 +- .../controllers/Cms/BlockController.php | 12 +- .../controllers/Cms/Page/WidgetController.php | 2 +- .../controllers/Cms/PageController.php | 26 +- .../Cms/Wysiwyg/ImagesController.php | 19 +- .../controllers/Cms/WysiwygController.php | 7 +- .../controllers/Customer/ConfigController.php | 2 +- .../controllers/Customer/GroupController.php | 6 +- .../controllers/Customer/OnlineController.php | 2 +- .../controllers/CustomerController.php | 28 +- .../controllers/DashboardController.php | 2 +- .../Adminhtml/controllers/IndexController.php | 22 +- .../Adminhtml/controllers/JsonController.php | 2 +- .../controllers/Media/EditorController.php | 2 +- .../controllers/Media/UploaderController.php | 2 +- .../Newsletter/ProblemController.php | 6 +- .../Newsletter/QueueController.php | 2 +- .../Newsletter/SubscriberController.php | 4 +- .../Newsletter/TemplateController.php | 6 +- .../controllers/NotificationController.php | 25 +- .../Permissions/RoleController.php | 18 +- .../Permissions/UserController.php | 14 +- .../controllers/Poll/AnswerController.php | 8 +- .../Adminhtml/controllers/PollController.php | 14 +- .../controllers/Promo/CatalogController.php | 24 +- .../controllers/Promo/QuoteController.php | 35 +- .../controllers/Promo/WidgetController.php | 2 +- .../Adminhtml/controllers/PromoController.php | 2 +- .../controllers/RatingController.php | 6 +- .../controllers/Report/CustomerController.php | 12 +- .../controllers/Report/ProductController.php | 34 +- .../controllers/Report/ReviewController.php | 2 +- .../controllers/Report/SalesController.php | 169 +- .../controllers/Report/ShopcartController.php | 4 +- .../Report/StatisticsController.php | 204 + .../controllers/Report/TagController.php | 29 +- .../controllers/ReportController.php | 2 +- .../controllers/Rss/CatalogController.php | 2 +- .../controllers/Rss/OrderController.php | 2 +- .../Sales/Billing/AgreementController.php | 219 + .../Sales/CreditmemoController.php | 21 +- .../controllers/Sales/InvoiceController.php | 20 +- .../Sales/Order/CreateController.php | 7 +- .../Sales/Order/CreditmemoController.php | 279 +- .../Sales/Order/EditController.php | 2 +- .../Sales/Order/InvoiceController.php | 244 +- .../Sales/Order/ShipmentController.php | 168 +- .../Order/View/GiftmessageController.php | 6 +- .../controllers/Sales/OrderController.php | 148 +- .../Sales/Recurring/ProfileController.php | 176 + .../controllers/Sales/ShipmentController.php | 20 +- .../Sales/TransactionsController.php | 140 + .../Adminhtml/controllers/SalesController.php | 2 +- .../controllers/SitemapController.php | 16 +- .../controllers/SurveyController.php | 2 +- .../controllers/System/AccountController.php | 6 +- .../controllers/System/BackupController.php | 8 +- .../controllers/System/CacheController.php | 58 +- .../controllers/System/ConfigController.php | 11 +- .../System/Convert/GuiController.php | 2 +- .../System/Convert/ProfileController.php | 10 +- .../controllers/System/CurrencyController.php | 8 +- .../controllers/System/DesignController.php | 8 +- .../System/Email/TemplateController.php | 10 +- .../controllers/System/StoreController.php | 52 +- .../controllers/System/VariableController.php | 6 +- .../controllers/SystemController.php | 2 +- .../Adminhtml/controllers/TagController.php | 33 +- .../Tax/Class/CustomerController.php | 6 +- .../Tax/Class/ProductController.php | 6 +- .../controllers/Tax/ClassController.php | 6 +- .../controllers/Tax/RateController.php | 14 +- .../controllers/Tax/RuleController.php | 12 +- .../controllers/UrlrewriteController.php | 30 +- .../core/Mage/Adminhtml/etc/adminhtml.xml | 2 +- app/code/core/Mage/Adminhtml/etc/config.xml | 5 +- app/code/core/Mage/Api/Controller/Action.php | 2 +- app/code/core/Mage/Api/Exception.php | 2 +- app/code/core/Mage/Api/Helper/Data.php | 2 +- app/code/core/Mage/Api/Model/Acl.php | 2 +- .../core/Mage/Api/Model/Acl/Assert/Ip.php | 2 +- .../core/Mage/Api/Model/Acl/Assert/Time.php | 2 +- app/code/core/Mage/Api/Model/Acl/Resource.php | 2 +- app/code/core/Mage/Api/Model/Acl/Role.php | 2 +- .../core/Mage/Api/Model/Acl/Role/Generic.php | 2 +- .../core/Mage/Api/Model/Acl/Role/Group.php | 2 +- .../core/Mage/Api/Model/Acl/Role/Registry.php | 2 +- .../core/Mage/Api/Model/Acl/Role/User.php | 2 +- app/code/core/Mage/Api/Model/Config.php | 2 +- app/code/core/Mage/Api/Model/Mysql4/Acl.php | 2 +- .../core/Mage/Api/Model/Mysql4/Acl/Role.php | 2 +- .../Api/Model/Mysql4/Acl/Role/Collection.php | 2 +- .../Model/Mysql4/Permissions/Collection.php | 2 +- app/code/core/Mage/Api/Model/Mysql4/Role.php | 2 +- .../Mage/Api/Model/Mysql4/Role/Collection.php | 2 +- app/code/core/Mage/Api/Model/Mysql4/Roles.php | 2 +- .../Api/Model/Mysql4/Roles/Collection.php | 2 +- .../Model/Mysql4/Roles/User/Collection.php | 2 +- app/code/core/Mage/Api/Model/Mysql4/Rules.php | 2 +- .../Api/Model/Mysql4/Rules/Collection.php | 2 +- app/code/core/Mage/Api/Model/Mysql4/User.php | 2 +- .../Mage/Api/Model/Mysql4/User/Collection.php | 2 +- .../core/Mage/Api/Model/Resource/Abstract.php | 2 +- app/code/core/Mage/Api/Model/Role.php | 2 +- app/code/core/Mage/Api/Model/Roles.php | 2 +- app/code/core/Mage/Api/Model/Rules.php | 2 +- app/code/core/Mage/Api/Model/Server.php | 8 +- .../Api/Model/Server/Adapter/Interface.php | 2 +- .../Mage/Api/Model/Server/Adapter/Soap.php | 3 +- .../Mage/Api/Model/Server/Adapter/Xmlrpc.php | 2 +- .../core/Mage/Api/Model/Server/Handler.php | 2 +- .../Api/Model/Server/Handler/Abstract.php | 2 +- .../Mage/Api/Model/Server/V2/Adapter/Soap.php | 2 +- .../core/Mage/Api/Model/Server/V2/Handler.php | 2 +- app/code/core/Mage/Api/Model/Session.php | 6 +- app/code/core/Mage/Api/Model/User.php | 2 +- app/code/core/Mage/Api/Model/Wsdl/Config.php | 2 +- .../core/Mage/Api/Model/Wsdl/Config/Base.php | 2 +- .../Mage/Api/Model/Wsdl/Config/Element.php | 2 +- .../Mage/Api/controllers/IndexController.php | 2 +- .../Mage/Api/controllers/SoapController.php | 2 +- .../Api/controllers/V2/SoapController.php | 2 +- .../Mage/Api/controllers/XmlrpcController.php | 2 +- app/code/core/Mage/Api/etc/adminhtml.xml | 2 +- app/code/core/Mage/Api/etc/api.xml | 2 +- app/code/core/Mage/Api/etc/config.xml | 2 +- app/code/core/Mage/Api/etc/system.xml | 4 +- .../sql/api_setup/mysql4-install-0.7.0.php | 2 +- .../api_setup/mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../api_setup/mysql4-upgrade-0.8.0-0.8.1.php | 2 +- app/code/core/Mage/Backup/Exception.php | 2 +- app/code/core/Mage/Backup/Helper/Data.php | 2 +- app/code/core/Mage/Backup/Model/Backup.php | 26 +- app/code/core/Mage/Backup/Model/Db.php | 2 +- .../core/Mage/Backup/Model/Fs/Collection.php | 2 +- app/code/core/Mage/Backup/Model/Mysql4/Db.php | 2 +- app/code/core/Mage/Backup/etc/adminhtml.xml | 2 +- app/code/core/Mage/Backup/etc/config.xml | 2 +- .../Catalog/Product/Edit/Tab/Attributes.php | 2 +- .../Product/Edit/Tab/Attributes/Extend.php | 4 +- .../Product/Edit/Tab/Attributes/Special.php | 2 +- .../Catalog/Product/Edit/Tab/Bundle.php | 2 +- .../Product/Edit/Tab/Bundle/Option.php | 2 +- .../Product/Edit/Tab/Bundle/Option/Search.php | 4 +- .../Edit/Tab/Bundle/Option/Search/Grid.php | 4 +- .../Edit/Tab/Bundle/Option/Selection.php | 2 +- .../Adminhtml/Catalog/Product/Edit/Tabs.php | 2 +- .../Adminhtml/Sales/Order/Items/Renderer.php | 2 +- .../Sales/Order/View/Items/Renderer.php | 2 +- .../Block/Catalog/Product/List/Partof.php | 2 +- .../Bundle/Block/Catalog/Product/Price.php | 2 +- .../Bundle/Block/Catalog/Product/View.php | 2 +- .../Catalog/Product/View/Type/Bundle.php | 4 +- .../Product/View/Type/Bundle/Option.php | 2 +- .../View/Type/Bundle/Option/Checkbox.php | 2 +- .../Product/View/Type/Bundle/Option/Multi.php | 2 +- .../Product/View/Type/Bundle/Option/Radio.php | 2 +- .../View/Type/Bundle/Option/Select.php | 2 +- .../Block/Checkout/Cart/Item/Renderer.php | 2 +- .../Block/Sales/Order/Items/Renderer.php | 2 +- app/code/core/Mage/Bundle/Helper/Data.php | 2 +- .../Bundle/Model/CatalogIndex/Data/Bundle.php | 2 +- .../core/Mage/Bundle/Model/Mysql4/Bundle.php | 2 +- .../Bundle/Model/Mysql4/Indexer/Price.php | 106 +- .../Bundle/Model/Mysql4/Indexer/Stock.php | 3 +- .../core/Mage/Bundle/Model/Mysql4/Option.php | 2 +- .../Bundle/Model/Mysql4/Option/Collection.php | 2 +- .../Mage/Bundle/Model/Mysql4/Price/Index.php | 2 +- .../Mage/Bundle/Model/Mysql4/Selection.php | 2 +- .../Model/Mysql4/Selection/Collection.php | 2 +- app/code/core/Mage/Bundle/Model/Observer.php | 2 +- app/code/core/Mage/Bundle/Model/Option.php | 2 +- .../core/Mage/Bundle/Model/Price/Index.php | 2 +- .../Product/Attribute/Source/Price/View.php | 4 +- .../core/Mage/Bundle/Model/Product/Price.php | 4 +- .../core/Mage/Bundle/Model/Product/Type.php | 58 +- .../Model/Sales/Order/Pdf/Items/Abstract.php | 2 +- .../Sales/Order/Pdf/Items/Creditmemo.php | 2 +- .../Model/Sales/Order/Pdf/Items/Invoice.php | 2 +- .../Model/Sales/Order/Pdf/Items/Shipment.php | 2 +- app/code/core/Mage/Bundle/Model/Selection.php | 2 +- .../Source/Option/Selection/Price/Type.php | 2 +- .../Mage/Bundle/Model/Source/Option/Type.php | 2 +- .../controllers/Product/EditController.php | 2 +- .../controllers/SelectionController.php | 2 +- app/code/core/Mage/Bundle/etc/config.xml | 22 +- .../sql/bundle_setup/mysql4-install-0.1.0.php | 2 +- .../mysql4-upgrade-0.1.0-0.1.1.php | 2 +- .../mysql4-upgrade-0.1.1-0.1.2.php | 2 +- .../mysql4-upgrade-0.1.10-0.1.11.php | 2 +- .../mysql4-upgrade-0.1.11-0.1.12.php | 126 + .../mysql4-upgrade-0.1.2-0.1.3.php | 2 +- .../mysql4-upgrade-0.1.3-0.1.4.php | 2 +- .../mysql4-upgrade-0.1.4-0.1.5.php | 2 +- .../mysql4-upgrade-0.1.5-0.1.6.php | 2 +- .../mysql4-upgrade-0.1.6-0.1.7.php | 2 +- .../mysql4-upgrade-0.1.7-0.1.8.php | 2 +- .../mysql4-upgrade-0.1.8-0.1.9.php | 2 +- .../mysql4-upgrade-0.1.9-0.1.10.php | 2 +- .../core/Mage/Catalog/Block/Breadcrumbs.php | 2 +- .../core/Mage/Catalog/Block/Category/View.php | 2 +- .../Catalog/Block/Category/Widget/Link.php | 2 +- .../Catalog/Block/Layer/Filter/Abstract.php | 4 +- .../Catalog/Block/Layer/Filter/Attribute.php | 2 +- .../Catalog/Block/Layer/Filter/Category.php | 2 +- .../Catalog/Block/Layer/Filter/Decimal.php | 2 +- .../Mage/Catalog/Block/Layer/Filter/Price.php | 2 +- .../core/Mage/Catalog/Block/Layer/State.php | 2 +- .../core/Mage/Catalog/Block/Layer/View.php | 2 +- .../core/Mage/Catalog/Block/Navigation.php | 212 +- app/code/core/Mage/Catalog/Block/Product.php | 2 +- .../Mage/Catalog/Block/Product/Abstract.php | 4 +- .../Block/Product/Compare/Abstract.php | 2 +- .../Catalog/Block/Product/Compare/List.php | 4 +- .../Catalog/Block/Product/Compare/Sidebar.php | 2 +- .../Mage/Catalog/Block/Product/Gallery.php | 2 +- .../core/Mage/Catalog/Block/Product/List.php | 5 +- .../Catalog/Block/Product/List/Crosssell.php | 2 +- .../Catalog/Block/Product/List/Promotion.php | 2 +- .../Catalog/Block/Product/List/Random.php | 2 +- .../Catalog/Block/Product/List/Related.php | 2 +- .../Catalog/Block/Product/List/Toolbar.php | 2 +- .../Catalog/Block/Product/List/Upsell.php | 2 +- .../core/Mage/Catalog/Block/Product/New.php | 23 +- .../core/Mage/Catalog/Block/Product/Price.php | 2 +- .../Catalog/Block/Product/Price/Template.php | 2 +- .../core/Mage/Catalog/Block/Product/Send.php | 2 +- .../core/Mage/Catalog/Block/Product/View.php | 2 +- .../Catalog/Block/Product/View/Abstract.php | 2 +- .../Catalog/Block/Product/View/Additional.php | 4 +- .../Catalog/Block/Product/View/Attributes.php | 4 +- .../Block/Product/View/Description.php | 2 +- .../Mage/Catalog/Block/Product/View/Media.php | 2 +- .../Catalog/Block/Product/View/Options.php | 2 +- .../Block/Product/View/Options/Abstract.php | 2 +- .../Block/Product/View/Options/Type/Date.php | 2 +- .../Product/View/Options/Type/Default.php | 2 +- .../Block/Product/View/Options/Type/File.php | 2 +- .../Product/View/Options/Type/Select.php | 2 +- .../Block/Product/View/Options/Type/Text.php | 2 +- .../Mage/Catalog/Block/Product/View/Price.php | 2 +- .../Mage/Catalog/Block/Product/View/Tabs.php | 2 +- .../Block/Product/View/Type/Configurable.php | 2 +- .../Block/Product/View/Type/Grouped.php | 2 +- .../Block/Product/View/Type/Simple.php | 2 +- .../Block/Product/View/Type/Virtual.php | 2 +- .../Catalog/Block/Product/Widget/Link.php | 2 +- .../Mage/Catalog/Block/Product/Widget/New.php | 2 +- .../Catalog/Block/Seo/Sitemap/Abstract.php | 2 +- .../Catalog/Block/Seo/Sitemap/Category.php | 2 +- .../Catalog/Block/Seo/Sitemap/Product.php | 2 +- .../Block/Seo/Sitemap/Tree/Category.php | 2 +- .../Catalog/Block/Seo/Sitemap/Tree/Pager.php | 2 +- .../core/Mage/Catalog/Block/Widget/Link.php | 2 +- app/code/core/Mage/Catalog/Exception.php | 2 +- .../core/Mage/Catalog/Helper/Category.php | 2 +- .../Mage/Catalog/Helper/Category/Flat.php | 2 +- app/code/core/Mage/Catalog/Helper/Data.php | 74 +- app/code/core/Mage/Catalog/Helper/Image.php | 2 +- app/code/core/Mage/Catalog/Helper/Map.php | 2 +- app/code/core/Mage/Catalog/Helper/Output.php | 40 +- app/code/core/Mage/Catalog/Helper/Product.php | 2 +- .../Mage/Catalog/Helper/Product/Compare.php | 2 +- .../core/Mage/Catalog/Helper/Product/Flat.php | 2 +- .../Mage/Catalog/Helper/Product/Options.php | 2 +- .../core/Mage/Catalog/Helper/Product/Url.php | 2 +- app/code/core/Mage/Catalog/Model/Abstract.php | 2 +- .../core/Mage/Catalog/Model/Api/Resource.php | 2 +- app/code/core/Mage/Catalog/Model/Category.php | 4 +- .../core/Mage/Catalog/Model/Category/Api.php | 12 +- .../Mage/Catalog/Model/Category/Api/V2.php | 6 +- .../Catalog/Model/Category/Attribute/Api.php | 2 +- .../Model/Category/Attribute/Api/V2.php | 2 +- .../Category/Attribute/Backend/Image.php | 2 +- .../Category/Attribute/Backend/Sortby.php | 4 +- .../Category/Attribute/Backend/Urlkey.php | 2 +- .../Category/Attribute/Source/Layout.php | 2 +- .../Model/Category/Attribute/Source/Mode.php | 2 +- .../Model/Category/Attribute/Source/Page.php | 4 +- .../Category/Attribute/Source/Sortby.php | 2 +- .../Catalog/Model/Category/Indexer/Flat.php | 2 +- .../Model/Category/Indexer/Product.php | 2 +- app/code/core/Mage/Catalog/Model/Config.php | 2 +- app/code/core/Mage/Catalog/Model/Convert.php | 2 +- .../Catalog/Model/Convert/Adapter/Catalog.php | 2 +- .../Catalog/Model/Convert/Adapter/Product.php | 24 +- .../Catalog/Model/Convert/Parser/Product.php | 16 +- app/code/core/Mage/Catalog/Model/Design.php | 2 +- .../Mage/Catalog/Model/Entity/Attribute.php | 2 +- .../Attribute/Design/Options/Container.php | 2 +- .../Product/Attribute/Frontend/Image.php | 2 +- app/code/core/Mage/Catalog/Model/Index.php | 2 +- .../core/Mage/Catalog/Model/Indexer/Url.php | 20 +- app/code/core/Mage/Catalog/Model/Layer.php | 6 +- .../Catalog/Model/Layer/Filter/Abstract.php | 4 +- .../Catalog/Model/Layer/Filter/Attribute.php | 2 +- .../Catalog/Model/Layer/Filter/Category.php | 2 +- .../Catalog/Model/Layer/Filter/Decimal.php | 2 +- .../Mage/Catalog/Model/Layer/Filter/Item.php | 4 +- .../Mage/Catalog/Model/Layer/Filter/Price.php | 2 +- .../core/Mage/Catalog/Model/Layer/State.php | 4 +- app/code/core/Mage/Catalog/Model/Observer.php | 15 +- app/code/core/Mage/Catalog/Model/Product.php | 23 +- .../Mage/Catalog/Model/Product/Action.php | 2 +- .../core/Mage/Catalog/Model/Product/Api.php | 38 +- .../Mage/Catalog/Model/Product/Api/V2.php | 37 +- .../Catalog/Model/Product/Attribute/Api.php | 2 +- .../Model/Product/Attribute/Api/V2.php | 2 +- .../Model/Product/Attribute/Backend/Media.php | 33 +- .../Model/Product/Attribute/Backend/Price.php | 2 +- .../Product/Attribute/Backend/Recurring.php | 62 + .../Product/Attribute/Backend/Startdate.php | 15 +- .../Product/Attribute/Backend/Tierprice.php | 2 +- .../Product/Attribute/Backend/Urlkey.php | 2 +- .../Product/Attribute/Frontend/Image.php | 2 +- .../Model/Product/Attribute/Media/Api.php | 8 +- .../Model/Product/Attribute/Media/Api/V2.php | 8 +- .../Model/Product/Attribute/Set/Api.php | 2 +- .../Model/Product/Attribute/Set/Api/V2.php | 2 +- .../Model/Product/Attribute/Source/Layout.php | 4 +- .../Model/Product/Attribute/Tierprice/Api.php | 72 +- .../Product/Attribute/Tierprice/Api/V2.php | 35 +- .../Catalog/Model/Product/Compare/Item.php | 2 +- .../Catalog/Model/Product/Compare/List.php | 2 +- .../Mage/Catalog/Model/Product/Condition.php | 2 +- .../Model/Product/Condition/Interface.php | 2 +- .../Mage/Catalog/Model/Product/Flat/Flag.php | 2 +- .../Catalog/Model/Product/Flat/Indexer.php | 2 +- .../Catalog/Model/Product/Flat/Observer.php | 2 +- .../core/Mage/Catalog/Model/Product/Image.php | 16 +- .../Catalog/Model/Product/Indexer/Eav.php | 2 +- .../Catalog/Model/Product/Indexer/Flat.php | 2 +- .../Catalog/Model/Product/Indexer/Price.php | 2 +- .../core/Mage/Catalog/Model/Product/Link.php | 2 +- .../Mage/Catalog/Model/Product/Link/Api.php | 6 +- .../Catalog/Model/Product/Link/Api/V2.php | 6 +- .../Catalog/Model/Product/Media/Config.php | 2 +- .../Mage/Catalog/Model/Product/Option.php | 2 +- .../Catalog/Model/Product/Option/Observer.php | 2 +- .../Model/Product/Option/Type/Date.php | 8 +- .../Model/Product/Option/Type/Default.php | 16 +- .../Model/Product/Option/Type/File.php | 6 +- .../Model/Product/Option/Type/Select.php | 18 +- .../Model/Product/Option/Type/Text.php | 6 +- .../Catalog/Model/Product/Option/Value.php | 2 +- .../Mage/Catalog/Model/Product/Status.php | 2 +- .../core/Mage/Catalog/Model/Product/Type.php | 2 +- .../Catalog/Model/Product/Type/Abstract.php | 46 +- .../Mage/Catalog/Model/Product/Type/Api.php | 2 +- .../Catalog/Model/Product/Type/Api/V2.php | 2 +- .../Model/Product/Type/Configurable.php | 20 +- .../Product/Type/Configurable/Attribute.php | 2 +- .../Model/Product/Type/Configurable/Price.php | 2 +- .../Catalog/Model/Product/Type/Grouped.php | 29 +- .../Mage/Catalog/Model/Product/Type/Price.php | 2 +- .../Catalog/Model/Product/Type/Simple.php | 2 +- .../Catalog/Model/Product/Type/Virtual.php | 2 +- .../core/Mage/Catalog/Model/Product/Url.php | 2 +- .../Mage/Catalog/Model/Product/Visibility.php | 2 +- .../Mage/Catalog/Model/Product/Website.php | 6 +- .../Catalog/Model/Resource/Eav/Attribute.php | 2 +- .../Model/Resource/Eav/Mysql4/Abstract.php | 117 +- .../Model/Resource/Eav/Mysql4/Attribute.php | 2 +- .../Model/Resource/Eav/Mysql4/Category.php | 2 +- .../Mysql4/Category/Attribute/Collection.php | 2 +- .../Category/Attribute/Frontend/Image.php | 2 +- .../Category/Attribute/Source/Layout.php | 4 +- .../Mysql4/Category/Attribute/Source/Mode.php | 2 +- .../Mysql4/Category/Attribute/Source/Page.php | 4 +- .../Eav/Mysql4/Category/Collection.php | 2 +- .../Resource/Eav/Mysql4/Category/Flat.php | 2 +- .../Eav/Mysql4/Category/Flat/Collection.php | 2 +- .../Eav/Mysql4/Category/Indexer/Product.php | 113 +- .../Resource/Eav/Mysql4/Category/Tree.php | 23 +- .../Eav/Mysql4/Collection/Abstract.php | 4 +- .../Model/Resource/Eav/Mysql4/Config.php | 10 +- .../Eav/Mysql4/Layer/Filter/Attribute.php | 2 +- .../Eav/Mysql4/Layer/Filter/Decimal.php | 2 +- .../Eav/Mysql4/Layer/Filter/Price.php | 2 +- .../Model/Resource/Eav/Mysql4/Product.php | 16 +- .../Resource/Eav/Mysql4/Product/Action.php | 2 +- .../Product/Attribute/Backend/Gallery.php | 2 +- .../Product/Attribute/Backend/Image.php | 2 +- .../Product/Attribute/Backend/Media.php | 2 +- .../Product/Attribute/Backend/Tierprice.php | 2 +- .../Product/Attribute/Backend/Urlkey.php | 2 +- .../Mysql4/Product/Attribute/Collection.php | 2 +- .../Product/Attribute/Frontend/Image.php | 2 +- .../Product/Attribute/Frontend/Tierprice.php | 2 +- .../Eav/Mysql4/Product/Collection.php | 83 +- .../Eav/Mysql4/Product/Compare/Item.php | 27 +- .../Product/Compare/Item/Collection.php | 17 +- .../Resource/Eav/Mysql4/Product/Flat.php | 2 +- .../Eav/Mysql4/Product/Flat/Indexer.php | 6 +- .../Eav/Mysql4/Product/Indexer/Abstract.php | 2 +- .../Eav/Mysql4/Product/Indexer/Eav.php | 18 +- .../Mysql4/Product/Indexer/Eav/Abstract.php | 10 +- .../Mysql4/Product/Indexer/Eav/Decimal.php | 15 +- .../Eav/Mysql4/Product/Indexer/Eav/Source.php | 15 +- .../Eav/Mysql4/Product/Indexer/Price.php | 29 +- .../Product/Indexer/Price/Configurable.php | 61 +- .../Mysql4/Product/Indexer/Price/Default.php | 112 +- .../Mysql4/Product/Indexer/Price/Grouped.php | 3 +- .../Product/Indexer/Price/Interface.php | 2 +- .../Resource/Eav/Mysql4/Product/Link.php | 2 +- .../Eav/Mysql4/Product/Link/Collection.php | 2 +- .../Product/Link/Product/Collection.php | 155 +- .../Resource/Eav/Mysql4/Product/Option.php | 2 +- .../Eav/Mysql4/Product/Option/Collection.php | 2 +- .../Eav/Mysql4/Product/Option/Value.php | 2 +- .../Product/Option/Value/Collection.php | 2 +- .../Resource/Eav/Mysql4/Product/Relation.php | 2 +- .../Resource/Eav/Mysql4/Product/Status.php | 2 +- .../Eav/Mysql4/Product/Type/Configurable.php | 2 +- .../Product/Type/Configurable/Attribute.php | 2 +- .../Configurable/Attribute/Collection.php | 2 +- .../Type/Configurable/Product/Collection.php | 2 +- .../Resource/Eav/Mysql4/Product/Website.php | 2 +- .../Model/Resource/Eav/Mysql4/Sendfriend.php | 2 +- .../Eav/Mysql4/Sendfriend/Collection.php | 2 +- .../Model/Resource/Eav/Mysql4/Setup.php | 55 +- .../Catalog/Model/Resource/Eav/Mysql4/Url.php | 32 +- .../core/Mage/Catalog/Model/Sendfriend.php | 16 +- app/code/core/Mage/Catalog/Model/Session.php | 2 +- .../Mage/Catalog/Model/Template/Filter.php | 106 + app/code/core/Mage/Catalog/Model/Url.php | 81 +- .../controllers/CategoryController.php | 2 +- .../Catalog/controllers/IndexController.php | 2 +- .../controllers/Product/CompareController.php | 10 +- .../Catalog/controllers/ProductController.php | 2 +- .../controllers/Seo/SitemapController.php | 2 +- app/code/core/Mage/Catalog/etc/adminhtml.xml | 2 +- app/code/core/Mage/Catalog/etc/api.xml | 2 +- app/code/core/Mage/Catalog/etc/config.xml | 91 +- app/code/core/Mage/Catalog/etc/convert.xml | 10 +- app/code/core/Mage/Catalog/etc/system.xml | 86 +- app/code/core/Mage/Catalog/etc/widget.xml | 2 +- app/code/core/Mage/Catalog/etc/wsdl.xml | 4 +- .../catalog_setup/mysql4-install-0.7.0.php | 2 +- .../mysql4-install-1.4.0.0.0.php | 2 +- .../mysql4-upgrade-0.6.40-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.11-0.7.12.php | 2 +- .../mysql4-upgrade-0.7.12-0.7.13.php | 2 +- .../mysql4-upgrade-0.7.13-0.7.14.php | 2 +- .../mysql4-upgrade-0.7.14-0.7.15.php | 2 +- .../mysql4-upgrade-0.7.15-0.7.16.php | 2 +- .../mysql4-upgrade-0.7.16-0.7.17.php | 2 +- .../mysql4-upgrade-0.7.17-0.7.18.php | 2 +- .../mysql4-upgrade-0.7.18-0.7.19.php | 2 +- .../mysql4-upgrade-0.7.19-0.7.20.php | 2 +- .../mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../mysql4-upgrade-0.7.20-0.7.21.php | 2 +- .../mysql4-upgrade-0.7.21-0.7.22.php | 2 +- .../mysql4-upgrade-0.7.22-0.7.23.php | 2 +- .../mysql4-upgrade-0.7.23-0.7.24.php | 2 +- .../mysql4-upgrade-0.7.24-0.7.25.php | 2 +- .../mysql4-upgrade-0.7.25-0.7.26.php | 2 +- .../mysql4-upgrade-0.7.26-0.7.27.php | 2 +- .../mysql4-upgrade-0.7.27-0.7.28.php | 2 +- .../mysql4-upgrade-0.7.28-0.7.29.php | 2 +- .../mysql4-upgrade-0.7.29-0.7.30.php | 2 +- .../mysql4-upgrade-0.7.30-0.7.31.php | 2 +- .../mysql4-upgrade-0.7.31-0.7.32.php | 2 +- .../mysql4-upgrade-0.7.32-0.7.33.php | 2 +- .../mysql4-upgrade-0.7.33-0.7.34.php | 2 +- .../mysql4-upgrade-0.7.34-0.7.35.php | 2 +- .../mysql4-upgrade-0.7.35-0.7.36.php | 2 +- .../mysql4-upgrade-0.7.36-0.7.37.php | 2 +- .../mysql4-upgrade-0.7.37-0.7.38.php | 2 +- .../mysql4-upgrade-0.7.38-0.7.39.php | 2 +- .../mysql4-upgrade-0.7.39-0.7.40.php | 2 +- .../mysql4-upgrade-0.7.4-0.7.5.php | 2 +- .../mysql4-upgrade-0.7.40-0.7.41.php | 2 +- .../mysql4-upgrade-0.7.41-0.7.42.php | 2 +- .../mysql4-upgrade-0.7.43-0.7.44.php | 2 +- .../mysql4-upgrade-0.7.44-0.7.45.php | 2 +- .../mysql4-upgrade-0.7.45-0.7.46.php | 2 +- .../mysql4-upgrade-0.7.46-0.7.47.php | 2 +- .../mysql4-upgrade-0.7.47-0.7.48.php | 2 +- .../mysql4-upgrade-0.7.48-0.7.49.php | 2 +- .../mysql4-upgrade-0.7.49-0.7.50.php | 2 +- .../mysql4-upgrade-0.7.5-0.7.6.php | 2 +- .../mysql4-upgrade-0.7.50-0.7.51.php | 2 +- .../mysql4-upgrade-0.7.51-0.7.52.php | 2 +- .../mysql4-upgrade-0.7.52-0.7.53.php | 2 +- .../mysql4-upgrade-0.7.53-0.7.54.php | 2 +- .../mysql4-upgrade-0.7.54-0.7.55.php | 2 +- .../mysql4-upgrade-0.7.55-0.7.56.php | 2 +- .../mysql4-upgrade-0.7.56-0.7.57.php | 2 +- .../mysql4-upgrade-0.7.57-0.7.58.php | 6 +- .../mysql4-upgrade-0.7.58-0.7.59.php | 2 +- .../mysql4-upgrade-0.7.59-0.7.60.php | 2 +- .../mysql4-upgrade-0.7.6-0.7.7.php | 2 +- .../mysql4-upgrade-0.7.60-0.7.61.php | 2 +- .../mysql4-upgrade-0.7.61-0.7.62.php | 2 +- .../mysql4-upgrade-0.7.62-0.7.63.php | 2 +- .../mysql4-upgrade-0.7.63-0.7.64.php | 2 +- .../mysql4-upgrade-0.7.64-0.7.65.php | 2 +- .../mysql4-upgrade-0.7.65-0.7.66.php | 2 +- .../mysql4-upgrade-0.7.66-0.7.67.php | 2 +- .../mysql4-upgrade-0.7.67-0.7.68.php | 2 +- .../mysql4-upgrade-0.7.68-0.7.69.php | 2 +- .../mysql4-upgrade-0.7.69-0.7.70.php | 2 +- .../mysql4-upgrade-0.7.7-0.7.8.php | 2 +- .../mysql4-upgrade-0.7.70-0.7.71.php | 2 +- .../mysql4-upgrade-0.7.71-0.7.72.php | 2 +- .../mysql4-upgrade-0.7.72-0.7.73.php | 2 +- .../mysql4-upgrade-0.7.73-1.4.0.0.0.php | 2 +- .../mysql4-upgrade-0.7.8-0.7.9.php | 2 +- .../mysql4-upgrade-1.4.0.0.0-1.4.0.0.1.php | 2 +- .../mysql4-upgrade-1.4.0.0.1-1.4.0.0.2.php | 2 +- .../mysql4-upgrade-1.4.0.0.10-1.4.0.0.11.php | 2 +- .../mysql4-upgrade-1.4.0.0.11-1.4.0.0.12.php | 2 +- .../mysql4-upgrade-1.4.0.0.12-1.4.0.0.13.php | 2 +- .../mysql4-upgrade-1.4.0.0.13-1.4.0.0.14.php | 2 +- .../mysql4-upgrade-1.4.0.0.14-1.4.0.0.15.php | 2 +- .../mysql4-upgrade-1.4.0.0.15-1.4.0.0.16.php | 2 +- .../mysql4-upgrade-1.4.0.0.16-1.4.0.0.17.php | 2 +- .../mysql4-upgrade-1.4.0.0.17-1.4.0.0.18.php | 2 +- .../mysql4-upgrade-1.4.0.0.18-1.4.0.0.19.php | 2 +- .../mysql4-upgrade-1.4.0.0.19-1.4.0.0.20.php | 2 +- .../mysql4-upgrade-1.4.0.0.2-1.4.0.0.3.php | 2 +- .../mysql4-upgrade-1.4.0.0.20-1.4.0.0.21.php | 2 +- .../mysql4-upgrade-1.4.0.0.21-1.4.0.0.22.php | 62 + .../mysql4-upgrade-1.4.0.0.22-1.4.0.0.23.php | 32 + .../mysql4-upgrade-1.4.0.0.23-1.4.0.0.24.php | 322 + .../mysql4-upgrade-1.4.0.0.24-1.4.0.0.25.php | 42 + .../mysql4-upgrade-1.4.0.0.25-1.4.0.0.26.php | 41 + .../mysql4-upgrade-1.4.0.0.26-1.4.0.0.27.php | 38 + .../mysql4-upgrade-1.4.0.0.27-1.4.0.0.28.php | 78 + .../mysql4-upgrade-1.4.0.0.3-1.4.0.0.4.php | 2 +- .../mysql4-upgrade-1.4.0.0.4-1.4.0.0.5.php | 2 +- .../mysql4-upgrade-1.4.0.0.5-1.4.0.0.6.php | 2 +- .../mysql4-upgrade-1.4.0.0.6-1.4.0.0.7.php | 2 +- .../mysql4-upgrade-1.4.0.0.7-1.4.0.0.8.php | 2 +- .../mysql4-upgrade-1.4.0.0.8-1.4.0.0.9.php | 2 +- .../mysql4-upgrade-1.4.0.0.9-1.4.0.0.10.php | 2 +- .../Mage/CatalogIndex/Model/Aggregation.php | 2 +- .../Mage/CatalogIndex/Model/Attribute.php | 2 +- .../CatalogIndex/Model/Catalog/Index/Flag.php | 2 +- .../Model/Catalog/Index/Kill/Flag.php | 2 +- .../Mage/CatalogIndex/Model/Data/Abstract.php | 2 +- .../CatalogIndex/Model/Data/Configurable.php | 2 +- .../Mage/CatalogIndex/Model/Data/Grouped.php | 2 +- .../Mage/CatalogIndex/Model/Data/Simple.php | 2 +- .../Mage/CatalogIndex/Model/Data/Virtual.php | 2 +- .../core/Mage/CatalogIndex/Model/Indexer.php | 2 +- .../CatalogIndex/Model/Indexer/Abstract.php | 2 +- .../Mage/CatalogIndex/Model/Indexer/Eav.php | 2 +- .../CatalogIndex/Model/Indexer/Interface.php | 2 +- .../Model/Indexer/Minimalprice.php | 2 +- .../Mage/CatalogIndex/Model/Indexer/Price.php | 2 +- .../CatalogIndex/Model/Indexer/Tierprice.php | 2 +- .../CatalogIndex/Model/Mysql4/Abstract.php | 2 +- .../CatalogIndex/Model/Mysql4/Aggregation.php | 2 +- .../CatalogIndex/Model/Mysql4/Attribute.php | 2 +- .../Model/Mysql4/Data/Abstract.php | 2 +- .../Model/Mysql4/Data/Configurable.php | 2 +- .../Model/Mysql4/Data/Grouped.php | 2 +- .../CatalogIndex/Model/Mysql4/Indexer.php | 2 +- .../Model/Mysql4/Indexer/Abstract.php | 2 +- .../CatalogIndex/Model/Mysql4/Indexer/Eav.php | 2 +- .../Model/Mysql4/Indexer/Minimalprice.php | 2 +- .../Model/Mysql4/Indexer/Price.php | 2 +- .../Mage/CatalogIndex/Model/Mysql4/Price.php | 2 +- .../CatalogIndex/Model/Mysql4/Retreiver.php | 2 +- .../Mage/CatalogIndex/Model/Mysql4/Setup.php | 2 +- .../core/Mage/CatalogIndex/Model/Observer.php | 2 +- .../core/Mage/CatalogIndex/Model/Price.php | 2 +- .../Mage/CatalogIndex/Model/Retreiver.php | 2 +- .../core/Mage/CatalogIndex/etc/config.xml | 2 +- .../mysql4-install-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../mysql4-upgrade-0.7.3-0.7.4.php | 2 +- .../mysql4-upgrade-0.7.4-0.7.5.php | 2 +- .../mysql4-upgrade-0.7.5-0.7.6.php | 2 +- .../mysql4-upgrade-0.7.6-0.7.7.php | 2 +- .../mysql4-upgrade-0.7.7-0.7.8.php | 2 +- .../mysql4-upgrade-0.7.8-0.7.9.php | 2 +- .../mysql4-upgrade-0.7.9-0.7.10.php | 2 +- .../Adminhtml/Form/Field/Customergroup.php | 95 + .../Block/Adminhtml/Form/Field/Minsaleqty.php | 88 + .../Block/Stockqty/Abstract.php | 100 + .../Block/Stockqty/Composite.php | 83 + .../Block/Stockqty/Default.php | 49 + .../Block/Stockqty/Type/Configurable.php | 47 + .../Block/Stockqty/Type/Grouped.php | 47 + .../Mage/CatalogInventory/Helper/Data.php | 12 +- .../CatalogInventory/Model/Indexer/Stock.php | 6 +- .../Model/Mysql4/Indexer/Stock.php | 43 +- .../Mysql4/Indexer/Stock/Configurable.php | 3 +- .../Model/Mysql4/Indexer/Stock/Default.php | 18 +- .../Model/Mysql4/Indexer/Stock/Grouped.php | 3 +- .../Model/Mysql4/Indexer/Stock/Interface.php | 2 +- .../CatalogInventory/Model/Mysql4/Stock.php | 50 +- .../Model/Mysql4/Stock/Item.php | 23 +- .../Model/Mysql4/Stock/Item/Collection.php | 4 +- .../Model/Mysql4/Stock/Status.php | 2 +- .../Mage/CatalogInventory/Model/Observer.php | 270 +- .../Model/Source/Backorders.php | 2 +- .../CatalogInventory/Model/Source/Stock.php | 2 +- .../Mage/CatalogInventory/Model/Stock.php | 59 +- .../CatalogInventory/Model/Stock/Item.php | 201 +- .../CatalogInventory/Model/Stock/Item/Api.php | 2 +- .../Model/Stock/Item/Api/V2.php | 2 +- .../CatalogInventory/Model/Stock/Status.php | 2 +- .../System/Config/Backend/Minsaleqty.php | 95 + .../Mage/CatalogInventory/etc/adminhtml.xml | 2 +- .../core/Mage/CatalogInventory/etc/api.xml | 2 +- .../core/Mage/CatalogInventory/etc/config.xml | 51 +- .../core/Mage/CatalogInventory/etc/system.xml | 46 +- .../mysql4-install-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../mysql4-upgrade-0.7.3-0.7.4.php | 2 +- .../mysql4-upgrade-0.7.4-0.7.5.php | 2 +- .../mysql4-upgrade-0.7.5-0.7.6.php | 36 + .../mysql4-upgrade-0.7.6-0.7.7.php | 55 + .../mysql4-upgrade-0.7.7-0.7.8.php | 36 + .../core/Mage/CatalogRule/Helper/Data.php | 2 +- .../Mage/CatalogRule/Model/Mysql4/Rule.php | 9 +- .../Model/Mysql4/Rule/Collection.php | 2 +- .../Model/Mysql4/Rule/Product/Price.php | 2 +- .../Mysql4/Rule/Product/Price/Collection.php | 2 +- .../core/Mage/CatalogRule/Model/Observer.php | 4 +- app/code/core/Mage/CatalogRule/Model/Rule.php | 26 +- .../Model/Rule/Action/Collection.php | 2 +- .../CatalogRule/Model/Rule/Action/Product.php | 2 +- .../Model/Rule/Condition/Combine.php | 2 +- .../Model/Rule/Condition/Product.php | 4 +- .../CatalogRule/Model/Rule/Product/Price.php | 2 +- .../core/Mage/CatalogRule/etc/adminhtml.xml | 2 +- app/code/core/Mage/CatalogRule/etc/config.xml | 9 +- .../mysql4-install-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../mysql4-upgrade-0.7.3-0.7.4.php | 2 +- .../mysql4-upgrade-0.7.4-0.7.5.php | 2 +- .../mysql4-upgrade-0.7.5-0.7.6.php | 2 +- .../mysql4-upgrade-0.7.6-0.7.7.php | 2 +- .../mysql4-upgrade-0.7.7-0.7.8.php | 2 +- .../mysql4-upgrade-0.7.8-0.7.9.php | 31 + .../mysql4-upgrade-0.7.9-0.7.10.php | 37 + .../CatalogSearch/Block/Advanced/Form.php | 2 +- .../CatalogSearch/Block/Advanced/Result.php | 2 +- .../Mage/CatalogSearch/Block/Autocomplete.php | 2 +- .../core/Mage/CatalogSearch/Block/Layer.php | 6 +- .../Block/Layer/Filter/Attribute.php | 2 +- .../core/Mage/CatalogSearch/Block/Result.php | 2 +- .../core/Mage/CatalogSearch/Block/Term.php | 2 +- .../core/Mage/CatalogSearch/Helper/Data.php | 47 +- .../Mage/CatalogSearch/Model/Advanced.php | 4 +- .../Mage/CatalogSearch/Model/Fulltext.php | 2 +- .../CatalogSearch/Model/Fulltext/Observer.php | 4 +- .../CatalogSearch/Model/Indexer/Fulltext.php | 2 +- .../core/Mage/CatalogSearch/Model/Layer.php | 5 +- .../Model/Layer/Filter/Attribute.php | 2 +- .../CatalogSearch/Model/Mysql4/Advanced.php | 16 +- .../Model/Mysql4/Advanced/Collection.php | 2 +- .../CatalogSearch/Model/Mysql4/Fulltext.php | 87 +- .../Model/Mysql4/Fulltext/Collection.php | 6 +- .../Model/Mysql4/Fulltext/Engine.php | 157 + .../Mage/CatalogSearch/Model/Mysql4/Query.php | 2 +- .../Model/Mysql4/Query/Collection.php | 2 +- .../Model/Mysql4/Search/Collection.php | 2 +- .../core/Mage/CatalogSearch/Model/Query.php | 4 +- .../core/Mage/CatalogSearch/Model/Session.php | 2 +- .../Model/System/Config/Backend/Sitemap.php | 2 +- .../controllers/AdvancedController.php | 2 +- .../controllers/AjaxController.php | 2 +- .../controllers/ResultController.php | 2 +- .../controllers/TermController.php | 2 +- .../core/Mage/CatalogSearch/etc/adminhtml.xml | 2 +- .../core/Mage/CatalogSearch/etc/config.xml | 2 +- .../core/Mage/CatalogSearch/etc/system.xml | 22 +- .../mysql4-install-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../mysql4-upgrade-0.7.3-0.7.4.php | 2 +- .../mysql4-upgrade-0.7.4-0.7.5.php | 2 +- .../mysql4-upgrade-0.7.5-0.7.6.php | 2 +- .../mysql4-upgrade-0.7.6-0.7.7.php | 2 +- .../Centinel/Block/Adminhtml/Validation.php | 2 +- .../Block/Adminhtml/Validation/Form.php | 2 +- .../Mage/Centinel/Block/Authentication.php | 55 +- .../Block/Authentication/Complete.php | 10 +- .../Centinel/Block/Authentication/Start.php | 6 +- app/code/core/Mage/Centinel/Block/Logo.php | 2 +- app/code/core/Mage/Centinel/Helper/Data.php | 8 +- app/code/core/Mage/Centinel/Model/Api.php | 46 +- app/code/core/Mage/Centinel/Model/Config.php | 12 +- .../core/Mage/Centinel/Model/Observer.php | 21 +- app/code/core/Mage/Centinel/Model/Service.php | 22 +- app/code/core/Mage/Centinel/Model/Session.php | 2 +- .../core/Mage/Centinel/Model/State/Jcb.php | 180 + .../Mage/Centinel/Model/State/Mastercard.php | 4 +- .../core/Mage/Centinel/Model/State/Visa.php | 6 +- .../Mage/Centinel/Model/StateAbstract.php | 8 +- .../Adminhtml/Centinel/IndexController.php | 22 +- .../Centinel/controllers/IndexController.php | 22 +- app/code/core/Mage/Centinel/etc/config.xml | 25 +- app/code/core/Mage/Centinel/etc/system.xml | 13 +- .../core/Mage/Checkout/Block/Agreements.php | 2 +- app/code/core/Mage/Checkout/Block/Cart.php | 30 +- .../Mage/Checkout/Block/Cart/Abstract.php | 2 +- .../core/Mage/Checkout/Block/Cart/Coupon.php | 2 +- .../Mage/Checkout/Block/Cart/Crosssell.php | 6 +- .../Checkout/Block/Cart/Item/Renderer.php | 12 +- .../Block/Cart/Item/Renderer/Configurable.php | 2 +- .../Block/Cart/Item/Renderer/Grouped.php | 2 +- .../Mage/Checkout/Block/Cart/Shipping.php | 2 +- .../core/Mage/Checkout/Block/Cart/Sidebar.php | 21 +- .../core/Mage/Checkout/Block/Cart/Totals.php | 2 +- app/code/core/Mage/Checkout/Block/Links.php | 2 +- .../Checkout/Block/Multishipping/Abstract.php | 2 +- .../Block/Multishipping/Address/Select.php | 2 +- .../Block/Multishipping/Addresses.php | 2 +- .../Checkout/Block/Multishipping/Billing.php | 2 +- .../Block/Multishipping/Billing/Items.php | 2 +- .../Checkout/Block/Multishipping/Link.php | 2 +- .../Checkout/Block/Multishipping/Overview.php | 2 +- .../Block/Multishipping/Payment/Info.php | 2 +- .../Checkout/Block/Multishipping/Shipping.php | 2 +- .../Checkout/Block/Multishipping/State.php | 2 +- .../Checkout/Block/Multishipping/Success.php | 2 +- app/code/core/Mage/Checkout/Block/Onepage.php | 2 +- .../Mage/Checkout/Block/Onepage/Abstract.php | 2 +- .../Mage/Checkout/Block/Onepage/Billing.php | 4 +- .../Mage/Checkout/Block/Onepage/Failure.php | 2 +- .../core/Mage/Checkout/Block/Onepage/Link.php | 2 +- .../Mage/Checkout/Block/Onepage/Login.php | 2 +- .../Mage/Checkout/Block/Onepage/Payment.php | 2 +- .../Checkout/Block/Onepage/Payment/Info.php | 2 +- .../Block/Onepage/Payment/Methods.php | 16 +- .../Mage/Checkout/Block/Onepage/Progress.php | 11 +- .../Mage/Checkout/Block/Onepage/Review.php | 2 +- .../Checkout/Block/Onepage/Review/Info.php | 2 +- .../Mage/Checkout/Block/Onepage/Shipping.php | 2 +- .../Block/Onepage/Shipping/Method.php | 2 +- .../Onepage/Shipping/Method/Additional.php | 2 +- .../Onepage/Shipping/Method/Available.php | 2 +- .../Mage/Checkout/Block/Onepage/Success.php | 111 +- app/code/core/Mage/Checkout/Block/Success.php | 2 +- .../Mage/Checkout/Block/Total/Default.php | 2 +- .../Mage/Checkout/Block/Total/Nominal.php | 135 + .../core/Mage/Checkout/Block/Total/Tax.php | 2 +- .../core/Mage/Checkout/Controller/Action.php | 2 +- app/code/core/Mage/Checkout/Exception.php | 2 +- app/code/core/Mage/Checkout/Helper/Cart.php | 2 +- app/code/core/Mage/Checkout/Helper/Data.php | 5 +- app/code/core/Mage/Checkout/Helper/Url.php | 2 +- .../core/Mage/Checkout/Model/Agreement.php | 2 +- app/code/core/Mage/Checkout/Model/Cart.php | 157 +- .../Model/Config/Source/Cart/Summary.php | 2 +- .../Mage/Checkout/Model/Mysql4/Agreement.php | 2 +- .../Model/Mysql4/Agreement/Collection.php | 2 +- .../core/Mage/Checkout/Model/Mysql4/Cart.php | 2 +- .../core/Mage/Checkout/Model/Mysql4/Setup.php | 2 +- .../core/Mage/Checkout/Model/Observer.php | 2 +- app/code/core/Mage/Checkout/Model/Session.php | 23 +- .../Mage/Checkout/Model/Type/Abstract.php | 2 +- .../Checkout/Model/Type/Multishipping.php | 17 +- .../Model/Type/Multishipping/State.php | 2 +- .../core/Mage/Checkout/Model/Type/Onepage.php | 99 +- .../Checkout/controllers/CartController.php | 44 +- .../Checkout/controllers/IndexController.php | 2 +- .../Multishipping/AddressController.php | 2 +- .../controllers/MultishippingController.php | 6 +- .../controllers/OnepageController.php | 19 +- app/code/core/Mage/Checkout/etc/adminhtml.xml | 2 +- app/code/core/Mage/Checkout/etc/config.xml | 11 +- app/code/core/Mage/Checkout/etc/system.xml | 14 +- .../checkout_setup/mysql4-install-0.9.1.php | 2 +- .../mysql4-upgrade-0.9.0-0.9.1.php | 2 +- .../mysql4-upgrade-0.9.1-0.9.2.php | 2 +- .../mysql4-upgrade-0.9.2-0.9.3.php | 2 +- .../mysql4-upgrade-0.9.3-0.9.4.php | 2 +- .../mysql4-upgrade-0.9.4-0.9.5.php | 2 +- app/code/core/Mage/Chronopay/Block/Form.php | 42 + app/code/core/Mage/Chronopay/Block/Info.php | 48 + .../Mage/Chronopay/Block/Standard/Failure.php | 37 + .../Mage/Chronopay/Block/Standard/Form.php | 43 + .../Chronopay/Block/Standard/Redirect.php | 59 + app/code/core/Mage/Chronopay/Helper/Data.php | 38 + .../core/Mage/Chronopay/Model/Api/Debug.php | 41 + app/code/core/Mage/Chronopay/Model/Config.php | 126 + .../core/Mage/Chronopay/Model/Gateway.php | 341 + .../Mage/Chronopay/Model/Gateway/Request.php | 38 + .../Mage/Chronopay/Model/Gateway/Result.php | 38 + .../Mage/Chronopay/Model/Mysql4/Api/Debug.php | 42 + .../Model/Mysql4/Api/Debug/Collection.php | 41 + .../Mage/Chronopay/Model/Mysql4/Setup.php | 39 + .../Mage/Chronopay/Model/Source/Cctype.php | 40 + .../Mage/Chronopay/Model/Source/Language.php | 50 + .../Chronopay/Model/Source/PaymentAction.php | 49 + .../core/Mage/Chronopay/Model/Standard.php | 273 + .../controllers/StandardController.php | 219 + app/code/core/Mage/Chronopay/etc/config.xml | 142 + .../{PaypalUk => Chronopay}/etc/system.xml | 287 +- .../chronopay_setup/mysql4-install-0.1.0.php | 45 + app/code/core/Mage/Cms/Block/Block.php | 2 +- app/code/core/Mage/Cms/Block/Page.php | 2 +- app/code/core/Mage/Cms/Block/Widget/Block.php | 2 +- .../core/Mage/Cms/Block/Widget/Page/Link.php | 2 +- app/code/core/Mage/Cms/Controller/Router.php | 2 +- app/code/core/Mage/Cms/Helper/Data.php | 2 +- app/code/core/Mage/Cms/Helper/Page.php | 8 +- .../core/Mage/Cms/Helper/Wysiwyg/Images.php | 58 +- app/code/core/Mage/Cms/Model/Block.php | 2 +- app/code/core/Mage/Cms/Model/Mysql4/Block.php | 4 +- .../Cms/Model/Mysql4/Block/Collection.php | 2 +- app/code/core/Mage/Cms/Model/Mysql4/Page.php | 15 +- .../Mage/Cms/Model/Mysql4/Page/Collection.php | 35 +- app/code/core/Mage/Cms/Model/Observer.php | 2 +- app/code/core/Mage/Cms/Model/Page.php | 2 +- .../core/Mage/Cms/Model/Template/Filter.php | 2 +- .../core/Mage/Cms/Model/Wysiwyg/Config.php | 12 +- .../Mage/Cms/Model/Wysiwyg/Images/Storage.php | 14 +- .../Wysiwyg/Images/Storage/Collection.php | 2 +- .../Mage/Cms/controllers/IndexController.php | 2 +- .../Mage/Cms/controllers/PageController.php | 2 +- app/code/core/Mage/Cms/etc/adminhtml.xml | 2 +- app/code/core/Mage/Cms/etc/config.xml | 2 +- app/code/core/Mage/Cms/etc/system.xml | 6 +- app/code/core/Mage/Cms/etc/widget.xml | 2 +- .../sql/cms_setup/mysql4-install-0.7.0.php | 2 +- .../cms_setup/mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../cms_setup/mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.10-0.7.11.php | 2 +- .../mysql4-upgrade-0.7.11-0.7.12.php | 2 +- .../mysql4-upgrade-0.7.12-0.7.13.php | 2 +- .../cms_setup/mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../cms_setup/mysql4-upgrade-0.7.4-0.7.5.php | 2 +- .../cms_setup/mysql4-upgrade-0.7.5-0.7.6.php | 2 +- .../cms_setup/mysql4-upgrade-0.7.7-0.7.8.php | 2 +- .../cms_setup/mysql4-upgrade-0.7.8-0.7.9.php | 2 +- .../cms_setup/mysql4-upgrade-0.7.9-0.7.10.php | 2 +- app/code/core/Mage/Compiler/Block/Process.php | 2 +- app/code/core/Mage/Compiler/Helper/Data.php | 2 +- app/code/core/Mage/Compiler/Model/Process.php | 2 +- .../controllers/ProcessController.php | 8 +- app/code/core/Mage/Compiler/etc/adminhtml.xml | 2 +- .../core/Mage/Compiler/etc/compilation.xml | 2 +- app/code/core/Mage/Compiler/etc/config.xml | 2 +- app/code/core/Mage/Contacts/Helper/Data.php | 2 +- .../Model/System/Config/Backend/Links.php | 2 +- .../Contacts/controllers/IndexController.php | 2 +- app/code/core/Mage/Contacts/etc/adminhtml.xml | 2 +- app/code/core/Mage/Contacts/etc/config.xml | 2 +- app/code/core/Mage/Contacts/etc/system.xml | 2 +- .../contacts_setup/mysql4-install-0.7.1.php | 2 +- .../contacts_setup/mysql4-install-0.8.0.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- app/code/core/Mage/Core/Block/Abstract.php | 326 +- app/code/core/Mage/Core/Block/Flush.php | 2 +- .../core/Mage/Core/Block/Html/Calendar.php | 13 +- app/code/core/Mage/Core/Block/Html/Date.php | 7 +- app/code/core/Mage/Core/Block/Html/Link.php | 2 +- app/code/core/Mage/Core/Block/Html/Select.php | 10 +- app/code/core/Mage/Core/Block/Messages.php | 2 +- app/code/core/Mage/Core/Block/Profiler.php | 2 +- .../core/Mage/Core/Block/Store/Switcher.php | 2 +- app/code/core/Mage/Core/Block/Template.php | 69 +- .../core/Mage/Core/Block/Template/Facade.php | 2 +- .../core/Mage/Core/Block/Template/Smarty.php | 2 +- .../core/Mage/Core/Block/Template/Zend.php | 2 +- app/code/core/Mage/Core/Block/Text.php | 2 +- app/code/core/Mage/Core/Block/Text/List.php | 2 +- .../core/Mage/Core/Block/Text/List/Item.php | 2 +- .../core/Mage/Core/Block/Text/List/Link.php | 2 +- app/code/core/Mage/Core/Block/Text/Tag.php | 2 +- .../core/Mage/Core/Block/Text/Tag/Css.php | 2 +- .../Mage/Core/Block/Text/Tag/Css/Admin.php | 2 +- .../core/Mage/Core/Block/Text/Tag/Debug.php | 2 +- app/code/core/Mage/Core/Block/Text/Tag/Js.php | 2 +- .../core/Mage/Core/Block/Text/Tag/Meta.php | 2 +- .../Mage/Core/Controller/Front/Action.php | 2 +- .../Mage/Core/Controller/Front/Router.php | 2 +- .../Mage/Core/Controller/Request/Http.php | 24 +- .../Mage/Core/Controller/Response/Http.php | 2 +- .../Mage/Core/Controller/Varien/Action.php | 2 +- .../Mage/Core/Controller/Varien/Exception.php | 2 +- .../Mage/Core/Controller/Varien/Front.php | 24 +- .../Controller/Varien/Router/Abstract.php | 2 +- .../Core/Controller/Varien/Router/Admin.php | 2 +- .../Core/Controller/Varien/Router/Default.php | 2 +- .../Controller/Varien/Router/Standard.php | 2 +- app/code/core/Mage/Core/Exception.php | 2 +- app/code/core/Mage/Core/Helper/Abstract.php | 69 +- app/code/core/Mage/Core/Helper/Data.php | 2 +- app/code/core/Mage/Core/Helper/Http.php | 2 +- app/code/core/Mage/Core/Helper/Js.php | 18 +- app/code/core/Mage/Core/Helper/String.php | 2 +- app/code/core/Mage/Core/Helper/Url.php | 2 +- app/code/core/Mage/Core/Model/Abstract.php | 32 +- app/code/core/Mage/Core/Model/App.php | 25 +- app/code/core/Mage/Core/Model/App/Area.php | 5 +- app/code/core/Mage/Core/Model/Cache.php | 2 +- app/code/core/Mage/Core/Model/Config.php | 10 +- app/code/core/Mage/Core/Model/Config/Base.php | 2 +- app/code/core/Mage/Core/Model/Config/Data.php | 21 +- .../core/Mage/Core/Model/Config/Element.php | 2 +- .../core/Mage/Core/Model/Config/Options.php | 2 +- .../core/Mage/Core/Model/Config/System.php | 2 +- app/code/core/Mage/Core/Model/Convert.php | 2 +- .../Model/Convert/Adapter/Interactive.php | 2 +- .../core/Mage/Core/Model/Convert/History.php | 2 +- .../core/Mage/Core/Model/Convert/Profile.php | 2 +- app/code/core/Mage/Core/Model/Cookie.php | 2 +- app/code/core/Mage/Core/Model/Date.php | 2 +- app/code/core/Mage/Core/Model/Design.php | 2 +- .../core/Mage/Core/Model/Design/Package.php | 2 +- .../Mage/Core/Model/Design/Source/Apply.php | 2 +- .../Mage/Core/Model/Design/Source/Design.php | 2 +- app/code/core/Mage/Core/Model/Email.php | 2 +- .../core/Mage/Core/Model/Email/Template.php | 10 +- .../Mage/Core/Model/Email/Template/Filter.php | 2 +- .../core/Mage/Core/Model/Email/Transport.php | 2 +- app/code/core/Mage/Core/Model/Encryption.php | 2 +- app/code/core/Mage/Core/Model/Flag.php | 2 +- app/code/core/Mage/Core/Model/Language.php | 2 +- app/code/core/Mage/Core/Model/Layout.php | 178 +- app/code/core/Mage/Core/Model/Layout/Data.php | 2 +- .../core/Mage/Core/Model/Layout/Element.php | 2 +- .../core/Mage/Core/Model/Layout/Update.php | 2 +- app/code/core/Mage/Core/Model/Locale.php | 2 +- .../core/Mage/Core/Model/Locale/Config.php | 2 +- app/code/core/Mage/Core/Model/Log/Adapter.php | 146 + app/code/core/Mage/Core/Model/Message.php | 2 +- .../core/Mage/Core/Model/Message/Abstract.php | 2 +- .../Mage/Core/Model/Message/Collection.php | 2 +- .../core/Mage/Core/Model/Message/Error.php | 2 +- .../core/Mage/Core/Model/Message/Notice.php | 2 +- .../core/Mage/Core/Model/Message/Success.php | 2 +- .../core/Mage/Core/Model/Message/Warning.php | 2 +- .../core/Mage/Core/Model/Mysql4/Abstract.php | 68 +- .../core/Mage/Core/Model/Mysql4/Cache.php | 2 +- .../Core/Model/Mysql4/Collection/Abstract.php | 266 +- .../core/Mage/Core/Model/Mysql4/Config.php | 2 +- .../Mage/Core/Model/Mysql4/Config/Data.php | 2 +- .../Model/Mysql4/Config/Data/Collection.php | 2 +- .../Core/Model/Mysql4/Convert/History.php | 2 +- .../Mysql4/Convert/History/Collection.php | 2 +- .../Core/Model/Mysql4/Convert/Profile.php | 2 +- .../Mysql4/Convert/Profile/Collection.php | 2 +- .../core/Mage/Core/Model/Mysql4/Design.php | 6 +- .../Core/Model/Mysql4/Design/Collection.php | 2 +- .../Mysql4/Design/Package/Collection.php | 2 +- .../Model/Mysql4/Design/Theme/Collection.php | 2 +- .../Mage/Core/Model/Mysql4/Email/Template.php | 2 +- .../Mysql4/Email/Template/Collection.php | 2 +- app/code/core/Mage/Core/Model/Mysql4/Flag.php | 2 +- .../core/Mage/Core/Model/Mysql4/History.php | 2 +- .../core/Mage/Core/Model/Mysql4/Language.php | 2 +- .../Core/Model/Mysql4/Language/Collection.php | 2 +- .../core/Mage/Core/Model/Mysql4/Layout.php | 2 +- .../core/Mage/Core/Model/Mysql4/Resource.php | 2 +- .../core/Mage/Core/Model/Mysql4/Session.php | 2 +- .../core/Mage/Core/Model/Mysql4/Store.php | 4 +- .../Core/Model/Mysql4/Store/Collection.php | 2 +- .../Mage/Core/Model/Mysql4/Store/Group.php | 2 +- .../Model/Mysql4/Store/Group/Collection.php | 2 +- .../core/Mage/Core/Model/Mysql4/Translate.php | 2 +- .../Core/Model/Mysql4/Translate/String.php | 2 +- .../Mage/Core/Model/Mysql4/Url/Rewrite.php | 6 +- .../Model/Mysql4/Url/Rewrite/Collection.php | 2 +- .../core/Mage/Core/Model/Mysql4/Variable.php | 2 +- .../Core/Model/Mysql4/Variable/Collection.php | 2 +- .../core/Mage/Core/Model/Mysql4/Website.php | 4 +- .../Core/Model/Mysql4/Website/Collection.php | 2 +- app/code/core/Mage/Core/Model/Resource.php | 4 +- .../Mage/Core/Model/Resource/Abstract.php | 44 +- .../Core/Model/Resource/Entity/Abstract.php | 2 +- .../Mage/Core/Model/Resource/Entity/Table.php | 2 +- .../Mage/Core/Model/Resource/Iterator.php | 2 +- .../core/Mage/Core/Model/Resource/Setup.php | 47 +- .../Mage/Core/Model/Resource/Transaction.php | 2 +- .../Core/Model/Resource/Type/Abstract.php | 2 +- .../core/Mage/Core/Model/Resource/Type/Db.php | 2 +- .../Core/Model/Resource/Type/Db/Mysqli.php | 2 +- .../Model/Resource/Type/Db/Mysqli/Setup.php | 2 +- .../Core/Model/Resource/Type/Db/Pdo/Mysql.php | 2 +- app/code/core/Mage/Core/Model/Session.php | 2 +- .../core/Mage/Core/Model/Session/Abstract.php | 2 +- .../Core/Model/Session/Abstract/Varien.php | 2 +- .../Mage/Core/Model/Session/Abstract/Zend.php | 2 +- .../Mage/Core/Model/Session/Exception.php | 2 +- .../Core/Model/Source/Email/Variables.php | 2 +- app/code/core/Mage/Core/Model/Store.php | 2 +- .../core/Mage/Core/Model/Store/Exception.php | 2 +- app/code/core/Mage/Core/Model/Store/Group.php | 2 +- app/code/core/Mage/Core/Model/Translate.php | 6 +- .../core/Mage/Core/Model/Translate/Expr.php | 2 +- .../core/Mage/Core/Model/Translate/Inline.php | 110 +- .../core/Mage/Core/Model/Translate/String.php | 2 +- app/code/core/Mage/Core/Model/Url.php | 2 +- app/code/core/Mage/Core/Model/Url/Rewrite.php | 2 +- app/code/core/Mage/Core/Model/Variable.php | 4 +- .../core/Mage/Core/Model/Variable/Config.php | 2 +- .../Mage/Core/Model/Variable/Observer.php | 2 +- app/code/core/Mage/Core/Model/Website.php | 4 +- .../Mage/Core/controllers/AjaxController.php | 2 +- .../Mage/Core/controllers/IndexController.php | 2 +- app/code/core/Mage/Core/etc/config.xml | 7 +- app/code/core/Mage/Core/etc/system.xml | 94 +- app/code/core/Mage/Core/functions.php | 9 +- .../sql/core_setup/mysql4-install-0.7.0.php | 2 +- .../sql/core_setup/mysql4-install-0.8.0.php | 2 +- .../mysql4-upgrade-0.6.26-0.7.0.php | 2 +- .../core_setup/mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../core_setup/mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../core_setup/mysql4-upgrade-0.7.3-0.7.4.php | 2 +- .../core_setup/mysql4-upgrade-0.7.4-0.7.5.php | 2 +- .../core_setup/mysql4-upgrade-0.7.5-0.7.6.php | 2 +- .../core_setup/mysql4-upgrade-0.7.6-0.7.7.php | 2 +- .../core_setup/mysql4-upgrade-0.7.7-0.7.8.php | 2 +- .../core_setup/mysql4-upgrade-0.7.8-0.7.9.php | 2 +- .../core_setup/mysql4-upgrade-0.8.0-0.8.1.php | 2 +- .../core_setup/mysql4-upgrade-0.8.1-0.8.2.php | 2 +- .../mysql4-upgrade-0.8.10-0.8.11.php | 2 +- .../mysql4-upgrade-0.8.11-0.8.12.php | 2 +- .../mysql4-upgrade-0.8.12-0.8.13.php | 2 +- .../mysql4-upgrade-0.8.13-0.8.14.php | 2 +- .../mysql4-upgrade-0.8.14-0.8.15.php | 2 +- .../mysql4-upgrade-0.8.15-0.8.16.php | 2 +- .../mysql4-upgrade-0.8.16-0.8.17.php | 2 +- .../mysql4-upgrade-0.8.17-0.8.18.php | 2 +- .../mysql4-upgrade-0.8.18-0.8.19.php | 2 +- .../mysql4-upgrade-0.8.19-0.8.20.php | 2 +- .../core_setup/mysql4-upgrade-0.8.2-0.8.3.php | 2 +- .../mysql4-upgrade-0.8.20-0.8.21.php | 2 +- .../mysql4-upgrade-0.8.21-0.8.22.php | 2 +- .../mysql4-upgrade-0.8.22-0.8.23.php | 2 +- .../mysql4-upgrade-0.8.23-0.8.24.php | 2 +- .../mysql4-upgrade-0.8.24-0.8.25.php | 2 +- .../mysql4-upgrade-0.8.25-0.8.26.php | 62 +- .../core_setup/mysql4-upgrade-0.8.3-0.8.4.php | 2 +- .../core_setup/mysql4-upgrade-0.8.4-0.8.5.php | 2 +- .../core_setup/mysql4-upgrade-0.8.5-0.8.6.php | 2 +- .../core_setup/mysql4-upgrade-0.8.6-0.8.7.php | 2 +- .../core_setup/mysql4-upgrade-0.8.7-0.8.8.php | 2 +- .../core_setup/mysql4-upgrade-0.8.8-0.8.9.php | 2 +- .../mysql4-upgrade-0.8.9-0.8.10.php | 2 +- app/code/core/Mage/Cron/Exception.php | 2 +- app/code/core/Mage/Cron/Helper/Data.php | 2 +- .../core/Mage/Cron/Model/Mysql4/Schedule.php | 15 +- .../Cron/Model/Mysql4/Schedule/Collection.php | 2 +- app/code/core/Mage/Cron/Model/Observer.php | 8 +- app/code/core/Mage/Cron/Model/Schedule.php | 7 +- app/code/core/Mage/Cron/etc/config.xml | 2 +- app/code/core/Mage/Cron/etc/system.xml | 14 +- .../sql/cron_setup/mysql4-install-0.7.0.php | 2 +- .../cron_setup/mysql4-upgrade-0.7.0-0.7.1.php | 2 +- app/code/core/Mage/Customer/Block/Account.php | 2 +- .../Mage/Customer/Block/Account/Dashboard.php | 6 +- .../Block/Account/Dashboard/Address.php | 2 +- .../Block/Account/Dashboard/Block.php | 2 +- .../Block/Account/Dashboard/Hello.php | 2 +- .../Customer/Block/Account/Dashboard/Info.php | 2 +- .../Block/Account/Dashboard/Newsletter.php | 2 +- .../Block/Account/Dashboard/Sidebar.php | 2 +- .../Customer/Block/Account/Forgotpassword.php | 2 +- .../Customer/Block/Account/Navigation.php | 2 +- .../core/Mage/Customer/Block/Address/Book.php | 2 +- .../core/Mage/Customer/Block/Address/Edit.php | 2 +- .../Block/Address/Renderer/Default.php | 17 +- .../Block/Address/Renderer/Interface.php | 2 +- .../core/Mage/Customer/Block/Form/Edit.php | 2 +- .../core/Mage/Customer/Block/Form/Login.php | 2 +- .../Mage/Customer/Block/Form/Register.php | 2 +- .../core/Mage/Customer/Block/Newsletter.php | 2 +- .../Mage/Customer/Block/Widget/Abstract.php | 2 +- .../core/Mage/Customer/Block/Widget/Dob.php | 2 +- .../Mage/Customer/Block/Widget/Gender.php | 2 +- .../core/Mage/Customer/Block/Widget/Name.php | 2 +- .../Mage/Customer/Block/Widget/Taxvat.php | 2 +- app/code/core/Mage/Customer/Exception.php | 2 +- .../core/Mage/Customer/Helper/Address.php | 16 +- app/code/core/Mage/Customer/Helper/Data.php | 2 +- app/code/core/Mage/Customer/Model/Address.php | 14 +- .../Mage/Customer/Model/Address/Abstract.php | 31 +- .../core/Mage/Customer/Model/Address/Api.php | 2 +- .../Mage/Customer/Model/Address/Api/V2.php | 2 +- .../Mage/Customer/Model/Address/Config.php | 2 +- .../core/Mage/Customer/Model/Api/Resource.php | 2 +- .../core/Mage/Customer/Model/Attribute.php | 2 +- .../core/Mage/Customer/Model/Config/Share.php | 4 +- .../Model/Convert/Adapter/Customer.php | 20 +- .../Model/Convert/Parser/Customer.php | 30 +- .../core/Mage/Customer/Model/Customer.php | 64 +- .../core/Mage/Customer/Model/Customer/Api.php | 2 +- .../Mage/Customer/Model/Customer/Api/V2.php | 2 +- .../Customer/Attribute/Backend/Billing.php | 2 +- .../Customer/Attribute/Backend/Password.php | 4 +- .../Customer/Attribute/Backend/Shipping.php | 2 +- .../Customer/Attribute/Backend/Store.php | 2 +- .../Customer/Attribute/Backend/Website.php | 2 +- .../Model/Customer/Attribute/Source/Group.php | 2 +- .../Model/Customer/Attribute/Source/Store.php | 2 +- .../Customer/Attribute/Source/Website.php | 2 +- .../Mage/Customer/Model/Entity/Address.php | 5 +- .../Address/Attribute/Backend/Region.php | 2 +- .../Address/Attribute/Backend/Street.php | 2 +- .../Entity/Address/Attribute/Collection.php | 2 +- .../Address/Attribute/Source/Country.php | 2 +- .../Address/Attribute/Source/Region.php | 2 +- .../Model/Entity/Address/Collection.php | 2 +- .../Mage/Customer/Model/Entity/Attribute.php | 2 +- .../Model/Entity/Attribute/Collection.php | 2 +- .../Mage/Customer/Model/Entity/Customer.php | 28 +- .../Model/Entity/Customer/Collection.php | 2 +- .../core/Mage/Customer/Model/Entity/Group.php | 4 +- .../Model/Entity/Group/Collection.php | 2 +- .../core/Mage/Customer/Model/Entity/Setup.php | 2 +- .../Model/Entity/Wishlist/Collection.php | 2 +- app/code/core/Mage/Customer/Model/Group.php | 2 +- .../core/Mage/Customer/Model/Group/Api.php | 2 +- .../core/Mage/Customer/Model/Group/Api/V2.php | 2 +- .../core/Mage/Customer/Model/Observer.php | 2 +- app/code/core/Mage/Customer/Model/Session.php | 2 +- .../controllers/AccountController.php | 28 +- .../controllers/AddressController.php | 14 +- .../Customer/controllers/ReviewController.php | 2 +- app/code/core/Mage/Customer/etc/adminhtml.xml | 2 +- app/code/core/Mage/Customer/etc/api.xml | 2 +- app/code/core/Mage/Customer/etc/config.xml | 4 +- app/code/core/Mage/Customer/etc/system.xml | 26 +- .../customer_setup/mysql4-install-0.7.0.php | 2 +- .../customer_setup/mysql4-install-0.8.0.php | 2 +- .../mysql4-install-1.4.0.0.0.php | 2 +- .../mysql4-upgrade-0.6.1-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../mysql4-upgrade-0.8.0-0.8.1.php | 2 +- .../mysql4-upgrade-0.8.10-0.8.11.php | 2 +- .../mysql4-upgrade-0.8.11-0.8.12.php | 2 +- .../mysql4-upgrade-0.8.12-1.4.0.0.0.php | 2 +- .../mysql4-upgrade-0.8.4-0.8.5.php | 2 +- .../mysql4-upgrade-0.8.5-0.8.6.php | 2 +- .../mysql4-upgrade-0.8.6-0.8.7.php | 2 +- .../mysql4-upgrade-0.8.7-0.8.8.php | 2 +- .../mysql4-upgrade-0.8.8-0.8.9.php | 2 +- .../mysql4-upgrade-0.8.9-0.8.10.php | 2 +- .../mysql4-upgrade-1.4.0.0.0-1.4.0.0.1.php | 2 +- .../mysql4-upgrade-1.4.0.0.1-1.4.0.0.2.php | 2 +- .../mysql4-upgrade-1.4.0.0.2-1.4.0.0.3.php | 2 +- .../mysql4-upgrade-1.4.0.0.3-1.4.0.0.4.php | 2 +- .../mysql4-upgrade-1.4.0.0.5-1.4.0.0.6.php | 2 +- .../mysql4-upgrade-1.4.0.0.6-1.4.0.0.7.php | 29 + app/code/core/Mage/Cybermut/Block/Error.php | 37 + app/code/core/Mage/Cybermut/Block/Form.php | 43 + .../core/Mage/Cybermut/Block/Redirect.php | 63 + app/code/core/Mage/Cybermut/Helper/Data.php | 38 + .../core/Mage/Cybermut/Model/Api/Debug.php | 41 + .../Mage/Cybermut/Model/Mysql4/Api/Debug.php | 42 + .../Model/Mysql4/Api/Debug/Collection.php | 41 + .../core/Mage/Cybermut/Model/Mysql4/Setup.php | 39 + app/code/core/Mage/Cybermut/Model/Payment.php | 378 + .../core/Mage/Cybermut/Model/Source/Bank.php | 49 + .../Mage/Cybermut/Model/Source/Language.php | 52 + .../controllers/PaymentController.php | 203 + app/code/core/Mage/Cybermut/etc/config.xml | 110 + app/code/core/Mage/Cybermut/etc/system.xml | 174 + .../cybermut_setup/mysql4-install-0.1.0.php | 45 + app/code/core/Mage/Cybersource/Block/Form.php | 96 + app/code/core/Mage/Cybersource/Block/Info.php | 75 + .../core/Mage/Cybersource/Helper/Data.php | 33 + .../Model}/Api/Debug.php | 11 +- .../Model/Api/ExtendedSoapClient.php | 117 + .../core/Mage/Cybersource/Model/Config.php | 62 + .../Cybersource/Model/Mysql4/Api/Debug.php | 39 + .../Model/Mysql4/Api/Debug/Collection.php | 39 + .../Mage/Cybersource/Model/Mysql4/Setup.php | 38 + app/code/core/Mage/Cybersource/Model/Soap.php | 582 ++ .../Mage/Cybersource/Model/Source/Cctype.php | 33 + .../Model/Source/PaymentAction.php | 42 + app/code/core/Mage/Cybersource/etc/config.xml | 123 + app/code/core/Mage/Cybersource/etc/system.xml | 160 + .../mysql4-install-0.7.0.php | 54 + app/code/core/Mage/Dataflow/Helper/Data.php | 2 +- app/code/core/Mage/Dataflow/Model/Batch.php | 2 +- .../Mage/Dataflow/Model/Batch/Abstract.php | 2 +- .../core/Mage/Dataflow/Model/Batch/Export.php | 2 +- .../core/Mage/Dataflow/Model/Batch/Import.php | 2 +- .../core/Mage/Dataflow/Model/Batch/Io.php | 2 +- app/code/core/Mage/Dataflow/Model/Convert.php | 2 +- .../Mage/Dataflow/Model/Convert/Action.php | 2 +- .../Model/Convert/Action/Abstract.php | 2 +- .../Model/Convert/Action/Interface.php | 2 +- .../Model/Convert/Adapter/Abstract.php | 2 +- .../Model/Convert/Adapter/Db/Table.php | 2 +- .../Dataflow/Model/Convert/Adapter/Http.php | 2 +- .../Model/Convert/Adapter/Http/Curl.php | 2 +- .../Model/Convert/Adapter/Interface.php | 2 +- .../Dataflow/Model/Convert/Adapter/Io.php | 26 +- .../Dataflow/Model/Convert/Adapter/Soap.php | 2 +- .../Dataflow/Model/Convert/Adapter/Std.php | 2 +- .../Model/Convert/Adapter/Zend/Cache.php | 2 +- .../Model/Convert/Adapter/Zend/Db.php | 2 +- .../Model/Convert/Container/Abstract.php | 2 +- .../Model/Convert/Container/Collection.php | 2 +- .../Model/Convert/Container/Generic.php | 2 +- .../Model/Convert/Container/Interface.php | 2 +- .../Mage/Dataflow/Model/Convert/Exception.php | 2 +- .../Mage/Dataflow/Model/Convert/Iterator.php | 4 +- .../Model/Convert/Iterator/File/Csv.php | 2 +- .../Dataflow/Model/Convert/Iterator/Http.php | 2 +- .../Model/Convert/Iterator/Interface.php | 2 +- .../Model/Convert/Mapper/Abstract.php | 2 +- .../Dataflow/Model/Convert/Mapper/Column.php | 4 +- .../Model/Convert/Mapper/Interface.php | 2 +- .../Model/Convert/Parser/Abstract.php | 4 +- .../Dataflow/Model/Convert/Parser/Csv.php | 10 +- .../Model/Convert/Parser/Interface.php | 2 +- .../Model/Convert/Parser/Serialize.php | 2 +- .../Model/Convert/Parser/Xml/Excel.php | 10 +- .../Mage/Dataflow/Model/Convert/Profile.php | 2 +- .../Model/Convert/Profile/Abstract.php | 2 +- .../Model/Convert/Profile/Collection.php | 2 +- .../Model/Convert/Profile/Interface.php | 2 +- .../Model/Convert/Validator/Abstract.php | 2 +- .../Model/Convert/Validator/Column.php | 2 +- .../Model/Convert/Validator/Dryrun.php | 4 +- .../Model/Convert/Validator/Interface.php | 2 +- app/code/core/Mage/Dataflow/Model/Import.php | 2 +- .../core/Mage/Dataflow/Model/Mysql4/Batch.php | 2 +- .../Dataflow/Model/Mysql4/Batch/Abstract.php | 2 +- .../Model/Mysql4/Batch/Collection.php | 2 +- .../Dataflow/Model/Mysql4/Batch/Export.php | 2 +- .../Dataflow/Model/Mysql4/Batch/Import.php | 2 +- .../Mage/Dataflow/Model/Mysql4/Catalogold.php | 2 +- .../Mage/Dataflow/Model/Mysql4/Import.php | 2 +- .../Model/Mysql4/Import/Collection.php | 2 +- .../Mage/Dataflow/Model/Mysql4/Profile.php | 2 +- .../Model/Mysql4/Profile/Collection.php | 2 +- .../Dataflow/Model/Mysql4/Profile/History.php | 2 +- .../Mysql4/Profile/History/Collection.php | 2 +- .../Mage/Dataflow/Model/Mysql4/Session.php | 2 +- app/code/core/Mage/Dataflow/Model/Profile.php | 4 +- .../Mage/Dataflow/Model/Profile/History.php | 2 +- app/code/core/Mage/Dataflow/Model/Session.php | 2 +- .../Dataflow/Model/Session/Adapter/Http.php | 2 +- .../Dataflow/Model/Session/Parser/Csv.php | 2 +- app/code/core/Mage/Dataflow/etc/config.xml | 2 +- .../dataflow_setup/mysql4-install-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../mysql4-upgrade-0.7.3-0.7.4.php | 2 +- .../Adminhtml/Frontend/Currency/Base.php | 2 +- .../Adminhtml/Frontend/Region/Updater.php | 2 +- .../core/Mage/Directory/Block/Currency.php | 2 +- app/code/core/Mage/Directory/Block/Data.php | 2 +- app/code/core/Mage/Directory/Exception.php | 2 +- app/code/core/Mage/Directory/Helper/Data.php | 2 +- app/code/core/Mage/Directory/Helper/Url.php | 2 +- .../core/Mage/Directory/Model/Country.php | 2 +- .../core/Mage/Directory/Model/Country/Api.php | 2 +- .../Mage/Directory/Model/Country/Api/V2.php | 2 +- .../Mage/Directory/Model/Country/Format.php | 2 +- .../core/Mage/Directory/Model/Currency.php | 8 +- .../Mage/Directory/Model/Currency/Filter.php | 2 +- .../Model/Currency/Import/Abstract.php | 2 +- .../Model/Currency/Import/Webservicex.php | 6 +- .../Mage/Directory/Model/Mysql4/Country.php | 2 +- .../Model/Mysql4/Country/Collection.php | 2 +- .../Directory/Model/Mysql4/Country/Format.php | 2 +- .../Mysql4/Country/Format/Collection.php | 2 +- .../Mage/Directory/Model/Mysql4/Currency.php | 2 +- .../Model/Mysql4/Currency/Collection.php | 2 +- .../Mage/Directory/Model/Mysql4/Region.php | 2 +- .../Model/Mysql4/Region/Collection.php | 2 +- .../core/Mage/Directory/Model/Observer.php | 6 +- app/code/core/Mage/Directory/Model/Region.php | 2 +- .../core/Mage/Directory/Model/Region/Api.php | 2 +- .../Mage/Directory/Model/Region/Api/V2.php | 2 +- .../controllers/CurrencyController.php | 2 +- app/code/core/Mage/Directory/etc/api.xml | 2 +- app/code/core/Mage/Directory/etc/config.xml | 2 +- app/code/core/Mage/Directory/etc/system.xml | 12 +- .../directory_setup/mysql4-install-0.7.0.php | 2 +- .../directory_setup/mysql4-install-0.8.0.php | 2 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.8.0-0.8.1.php | 2 +- .../mysql4-upgrade-0.8.1-0.8.2.php | 2 +- .../mysql4-upgrade-0.8.2-0.8.3.php | 2 +- .../mysql4-upgrade-0.8.3-0.8.4.php | 2 +- .../mysql4-upgrade-0.8.4-0.8.5.php | 2 +- .../mysql4-upgrade-0.8.5-0.8.6.php | 2 +- .../mysql4-upgrade-0.8.6-0.8.7.php | 2 +- .../mysql4-upgrade-0.8.7-0.8.8.php | 2 +- .../mysql4-upgrade-0.8.8-0.8.9.php | 2 +- .../mysql4-upgrade-0.8.9-0.8.10.php | 2 +- .../Catalog/Product/Edit/Tab/Downloadable.php | 2 +- .../Product/Edit/Tab/Downloadable/Links.php | 2 +- .../Product/Edit/Tab/Downloadable/Samples.php | 2 +- .../Sales/Items/Column/Downloadable/Name.php | 2 +- .../Block/Catalog/Product/Links.php | 2 +- .../Block/Catalog/Product/Samples.php | 2 +- .../Block/Catalog/Product/View/Type.php | 2 +- .../Block/Checkout/Cart/Item/Renderer.php | 2 +- .../Downloadable/Block/Checkout/Success.php | 2 +- .../Block/Customer/Products/List.php | 2 +- .../Sales/Order/Email/Items/Downloadable.php | 2 +- .../Order/Email/Items/Order/Downloadable.php | 2 +- .../Order/Item/Renderer/Downloadable.php | 2 +- .../core/Mage/Downloadable/Helper/Data.php | 2 +- .../Mage/Downloadable/Helper/Download.php | 16 +- .../core/Mage/Downloadable/Helper/File.php | 2 +- .../Model/CatalogIndex/Data/Downloadable.php | 2 +- .../core/Mage/Downloadable/Model/Link.php | 2 +- .../Downloadable/Model/Link/Purchased.php | 2 +- .../Model/Link/Purchased/Item.php | 2 +- .../Model/Mysql4/Indexer/Price.php | 33 +- .../Mage/Downloadable/Model/Mysql4/Link.php | 2 +- .../Model/Mysql4/Link/Collection.php | 2 +- .../Model/Mysql4/Link/Purchased.php | 2 +- .../Mysql4/Link/Purchased/Collection.php | 2 +- .../Model/Mysql4/Link/Purchased/Item.php | 2 +- .../Mysql4/Link/Purchased/Item/Collection.php | 2 +- .../Mage/Downloadable/Model/Mysql4/Sample.php | 2 +- .../Model/Mysql4/Sample/Collection.php | 2 +- .../core/Mage/Downloadable/Model/Observer.php | 14 +- .../Mage/Downloadable/Model/Product/Price.php | 2 +- .../Mage/Downloadable/Model/Product/Type.php | 2 +- .../Model/Sales/Order/Pdf/Items/Abstract.php | 2 +- .../Sales/Order/Pdf/Items/Creditmemo.php | 2 +- .../Model/Sales/Order/Pdf/Items/Invoice.php | 2 +- .../core/Mage/Downloadable/Model/Sample.php | 2 +- .../Config/Source/Contentdisposition.php | 2 +- .../System/Config/Source/Orderitemstatus.php | 2 +- .../controllers/CustomerController.php | 2 +- .../controllers/DownloadController.php | 18 +- .../controllers/FileController.php | 2 +- .../controllers/Product/EditController.php | 4 +- .../core/Mage/Downloadable/etc/adminhtml.xml | 2 +- .../core/Mage/Downloadable/etc/config.xml | 10 +- .../core/Mage/Downloadable/etc/system.xml | 8 +- .../mysql4-install-0.1.0.php | 2 +- .../mysql4-install-1.4.0.0.php | 262 + .../mysql4-upgrade-0.1.0-0.1.1.php | 2 +- .../mysql4-upgrade-0.1.1-0.1.2.php | 2 +- .../mysql4-upgrade-0.1.10-0.1.11.php | 2 +- .../mysql4-upgrade-0.1.11-0.1.12.php | 2 +- .../mysql4-upgrade-0.1.12-0.1.13.php | 2 +- .../mysql4-upgrade-0.1.13-0.1.14.php | 2 +- .../mysql4-upgrade-0.1.14-0.1.15.php | 2 +- .../mysql4-upgrade-0.1.15-0.1.16.php | 2 +- .../mysql4-upgrade-0.1.2-0.1.3.php | 2 +- .../mysql4-upgrade-0.1.3-0.1.4.php | 2 +- .../mysql4-upgrade-0.1.4-0.1.5.php | 2 +- .../mysql4-upgrade-0.1.5-0.1.6.php | 2 +- .../mysql4-upgrade-0.1.6-0.1.7.php | 2 +- .../mysql4-upgrade-0.1.7-0.1.8.php | 2 +- .../mysql4-upgrade-0.1.8-0.1.9.php | 2 +- .../mysql4-upgrade-0.1.9-0.1.10.php | 2 +- .../mysql4-upgrade-1.3.9-1.4.0.0.php | 49 + .../mysql4-upgrade-1.4.0.0-1.4.0.1.php | 53 + .../Eav/Block/Adminhtml/Attribute/Edit/Js.php | 2 +- .../Attribute/Edit/Main/Abstract.php | 18 +- .../Attribute/Edit/Options/Abstract.php | 2 +- .../Adminhtml/Attribute/Grid/Abstract.php | 2 +- app/code/core/Mage/Eav/Exception.php | 2 +- app/code/core/Mage/Eav/Helper/Data.php | 6 +- .../System/Config/Source/Inputtype.php | 2 +- app/code/core/Mage/Eav/Model/Config.php | 19 +- .../Mage/Eav/Model/Convert/Adapter/Entity.php | 8 +- .../Mage/Eav/Model/Convert/Adapter/Grid.php | 10 +- .../Eav/Model/Convert/Parser/Abstract.php | 2 +- app/code/core/Mage/Eav/Model/Entity.php | 2 +- .../core/Mage/Eav/Model/Entity/Abstract.php | 44 +- .../core/Mage/Eav/Model/Entity/Attribute.php | 8 +- .../Eav/Model/Entity/Attribute/Abstract.php | 4 +- .../Entity/Attribute/Backend/Abstract.php | 4 +- .../Model/Entity/Attribute/Backend/Array.php | 2 +- .../Entity/Attribute/Backend/Datetime.php | 2 +- .../Entity/Attribute/Backend/Default.php | 2 +- .../Entity/Attribute/Backend/Increment.php | 2 +- .../Entity/Attribute/Backend/Interface.php | 2 +- .../Entity/Attribute/Backend/Serialized.php | 81 + .../Model/Entity/Attribute/Backend/Store.php | 2 +- .../Entity/Attribute/Backend/Time/Created.php | 2 +- .../Entity/Attribute/Backend/Time/Updated.php | 2 +- .../Eav/Model/Entity/Attribute/Exception.php | 2 +- .../Entity/Attribute/Frontend/Abstract.php | 2 +- .../Entity/Attribute/Frontend/Datetime.php | 2 +- .../Entity/Attribute/Frontend/Default.php | 2 +- .../Entity/Attribute/Frontend/Interface.php | 2 +- .../Mage/Eav/Model/Entity/Attribute/Group.php | 2 +- .../Eav/Model/Entity/Attribute/Interface.php | 2 +- .../Eav/Model/Entity/Attribute/Option.php | 2 +- .../Mage/Eav/Model/Entity/Attribute/Set.php | 4 +- .../Entity/Attribute/Source/Abstract.php | 2 +- .../Model/Entity/Attribute/Source/Boolean.php | 2 +- .../Model/Entity/Attribute/Source/Config.php | 2 +- .../Entity/Attribute/Source/Interface.php | 2 +- .../Model/Entity/Attribute/Source/Store.php | 2 +- .../Model/Entity/Attribute/Source/Table.php | 2 +- .../core/Mage/Eav/Model/Entity/Collection.php | 2 +- .../Eav/Model/Entity/Collection/Abstract.php | 43 +- .../Eav/Model/Entity/Increment/Abstract.php | 2 +- .../Eav/Model/Entity/Increment/Alphanum.php | 2 +- .../Eav/Model/Entity/Increment/Interface.php | 2 +- .../Eav/Model/Entity/Increment/Numeric.php | 2 +- .../core/Mage/Eav/Model/Entity/Interface.php | 2 +- app/code/core/Mage/Eav/Model/Entity/Setup.php | 12 +- app/code/core/Mage/Eav/Model/Entity/Store.php | 2 +- app/code/core/Mage/Eav/Model/Entity/Type.php | 8 +- app/code/core/Mage/Eav/Model/Form/Element.php | 6 +- .../core/Mage/Eav/Model/Form/Fieldset.php | 4 +- app/code/core/Mage/Eav/Model/Form/Type.php | 2 +- .../core/Mage/Eav/Model/Mysql4/Config.php | 2 +- .../Eav/Model/Mysql4/Entity/Attribute.php | 6 +- .../Mysql4/Entity/Attribute/Collection.php | 17 +- .../Model/Mysql4/Entity/Attribute/Group.php | 2 +- .../Entity/Attribute/Group/Collection.php | 2 +- .../Model/Mysql4/Entity/Attribute/Option.php | 2 +- .../Entity/Attribute/Option/Collection.php | 2 +- .../Eav/Model/Mysql4/Entity/Attribute/Set.php | 2 +- .../Entity/Attribute/Set/Collection.php | 2 +- .../Mage/Eav/Model/Mysql4/Entity/Store.php | 2 +- .../Mage/Eav/Model/Mysql4/Entity/Type.php | 2 +- .../Model/Mysql4/Entity/Type/Collection.php | 2 +- .../Mage/Eav/Model/Mysql4/Form/Element.php | 2 +- .../Model/Mysql4/Form/Element/Collection.php | 2 +- .../Mage/Eav/Model/Mysql4/Form/Fieldset.php | 2 +- .../Model/Mysql4/Form/Fieldset/Collection.php | 2 +- .../core/Mage/Eav/Model/Mysql4/Form/Type.php | 2 +- .../Eav/Model/Mysql4/Form/Type/Collection.php | 2 +- app/code/core/Mage/Eav/etc/config.xml | 2 +- .../sql/eav_setup/mysql4-install-0.7.0.php | 2 +- .../eav_setup/mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../eav_setup/mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.10-0.7.11.php | 2 +- .../mysql4-upgrade-0.7.11-0.7.12.php | 2 +- .../mysql4-upgrade-0.7.12-0.7.13.php | 2 +- .../mysql4-upgrade-0.7.13-0.7.14.php | 2 +- .../mysql4-upgrade-0.7.14-0.7.15.php | 2 +- .../eav_setup/mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../eav_setup/mysql4-upgrade-0.7.3-0.7.4.php | 2 +- .../eav_setup/mysql4-upgrade-0.7.4-0.7.5.php | 2 +- .../eav_setup/mysql4-upgrade-0.7.5-0.7.6.php | 2 +- .../eav_setup/mysql4-upgrade-0.7.6-0.7.7.php | 2 +- .../eav_setup/mysql4-upgrade-0.7.7-0.7.8.php | 2 +- .../eav_setup/mysql4-upgrade-0.7.8-0.7.9.php | 2 +- .../eav_setup/mysql4-upgrade-0.7.9-0.7.10.php | 2 +- app/code/core/Mage/Eway/Block/Form.php | 42 + app/code/core/Mage/Eway/Block/Info.php | 48 + .../core/Mage/Eway/Block/Secure/Failure.php | 53 + app/code/core/Mage/Eway/Block/Secure/Form.php | 41 + .../core/Mage/Eway/Block/Secure/Redirect.php | 57 + .../core/Mage/Eway/Block/Shared/Failure.php | 55 + app/code/core/Mage/Eway/Block/Shared/Form.php | 42 + .../core/Mage/Eway/Block/Shared/Redirect.php | 58 + .../core/Mage/Eway/Controller/Abstract.php | 178 + .../Pro/Result.php => Eway/Helper/Data.php} | 11 +- app/code/core/Mage/Eway/Model/Api/Debug.php | 40 + app/code/core/Mage/Eway/Model/Direct.php | 309 + .../core/Mage/Eway/Model/Mysql4/Api/Debug.php | 40 + .../Model/Mysql4/Api/Debug/Collection.php | 40 + .../core/Mage/Eway/Model/Mysql4/Setup.php | 38 + app/code/core/Mage/Eway/Model/Secure.php | 54 + app/code/core/Mage/Eway/Model/Shared.php | 254 + .../Payflow => Eway/Model}/Source/Cctype.php | 12 +- .../Eway/controllers/SecureController.php | 42 + .../Eway/controllers/SharedController.php | 42 + app/code/core/Mage/Eway/etc/config.xml | 142 + app/code/core/Mage/Eway/etc/system.xml | 354 + .../sql/eway_setup/mysql4-install-0.1.0.php | 46 + app/code/core/Mage/Flo2Cash/Block/Form.php | 41 + app/code/core/Mage/Flo2Cash/Block/Info.php | 48 + app/code/core/Mage/Flo2Cash/Helper/Data.php | 37 + .../core/Mage/Flo2Cash/Model/Api/Debug.php | 40 + .../Mage/Flo2Cash/Model/Mysql4/Api/Debug.php | 40 + .../Model/Mysql4/Api/Debug/Collection.php | 40 + .../core/Mage/Flo2Cash/Model/Mysql4/Setup.php | 37 + .../Mage/Flo2Cash/Model/Source/Cctype.php | 40 + .../Model}/Source/PaymentAction.php | 19 +- app/code/core/Mage/Flo2Cash/Model/Web.php | 304 + app/code/core/Mage/Flo2Cash/etc/config.xml | 121 + app/code/core/Mage/Flo2Cash/etc/system.xml | 176 + .../flo2cash_setup/mysql4-install-0.1.0.php | 47 + .../mysql4-upgrade-0.1.0-0.1.1.php | 32 + .../Mage/GiftMessage/Block/Message/Form.php | 2 +- .../Mage/GiftMessage/Block/Message/Helper.php | 2 +- .../Mage/GiftMessage/Block/Message/Inline.php | 2 +- .../core/Mage/GiftMessage/Helper/Data.php | 2 +- .../core/Mage/GiftMessage/Helper/Message.php | 2 +- app/code/core/Mage/GiftMessage/Helper/Url.php | 2 +- .../Attribute/Backend/Boolean/Config.php | 18 +- .../Attribute/Source/Boolean/Config.php | 2 +- .../core/Mage/GiftMessage/Model/Message.php | 2 +- .../Mage/GiftMessage/Model/Mysql4/Message.php | 2 +- .../Model/Mysql4/Message/Collection.php | 2 +- .../Mage/GiftMessage/Model/Mysql4/Setup.php | 2 +- .../core/Mage/GiftMessage/Model/Observer.php | 9 +- .../controllers/IndexController.php | 2 +- app/code/core/Mage/GiftMessage/etc/config.xml | 2 +- app/code/core/Mage/GiftMessage/etc/system.xml | 2 +- .../mysql4-install-0.7.0.php | 2 +- .../mysql4-upgrade-0.1.3-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../core/Mage/GiftRegistry/Model/Gift.php | 2 +- .../Mage/GiftRegistry/Model/Mysql4/Gift.php | 2 +- .../Model/Mysql4/Gift/Collection.php | 2 +- .../core/Mage/GiftRegistry/etc/config.xml | 2 +- .../core/Mage/GoogleAnalytics/Block/Ga.php | 3 +- .../core/Mage/GoogleAnalytics/Helper/Data.php | 2 +- .../Mage/GoogleAnalytics/Model/Observer.php | 8 +- .../Mage/GoogleAnalytics/etc/adminhtml.xml | 2 +- .../core/Mage/GoogleAnalytics/etc/config.xml | 2 +- .../core/Mage/GoogleAnalytics/etc/system.xml | 4 +- .../GoogleBase/Block/Adminhtml/Captcha.php | 2 +- .../Mage/GoogleBase/Block/Adminhtml/Items.php | 2 +- .../GoogleBase/Block/Adminhtml/Items/Item.php | 2 +- .../Block/Adminhtml/Items/Product.php | 2 +- .../Block/Adminhtml/Items/Renderer/Id.php | 2 +- .../Block/Adminhtml/Store/Switcher.php | 2 +- .../Mage/GoogleBase/Block/Adminhtml/Types.php | 2 +- .../GoogleBase/Block/Adminhtml/Types/Edit.php | 2 +- .../Block/Adminhtml/Types/Edit/Attributes.php | 2 +- .../Block/Adminhtml/Types/Edit/Form.php | 4 +- .../GoogleBase/Block/Adminhtml/Types/Grid.php | 2 +- .../Adminhtml/Types/Renderer/Country.php | 2 +- app/code/core/Mage/GoogleBase/Helper/Data.php | 2 +- .../core/Mage/GoogleBase/Model/Attribute.php | 2 +- .../core/Mage/GoogleBase/Model/Config.php | 2 +- app/code/core/Mage/GoogleBase/Model/Item.php | 2 +- .../GoogleBase/Model/Mysql4/Attribute.php | 2 +- .../Model/Mysql4/Attribute/Collection.php | 2 +- .../Mage/GoogleBase/Model/Mysql4/Item.php | 2 +- .../Model/Mysql4/Item/Collection.php | 2 +- .../Mage/GoogleBase/Model/Mysql4/Type.php | 2 +- .../Model/Mysql4/Type/Collection.php | 2 +- .../core/Mage/GoogleBase/Model/Observer.php | 2 +- .../core/Mage/GoogleBase/Model/Service.php | 2 +- .../Mage/GoogleBase/Model/Service/Feed.php | 2 +- .../Mage/GoogleBase/Model/Service/Item.php | 6 +- .../GoogleBase/Model/Source/Accounttype.php | 2 +- .../Mage/GoogleBase/Model/Source/Authtype.php | 2 +- .../Mage/GoogleBase/Model/Source/Country.php | 2 +- .../Mage/GoogleBase/Model/Source/Statuses.php | 2 +- app/code/core/Mage/GoogleBase/Model/Type.php | 2 +- .../controllers/ItemsController.php | 20 +- .../controllers/SelectionController.php | 2 +- .../controllers/TypesController.php | 6 +- .../core/Mage/GoogleBase/etc/adminhtml.xml | 2 +- app/code/core/Mage/GoogleBase/etc/config.xml | 2 +- app/code/core/Mage/GoogleBase/etc/system.xml | 8 +- .../googlebase_setup/mysql4-install-0.1.0.php | 2 +- .../mysql4-upgrade-0.1.0-0.1.1.php | 2 +- .../Shipping/Applicable/Countries.php | 4 +- .../Block/Adminhtml/Shipping/Merchant.php | 2 +- .../core/Mage/GoogleCheckout/Block/Form.php | 2 +- .../core/Mage/GoogleCheckout/Block/Link.php | 2 +- .../Mage/GoogleCheckout/Block/Redirect.php | 2 +- .../core/Mage/GoogleCheckout/Exception.php | 2 +- .../core/Mage/GoogleCheckout/Helper/Data.php | 2 +- .../core/Mage/GoogleCheckout/Model/Api.php | 44 +- .../Mage/GoogleCheckout/Model/Api/Debug.php | 2 +- .../GoogleCheckout/Model/Api/Xml/Abstract.php | 30 +- .../Model/Api/Xml/Calculate.php | 10 +- .../GoogleCheckout/Model/Api/Xml/Callback.php | 177 +- .../GoogleCheckout/Model/Api/Xml/Checkout.php | 36 +- .../GoogleCheckout/Model/Api/Xml/Order.php | 2 +- .../GoogleCheckout/Model/Mysql4/Api/Debug.php | 2 +- .../Model/Mysql4/Api/Debug/Collection.php | 2 +- .../GoogleCheckout/Model/Mysql4/Setup.php | 2 +- .../Mage/GoogleCheckout/Model/Mysql4/Tax.php | 2 +- .../Mage/GoogleCheckout/Model/Observer.php | 2 +- .../Mage/GoogleCheckout/Model/Payment.php | 2 +- .../Mage/GoogleCheckout/Model/Shipping.php | 2 +- .../Model/Source/Checkout/Image.php | 2 +- .../GoogleCheckout/Model/Source/Locale.php | 2 +- .../Model/Source/Shipping/Carrier.php | 2 +- .../Model/Source/Shipping/Category.php | 2 +- .../Model/Source/Shipping/Units.php | 2 +- .../Model/Source/Shipping/Virtual/Method.php | 2 +- .../Source/Shipping/Virtual/Schedule.php | 2 +- .../controllers/ApiController.php | 4 +- .../controllers/RedirectController.php | 2 +- .../Mage/GoogleCheckout/etc/adminhtml.xml | 2 +- .../core/Mage/GoogleCheckout/etc/config.xml | 2 +- .../core/Mage/GoogleCheckout/etc/system.xml | 8 +- .../mysql4-install-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../Category/Edit/Tab/Googleoptimizer.php | 2 +- .../Product/Edit/Tab/Googleoptimizer.php | 8 +- .../Block/Adminhtml/Cms/Page/Edit/Enable.php | 2 +- .../Cms/Page/Edit/Renderer/Conversion.php | 2 +- .../Cms/Page/Edit/Tab/Googleoptimizer.php | 4 +- .../core/Mage/GoogleOptimizer/Block/Code.php | 2 +- .../GoogleOptimizer/Block/Code/Category.php | 2 +- .../GoogleOptimizer/Block/Code/Conversion.php | 2 +- .../Mage/GoogleOptimizer/Block/Code/Page.php | 2 +- .../GoogleOptimizer/Block/Code/Product.php | 2 +- .../core/Mage/GoogleOptimizer/Block/Js.php | 2 +- .../core/Mage/GoogleOptimizer/Helper/Data.php | 4 +- .../Googleoptimizer/Conversionpages.php | 2 +- .../core/Mage/GoogleOptimizer/Model/Code.php | 2 +- .../GoogleOptimizer/Model/Code/Category.php | 2 +- .../Mage/GoogleOptimizer/Model/Code/Page.php | 2 +- .../GoogleOptimizer/Model/Code/Product.php | 2 +- .../GoogleOptimizer/Model/Mysql4/Code.php | 2 +- .../Model/Mysql4/Code/Collection.php | 2 +- .../Mage/GoogleOptimizer/Model/Observer.php | 2 +- .../controllers/IndexController.php | 2 +- .../core/Mage/GoogleOptimizer/etc/config.xml | 2 +- .../core/Mage/GoogleOptimizer/etc/system.xml | 2 +- .../mysql4-install-0.1.0.php | 2 +- .../mysql4-upgrade-0.1.0-0.1.1.php | 2 +- .../mysql4-upgrade-0.1.1-0.1.2.php | 2 +- .../Mage/Ideal/Block/Advanced/Failure.php | 55 + .../core/Mage/Ideal/Block/Advanced/Form.php | 52 + .../core/Mage/Ideal/Block/Advanced/Info.php | 63 + .../Mage/Ideal/Block/Advanced/Redirect.php | 45 + .../core/Mage/Ideal/Block/Basic/Failure.php | 55 + app/code/core/Mage/Ideal/Block/Basic/Form.php | 42 + .../core/Mage/Ideal/Block/Basic/Redirect.php | 59 + app/code/core/Mage/Ideal/Helper/Data.php | 46 + app/code/core/Mage/Ideal/Model/Advanced.php | 237 + .../core/Mage/Ideal/Model/Api/Advanced.php | 507 + .../Api/Advanced/AcquirerStatusRequest.php | 61 + .../Api/Advanced/AcquirerStatusResponse.php | 44 + .../Model/Api/Advanced/AcquirerTrxRequest.php | 84 + .../Api/Advanced/AcquirerTrxResponse.php | 41 + .../Model/Api/Advanced/DirectoryRequest.php | 36 + .../Model/Api/Advanced/DirectoryResponse.php | 50 + .../Mage/Ideal/Model/Api/Advanced/Issuer.php | 41 + .../Mage/Ideal/Model/Api/Advanced/Request.php | 80 + .../Ideal/Model/Api/Advanced/Response.php | 54 + .../Ideal/Model/Api/Advanced/Security.php | 155 + app/code/core/Mage/Ideal/Model/Api/Debug.php | 40 + app/code/core/Mage/Ideal/Model/Basic.php | 220 + .../Mage/Ideal/Model/Mysql4/Api/Debug.php | 42 + .../Model/Mysql4/Api/Debug/Collection.php | 41 + .../core/Mage/Ideal/Model/Mysql4/Setup.php | 37 + app/code/core/Mage/Ideal/Model/Observer.php | 58 + .../core/Mage/Ideal/Model/Source/Language.php | 47 + .../Ideal/controllers/AdvancedController.php | 195 + .../Ideal/controllers/BasicController.php | 247 + app/code/core/Mage/Ideal/etc/config.xml | 136 + app/code/core/Mage/Ideal/etc/system.xml | 326 + .../sql/ideal_setup/mysql4-install-0.1.0.php | 51 + .../Index/Block/Adminhtml/Notifications.php | 2 +- .../Mage/Index/Block/Adminhtml/Process.php | 2 +- .../Index/Block/Adminhtml/Process/Edit.php | 2 +- .../Block/Adminhtml/Process/Edit/Form.php | 2 +- .../Block/Adminhtml/Process/Edit/Tab/Main.php | 2 +- .../Block/Adminhtml/Process/Edit/Tabs.php | 2 +- .../Index/Block/Adminhtml/Process/Grid.php | 2 +- app/code/core/Mage/Index/Helper/Data.php | 2 +- app/code/core/Mage/Index/Model/Event.php | 2 +- app/code/core/Mage/Index/Model/Indexer.php | 2 +- .../Mage/Index/Model/Indexer/Abstract.php | 2 +- .../core/Mage/Index/Model/Mysql4/Abstract.php | 41 +- .../core/Mage/Index/Model/Mysql4/Event.php | 2 +- .../Index/Model/Mysql4/Event/Collection.php | 2 +- .../core/Mage/Index/Model/Mysql4/Process.php | 2 +- .../Index/Model/Mysql4/Process/Collection.php | 2 +- .../core/Mage/Index/Model/Mysql4/Setup.php | 2 +- app/code/core/Mage/Index/Model/Observer.php | 2 +- app/code/core/Mage/Index/Model/Process.php | 4 +- .../Adminhtml/ProcessController.php | 24 +- app/code/core/Mage/Index/etc/adminhtml.xml | 10 +- app/code/core/Mage/Index/etc/config.xml | 2 +- .../index_setup/mysql4-install-1.4.0.0.php | 2 +- .../mysql4-upgrade-1.4.0.0-1.4.0.1.php | 2 +- .../mysql4-upgrade-1.4.0.1-1.4.0.2.php | 2 +- app/code/core/Mage/Install/Block/Abstract.php | 2 +- app/code/core/Mage/Install/Block/Admin.php | 2 +- app/code/core/Mage/Install/Block/Begin.php | 2 +- app/code/core/Mage/Install/Block/Config.php | 6 +- app/code/core/Mage/Install/Block/Download.php | 2 +- app/code/core/Mage/Install/Block/End.php | 2 +- app/code/core/Mage/Install/Block/Locale.php | 2 +- app/code/core/Mage/Install/Block/State.php | 2 +- .../core/Mage/Install/Controller/Action.php | 2 +- app/code/core/Mage/Install/Helper/Data.php | 2 +- app/code/core/Mage/Install/Model/Config.php | 2 +- .../core/Mage/Install/Model/Installer.php | 4 +- .../Mage/Install/Model/Installer/Abstract.php | 2 +- .../Mage/Install/Model/Installer/Config.php | 8 +- .../Mage/Install/Model/Installer/Console.php | 2 +- .../Mage/Install/Model/Installer/Data.php | 2 +- .../core/Mage/Install/Model/Installer/Db.php | 8 +- .../core/Mage/Install/Model/Installer/Env.php | 6 +- .../Install/Model/Installer/Filesystem.php | 4 +- .../Mage/Install/Model/Installer/Pear.php | 2 +- app/code/core/Mage/Install/Model/Observer.php | 2 +- app/code/core/Mage/Install/Model/Session.php | 2 +- app/code/core/Mage/Install/Model/Wizard.php | 2 +- .../Install/controllers/IndexController.php | 2 +- .../Install/controllers/WizardController.php | 9 +- app/code/core/Mage/Install/etc/config.xml | 2 +- app/code/core/Mage/Install/etc/install.xml | 2 +- app/code/core/Mage/Log/Helper/Data.php | 2 +- app/code/core/Mage/Log/Model/Aggregation.php | 2 +- app/code/core/Mage/Log/Model/Cron.php | 2 +- app/code/core/Mage/Log/Model/Customer.php | 2 +- app/code/core/Mage/Log/Model/Log.php | 2 +- .../Mage/Log/Model/Mysql4/Aggregation.php | 2 +- .../core/Mage/Log/Model/Mysql4/Customer.php | 2 +- app/code/core/Mage/Log/Model/Mysql4/Log.php | 2 +- .../core/Mage/Log/Model/Mysql4/Visitor.php | 2 +- .../Log/Model/Mysql4/Visitor/Aggregator.php | 2 +- .../Log/Model/Mysql4/Visitor/Collection.php | 2 +- .../Mage/Log/Model/Mysql4/Visitor/Online.php | 2 +- .../Mysql4/Visitor/Online/Collection.php | 2 +- app/code/core/Mage/Log/Model/Visitor.php | 2 +- .../Mage/Log/Model/Visitor/Aggregator.php | 2 +- .../core/Mage/Log/Model/Visitor/Online.php | 2 +- app/code/core/Mage/Log/etc/config.xml | 2 +- app/code/core/Mage/Log/etc/system.xml | 6 +- .../sql/log_setup/mysql4-install-0.7.0.php | 2 +- .../log_setup/mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../log_setup/mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../log_setup/mysql4-upgrade-0.7.3-0.7.4.php | 2 +- .../log_setup/mysql4-upgrade-0.7.4-0.7.5.php | 2 +- .../log_setup/mysql4-upgrade-0.7.5-0.7.6.php | 2 +- .../log_setup/mysql4-upgrade-0.7.6-0.7.7.php | 2 +- app/code/core/Mage/Media/Helper/Data.php | 2 +- app/code/core/Mage/Media/Model/File/Image.php | 8 +- app/code/core/Mage/Media/Model/Image.php | 2 +- .../Media/Model/Image/Config/Interface.php | 2 +- app/code/core/Mage/Media/etc/config.xml | 2 +- .../core/Mage/Newsletter/Block/Subscribe.php | 2 +- app/code/core/Mage/Newsletter/Helper/Data.php | 2 +- .../core/Mage/Newsletter/Model/Message.php | 2 +- .../Mage/Newsletter/Model/Mysql4/Problem.php | 2 +- .../Model/Mysql4/Problem/Collection.php | 2 +- .../Mage/Newsletter/Model/Mysql4/Queue.php | 6 +- .../Model/Mysql4/Queue/Collection.php | 2 +- .../Newsletter/Model/Mysql4/Subscriber.php | 4 +- .../Model/Mysql4/Subscriber/Collection.php | 2 +- .../Mage/Newsletter/Model/Mysql4/Template.php | 4 +- .../Model/Mysql4/Template/Collection.php | 2 +- .../core/Mage/Newsletter/Model/Observer.php | 2 +- .../core/Mage/Newsletter/Model/Problem.php | 2 +- app/code/core/Mage/Newsletter/Model/Queue.php | 2 +- .../core/Mage/Newsletter/Model/Session.php | 2 +- .../core/Mage/Newsletter/Model/Subscriber.php | 35 +- .../core/Mage/Newsletter/Model/Template.php | 2 +- .../Mage/Newsletter/Model/Template/Filter.php | 2 +- .../controllers/ManageController.php | 22 +- .../controllers/SubscriberController.php | 36 +- .../core/Mage/Newsletter/etc/adminhtml.xml | 2 +- app/code/core/Mage/Newsletter/etc/config.xml | 3 +- app/code/core/Mage/Newsletter/etc/system.xml | 11 +- .../newsletter_setup/mysql4-install-0.7.0.php | 2 +- .../newsletter_setup/mysql4-install-0.8.0.php | 2 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../mysql4-upgrade-0.8.0-0.8.1.php | 2 +- .../mysql4-upgrade-0.8.1-0.8.2.php | 2 +- app/code/core/Mage/Ogone/Block/Form.php | 39 + app/code/core/Mage/Ogone/Block/Info.php | 41 + app/code/core/Mage/Ogone/Block/Paypage.php | 41 + app/code/core/Mage/Ogone/Block/Placeform.php | 90 + app/code/core/Mage/Ogone/Helper/Data.php | 70 + app/code/core/Mage/Ogone/Model/Api.php | 268 + app/code/core/Mage/Ogone/Model/Api/Debug.php | 40 + app/code/core/Mage/Ogone/Model/Config.php | 151 + .../Mage/Ogone/Model/Mysql4/Api/Debug.php | 40 + .../Mage/Ogone/Model/Source/PaymentAction.php | 45 + .../core/Mage/Ogone/Model/Source/Pmlist.php | 45 + .../core/Mage/Ogone/Model/Source/Template.php | 44 + .../Mage/Ogone/controllers/ApiController.php | 482 + app/code/core/Mage/Ogone/etc/config.xml | 137 + app/code/core/Mage/Ogone/etc/system.xml | 234 + .../sql/ogone_setup/mysql4-install-0.0.1.php | 46 + .../Oscommerce/Block/Adminhtml/Import.php | 43 + .../Block/Adminhtml/Import/Edit.php | 68 + .../Block/Adminhtml/Import/Edit/Form.php | 52 + .../Adminhtml/Import/Edit/Tab/General.php | 110 + .../Block/Adminhtml/Import/Edit/Tab/Run.php | 239 + .../Block/Adminhtml/Import/Edit/Tabs.php | 66 + .../Block/Adminhtml/Import/Grid.php | 94 + .../Oscommerce/Block/Adminhtml/Import/Run.php | 293 + .../Mage/Oscommerce/Block/Adminhtml/Order.php | 43 + .../Oscommerce/Block/Adminhtml/Order/Grid.php | 128 + .../Oscommerce/Block/Adminhtml/Order/View.php | 102 + .../core/Mage/Oscommerce/Block/Order/List.php | 73 + .../core/Mage/Oscommerce/Block/Order/View.php | 69 + app/code/core/Mage/Oscommerce/Helper/Data.php | 35 + .../core/Mage/Oscommerce/Model/Config.php | 49 + .../Oscommerce/Model/Mysql4/Oscommerce.php | 2113 ++++ .../Model/Mysql4/Oscommerce/Collection.php | 38 + .../Model/Mysql4/Oscommerce/Order.php | 81 + .../Mysql4/Oscommerce/Order/Collection.php | 55 + .../core/Mage/Oscommerce/Model/Oscommerce.php | 87 + .../Oscommerce/Model/Oscommerce/Order.php | 55 + .../core/Mage/Oscommerce/Model/Session.php | 39 + .../Adminhtml/ImportController.php | 432 + .../controllers/Adminhtml/OrderController.php | 107 + .../controllers/OrderController.php | 100 + .../core/Mage/Oscommerce/etc/adminhtml.xml | 80 + .../core/Mage/Oscommerce/etc/charsets.xml | 595 ++ app/code/core/Mage/Oscommerce/etc/config.xml | 159 + .../oscommerce_setup/mysql4-install-0.8.0.php | 72 + .../mysql4-upgrade-0.8.0-0.8.1.php | 47 + .../mysql4-upgrade-0.8.1-0.8.2.php | 41 + .../mysql4-upgrade-0.8.2-0.8.3.php | 125 + .../mysql4-upgrade-0.8.3-0.8.4.php | 36 + .../mysql4-upgrade-0.8.4-0.8.5.php | 37 + .../mysql4-upgrade-0.8.5-0.8.6.php | 37 + .../mysql4-upgrade-0.8.6-0.8.7.php | 39 + .../mysql4-upgrade-0.8.7-0.8.8.php | 41 + .../mysql4-upgrade-0.8.8-0.8.9.php | 41 + .../mysql4-upgrade-0.8.9-0.8.10.php | 38 + app/code/core/Mage/Page/Block/Html.php | 2 +- .../core/Mage/Page/Block/Html/Breadcrumbs.php | 2 +- app/code/core/Mage/Page/Block/Html/Footer.php | 19 +- app/code/core/Mage/Page/Block/Html/Head.php | 2 +- app/code/core/Mage/Page/Block/Html/Header.php | 2 +- .../core/Mage/Page/Block/Html/Notices.php | 2 +- app/code/core/Mage/Page/Block/Html/Pager.php | 2 +- .../core/Mage/Page/Block/Html/Toplinks.php | 8 +- .../core/Mage/Page/Block/Html/Wrapper.php | 2 +- app/code/core/Mage/Page/Block/Js/Cookie.php | 2 +- .../core/Mage/Page/Block/Js/Translate.php | 2 +- app/code/core/Mage/Page/Block/Redirect.php | 2 +- app/code/core/Mage/Page/Block/Switch.php | 2 +- .../Mage/Page/Block/Template/Container.php | 2 +- .../core/Mage/Page/Block/Template/Links.php | 2 +- app/code/core/Mage/Page/Helper/Data.php | 2 +- app/code/core/Mage/Page/Helper/Html.php | 2 +- app/code/core/Mage/Page/Helper/Layout.php | 2 +- app/code/core/Mage/Page/Model/Config.php | 2 +- .../core/Mage/Page/Model/Source/Layout.php | 2 +- app/code/core/Mage/Page/etc/config.xml | 10 +- app/code/core/Mage/Page/etc/system.xml | 10 +- .../Mage/Paybox/Block/Adminhtml/Cart/Type.php | 46 + .../Block/Adminhtml/Cart/Type/Select.php | 56 + .../core/Mage/Paybox/Block/Direct/Form.php | 42 + .../core/Mage/Paybox/Block/Direct/Info.php | 48 + .../core/Mage/Paybox/Block/System/Error.php | 93 + .../core/Mage/Paybox/Block/System/Failure.php | 61 + .../core/Mage/Paybox/Block/System/Form.php | 42 + .../Mage/Paybox/Block/System/Redirect.php | 57 + .../Request.php => Paybox/Helper/Data.php} | 11 +- app/code/core/Mage/Paybox/Model/Api/Debug.php | 40 + app/code/core/Mage/Paybox/Model/Direct.php | 503 + .../Mage/Paybox/Model/Mysql4/Api/Debug.php | 40 + .../Model/Mysql4/Api/Debug/Collection.php | 13 +- .../Paybox/Model/Mysql4/Question/Number.php | 41 + .../core/Mage/Paybox/Model/Mysql4/Setup.php | 37 + .../Mage/Paybox/Model/Question/Number.php | 95 + .../Mage/Paybox/Model/Source/CartType.php | 61 + .../core/Mage/Paybox/Model/Source/Cctype.php | 40 + .../Mage/Paybox/Model/Source/Language.php | 50 + .../Paybox/Model/Source/ManagementMode.php | 48 + .../Mage/Paybox/Model/Source/MethodCall.php | 45 + .../Paybox/Model/Source/PaymentAction.php | 43 + .../Mage/Paybox/Model/Source/PaymentMode.php | 45 + .../Mage/Paybox/Model/Source/PaymentType.php | 48 + app/code/core/Mage/Paybox/Model/System.php | 517 + .../Paybox/controllers/SystemController.php | 364 + app/code/core/Mage/Paybox/etc/config.xml | 120 + app/code/core/Mage/Paybox/etc/currency.xml | 209 + app/code/core/Mage/Paybox/etc/system.xml | 459 + .../sql/paybox_setup/mysql4-install-0.1.0.php | 47 + .../mysql4-upgrade-0.1.0-0.1.1.php | 33 + .../mysql4-upgrade-0.1.1-0.1.2.php | 44 + .../mysql4-upgrade-0.1.2-0.1.3.php | 33 + app/code/core/Mage/Paygate/Helper/Data.php | 2 +- .../core/Mage/Paygate/Model/Authorizenet.php | 60 +- .../Mage/Paygate/Model/Authorizenet/Debug.php | 2 +- .../Paygate/Model/Authorizenet/Request.php | 2 +- .../Paygate/Model/Authorizenet/Result.php | 2 +- .../Model/Authorizenet/Source/Cctype.php | 2 +- .../Authorizenet/Source/PaymentAction.php | 2 +- .../Model/Mysql4/Authorizenet/Debug.php | 2 +- .../Mysql4/Authorizenet/Debug/Collection.php | 2 +- app/code/core/Mage/Paygate/etc/config.xml | 24 +- app/code/core/Mage/Paygate/etc/system.xml | 257 +- .../paygate_setup/mysql4-install-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../Block/Catalog/Product/View/Profile.php | 104 + app/code/core/Mage/Payment/Block/Form.php | 14 +- app/code/core/Mage/Payment/Block/Form/Cc.php | 7 +- .../core/Mage/Payment/Block/Form/Ccsave.php | 2 +- .../core/Mage/Payment/Block/Form/Checkmo.php | 2 +- .../Mage/Payment/Block/Form/Container.php | 2 +- .../Mage/Payment/Block/Form/Purchaseorder.php | 2 +- app/code/core/Mage/Payment/Block/Info.php | 4 +- app/code/core/Mage/Payment/Block/Info/Cc.php | 10 +- .../core/Mage/Payment/Block/Info/Ccsave.php | 2 +- .../core/Mage/Payment/Block/Info/Checkmo.php | 2 +- .../Mage/Payment/Block/Info/Container.php | 2 +- .../Mage/Payment/Block/Info/Purchaseorder.php | 2 +- app/code/core/Mage/Payment/Exception.php | 2 +- app/code/core/Mage/Payment/Helper/Data.php | 151 +- .../Mage/Payment/Model/Billing/Agreement.php | 110 + .../Billing/Agreement/MethodInterface.php | 61 + .../Model/Billing/AgreementAbstract.php | 117 + app/code/core/Mage/Payment/Model/Config.php | 6 +- app/code/core/Mage/Payment/Model/Info.php | 8 +- .../Mage/Payment/Model/Method/Abstract.php | 186 +- .../core/Mage/Payment/Model/Method/Cc.php | 37 +- .../core/Mage/Payment/Model/Method/Ccsave.php | 2 +- .../Mage/Payment/Model/Method/Checkmo.php | 2 +- .../core/Mage/Payment/Model/Method/Free.php | 2 +- .../Payment/Model/Method/Purchaseorder.php | 2 +- app/code/core/Mage/Payment/Model/Observer.php | 47 +- .../Mage/Payment/Model/Paygate/Request.php | 2 +- .../Mage/Payment/Model/Paygate/Result.php | 2 +- .../Mage/Payment/Model/Recurring/Profile.php | 618 ++ .../Recurring/Profile/MethodInterface.php | 76 + .../core/Mage/Payment/Model/Source/Cctype.php | 2 +- .../Mage/Payment/Model/Source/Invoice.php | 2 +- app/code/core/Mage/Payment/etc/adminhtml.xml | 2 +- app/code/core/Mage/Payment/etc/config.xml | 40 +- app/code/core/Mage/Payment/etc/system.xml | 49 +- .../Block/Adminhtml/Settlement/Details.php | 60 + .../Adminhtml/Settlement/Details/Form.php | 122 + .../Block/Adminhtml/Settlement/Report.php | 53 + .../Adminhtml/Settlement/Report/Grid.php | 144 + .../Adminhtml/System/Config/ApiWizard.php | 72 + .../System/Config/Fieldset/Global.php | 201 + .../Adminhtml/System/Config/Fieldset/Hint.php | 48 + .../core/Mage/Paypal/Block/Express/Form.php | 19 +- .../core/Mage/Paypal/Block/Express/Review.php | 143 +- .../Paypal/Block/Express/Review/Details.php | 2 +- .../Mage/Paypal/Block/Express/Shortcut.php | 157 +- app/code/core/Mage/Paypal/Block/Logo.php | 67 + .../core/Mage/Paypal/Block/Payment/Info.php | 14 +- .../core/Mage/Paypal/Block/Standard/Form.php | 17 +- .../Mage/Paypal/Block/Standard/Redirect.php | 2 +- .../Paypal/Controller/Express/Abstract.php | 86 +- .../Mage/Paypal/Controller/Ipn/Abstract.php | 81 - app/code/core/Mage/Paypal/Helper/Data.php | 85 +- .../core/Mage/Paypal/Model/Api/Abstract.php | 152 +- app/code/core/Mage/Paypal/Model/Api/Nvp.php | 651 +- .../core/Mage/Paypal/Model/Api/Standard.php | 38 +- app/code/core/Mage/Paypal/Model/Config.php | 663 +- app/code/core/Mage/Paypal/Model/Direct.php | 156 +- app/code/core/Mage/Paypal/Model/Express.php | 213 +- .../Mage/Paypal/Model/Express/Checkout.php | 334 +- app/code/core/Mage/Paypal/Model/Info.php | 225 +- app/code/core/Mage/Paypal/Model/Ipn.php | 766 +- .../Mage/Paypal/Model/Method/Agreement.php | 347 + .../Paypal/Model/Mysql4/Report/Settlement.php | 93 + .../Report/Settlement/Row.php} | 10 +- .../Report/Settlement/Row/Collection.php | 68 + .../core/Mage/Paypal/Model/Mysql4/Setup.php | 2 +- app/code/core/Mage/Paypal/Model/Observer.php | 56 + .../Pro.php => Paypal/Model/Payflowpro.php} | 190 +- app/code/core/Mage/Paypal/Model/Pro.php | 253 +- .../Mage/Paypal/Model/Report/Settlement.php | 378 + .../Paypal/Model/Report/Settlement/Row.php | 258 + app/code/core/Mage/Paypal/Model/Session.php | 2 +- app/code/core/Mage/Paypal/Model/Standard.php | 58 +- .../Model/System/Config/Backend/Cron.php | 53 + .../System/Config/Backend/MerchantCountry.php | 53 + .../System/Config/Source/BuyerCountry.php | 42 + .../System/Config/Source/FetchingSchedule.php | 44 + .../Model/System/Config/Source/Logo.php | 38 + .../System/Config/Source/MerchantCountry.php | 42 + .../Adminhtml/Paypal/ReportsController.php | 143 + .../Paypal/controllers/ExpressController.php | 2 +- .../Mage/Paypal/controllers/IpnController.php | 20 +- .../Paypal/controllers/StandardController.php | 3 +- app/code/core/Mage/Paypal/etc/adminhtml.xml | 36 +- app/code/core/Mage/Paypal/etc/config.xml | 130 +- app/code/core/Mage/Paypal/etc/system.xml | 1451 ++- .../sql/paypal_setup/mysql4-install-0.7.0.php | 2 +- .../paypal_setup/mysql4-install-1.4.0.0.php | 48 + .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../mysql4-upgrade-0.7.3-0.7.4.php | 134 - .../mysql4-upgrade-1.4.0.0-1.4.0.1.php | 72 + .../core/Mage/PaypalUk/Block/Express/Form.php | 4 +- .../Express/Shortcut.php} | 28 +- app/code/core/Mage/PaypalUk/Helper/Data.php | 2 +- app/code/core/Mage/PaypalUk/Model/Api/Nvp.php | 36 +- app/code/core/Mage/PaypalUk/Model/Config.php | 198 - app/code/core/Mage/PaypalUk/Model/Direct.php | 47 +- app/code/core/Mage/PaypalUk/Model/Express.php | 34 +- .../Mage/PaypalUk/Model/Express/Checkout.php | 4 +- app/code/core/Mage/PaypalUk/Model/Pro.php | 4 +- app/code/core/Mage/PaypalUk/Model/Session.php | 2 +- .../controllers/ExpressController.php | 6 +- app/code/core/Mage/PaypalUk/etc/config.xml | 16 +- .../paypaluk_setup/mysql4-install-0.7.0.php | 2 +- app/code/core/Mage/Poll/Block/ActivePoll.php | 2 +- app/code/core/Mage/Poll/Block/Poll.php | 2 +- app/code/core/Mage/Poll/Helper/Data.php | 2 +- app/code/core/Mage/Poll/Model/Mysql4/Poll.php | 2 +- .../Mage/Poll/Model/Mysql4/Poll/Answer.php | 2 +- .../Model/Mysql4/Poll/Answer/Collection.php | 2 +- .../Poll/Model/Mysql4/Poll/Collection.php | 2 +- .../core/Mage/Poll/Model/Mysql4/Poll/Vote.php | 2 +- app/code/core/Mage/Poll/Model/Poll.php | 2 +- app/code/core/Mage/Poll/Model/Poll/Answer.php | 2 +- app/code/core/Mage/Poll/Model/Poll/Vote.php | 2 +- .../Mage/Poll/controllers/VoteController.php | 2 +- app/code/core/Mage/Poll/etc/adminhtml.xml | 2 +- app/code/core/Mage/Poll/etc/config.xml | 2 +- app/code/core/Mage/Poll/etc/system.xml | 4 +- .../sql/poll_setup/mysql4-install-0.7.0.php | 2 +- .../poll_setup/mysql4-upgrade-0.6.0-0.6.1.php | 2 +- .../poll_setup/mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../ProductAlert/Block/Email/Abstract.php | 2 +- .../Mage/ProductAlert/Block/Email/Price.php | 2 +- .../Mage/ProductAlert/Block/Email/Stock.php | 2 +- .../core/Mage/ProductAlert/Block/Price.php | 2 +- .../core/Mage/ProductAlert/Block/Stock.php | 2 +- .../core/Mage/ProductAlert/Helper/Data.php | 2 +- .../core/Mage/ProductAlert/Model/Email.php | 2 +- .../Mage/ProductAlert/Model/Mysql4/Price.php | 2 +- .../Model/Mysql4/Price/Collection.php | 2 +- .../Mysql4/Price/Customer/Collection.php | 2 +- .../Mage/ProductAlert/Model/Mysql4/Stock.php | 2 +- .../Model/Mysql4/Stock/Collection.php | 2 +- .../Mysql4/Stock/Customer/Collection.php | 2 +- .../core/Mage/ProductAlert/Model/Observer.php | 2 +- .../core/Mage/ProductAlert/Model/Price.php | 2 +- .../core/Mage/ProductAlert/Model/Stock.php | 2 +- .../controllers/AddController.php | 14 +- .../controllers/UnsubscribeController.php | 22 +- .../core/Mage/ProductAlert/etc/config.xml | 10 +- .../core/Mage/ProductAlert/etc/system.xml | 10 +- .../mysql4-install-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../Mage/Protx/Block/Standard/Failure.php | 56 + .../core/Mage/Protx/Block/Standard/Form.php | 43 + .../Mage/Protx/Block/Standard/Redirect.php | 58 + app/code/core/Mage/Protx/Helper/Data.php | 38 + app/code/core/Mage/Protx/Model/Api/Debug.php | 41 + app/code/core/Mage/Protx/Model/Config.php | 179 + .../Mage/Protx/Model/Mysql4/Api/Debug.php | 42 + .../Model/Mysql4/Api/Debug/Collection.php | 41 + .../core/Mage/Protx/Model/Mysql4/Setup.php | 39 + app/code/core/Mage/Protx/Model/Session.php | 42 + .../Mage/Protx/Model/Source/ModeAction.php | 49 + .../Mage/Protx/Model/Source/PaymentAction.php | 46 + app/code/core/Mage/Protx/Model/Standard.php | 462 + .../Protx/controllers/StandardController.php | 271 + app/code/core/Mage/Protx/etc/config.xml | 109 + app/code/core/Mage/Protx/etc/system.xml | 167 + .../sql/protx_setup/mysql4-install-0.1.0.php | 46 + .../Mage/Rating/Block/Entity/Detailed.php | 2 +- app/code/core/Mage/Rating/Helper/Data.php | 2 +- .../core/Mage/Rating/Model/Mysql4/Rating.php | 2 +- .../Rating/Model/Mysql4/Rating/Collection.php | 2 +- .../Rating/Model/Mysql4/Rating/Entity.php | 2 +- .../Rating/Model/Mysql4/Rating/Option.php | 2 +- .../Model/Mysql4/Rating/Option/Collection.php | 2 +- .../Model/Mysql4/Rating/Option/Vote.php | 2 +- .../Mysql4/Rating/Option/Vote/Collection.php | 2 +- app/code/core/Mage/Rating/Model/Observer.php | 2 +- app/code/core/Mage/Rating/Model/Rating.php | 2 +- .../core/Mage/Rating/Model/Rating/Entity.php | 2 +- .../core/Mage/Rating/Model/Rating/Option.php | 2 +- .../Mage/Rating/Model/Rating/Option/Vote.php | 2 +- app/code/core/Mage/Rating/etc/adminhtml.xml | 2 +- app/code/core/Mage/Rating/etc/config.xml | 2 +- .../sql/rating_setup/mysql4-install-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../Mage/Reports/Block/Product/Abstract.php | 11 +- .../Mage/Reports/Block/Product/Compared.php | 2 +- .../Mage/Reports/Block/Product/Viewed.php | 16 +- .../Reports/Block/Product/Widget/Compared.php | 2 +- .../Reports/Block/Product/Widget/Viewed.php | 2 +- app/code/core/Mage/Reports/Exception.php | 2 +- app/code/core/Mage/Reports/Helper/Data.php | 6 +- app/code/core/Mage/Reports/Model/Config.php | 2 +- app/code/core/Mage/Reports/Model/Event.php | 2 +- .../Mage/Reports/Model/Event/Observer.php | 2 +- .../core/Mage/Reports/Model/Event/Type.php | 2 +- app/code/core/Mage/Reports/Model/Flag.php | 5 +- .../Mage/Reports/Model/Grouped/Collection.php | 2 +- .../Model/Mysql4/Accounts/Collection.php | 2 +- .../Model/Mysql4/Coupons/Collection.php | 2 +- .../Model/Mysql4/Customer/Collection.php | 99 +- .../Mysql4/Customer/Orders/Collection.php | 2 +- .../Mysql4/Customer/Totals/Collection.php | 2 +- .../Entity/Summary/Collection/Abstract.php | 2 +- .../core/Mage/Reports/Model/Mysql4/Event.php | 2 +- .../Reports/Model/Mysql4/Event/Collection.php | 2 +- .../Mage/Reports/Model/Mysql4/Event/Type.php | 2 +- .../Model/Mysql4/Event/Type/Collection.php | 2 +- .../Model/Mysql4/Invoiced/Collection.php | 2 +- .../Reports/Model/Mysql4/Order/Collection.php | 465 +- .../Model/Mysql4/Product/Collection.php | 40 +- .../Mysql4/Product/Downloads/Collection.php | 2 +- .../Model/Mysql4/Product/Index/Abstract.php | 30 +- .../Product/Index/Collection/Abstract.php | 54 +- .../Model/Mysql4/Product/Index/Compared.php | 2 +- .../Product/Index/Compared/Collection.php | 2 +- .../Model/Mysql4/Product/Index/Viewed.php | 2 +- .../Product/Index/Viewed/Collection.php | 2 +- .../Mysql4/Product/Lowstock/Collection.php | 2 +- .../Mysql4/Product/Ordered/Collection.php | 7 +- .../Model/Mysql4/Product/Sold/Collection.php | 2 +- .../Mysql4/Product/Viewed/Collection.php | 2 +- .../Reports/Model/Mysql4/Quote/Collection.php | 2 +- .../Model/Mysql4/Refunded/Collection.php | 2 +- .../Reports/Model/Mysql4/Report/Abstract.php | 352 + .../Model/Mysql4/Report/Collection.php | 2 +- .../Model/Mysql4/Review/Collection.php | 2 +- .../Mysql4/Review/Customer/Collection.php | 2 +- .../Mysql4/Review/Product/Collection.php | 2 +- .../Model/Mysql4/Shipping/Collection.php | 2 +- .../Mysql4/Shopcart/Product/Collection.php | 2 +- .../Reports/Model/Mysql4/Tag/Collection.php | 35 +- .../Model/Mysql4/Tag/Customer/Collection.php | 2 +- .../Model/Mysql4/Tag/Product/Collection.php | 2 +- .../Reports/Model/Mysql4/Tax/Collection.php | 3 +- .../Model/Mysql4/Wishlist/Collection.php | 2 +- .../Mysql4/Wishlist/Product/Collection.php | 2 +- .../Reports/Model/Product/Index/Abstract.php | 14 +- .../Reports/Model/Product/Index/Compared.php | 2 +- .../Reports/Model/Product/Index/Viewed.php | 2 +- app/code/core/Mage/Reports/Model/Report.php | 2 +- app/code/core/Mage/Reports/Model/Session.php | 2 +- app/code/core/Mage/Reports/Model/Test.php | 2 +- app/code/core/Mage/Reports/Model/Totals.php | 2 +- app/code/core/Mage/Reports/etc/adminhtml.xml | 32 +- app/code/core/Mage/Reports/etc/config.xml | 2 +- app/code/core/Mage/Reports/etc/system.xml | 8 +- app/code/core/Mage/Reports/etc/widget.xml | 2 +- .../reports_setup/mysql4-install-0.7.1.php | 2 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../mysql4-upgrade-0.7.3-0.7.4.php | 2 +- .../mysql4-upgrade-0.7.4-0.7.5.php | 2 +- .../mysql4-upgrade-0.7.5-0.7.7.php | 2 +- .../mysql4-upgrade-0.7.7-0.7.8.php | 2 +- .../mysql4-upgrade-0.7.8-0.7.9.php | 2 +- .../mysql4-upgrade-0.7.9-0.7.10.php | 2 +- .../core/Mage/Review/Block/Customer/List.php | 2 +- .../Mage/Review/Block/Customer/Recent.php | 2 +- .../core/Mage/Review/Block/Customer/View.php | 2 +- app/code/core/Mage/Review/Block/Form.php | 2 +- app/code/core/Mage/Review/Block/Helper.php | 2 +- .../core/Mage/Review/Block/Product/View.php | 2 +- .../Mage/Review/Block/Product/View/List.php | 2 +- app/code/core/Mage/Review/Block/View.php | 2 +- app/code/core/Mage/Review/Helper/Data.php | 2 +- .../core/Mage/Review/Model/Mysql4/Review.php | 2 +- .../Review/Model/Mysql4/Review/Collection.php | 2 +- .../Mysql4/Review/Product/Collection.php | 2 +- .../Model/Mysql4/Review/Status/Collection.php | 2 +- .../Review/Model/Mysql4/Review/Summary.php | 2 +- .../Mysql4/Review/Summary/Collection.php | 2 +- app/code/core/Mage/Review/Model/Observer.php | 2 +- app/code/core/Mage/Review/Model/Review.php | 2 +- .../core/Mage/Review/Model/Review/Summary.php | 2 +- app/code/core/Mage/Review/Model/Session.php | 2 +- .../Review/controllers/CustomerController.php | 2 +- .../Review/controllers/ProductController.php | 8 +- app/code/core/Mage/Review/etc/adminhtml.xml | 2 +- app/code/core/Mage/Review/etc/config.xml | 2 +- app/code/core/Mage/Review/etc/system.xml | 4 +- .../sql/review_setup/mysql4-install-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../mysql4-upgrade-0.7.3-0.7.4.php | 2 +- .../mysql4-upgrade-0.7.4-0.7.5.php | 2 +- .../mysql4-upgrade-0.7.5-0.7.6.php | 2 +- app/code/core/Mage/Rss/Block/Abstract.php | 2 +- .../core/Mage/Rss/Block/Catalog/Abstract.php | 2 +- .../core/Mage/Rss/Block/Catalog/Category.php | 7 +- app/code/core/Mage/Rss/Block/Catalog/New.php | 10 +- .../Mage/Rss/Block/Catalog/NotifyStock.php | 2 +- .../core/Mage/Rss/Block/Catalog/Review.php | 2 +- .../core/Mage/Rss/Block/Catalog/Salesrule.php | 2 +- .../core/Mage/Rss/Block/Catalog/Special.php | 4 +- app/code/core/Mage/Rss/Block/Catalog/Tag.php | 4 +- app/code/core/Mage/Rss/Block/List.php | 19 +- .../core/Mage/Rss/Block/Order/Details.php | 2 +- app/code/core/Mage/Rss/Block/Order/New.php | 4 +- app/code/core/Mage/Rss/Block/Order/Status.php | 2 +- app/code/core/Mage/Rss/Block/Wishlist.php | 10 +- app/code/core/Mage/Rss/Helper/Catalog.php | 2 +- app/code/core/Mage/Rss/Helper/Data.php | 2 +- app/code/core/Mage/Rss/Helper/Order.php | 2 +- app/code/core/Mage/Rss/Model/Mysql4/Order.php | 2 +- app/code/core/Mage/Rss/Model/Observer.php | 2 +- app/code/core/Mage/Rss/Model/Rss.php | 2 +- app/code/core/Mage/Rss/Model/Session.php | 2 +- .../Rss/Model/System/Config/Backend/Links.php | 44 + .../Rss/controllers/CatalogController.php | 2 +- .../Mage/Rss/controllers/IndexController.php | 2 +- .../Mage/Rss/controllers/OrderController.php | 2 +- app/code/core/Mage/Rss/etc/adminhtml.xml | 2 +- app/code/core/Mage/Rss/etc/config.xml | 2 +- app/code/core/Mage/Rss/etc/system.xml | 3 +- app/code/core/Mage/Rule/Block/Actions.php | 2 +- app/code/core/Mage/Rule/Block/Conditions.php | 2 +- app/code/core/Mage/Rule/Block/Editable.php | 4 +- app/code/core/Mage/Rule/Block/Newchild.php | 2 +- app/code/core/Mage/Rule/Block/Rule.php | 2 +- app/code/core/Mage/Rule/Helper/Data.php | 2 +- .../core/Mage/Rule/Model/Action/Abstract.php | 2 +- .../Mage/Rule/Model/Action/Collection.php | 2 +- .../core/Mage/Rule/Model/Action/Interface.php | 2 +- .../Mage/Rule/Model/Condition/Abstract.php | 2 +- .../Mage/Rule/Model/Condition/Combine.php | 10 +- .../Mage/Rule/Model/Condition/Interface.php | 2 +- app/code/core/Mage/Rule/Model/Environment.php | 2 +- app/code/core/Mage/Rule/Model/Mysql4/Rule.php | 2 +- .../Rule/Model/Mysql4/Rule/Collection.php | 2 +- .../core/Mage/Rule/Model/Renderer/Actions.php | 2 +- .../Mage/Rule/Model/Renderer/Conditions.php | 2 +- app/code/core/Mage/Rule/Model/Rule.php | 2 +- app/code/core/Mage/Rule/etc/config.xml | 2 +- .../Block/Adminhtml/Billing/Agreement.php | 46 + .../Adminhtml/Billing/Agreement/Grid.php | 154 + .../Adminhtml/Billing/Agreement/View.php | 109 + .../Adminhtml/Billing/Agreement/View/Form.php | 43 + .../Billing/Agreement/View/Tab/Info.php | 120 + .../Billing/Agreement/View/Tab/Orders.php | 127 + .../Adminhtml/Billing/Agreement/View/Tabs.php | 45 + .../Adminhtml/Customer/Edit/Tab/Agreement.php | 139 + .../Block/Adminhtml/Recurring/Profile.php | 49 + .../Adminhtml/Recurring/Profile/Edit/Form.php | 214 + .../Adminhtml/Recurring/Profile/Grid.php | 148 + .../Adminhtml/Recurring/Profile/View.php | 103 + .../Recurring/Profile/View/Getawayinfo.php | 50 + .../Adminhtml/Recurring/Profile/View/Info.php | 50 + .../Recurring/Profile/View/Items.php | 79 + .../Recurring/Profile/View/Tab/Info.php | 69 + .../Recurring/Profile/View/Tab/Orders.php | 225 + .../Block/Adminhtml/Report/Filter/Form.php | 90 + .../Adminhtml/Report/Filter/Form/Order.php | 60 + .../Sales/Block/Billing/Agreement/View.php | 186 + .../Mage/Sales/Block/Billing/Agreements.php | 152 + .../core/Mage/Sales/Block/Items/Abstract.php | 2 +- .../Mage/Sales/Block/Order/Creditmemo.php | 2 +- .../Sales/Block/Order/Creditmemo/Items.php | 2 +- .../Sales/Block/Order/Creditmemo/Totals.php | 2 +- .../core/Mage/Sales/Block/Order/Details.php | 2 +- .../Block/Order/Email/Creditmemo/Items.php | 2 +- .../Sales/Block/Order/Email/Invoice/Items.php | 2 +- .../Mage/Sales/Block/Order/Email/Items.php | 2 +- .../Sales/Block/Order/Email/Items/Default.php | 2 +- .../Block/Order/Email/Items/Order/Default.php | 2 +- .../Block/Order/Email/Items/Order/Grouped.php | 2 +- .../Block/Order/Email/Shipment/Items.php | 2 +- .../core/Mage/Sales/Block/Order/History.php | 13 +- app/code/core/Mage/Sales/Block/Order/Info.php | 2 +- .../core/Mage/Sales/Block/Order/Invoice.php | 2 +- .../Mage/Sales/Block/Order/Invoice/Items.php | 2 +- .../Mage/Sales/Block/Order/Invoice/Totals.php | 2 +- .../Block/Order/Item/Renderer/Default.php | 2 +- .../Block/Order/Item/Renderer/Grouped.php | 2 +- .../core/Mage/Sales/Block/Order/Items.php | 2 +- .../core/Mage/Sales/Block/Order/Print.php | 2 +- .../Sales/Block/Order/Print/Creditmemo.php | 2 +- .../Mage/Sales/Block/Order/Print/Invoice.php | 2 +- .../Mage/Sales/Block/Order/Print/Shipment.php | 2 +- .../core/Mage/Sales/Block/Order/Recent.php | 2 +- .../core/Mage/Sales/Block/Order/Shipment.php | 2 +- .../Mage/Sales/Block/Order/Shipment/Items.php | 2 +- app/code/core/Mage/Sales/Block/Order/Tax.php | 2 +- .../core/Mage/Sales/Block/Order/Totals.php | 4 +- app/code/core/Mage/Sales/Block/Order/View.php | 2 +- .../Block/Payment/Form/Billing/Agreement.php | 66 + .../Block/Payment/Info/Billing/Agreement.php | 53 + .../Sales/Block/Recurring/Profile/View.php | 326 + .../Mage/Sales/Block/Recurring/Profiles.php | 129 + .../core/Mage/Sales/Block/Reorder/Sidebar.php | 2 +- app/code/core/Mage/Sales/Exception.php | 2 +- app/code/core/Mage/Sales/Helper/Data.php | 4 +- app/code/core/Mage/Sales/Helper/Reorder.php | 2 +- app/code/core/Mage/Sales/Model/Abstract.php | 16 +- .../core/Mage/Sales/Model/Api/Resource.php | 2 +- .../Mage/Sales/Model/Billing/Agreement.php | 238 + app/code/core/Mage/Sales/Model/Config.php | 25 +- .../core/Mage/Sales/Model/Convert/Order.php | 2 +- .../core/Mage/Sales/Model/Convert/Quote.php | 5 +- .../core/Mage/Sales/Model/Email/Template.php | 2 +- .../core/Mage/Sales/Model/Entity/Order.php | 2 +- .../Mage/Sales/Model/Entity/Order/Address.php | 2 +- .../Model/Entity/Order/Address/Collection.php | 2 +- .../Order/Attribute/Backend/Billing.php | 2 +- .../Entity/Order/Attribute/Backend/Child.php | 2 +- .../Entity/Order/Attribute/Backend/Parent.php | 2 +- .../Order/Attribute/Backend/Shipping.php | 2 +- .../Sales/Model/Entity/Order/Collection.php | 2 +- .../Sales/Model/Entity/Order/Creditmemo.php | 2 +- .../Creditmemo/Attribute/Backend/Child.php | 2 +- .../Creditmemo/Attribute/Backend/Parent.php | 2 +- .../Entity/Order/Creditmemo/Collection.php | 2 +- .../Model/Entity/Order/Creditmemo/Comment.php | 2 +- .../Order/Creditmemo/Comment/Collection.php | 2 +- .../Model/Entity/Order/Creditmemo/Item.php | 2 +- .../Order/Creditmemo/Item/Collection.php | 2 +- .../Mage/Sales/Model/Entity/Order/Invoice.php | 2 +- .../Order/Invoice/Attribute/Backend/Child.php | 2 +- .../Order/Invoice/Attribute/Backend/Item.php | 2 +- .../Order/Invoice/Attribute/Backend/Order.php | 2 +- .../Invoice/Attribute/Backend/Parent.php | 2 +- .../Model/Entity/Order/Invoice/Collection.php | 2 +- .../Model/Entity/Order/Invoice/Comment.php | 2 +- .../Order/Invoice/Comment/Collection.php | 2 +- .../Sales/Model/Entity/Order/Invoice/Item.php | 2 +- .../Entity/Order/Invoice/Item/Collection.php | 2 +- .../Mage/Sales/Model/Entity/Order/Item.php | 2 +- .../Model/Entity/Order/Item/Collection.php | 2 +- .../Mage/Sales/Model/Entity/Order/Payment.php | 2 +- .../Model/Entity/Order/Payment/Collection.php | 2 +- .../Sales/Model/Entity/Order/Shipment.php | 2 +- .../Shipment/Attribute/Backend/Child.php | 2 +- .../Shipment/Attribute/Backend/Parent.php | 2 +- .../Entity/Order/Shipment/Collection.php | 2 +- .../Model/Entity/Order/Shipment/Comment.php | 2 +- .../Order/Shipment/Comment/Collection.php | 2 +- .../Model/Entity/Order/Shipment/Item.php | 2 +- .../Entity/Order/Shipment/Item/Collection.php | 2 +- .../Model/Entity/Order/Shipment/Track.php | 2 +- .../Order/Shipment/Track/Collection.php | 2 +- .../Model/Entity/Order/Status/History.php | 2 +- .../Order/Status/History/Collection.php | 2 +- .../core/Mage/Sales/Model/Entity/Quote.php | 2 +- .../Mage/Sales/Model/Entity/Quote/Address.php | 2 +- .../Quote/Address/Attribute/Backend.php | 2 +- .../Quote/Address/Attribute/Backend/Child.php | 2 +- .../Address/Attribute/Backend/Parent.php | 2 +- .../Address/Attribute/Backend/Region.php | 2 +- .../Quote/Address/Attribute/Frontend.php | 2 +- .../Attribute/Frontend/Custbalance.php | 2 +- .../Address/Attribute/Frontend/Discount.php | 2 +- .../Address/Attribute/Frontend/Grand.php | 2 +- .../Address/Attribute/Frontend/Shipping.php | 2 +- .../Address/Attribute/Frontend/Subtotal.php | 2 +- .../Quote/Address/Attribute/Frontend/Tax.php | 2 +- .../Model/Entity/Quote/Address/Collection.php | 2 +- .../Sales/Model/Entity/Quote/Address/Item.php | 2 +- .../Entity/Quote/Address/Item/Collection.php | 2 +- .../Sales/Model/Entity/Quote/Address/Rate.php | 2 +- .../Entity/Quote/Address/Rate/Collection.php | 2 +- .../Sales/Model/Entity/Quote/Collection.php | 2 +- .../Mage/Sales/Model/Entity/Quote/Item.php | 2 +- .../Model/Entity/Quote/Item/Collection.php | 2 +- .../Mage/Sales/Model/Entity/Quote/Payment.php | 2 +- .../Model/Entity/Quote/Payment/Collection.php | 2 +- .../Sales/Model/Entity/Sale/Collection.php | 2 +- .../core/Mage/Sales/Model/Entity/Setup.php | 3 +- .../core/Mage/Sales/Model/Mysql4/Abstract.php | 4 +- .../Sales/Model/Mysql4/Billing/Agreement.php | 59 + .../Mysql4/Billing/Agreement/Collection.php | 73 + .../Model/Mysql4/Collection/Abstract.php | 155 + .../core/Mage/Sales/Model/Mysql4/Order.php | 167 +- .../Sales/Model/Mysql4/Order/Abstract.php | 422 + .../Mage/Sales/Model/Mysql4/Order/Address.php | 21 +- .../Model/Mysql4/Order/Address/Collection.php | 19 +- .../Order/Attribute/Backend/Billing.php | 3 +- .../Mysql4/Order/Attribute/Backend/Child.php | 6 +- .../Mysql4/Order/Attribute/Backend/Parent.php | 6 +- .../Order/Attribute/Backend/Shipping.php | 5 +- .../Sales/Model/Mysql4/Order/Collection.php | 148 +- .../Mysql4/Order/Collection/Abstract.php | 99 + .../Sales/Model/Mysql4/Order/Creditmemo.php | 54 +- .../Creditmemo/Attribute/Backend/Child.php | 6 +- .../Creditmemo/Attribute/Backend/Parent.php | 8 +- .../Mysql4/Order/Creditmemo/Collection.php | 36 +- .../Model/Mysql4/Order/Creditmemo/Comment.php | 20 +- .../Order/Creditmemo/Comment/Collection.php | 31 +- .../Order/Creditmemo/Grid/Collection.php | 41 + .../Model/Mysql4/Order/Creditmemo/Item.php | 19 +- .../Order/Creditmemo/Item/Collection.php | 22 +- .../Model/Mysql4/Order/Grid/Collection.php | 41 + .../Mage/Sales/Model/Mysql4/Order/Invoice.php | 53 +- .../Order/Invoice/Attribute/Backend/Child.php | 6 +- .../Order/Invoice/Attribute/Backend/Item.php | 6 +- .../Order/Invoice/Attribute/Backend/Order.php | 6 +- .../Invoice/Attribute/Backend/Parent.php | 6 +- .../Model/Mysql4/Order/Invoice/Collection.php | 44 +- .../Model/Mysql4/Order/Invoice/Comment.php | 20 +- .../Order/Invoice/Comment/Collection.php | 31 +- .../Mysql4/Order/Invoice/Grid/Collection.php | 41 + .../Sales/Model/Mysql4/Order/Invoice/Item.php | 19 +- .../Mysql4/Order/Invoice/Item/Collection.php | 21 +- .../Mage/Sales/Model/Mysql4/Order/Item.php | 15 +- .../Model/Mysql4/Order/Item/Collection.php | 43 +- .../Mage/Sales/Model/Mysql4/Order/Payment.php | 73 +- .../Model/Mysql4/Order/Payment/Collection.php | 19 +- .../Mysql4/Order/Payment/Transaction.php | 78 +- .../Order/Payment/Transaction/Collection.php | 125 +- .../Sales/Model/Mysql4/Order/Shipment.php | 54 +- .../Shipment/Attribute/Backend/Child.php | 6 +- .../Shipment/Attribute/Backend/Parent.php | 6 +- .../Mysql4/Order/Shipment/Collection.php | 34 +- .../Model/Mysql4/Order/Shipment/Comment.php | 20 +- .../Order/Shipment/Comment/Collection.php | 31 +- .../Mysql4/Order/Shipment/Grid/Collection.php | 43 + .../Model/Mysql4/Order/Shipment/Item.php | 19 +- .../Mysql4/Order/Shipment/Item/Collection.php | 22 +- .../Model/Mysql4/Order/Shipment/Track.php | 19 +- .../Order/Shipment/Track/Collection.php | 36 +- .../Model/Mysql4/Order/Status/History.php | 22 +- .../Order/Status/History/Collection.php | 19 +- .../Mage/Sales/Model/Mysql4/Order/Tax.php | 5 +- .../Model/Mysql4/Order/Tax/Collection.php | 5 +- .../core/Mage/Sales/Model/Mysql4/Quote.php | 26 +- .../Mage/Sales/Model/Mysql4/Quote/Address.php | 2 +- .../Quote/Address/Attribute/Backend.php | 2 +- .../Quote/Address/Attribute/Backend/Child.php | 2 +- .../Address/Attribute/Backend/Parent.php | 2 +- .../Address/Attribute/Backend/Region.php | 2 +- .../Quote/Address/Attribute/Frontend.php | 2 +- .../Attribute/Frontend/Custbalance.php | 2 +- .../Address/Attribute/Frontend/Discount.php | 2 +- .../Address/Attribute/Frontend/Grand.php | 2 +- .../Address/Attribute/Frontend/Shipping.php | 2 +- .../Address/Attribute/Frontend/Subtotal.php | 2 +- .../Quote/Address/Attribute/Frontend/Tax.php | 2 +- .../Model/Mysql4/Quote/Address/Collection.php | 2 +- .../Sales/Model/Mysql4/Quote/Address/Item.php | 2 +- .../Mysql4/Quote/Address/Item/Collection.php | 10 +- .../Sales/Model/Mysql4/Quote/Address/Rate.php | 2 +- .../Mysql4/Quote/Address/Rate/Collection.php | 48 +- .../Sales/Model/Mysql4/Quote/Collection.php | 2 +- .../Mage/Sales/Model/Mysql4/Quote/Item.php | 2 +- .../Model/Mysql4/Quote/Item/Collection.php | 10 +- .../Sales/Model/Mysql4/Quote/Item/Option.php | 2 +- .../Mysql4/Quote/Item/Option/Collection.php | 15 +- .../Mage/Sales/Model/Mysql4/Quote/Payment.php | 60 +- .../Model/Mysql4/Quote/Payment/Collection.php | 2 +- .../Sales/Model/Mysql4/Recurring/Profile.php | 83 + .../Mysql4/Recurring/Profile/Collection.php | 40 + .../Model/Mysql4/Recurring/Profile/Info.php | 33 + .../core/Mage/Sales/Model/Mysql4/Report.php | 2 +- .../Sales/Model/Mysql4/Report/Abstract.php | 38 + .../Sales/Model/Mysql4/Report/Bestsellers.php | 253 + .../Mysql4/Report/Bestsellers/Collection.php | 259 + .../Mysql4/Report/Collection/Abstract.php | 21 +- .../Sales/Model/Mysql4/Report/Invoiced.php | 221 +- .../Report/Invoiced/Collection/Invoiced.php | 2 +- .../Report/Invoiced/Collection/Order.php | 2 +- .../Mage/Sales/Model/Mysql4/Report/Order.php | 160 + .../Model/Mysql4/Report/Order/Collection.php | 31 +- .../Report/Order/Updatedat/Collection.php | 58 +- .../Sales/Model/Mysql4/Report/Refunded.php | 241 +- .../Report/Refunded/Collection/Order.php | 2 +- .../Report/Refunded/Collection/Refunded.php | 2 +- .../Sales/Model/Mysql4/Report/Shipping.php | 268 +- .../Report/Shipping/Collection/Order.php | 5 +- .../Report/Shipping/Collection/Shipment.php | 2 +- .../Sales/Model/Mysql4/Sale/Collection.php | 18 +- .../core/Mage/Sales/Model/Mysql4/Setup.php | 84 +- app/code/core/Mage/Sales/Model/Observer.php | 60 +- app/code/core/Mage/Sales/Model/Order.php | 473 +- .../core/Mage/Sales/Model/Order/Address.php | 21 +- app/code/core/Mage/Sales/Model/Order/Api.php | 2 +- .../core/Mage/Sales/Model/Order/Api/V2.php | 2 +- .../core/Mage/Sales/Model/Order/Config.php | 2 +- .../Mage/Sales/Model/Order/Creditmemo.php | 146 +- .../Sales/Model/Order/Creditmemo/Comment.php | 18 +- .../Sales/Model/Order/Creditmemo/Config.php | 2 +- .../Sales/Model/Order/Creditmemo/Item.php | 17 +- .../Model/Order/Creditmemo/Total/Abstract.php | 2 +- .../Model/Order/Creditmemo/Total/Cost.php | 2 +- .../Model/Order/Creditmemo/Total/Discount.php | 2 +- .../Model/Order/Creditmemo/Total/Grand.php | 2 +- .../Model/Order/Creditmemo/Total/Shipping.php | 46 +- .../Model/Order/Creditmemo/Total/Subtotal.php | 2 +- .../Model/Order/Creditmemo/Total/Tax.php | 95 +- .../core/Mage/Sales/Model/Order/Invoice.php | 91 +- .../Mage/Sales/Model/Order/Invoice/Api.php | 14 +- .../Mage/Sales/Model/Order/Invoice/Api/V2.php | 4 +- .../Sales/Model/Order/Invoice/Comment.php | 18 +- .../Mage/Sales/Model/Order/Invoice/Config.php | 2 +- .../Mage/Sales/Model/Order/Invoice/Item.php | 38 +- .../Model/Order/Invoice/Total/Abstract.php | 2 +- .../Sales/Model/Order/Invoice/Total/Cost.php | 2 +- .../Model/Order/Invoice/Total/Discount.php | 2 +- .../Sales/Model/Order/Invoice/Total/Grand.php | 2 +- .../Model/Order/Invoice/Total/Shipping.php | 11 +- .../Model/Order/Invoice/Total/Subtotal.php | 2 +- .../Sales/Model/Order/Invoice/Total/Tax.php | 110 +- app/code/core/Mage/Sales/Model/Order/Item.php | 4 +- .../core/Mage/Sales/Model/Order/Payment.php | 502 +- .../Sales/Model/Order/Payment/Transaction.php | 187 +- .../Mage/Sales/Model/Order/Pdf/Abstract.php | 8 +- .../Mage/Sales/Model/Order/Pdf/Creditmemo.php | 8 +- .../Mage/Sales/Model/Order/Pdf/Invoice.php | 6 +- .../Sales/Model/Order/Pdf/Items/Abstract.php | 2 +- .../Order/Pdf/Items/Creditmemo/Default.php | 2 +- .../Order/Pdf/Items/Creditmemo/Grouped.php | 2 +- .../Model/Order/Pdf/Items/Invoice/Default.php | 2 +- .../Model/Order/Pdf/Items/Invoice/Grouped.php | 2 +- .../Order/Pdf/Items/Shipment/Default.php | 2 +- .../Mage/Sales/Model/Order/Pdf/Shipment.php | 6 +- .../Sales/Model/Order/Pdf/Total/Default.php | 2 +- .../core/Mage/Sales/Model/Order/Shipment.php | 57 +- .../Mage/Sales/Model/Order/Shipment/Api.php | 4 +- .../Sales/Model/Order/Shipment/Api/V2.php | 4 +- .../Sales/Model/Order/Shipment/Comment.php | 18 +- .../Mage/Sales/Model/Order/Shipment/Item.php | 18 +- .../Mage/Sales/Model/Order/Shipment/Track.php | 18 +- .../core/Mage/Sales/Model/Order/Status.php | 2 +- .../Mage/Sales/Model/Order/Status/History.php | 23 +- app/code/core/Mage/Sales/Model/Order/Tax.php | 5 +- .../core/Mage/Sales/Model/Order/Total.php | 2 +- .../Method/Billing/AgreementAbstract.php | 106 + app/code/core/Mage/Sales/Model/Quote.php | 105 +- .../core/Mage/Sales/Model/Quote/Address.php | 148 +- .../Mage/Sales/Model/Quote/Address/Item.php | 2 +- .../Mage/Sales/Model/Quote/Address/Rate.php | 2 +- .../Mage/Sales/Model/Quote/Address/Total.php | 2 +- .../Model/Quote/Address/Total/Abstract.php | 97 +- .../Model/Quote/Address/Total/Collector.php | 100 +- .../Model/Quote/Address/Total/Custbalance.php | 2 +- .../Model/Quote/Address/Total/Discount.php | 2 +- .../Sales/Model/Quote/Address/Total/Grand.php | 2 +- .../Model/Quote/Address/Total/Nominal.php | 99 + .../Quote/Address/Total/Nominal/Collector.php | 45 + .../Total/Nominal/Recurring/Initial.php | 50 + .../Address/Total/Nominal/Recurring/Trial.php | 62 + .../Total/Nominal/RecurringAbstract.php | 107 + .../Quote/Address/Total/Nominal/Shipping.php | 111 + .../Quote/Address/Total/Nominal/Subtotal.php | 77 + .../Model/Quote/Address/Total/Shipping.php | 14 +- .../Model/Quote/Address/Total/Subtotal.php | 35 +- .../Sales/Model/Quote/Address/Total/Tax.php | 2 +- .../core/Mage/Sales/Model/Quote/Config.php | 2 +- app/code/core/Mage/Sales/Model/Quote/Item.php | 22 +- .../Mage/Sales/Model/Quote/Item/Abstract.php | 68 +- .../Mage/Sales/Model/Quote/Item/Option.php | 2 +- .../core/Mage/Sales/Model/Quote/Payment.php | 16 +- .../Mage/Sales/Model/Recurring/Profile.php | 736 ++ .../core/Mage/Sales/Model/Service/Order.php | 382 + .../core/Mage/Sales/Model/Service/Quote.php | 118 +- .../Billing/AgreementController.php | 200 + .../Sales/controllers/DownloadController.php | 2 +- .../Sales/controllers/OrderController.php | 4 +- .../Recurring/ProfileController.php | 200 + app/code/core/Mage/Sales/doc/test.php | 2 +- app/code/core/Mage/Sales/etc/adminhtml.xml | 60 +- app/code/core/Mage/Sales/etc/api.xml | 2 +- app/code/core/Mage/Sales/etc/config.xml | 144 +- app/code/core/Mage/Sales/etc/system.xml | 65 +- .../sql/sales_setup/mysql4-install-0.7.0.php | 2 +- .../sql/sales_setup/mysql4-install-0.8.11.php | 2 +- .../sql/sales_setup/mysql4-install-0.9.0.php | 2 +- .../sales_setup/mysql4-install-1.4.0.0.php | 1309 +++ .../mysql4-upgrade-0.6.2-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../mysql4-upgrade-0.7.9-0.7.10.php | 2 +- .../mysql4-upgrade-0.8.0-0.8.1.php | 2 +- .../mysql4-upgrade-0.8.1-0.8.2.php | 2 +- .../mysql4-upgrade-0.8.11-0.8.12.php | 2 +- .../mysql4-upgrade-0.8.12-0.8.13.php | 2 +- .../mysql4-upgrade-0.8.13-0.8.14.php | 2 +- .../mysql4-upgrade-0.8.14-0.8.15.php | 2 +- .../mysql4-upgrade-0.8.15-0.8.16.php | 2 +- .../mysql4-upgrade-0.8.16-0.8.17.php | 2 +- .../mysql4-upgrade-0.8.17-0.8.18.php | 2 +- .../mysql4-upgrade-0.8.18-0.8.19.php | 2 +- .../mysql4-upgrade-0.8.19-0.8.20.php | 2 +- .../mysql4-upgrade-0.8.2-0.8.3.php | 2 +- .../mysql4-upgrade-0.8.20-0.8.21.php | 2 +- .../mysql4-upgrade-0.8.21-0.8.22.php | 2 +- .../mysql4-upgrade-0.8.22-0.8.23.php | 2 +- .../mysql4-upgrade-0.8.23-0.8.24.php | 2 +- .../mysql4-upgrade-0.8.24-0.8.25.php | 2 +- .../mysql4-upgrade-0.8.25-0.8.26.php | 2 +- .../mysql4-upgrade-0.8.26-0.8.27.php | 2 +- .../mysql4-upgrade-0.8.27-0.8.28.php | 2 +- .../mysql4-upgrade-0.8.28-0.8.29.php | 2 +- .../mysql4-upgrade-0.8.29-0.9.0.php | 2 +- .../mysql4-upgrade-0.8.3-0.8.4.php | 2 +- .../mysql4-upgrade-0.8.6-0.8.7.php | 2 +- .../mysql4-upgrade-0.8.7-0.8.8.php | 2 +- .../mysql4-upgrade-0.8.8-0.8.9.php | 2 +- .../mysql4-upgrade-0.9.0-0.9.1.php | 2 +- .../mysql4-upgrade-0.9.1-0.9.2.php | 2 +- .../mysql4-upgrade-0.9.10-0.9.11.php | 2 +- .../mysql4-upgrade-0.9.11-0.9.12.php | 2 +- .../mysql4-upgrade-0.9.12-0.9.13.php | 2 +- .../mysql4-upgrade-0.9.13-0.9.14.php | 2 +- .../mysql4-upgrade-0.9.14-0.9.15.php | 2 +- .../mysql4-upgrade-0.9.15-0.9.16.php | 2 +- .../mysql4-upgrade-0.9.16-0.9.17.php | 2 +- .../mysql4-upgrade-0.9.17-0.9.18.php | 2 +- .../mysql4-upgrade-0.9.18-0.9.19.php | 2 +- .../mysql4-upgrade-0.9.19-0.9.20.php | 2 +- .../mysql4-upgrade-0.9.2-0.9.3.php | 2 +- .../mysql4-upgrade-0.9.20-0.9.21.php | 2 +- .../mysql4-upgrade-0.9.21-0.9.22.php | 2 +- .../mysql4-upgrade-0.9.22-0.9.23.php | 2 +- .../mysql4-upgrade-0.9.23-0.9.24.php | 2 +- .../mysql4-upgrade-0.9.24-0.9.25.php | 2 +- .../mysql4-upgrade-0.9.25-0.9.26.php | 2 +- .../mysql4-upgrade-0.9.26-0.9.27.php | 5 +- .../mysql4-upgrade-0.9.27-0.9.28.php | 2 +- .../mysql4-upgrade-0.9.28-0.9.29.php | 87 +- .../mysql4-upgrade-0.9.29-0.9.30.php | 6 +- .../mysql4-upgrade-0.9.3-0.9.4.php | 2 +- .../mysql4-upgrade-0.9.30-0.9.31.php | 2 +- .../mysql4-upgrade-0.9.31-0.9.32.php | 2 +- .../mysql4-upgrade-0.9.32-0.9.33.php | 2 +- .../mysql4-upgrade-0.9.33-0.9.34.php | 2 +- .../mysql4-upgrade-0.9.34-0.9.35.php | 2 +- .../mysql4-upgrade-0.9.35-0.9.36.php | 2 +- .../mysql4-upgrade-0.9.36-0.9.37.php | 2 +- .../mysql4-upgrade-0.9.37-0.9.38.php | 12 +- .../mysql4-upgrade-0.9.38-0.9.39.php | 10 +- .../mysql4-upgrade-0.9.39-0.9.40.php | 2 +- .../mysql4-upgrade-0.9.4-0.9.5.php | 2 +- .../mysql4-upgrade-0.9.40-0.9.41.php | 6 +- .../mysql4-upgrade-0.9.41-0.9.42.php | 2 +- .../mysql4-upgrade-0.9.42-0.9.43.php | 2 +- .../mysql4-upgrade-0.9.43-0.9.44.php | 2 +- .../mysql4-upgrade-0.9.44-0.9.45.php | 10 +- .../mysql4-upgrade-0.9.45-0.9.46.php | 10 +- .../mysql4-upgrade-0.9.46-0.9.47.php | 12 +- .../mysql4-upgrade-0.9.47-0.9.48.php | 2 +- .../mysql4-upgrade-0.9.48-0.9.49.php | 2 +- .../mysql4-upgrade-0.9.49-0.9.50.php | 6 +- .../mysql4-upgrade-0.9.5-0.9.6.php | 2 +- .../mysql4-upgrade-0.9.50-0.9.51.php | 110 +- .../mysql4-upgrade-0.9.51-0.9.52.php | 6 +- .../mysql4-upgrade-0.9.52-0.9.53.php | 2 +- .../mysql4-upgrade-0.9.53-0.9.54.php | 2 +- .../mysql4-upgrade-0.9.54-0.9.55.php | 2 +- .../mysql4-upgrade-0.9.55-0.9.56.php | 2 +- .../mysql4-upgrade-0.9.6-0.9.7.php | 2 +- .../mysql4-upgrade-0.9.7-0.9.8.php | 2 +- .../mysql4-upgrade-0.9.8-0.9.9.php | 2 +- .../mysql4-upgrade-0.9.9-0.9.10.php | 2 +- .../mysql4-upgrade-1.3.99-1.4.0.0.php | 1170 +++ .../mysql4-upgrade-1.4.0.0-1.4.0.1.php | 35 + .../mysql4-upgrade-1.4.0.1-1.4.0.2.php | 33 + .../mysql4-upgrade-1.4.0.2-1.4.0.3.php | 70 + .../mysql4-upgrade-1.4.0.3-1.4.0.4.php | 69 + .../mysql4-upgrade-1.4.0.4-1.4.0.5.php | 39 + .../mysql4-upgrade-1.4.0.5-1.4.0.6.php | 64 + .../mysql4-upgrade-1.4.0.6-1.4.0.7.php | 38 + .../mysql4-upgrade-1.4.0.7-1.4.0.8.php | 38 + .../mysql4-upgrade-1.4.0.8-1.4.0.15.php | 177 + app/code/core/Mage/SalesRule/Exception.php | 2 +- app/code/core/Mage/SalesRule/Helper/Data.php | 2 +- app/code/core/Mage/SalesRule/Model/Coupon.php | 78 + .../SalesRule/Model/Coupon/Codegenerator.php | 60 + .../Model/Coupon/CodegeneratorInterface.php | 43 + .../Mage/SalesRule/Model/Mysql4/Coupon.php | 92 + .../Model/Mysql4/Coupon/Collection.php | 60 + .../SalesRule/Model/Mysql4/Coupon/Usage.php | 82 + .../Model/Mysql4/Report/Collection.php | 24 +- .../SalesRule/Model/Mysql4/Report/Rule.php | 154 + .../Mysql4/Report/Updatedat/Collection.php | 63 +- .../core/Mage/SalesRule/Model/Mysql4/Rule.php | 219 +- .../Model/Mysql4/Rule/Collection.php | 44 +- .../SalesRule/Model/Mysql4/Rule/Customer.php | 2 +- .../Model/Mysql4/Rule/Customer/Collection.php | 2 +- .../SalesRule/Model/Mysql4/Rule/Product.php | 2 +- .../Model/Mysql4/Rule/Product/Collection.php | 2 +- .../core/Mage/SalesRule/Model/Observer.php | 16 +- .../Mage/SalesRule/Model/Quote/Discount.php | 4 +- .../SalesRule/Model/Quote/Freeshipping.php | 5 +- .../Model/Quote/Nominal/Discount.php | 60 + app/code/core/Mage/SalesRule/Model/Rule.php | 188 +- .../Model/Rule/Action/Collection.php | 2 +- .../SalesRule/Model/Rule/Action/Product.php | 4 +- .../Model/Rule/Condition/Address.php | 2 +- .../Model/Rule/Condition/Combine.php | 2 +- .../Model/Rule/Condition/Product.php | 2 +- .../Model/Rule/Condition/Product/Combine.php | 2 +- .../Model/Rule/Condition/Product/Found.php | 2 +- .../Rule/Condition/Product/Subselect.php | 2 +- .../Mage/SalesRule/Model/Rule/Customer.php | 2 +- .../Mage/SalesRule/Model/Rule/Product.php | 2 +- .../core/Mage/SalesRule/Model/Validator.php | 59 +- .../core/Mage/SalesRule/etc/adminhtml.xml | 2 +- app/code/core/Mage/SalesRule/etc/config.xml | 16 +- .../salesrule_setup/mysql4-install-0.7.0.php | 2 +- .../mysql4-install-1.4.0.0.0.php | 140 + .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.10-0.7.11.php | 21 +- .../mysql4-upgrade-0.7.11-0.7.12.php | 10 +- .../mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../mysql4-upgrade-0.7.3-0.7.4.php | 2 +- .../mysql4-upgrade-0.7.4-0.7.5.php | 2 +- .../mysql4-upgrade-0.7.5-0.7.6.php | 2 +- .../mysql4-upgrade-0.7.6-0.7.7.php | 2 +- .../mysql4-upgrade-0.7.7-0.7.8.php | 2 +- .../mysql4-upgrade-0.7.8-0.7.9.php | 29 +- .../mysql4-upgrade-0.7.9-0.7.10.php | 2 +- .../mysql4-upgrade-1.4.0.0.0-1.4.0.0.1.php | 103 + .../mysql4-upgrade-1.4.0.0.1-1.4.0.0.2.php | 60 + .../mysql4-upgrade-1.4.0.0.2-1.4.0.0.3.php | 37 + .../mysql4-upgrade-1.4.0.0.3-1.4.0.0.4.php | 37 + app/code/core/Mage/Sendfriend/Block/Send.php | 2 +- app/code/core/Mage/Sendfriend/Helper/Data.php | 2 +- .../Sendfriend/Model/Mysql4/Sendfriend.php | 2 +- .../Model/Mysql4/Sendfriend/Collection.php | 2 +- .../Mage/Sendfriend/Model/Mysql4/Setup.php | 2 +- .../core/Mage/Sendfriend/Model/Observer.php | 2 +- .../core/Mage/Sendfriend/Model/Sendfriend.php | 22 +- .../controllers/ProductController.php | 10 +- app/code/core/Mage/Sendfriend/etc/config.xml | 2 +- app/code/core/Mage/Sendfriend/etc/system.xml | 6 +- .../sendfriend_setup/mysql4-install-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../mysql4-upgrade-0.7.3-0.7.4.php | 2 +- .../Mage/Shipping/Block/Tracking/Ajax.php | 2 +- .../Mage/Shipping/Block/Tracking/Popup.php | 2 +- app/code/core/Mage/Shipping/Exception.php | 2 +- app/code/core/Mage/Shipping/Helper/Data.php | 2 +- .../Mage/Shipping/Model/Carrier/Abstract.php | 72 +- .../Mage/Shipping/Model/Carrier/Flatrate.php | 3 +- .../Shipping/Model/Carrier/Freeshipping.php | 3 +- .../Mage/Shipping/Model/Carrier/Interface.php | 2 +- .../Mage/Shipping/Model/Carrier/Pickup.php | 3 +- .../Mage/Shipping/Model/Carrier/Tablerate.php | 3 +- app/code/core/Mage/Shipping/Model/Config.php | 2 +- app/code/core/Mage/Shipping/Model/Info.php | 2 +- .../Model/Mysql4/Carrier/Tablerate.php | 12 +- .../Mysql4/Carrier/Tablerate/Collection.php | 2 +- .../Mage/Shipping/Model/Rate/Abstract.php | 2 +- .../core/Mage/Shipping/Model/Rate/Request.php | 2 +- .../core/Mage/Shipping/Model/Rate/Result.php | 5 +- .../Shipping/Model/Rate/Result/Abstract.php | 2 +- .../Mage/Shipping/Model/Rate/Result/Error.php | 2 +- .../Shipping/Model/Rate/Result/Method.php | 2 +- .../Mage/Shipping/Model/Rule/Abstract.php | 2 +- .../Shipping/Model/Rule/Action/Abstract.php | 2 +- .../Shipping/Model/Rule/Action/Carrier.php | 2 +- .../Shipping/Model/Rule/Action/Method.php | 2 +- .../Model/Rule/Condition/Abstract.php | 2 +- .../Model/Rule/Condition/Dest/Country.php | 2 +- .../Model/Rule/Condition/Dest/Region.php | 2 +- .../Model/Rule/Condition/Dest/Zip.php | 2 +- .../Model/Rule/Condition/Order/Subtotal.php | 2 +- .../Model/Rule/Condition/Order/Totalqty.php | 2 +- .../Model/Rule/Condition/Package/Weight.php | 2 +- .../core/Mage/Shipping/Model/Shipping.php | 5 +- .../Shipping/Model/Source/HandlingAction.php | 2 +- .../Shipping/Model/Source/HandlingType.php | 2 +- .../Mage/Shipping/Model/Tracking/Result.php | 2 +- .../Model/Tracking/Result/Abstract.php | 2 +- .../Shipping/Model/Tracking/Result/Error.php | 2 +- .../Shipping/Model/Tracking/Result/Status.php | 2 +- .../controllers/ShippingController.php | 2 +- .../controllers/TrackingController.php | 2 +- app/code/core/Mage/Shipping/etc/adminhtml.xml | 2 +- app/code/core/Mage/Shipping/etc/config.xml | 2 +- app/code/core/Mage/Shipping/etc/system.xml | 42 +- .../shipping_setup/mysql4-install-0.7.0.php | 2 +- app/code/core/Mage/Sitemap/Helper/Data.php | 2 +- .../Sitemap/Model/Mysql4/Catalog/Category.php | 2 +- .../Sitemap/Model/Mysql4/Catalog/Product.php | 2 +- .../Mage/Sitemap/Model/Mysql4/Cms/Page.php | 2 +- .../Mage/Sitemap/Model/Mysql4/Sitemap.php | 2 +- .../Model/Mysql4/Sitemap/Collection.php | 2 +- app/code/core/Mage/Sitemap/Model/Observer.php | 2 +- app/code/core/Mage/Sitemap/Model/Sitemap.php | 2 +- app/code/core/Mage/Sitemap/etc/adminhtml.xml | 2 +- app/code/core/Mage/Sitemap/etc/config.xml | 2 +- app/code/core/Mage/Sitemap/etc/system.xml | 8 +- .../sitemap_setup/mysql4-install-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- app/code/core/Mage/Strikeiron/Helper/Data.php | 38 + .../Model/Currency/Import/Strikeiron.php | 104 + .../Mage/Strikeiron/Model/Mysql4/Taxrate.php | 106 + .../Model/Mysql4/Taxrate/Collection.php | 51 + .../Model/Service/AddressVerification.php | 49 + .../Mage/Strikeiron/Model/Service/Base.php | 61 + .../Model/Service/EmailVerification.php | 48 + .../Model/Service/ForeignExchangeRates.php | 45 + .../Strikeiron/Model/Service/SalesUseTax.php | 40 + .../Model/Service/SalesUseTaxBasic.php | 45 + .../Model/Service/SalesUseTaxComplete.php | 45 + .../Model/Service/UsAddressVerification.php | 45 + .../core/Mage/Strikeiron/Model/Session.php | 39 + .../Model/Source/ErrorAddressAction.php | 42 + .../Strikeiron/Model/Source/SalesTaxType.php | 42 + .../Model/Source/Salestaxminmax.php | 42 + .../Model/Source/UndeterminedEmailAction.php | 42 + .../core/Mage/Strikeiron/Model/Strikeiron.php | 391 + .../Model/Taxrate.php} | 9 +- .../Strikeiron/controllers/TestController.php | 42 + .../core/Mage/Strikeiron/etc/adminhtml.xml | 49 + app/code/core/Mage/Strikeiron/etc/config.xml | 140 + app/code/core/Mage/Strikeiron/etc/system.xml | 293 + .../strikeiron_setup/mysql4-install-0.9.1.php | 48 + app/code/core/Mage/Tag/Block/All.php | 2 +- .../core/Mage/Tag/Block/Customer/Edit.php | 2 +- .../core/Mage/Tag/Block/Customer/Recent.php | 2 +- .../core/Mage/Tag/Block/Customer/Tags.php | 2 +- .../core/Mage/Tag/Block/Customer/View.php | 2 +- app/code/core/Mage/Tag/Block/Popular.php | 2 +- app/code/core/Mage/Tag/Block/Product/List.php | 43 +- .../core/Mage/Tag/Block/Product/Result.php | 2 +- app/code/core/Mage/Tag/Helper/Data.php | 2 +- .../Tag/Model/Entity/Customer/Collection.php | 2 +- .../core/Mage/Tag/Model/Indexer/Summary.php | 227 + .../Tag/Model/Mysql4/Customer/Collection.php | 2 +- .../Mage/Tag/Model/Mysql4/Indexer/Summary.php | 259 + .../Tag/Model/Mysql4/Popular/Collection.php | 16 +- .../Tag/Model/Mysql4/Product/Collection.php | 6 +- app/code/core/Mage/Tag/Model/Mysql4/Tag.php | 70 +- .../Mage/Tag/Model/Mysql4/Tag/Collection.php | 20 +- .../Mage/Tag/Model/Mysql4/Tag/Relation.php | 23 +- app/code/core/Mage/Tag/Model/Session.php | 2 +- app/code/core/Mage/Tag/Model/Tag.php | 72 +- app/code/core/Mage/Tag/Model/Tag/Relation.php | 37 +- .../Tag/controllers/CustomerController.php | 4 +- .../Mage/Tag/controllers/IndexController.php | 238 +- .../Mage/Tag/controllers/ListController.php | 2 +- .../Tag/controllers/ProductController.php | 2 +- app/code/core/Mage/Tag/etc/adminhtml.xml | 2 +- app/code/core/Mage/Tag/etc/config.xml | 14 +- .../sql/tag_setup/mysql4-install-0.7.0.php | 2 +- .../tag_setup/mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../tag_setup/mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../tag_setup/mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../tag_setup/mysql4-upgrade-0.7.3-0.7.4.php | 2 +- .../tag_setup/mysql4-upgrade-0.7.4-0.7.5.php | 2 +- .../tag_setup/mysql4-upgrade-0.7.5-0.7.6.php | 67 + .../tag_setup/mysql4-upgrade-0.7.6-0.7.7.php | 36 + .../Adminhtml/Frontend/Region/Updater.php | 2 +- .../core/Mage/Tax/Block/Checkout/Discount.php | 2 +- .../Mage/Tax/Block/Checkout/Grandtotal.php | 2 +- .../core/Mage/Tax/Block/Checkout/Shipping.php | 5 +- .../core/Mage/Tax/Block/Checkout/Subtotal.php | 2 +- app/code/core/Mage/Tax/Block/Checkout/Tax.php | 2 +- .../core/Mage/Tax/Block/Sales/Order/Tax.php | 33 +- app/code/core/Mage/Tax/Exception.php | 2 +- app/code/core/Mage/Tax/Helper/Data.php | 2 +- app/code/core/Mage/Tax/Model/Calculation.php | 24 +- .../core/Mage/Tax/Model/Calculation/Rate.php | 13 +- .../Mage/Tax/Model/Calculation/Rate/Title.php | 2 +- .../core/Mage/Tax/Model/Calculation/Rule.php | 2 +- app/code/core/Mage/Tax/Model/Class.php | 2 +- .../Mage/Tax/Model/Class/Source/Customer.php | 2 +- .../Mage/Tax/Model/Class/Source/Product.php | 2 +- app/code/core/Mage/Tax/Model/Config.php | 21 +- .../Mage/Tax/Model/Config/Price/Include.php | 2 +- .../Mage/Tax/Model/Mysql4/Calculation.php | 40 +- .../Model/Mysql4/Calculation/Collection.php | 2 +- .../Tax/Model/Mysql4/Calculation/Rate.php | 2 +- .../Mysql4/Calculation/Rate/Collection.php | 2 +- .../Model/Mysql4/Calculation/Rate/Title.php | 2 +- .../Calculation/Rate/Title/Collection.php | 2 +- .../Tax/Model/Mysql4/Calculation/Rule.php | 2 +- .../Mysql4/Calculation/Rule/Collection.php | 2 +- app/code/core/Mage/Tax/Model/Mysql4/Class.php | 4 +- .../Tax/Model/Mysql4/Class/Collection.php | 2 +- .../Tax/Model/Mysql4/Report/Collection.php | 2 +- .../core/Mage/Tax/Model/Mysql4/Report/Tax.php | 129 + .../Mysql4/Report/Updatedat/Collection.php | 4 +- .../Mage/Tax/Model/Mysql4/Sales/Order/Tax.php | 33 + .../Mysql4/Sales/Order/Tax/Collection.php | 48 + app/code/core/Mage/Tax/Model/Mysql4/Setup.php | 2 +- app/code/core/Mage/Tax/Model/Mysql4/Tax.php | 138 - app/code/core/Mage/Tax/Model/Observer.php | 6 +- .../core/Mage/Tax/Model/Sales/Order/Tax.php | 33 + .../Mage/Tax/Model/Sales/Pdf/Grandtotal.php | 2 +- .../Mage/Tax/Model/Sales/Pdf/Shipping.php | 7 +- .../Mage/Tax/Model/Sales/Pdf/Subtotal.php | 2 +- .../core/Mage/Tax/Model/Sales/Pdf/Tax.php | 2 +- .../Tax/Model/Sales/Total/Quote/Discount.php | 2 +- .../Sales/Total/Quote/Nominal/Subtotal.php | 60 + .../Model/Sales/Total/Quote/Nominal/Tax.php | 67 + .../Tax/Model/Sales/Total/Quote/Shipping.php | 232 + .../Tax/Model/Sales/Total/Quote/Subtotal.php | 647 +- .../Mage/Tax/Model/Sales/Total/Quote/Tax.php | 484 +- .../Model/System/Config/Source/Algorithm.php | 2 +- .../Tax/Model/System/Config/Source/Apply.php | 2 +- .../Model/System/Config/Source/PriceType.php | 2 +- .../System/Config/Source/Tax/Country.php | 2 +- .../System/Config/Source/Tax/Display/Type.php | 8 +- .../Model/System/Config/Source/Tax/Region.php | 2 +- app/code/core/Mage/Tax/etc/adminhtml.xml | 2 +- app/code/core/Mage/Tax/etc/config.xml | 24 +- app/code/core/Mage/Tax/etc/system.xml | 12 +- .../sql/tax_setup/mysql4-install-0.7.0.php | 2 +- .../sql/tax_setup/mysql4-install-1.4.0.0.php | 146 + .../tax_setup/mysql4-upgrade-0.6.1-0.7.0.php | 2 +- .../tax_setup/mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../tax_setup/mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.10-0.7.11.php | 2 +- .../mysql4-upgrade-0.7.11-0.7.12.php | 35 + .../mysql4-upgrade-0.7.12-0.7.13.php | 34 + .../tax_setup/mysql4-upgrade-0.7.2-0.7.3.php | 2 +- .../tax_setup/mysql4-upgrade-0.7.3-0.7.4.php | 2 +- .../tax_setup/mysql4-upgrade-0.7.4-0.7.5.php | 2 +- .../tax_setup/mysql4-upgrade-0.7.5-0.7.6.php | 2 +- .../tax_setup/mysql4-upgrade-0.7.6-0.7.7.php | 2 +- .../tax_setup/mysql4-upgrade-0.7.7-0.7.8.php | 2 +- .../tax_setup/mysql4-upgrade-0.7.8-0.7.9.php | 2 +- .../tax_setup/mysql4-upgrade-0.7.9-0.7.10.php | 2 +- .../tax_setup/mysql4-upgrade-1.3.9-1.4.0.php | 37 + app/code/core/Mage/Usa/Helper/Data.php | 2 +- .../Usa/Model/Shipping/Carrier/Abstract.php | 2 +- .../Mage/Usa/Model/Shipping/Carrier/Dhl.php | 27 +- .../Carrier/Dhl/Source/Dutypaymenttype.php | 2 +- .../Carrier/Dhl/Source/Freemethod.php | 2 +- .../Shipping/Carrier/Dhl/Source/Method.php | 2 +- .../Dhl/Source/Protection/Rounding.php | 2 +- .../Carrier/Dhl/Source/Protection/Value.php | 2 +- .../Carrier/Dhl/Source/Shipmenttype.php | 2 +- .../Mage/Usa/Model/Shipping/Carrier/Fedex.php | 30 +- .../Shipping/Carrier/Fedex/Source/Dropoff.php | 2 +- .../Carrier/Fedex/Source/Freemethod.php | 2 +- .../Shipping/Carrier/Fedex/Source/Method.php | 2 +- .../Carrier/Fedex/Source/Packaging.php | 2 +- .../Mage/Usa/Model/Shipping/Carrier/Ups.php | 57 +- .../Shipping/Carrier/Ups/Source/Container.php | 2 +- .../Shipping/Carrier/Ups/Source/DestType.php | 2 +- .../Carrier/Ups/Source/Freemethod.php | 2 +- .../Shipping/Carrier/Ups/Source/Method.php | 2 +- .../Shipping/Carrier/Ups/Source/Mode.php | 2 +- .../Carrier/Ups/Source/OriginShipment.php | 2 +- .../Shipping/Carrier/Ups/Source/Pickup.php | 2 +- .../Shipping/Carrier/Ups/Source/Type.php | 2 +- .../Carrier/Ups/Source/Unitofmeasure.php | 2 +- .../Mage/Usa/Model/Shipping/Carrier/Usps.php | 17 +- .../Carrier/Usps/Source/Container.php | 2 +- .../Carrier/Usps/Source/Freemethod.php | 2 +- .../Carrier/Usps/Source/Machinable.php | 2 +- .../Shipping/Carrier/Usps/Source/Method.php | 2 +- .../Shipping/Carrier/Usps/Source/Size.php | 2 +- app/code/core/Mage/Usa/Model/Tax/Uszip.php | 2 +- app/code/core/Mage/Usa/etc/config.xml | 3 +- app/code/core/Mage/Usa/etc/system.xml | 145 +- .../usa_setup/mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../core/Mage/Weee/Block/Element/Weee/Tax.php | 2 +- .../Mage/Weee/Block/Renderer/Weee/Tax.php | 2 +- app/code/core/Mage/Weee/Helper/Data.php | 2 +- .../Weee/Model/Attribute/Backend/Weee/Tax.php | 2 +- .../Mage/Weee/Model/Config/Source/Display.php | 2 +- .../Mysql4/Attribute/Backend/Weee/Tax.php | 2 +- .../core/Mage/Weee/Model/Mysql4/Setup.php | 2 +- app/code/core/Mage/Weee/Model/Mysql4/Tax.php | 2 +- app/code/core/Mage/Weee/Model/Observer.php | 2 +- app/code/core/Mage/Weee/Model/Tax.php | 2 +- .../Mage/Weee/Model/Total/Creditmemo/Weee.php | 2 +- .../Mage/Weee/Model/Total/Invoice/Weee.php | 2 +- .../Weee/Model/Total/Quote/Nominal/Weee.php | 56 + .../core/Mage/Weee/Model/Total/Quote/Weee.php | 22 +- app/code/core/Mage/Weee/etc/config.xml | 8 +- app/code/core/Mage/Weee/etc/system.xml | 2 +- .../sql/weee_setup/mysql4-install-0.1.php | 2 +- .../sql/weee_setup/mysql4-upgrade-0.1-0.2.php | 2 +- .../weee_setup/mysql4-upgrade-0.10-0.11.php | 2 +- .../weee_setup/mysql4-upgrade-0.11-0.12.php | 2 +- .../weee_setup/mysql4-upgrade-0.12-0.13.php | 2 +- .../sql/weee_setup/mysql4-upgrade-0.2-0.3.php | 2 +- .../sql/weee_setup/mysql4-upgrade-0.3-0.4.php | 2 +- .../sql/weee_setup/mysql4-upgrade-0.4-0.5.php | 2 +- .../sql/weee_setup/mysql4-upgrade-0.5-0.6.php | 2 +- .../sql/weee_setup/mysql4-upgrade-0.6-0.7.php | 2 +- .../sql/weee_setup/mysql4-upgrade-0.7-0.8.php | 2 +- .../sql/weee_setup/mysql4-upgrade-0.8-0.9.php | 2 +- .../weee_setup/mysql4-upgrade-0.9-0.10.php | 2 +- .../Mage/Widget/Block/Adminhtml/Widget.php | 2 +- .../Widget/Block/Adminhtml/Widget/Chooser.php | 6 +- .../Widget/Block/Adminhtml/Widget/Form.php | 2 +- .../Block/Adminhtml/Widget/Instance.php | 2 +- .../Block/Adminhtml/Widget/Instance/Edit.php | 2 +- .../Widget/Instance/Edit/Chooser/Block.php | 2 +- .../Widget/Instance/Edit/Chooser/Layout.php | 4 +- .../Widget/Instance/Edit/Chooser/Template.php | 2 +- .../Adminhtml/Widget/Instance/Edit/Form.php | 2 +- .../Widget/Instance/Edit/Tab/Main.php | 2 +- .../Widget/Instance/Edit/Tab/Main/Layout.php | 2 +- .../Widget/Instance/Edit/Tab/Properties.php | 2 +- .../Widget/Instance/Edit/Tab/Settings.php | 2 +- .../Adminhtml/Widget/Instance/Edit/Tabs.php | 2 +- .../Block/Adminhtml/Widget/Instance/Grid.php | 2 +- .../Widget/Block/Adminhtml/Widget/Options.php | 2 +- app/code/core/Mage/Widget/Block/Interface.php | 2 +- app/code/core/Mage/Widget/Helper/Data.php | 2 +- .../core/Mage/Widget/Model/Mysql4/Widget.php | 2 +- .../Widget/Model/Mysql4/Widget/Instance.php | 2 +- .../Mysql4/Widget/Instance/Collection.php | 2 +- app/code/core/Mage/Widget/Model/Observer.php | 2 +- .../Mage/Widget/Model/Template/Filter.php | 2 +- app/code/core/Mage/Widget/Model/Widget.php | 2 +- .../core/Mage/Widget/Model/Widget/Config.php | 2 +- .../Mage/Widget/Model/Widget/Instance.php | 2 +- .../Adminhtml/Widget/InstanceController.php | 6 +- .../Adminhtml/WidgetController.php | 2 +- app/code/core/Mage/Widget/etc/adminhtml.xml | 2 +- app/code/core/Mage/Widget/etc/config.xml | 2 +- .../widget_setup/mysql4-install-1.4.0.0.0.php | 2 +- .../core/Mage/Wishlist/Block/Abstract.php | 2 +- .../Mage/Wishlist/Block/Customer/Sharing.php | 2 +- .../Mage/Wishlist/Block/Customer/Sidebar.php | 2 +- .../Mage/Wishlist/Block/Customer/Wishlist.php | 2 +- app/code/core/Mage/Wishlist/Block/Links.php | 2 +- .../Mage/Wishlist/Block/Share/Email/Items.php | 2 +- .../Mage/Wishlist/Block/Share/Email/Rss.php | 2 +- .../Mage/Wishlist/Block/Share/Wishlist.php | 2 +- .../Mage/Wishlist/Controller/Abstract.php | 15 +- app/code/core/Mage/Wishlist/Helper/Data.php | 2 +- app/code/core/Mage/Wishlist/Model/Item.php | 8 +- .../core/Mage/Wishlist/Model/Mysql4/Item.php | 2 +- .../Wishlist/Model/Mysql4/Item/Collection.php | 2 +- .../Model/Mysql4/Product/Collection.php | 2 +- .../Mage/Wishlist/Model/Mysql4/Wishlist.php | 2 +- .../Model/Mysql4/Wishlist/Collection.php | 2 +- .../core/Mage/Wishlist/Model/Observer.php | 2 +- app/code/core/Mage/Wishlist/Model/Session.php | 2 +- .../core/Mage/Wishlist/Model/Wishlist.php | 14 +- .../Wishlist/controllers/IndexController.php | 34 +- .../Wishlist/controllers/SharedController.php | 2 +- app/code/core/Mage/Wishlist/etc/adminhtml.xml | 2 +- app/code/core/Mage/Wishlist/etc/config.xml | 4 +- app/code/core/Mage/Wishlist/etc/system.xml | 4 +- .../wishlist_setup/mysql4-install-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.2-0.7.4.php | 2 +- .../mysql4-upgrade-0.7.4-0.7.5.php | 2 +- .../mysql4-upgrade-0.7.5-0.7.6.php | 2 +- .../mysql4-upgrade-0.7.6-0.7.7.php | 2 +- .../mysql4-upgrade-0.7.7-0.7.8.php | 31 + .../default/default/layout/admin.xml | 2 +- .../default/layout/adminnotification.xml | 2 +- .../default/default/layout/bundle.xml | 2 +- .../default/default/layout/catalog.xml | 6 +- .../default/default/layout/centinel.xml | 2 +- .../adminhtml/default/default/layout/cms.xml | 2 +- .../default/default/layout/compiler.xml | 2 +- .../default/default/layout/customer.xml | 2 +- .../default/default/layout/downloadable.xml | 2 +- .../default/layout/googleoptimizer.xml | 2 +- .../default/default/layout/index.xml | 2 +- .../adminhtml/default/default/layout/main.xml | 1 + .../default/default/layout/newsletter.xml | 2 +- .../default/default/layout/promo.xml | 2 +- .../default/default/layout/report.xml | 35 + .../adminhtml/default/default/layout/rss.xml | 2 +- .../default/default/layout/sales.xml | 242 +- .../adminhtml/default/default/layout/tag.xml | 2 +- .../default/default/layout/widget.xml | 2 +- .../default/template/access_denied.phtml | 2 +- .../template/api/role_users_grid_js.phtml | 2 +- .../default/template/api/roleinfo.phtml | 2 +- .../default/default/template/api/roles.phtml | 2 +- .../default/template/api/rolesedit.phtml | 6 +- .../default/template/api/rolesusers.phtml | 2 +- .../template/api/user_roles_grid_js.phtml | 2 +- .../default/template/api/userinfo.phtml | 2 +- .../default/template/api/usernroles.phtml | 2 +- .../default/template/api/userroles.phtml | 2 +- .../default/default/template/api/users.phtml | 2 +- .../default/template/backup/left.phtml | 2 +- .../default/template/backup/list.phtml | 2 +- .../template/bundle/product/edit/bundle.phtml | 2 +- .../bundle/product/edit/bundle/option.phtml | 5 +- .../product/edit/bundle/option/search.phtml | 2 +- .../edit/bundle/option/selection.phtml | 2 +- .../creditmemo/create/items/renderer.phtml | 2 +- .../creditmemo/view/items/renderer.phtml | 2 +- .../sales/invoice/create/items/renderer.phtml | 2 +- .../sales/invoice/view/items/renderer.phtml | 2 +- .../sales/order/view/items/renderer.phtml | 2 +- .../shipment/create/items/renderer.phtml | 2 +- .../sales/shipment/view/items/renderer.phtml | 2 +- .../catalog/category/checkboxes/tree.phtml | 2 +- .../template/catalog/category/edit.phtml | 16 +- .../template/catalog/category/edit/form.phtml | 6 +- .../template/catalog/category/tree.phtml | 2 +- .../catalog/category/widget/tree.phtml | 2 +- .../form/renderer/fieldset/element.phtml | 15 +- .../renderer/googleoptimizer/import.phtml | 2 +- .../default/template/catalog/product.phtml | 2 +- .../catalog/product/attribute/js.phtml | 17 +- .../product/attribute/new/created.phtml | 2 +- .../catalog/product/attribute/options.phtml | 2 +- .../catalog/product/attribute/set/main.phtml | 4 +- .../attribute/set/main/tree/attribute.phtml | 2 +- .../attribute/set/main/tree/group.phtml | 2 +- .../product/attribute/set/toolbar/add.phtml | 2 +- .../product/attribute/set/toolbar/main.phtml | 2 +- .../template/catalog/product/created.phtml | 2 +- .../template/catalog/product/edit.phtml | 6 +- .../product/edit/action/attribute.phtml | 2 +- .../product/edit/action/inventory.phtml | 44 +- .../product/edit/action/websites.phtml | 4 +- .../catalog/product/edit/categories.phtml | 2 +- .../catalog/product/edit/options.phtml | 2 +- .../catalog/product/edit/options/option.phtml | 6 +- .../product/edit/options/type/date.phtml | 2 +- .../product/edit/options/type/file.phtml | 2 +- .../product/edit/options/type/select.phtml | 2 +- .../product/edit/options/type/text.phtml | 2 +- .../catalog/product/edit/price/tier.phtml | 4 +- .../catalog/product/edit/serializer.phtml | 2 +- .../catalog/product/edit/super/config.phtml | 2 +- .../catalog/product/edit/websites.phtml | 2 +- .../catalog/product/helper/gallery.phtml | 2 +- .../default/template/catalog/product/js.phtml | 2 +- .../template/catalog/product/tab/alert.phtml | 2 +- .../catalog/product/tab/inventory.phtml | 50 +- .../product/widget/chooser/container.phtml | 2 +- .../default/template/catalog/wysiwyg/js.phtml | 13 +- .../centinel/authentication/complete.phtml | 24 +- .../centinel/authentication/start.phtml | 2 +- .../template/centinel/validation/form.phtml | 10 +- .../default/template/chronopay/form.phtml | 81 + .../default/template/chronopay/info.phtml | 31 + .../default/template/chronopay/pdf/info.phtml | 33 + .../template/cms/browser/content.phtml | 12 +- .../template/cms/browser/content/files.phtml | 2 +- .../cms/browser/content/newfolder.phtml | 2 +- .../cms/browser/content/uploader.phtml | 2 +- .../default/template/cms/browser/js.phtml | 3 +- .../default/template/cms/browser/tree.phtml | 2 +- .../cms/page/edit/form/renderer/content.phtml | 2 +- .../default/default/template/coming.phtml | 2 +- .../default/template/compiler/process.phtml | 9 +- .../default/template/customer/edit/js.phtml | 2 +- .../default/template/customer/online.phtml | 2 +- .../template/customer/tab/addresses.phtml | 2 +- .../default/template/customer/tab/cart.phtml | 2 +- .../template/customer/tab/newsletter.phtml | 2 +- .../default/template/customer/tab/view.phtml | 2 +- .../template/customer/tab/view/sales.phtml | 2 +- .../template/customer/tab/wishlist.phtml | 2 +- .../default/template/cybersource/form.phtml | 162 + .../default/template/cybersource/info.phtml | 39 + .../template/cybersource/pdf/info.phtml | 43 + .../default/template/dashboard/graph.phtml | 2 +- .../default/template/dashboard/grid.phtml | 2 +- .../default/template/dashboard/index.phtml | 2 +- .../default/template/dashboard/salebar.phtml | 2 +- .../default/template/dashboard/searches.phtml | 2 +- .../template/dashboard/store/switcher.phtml | 4 +- .../default/template/dashboard/totalbar.phtml | 2 +- .../directory/js/optional_zip_countries.phtml | 2 +- .../product/edit/downloadable.phtml | 2 +- .../product/edit/downloadable/links.phtml | 9 +- .../product/edit/downloadable/samples.phtml | 5 +- .../column/downloadable/creditmemo/name.phtml | 2 +- .../column/downloadable/invoice/name.phtml | 2 +- .../items/column/downloadable/name.phtml | 2 +- .../create/items/renderer/downloadable.phtml | 2 +- .../view/items/renderer/downloadable.phtml | 2 +- .../create/items/renderer/downloadable.phtml | 2 +- .../view/items/renderer/downloadable.phtml | 2 +- .../view/items/renderer/downloadable.phtml | 2 +- .../template/eav/attribute/edit/js.phtml | 2 +- .../default/template/email/order/items.phtml | 2 +- .../default/default/template/eway/form.phtml | 82 + .../default/default/template/eway/info.phtml | 30 + .../default/template/eway/pdf/info.phtml | 31 + .../default/default/template/example.phtml | 2 +- .../default/template/flo2cash/form.phtml | 82 + .../default/template/flo2cash/info.phtml | 31 + .../default/template/flo2cash/pdf/info.phtml | 33 + .../default/template/forgotpassword.phtml | 4 +- .../default/default/template/formkey.phtml | 2 +- .../default/template/giftmessage/form.phtml | 6 +- .../default/template/giftmessage/helper.phtml | 2 +- .../default/template/googlebase/captcha.phtml | 2 +- .../default/template/googlebase/items.phtml | 2 +- .../googlebase/types/edit/attributes.phtml | 2 +- .../cms/edit/renderer/conversion.phtml | 2 +- .../default/template/googleoptimizer/js.phtml | 2 +- .../template/ideal/advanced/info.phtml | 33 + .../template/ideal/advanced/pdf/info.phtml | 29 + .../template/index/notifications.phtml | 2 +- .../default/default/template/login.phtml | 5 +- .../default/template/media/editor.phtml | 2 +- .../default/template/media/uploader.phtml | 2 +- .../template/moneybookers/jsinit.phtml | 4 + .../template/newsletter/problem/list.phtml | 2 +- .../template/newsletter/queue/edit.phtml | 2 +- .../template/newsletter/queue/list.phtml | 2 +- .../template/newsletter/subscriber/list.phtml | 2 +- .../template/newsletter/template/edit.phtml | 2 +- .../template/newsletter/template/list.phtml | 2 +- .../newsletter/template/preview.phtml | 2 +- .../template/notification/baseurl.phtml | 2 +- .../template/notification/survey.phtml | 2 +- .../template/notification/toolbar.phtml | 2 +- .../template/notification/window.phtml | 2 +- .../default/default/template/ogone/info.phtml | 29 + .../template/oscommerce/convert/run.phtml | 252 + .../template/oscommerce/order/view.phtml | 241 + .../default/template/overlay_popup.phtml | 2 +- .../default/default/template/page.phtml | 2 +- .../default/template/page/footer.phtml | 4 +- .../default/template/page/header.phtml | 2 +- .../default/template/page/js/calendar.phtml | 3 +- .../default/template/page/js/translate.phtml | 2 +- .../default/default/template/page/menu.phtml | 2 +- .../default/template/page/notices.phtml | 2 +- .../paybox/adminhtml/cart/type/select.phtml | 45 + .../default/template/paybox/direct/form.phtml | 82 + .../default/template/paybox/direct/info.phtml | 31 + .../template/paybox/direct/pdf/info.phtml | 33 + .../default/template/payment/form/cc.phtml | 2 +- .../template/payment/form/ccsave.phtml | 2 +- .../template/payment/form/checkmo.phtml | 2 +- .../template/payment/form/purchaseorder.phtml | 2 +- .../template/payment/info/checkmo.phtml | 2 +- .../template/payment/info/default.phtml | 2 +- .../template/payment/info/pdf/checkmo.phtml | 2 +- .../template/payment/info/pdf/default.phtml | 2 +- .../payment/info/pdf/purchaseorder.phtml | 2 +- .../template/payment/info/purchaseorder.phtml | 2 +- .../paypal/system/config/api_wizard.phtml | 34 + .../system/config/fieldset/global.phtml | 432 + .../paypal/system/config/fieldset/hint.phtml | 35 + .../template/permissions/roleinfo.phtml | 2 +- .../default/template/permissions/roles.phtml | 2 +- .../template/permissions/rolesedit.phtml | 4 +- .../template/permissions/rolesusers.phtml | 2 +- .../template/permissions/userinfo.phtml | 2 +- .../template/permissions/usernroles.phtml | 2 +- .../template/permissions/userroles.phtml | 2 +- .../default/template/permissions/users.phtml | 2 +- .../default/template/poll/answers/list.phtml | 2 +- .../default/default/template/popup.phtml | 2 +- .../default/template/promo/fieldset.phtml | 5 +- .../default/default/template/promo/form.phtml | 2 +- .../default/template/rating/detailed.phtml | 2 +- .../default/template/rating/options.phtml | 2 +- .../template/rating/stars/detailed.phtml | 2 +- .../template/rating/stars/summary.phtml | 2 +- .../default/template/report/grid.phtml | 4 +- .../template/report/grid/container.phtml | 2 +- .../template/report/refresh/statistics.phtml | 2 +- .../template/report/store/switcher.phtml | 4 +- .../report/store/switcher/enhanced.phtml | 4 +- .../default/template/report/wishlist.phtml | 2 +- .../default/default/template/review/add.phtml | 2 +- .../sales/billing/agreement/form.phtml | 40 + .../sales/billing/agreement/view/form.phtml | 27 + .../billing/agreement/view/tab/info.phtml | 63 + .../template/sales/items/column/name.phtml | 2 +- .../template/sales/items/column/qty.phtml | 2 +- .../sales/items/renderer/default.phtml | 2 +- .../template/sales/order/comments/view.phtml | 4 +- .../sales/order/create/abstract.phtml | 2 +- .../order/create/billing/method/form.phtml | 7 +- .../template/sales/order/create/comment.phtml | 2 +- .../sales/order/create/coupons/form.phtml | 2 +- .../template/sales/order/create/data.phtml | 2 +- .../template/sales/order/create/form.phtml | 2 +- .../sales/order/create/form/account.phtml | 2 +- .../sales/order/create/form/address.phtml | 2 +- .../sales/order/create/giftmessage.phtml | 2 +- .../template/sales/order/create/items.phtml | 2 +- .../sales/order/create/items/grid.phtml | 37 +- .../template/sales/order/create/js.phtml | 2 +- .../sales/order/create/newsletter/form.phtml | 2 +- .../order/create/shipping/method/form.phtml | 3 +- .../template/sales/order/create/sidebar.phtml | 2 +- .../sales/order/create/sidebar/items.phtml | 2 +- .../sales/order/create/store/select.phtml | 2 +- .../template/sales/order/create/totals.phtml | 2 +- .../sales/order/create/totals/default.phtml | 2 +- .../order/create/totals/grandtotal.phtml | 8 +- .../sales/order/create/totals/shipping.phtml | 10 +- .../sales/order/create/totals/subtotal.phtml | 8 +- .../sales/order/create/totals/tax.phtml | 10 +- .../sales/order/creditmemo/create/form.phtml | 2 +- .../sales/order/creditmemo/create/items.phtml | 4 +- .../create/items/renderer/configurable.phtml | 2 +- .../create/items/renderer/default.phtml | 2 +- .../create/totals/adjustments.phtml | 43 +- .../sales/order/creditmemo/view/form.phtml | 2 +- .../sales/order/creditmemo/view/items.phtml | 2 +- .../view/items/renderer/configurable.phtml | 2 +- .../view/items/renderer/default.phtml | 2 +- .../sales/order/invoice/create/form.phtml | 2 +- .../sales/order/invoice/create/items.phtml | 4 +- .../create/items/renderer/configurable.phtml | 2 +- .../create/items/renderer/default.phtml | 2 +- .../sales/order/invoice/create/tracking.phtml | 2 +- .../sales/order/invoice/view/form.phtml | 2 +- .../sales/order/invoice/view/items.phtml | 2 +- .../view/items/renderer/configurable.phtml | 2 +- .../invoice/view/items/renderer/default.phtml | 2 +- .../sales/order/shipment/create/form.phtml | 4 +- .../sales/order/shipment/create/items.phtml | 4 +- .../create/items/renderer/configurable.phtml | 2 +- .../create/items/renderer/default.phtml | 2 +- .../order/shipment/create/tracking.phtml | 2 +- .../sales/order/shipment/tracking/info.phtml | 2 +- .../sales/order/shipment/view/form.phtml | 2 +- .../sales/order/shipment/view/items.phtml | 2 +- .../view/items/renderer/configurable.phtml | 2 +- .../view/items/renderer/default.phtml | 2 +- .../sales/order/shipment/view/tracking.phtml | 2 +- .../template/sales/order/totalbar.phtml | 2 +- .../default/template/sales/order/totals.phtml | 2 +- .../sales/order/totals/discount.phtml | 2 +- .../template/sales/order/totals/due.phtml | 2 +- .../template/sales/order/totals/footer.phtml | 2 +- .../template/sales/order/totals/grand.phtml | 2 +- .../template/sales/order/totals/item.phtml | 2 +- .../template/sales/order/totals/main.phtml | 2 +- .../template/sales/order/totals/paid.phtml | 2 +- .../sales/order/totals/refunded.phtml | 2 +- .../sales/order/totals/shipping.phtml | 2 +- .../sales/order/totals/subtotal.phtml | 2 +- .../template/sales/order/totals/tax.phtml | 12 +- .../template/sales/order/view/form.phtml | 2 +- .../sales/order/view/giftmessage.phtml | 4 +- .../template/sales/order/view/history.phtml | 16 +- .../template/sales/order/view/info.phtml | 10 +- .../template/sales/order/view/items.phtml | 2 +- .../order/view/items/renderer/default.phtml | 2 +- .../sales/order/view/tab/history.phtml | 2 +- .../template/sales/order/view/tab/info.phtml | 4 +- .../template/sales/order/view/tracking.phtml | 2 +- .../payment/form/billing/agreement.phtml | 41 + .../sales/recurring/profile/view.phtml | 53 + .../sales/recurring/profile/view/info.phtml | 50 + .../template/sales/transactions/detail.phtml | 108 + .../default/template/store/switcher.phtml | 2 +- .../template/store/switcher/enhanced.phtml | 2 +- .../template/system/autocomplete.phtml | 2 +- .../template/system/cache/additional.phtml | 2 +- .../default/template/system/cache/edit.phtml | 2 +- .../template/system/cache/notifications.phtml | 2 +- .../default/template/system/config/edit.phtml | 7 +- .../system/config/form/field/array.phtml | 2 +- .../default/template/system/config/js.phtml | 2 +- .../default/template/system/config/tabs.phtml | 2 +- .../system/convert/profile/upload.phtml | 5 + .../system/convert/profile/wizard.phtml | 7 +- .../system/currency/rate/matrix.phtml | 2 +- .../system/currency/rate/services.phtml | 2 +- .../template/system/currency/rates.phtml | 2 +- .../default/template/system/design/edit.phtml | 2 +- .../template/system/design/index.phtml | 2 +- .../template/system/email/template/edit.phtml | 2 +- .../template/system/email/template/list.phtml | 2 +- .../system/email/template/preview.phtml | 2 +- .../default/template/system/info.phtml | 2 +- .../system/shipping/applicable_country.phtml | 2 +- .../template/system/shipping/ups.phtml | 2 +- .../default/template/system/variable/js.phtml | 2 +- .../default/template/tag/edit/container.phtml | 2 +- .../default/default/template/tag/index.phtml | 2 +- .../template/tax/class/page/edit.phtml | 2 +- .../default/template/tax/importExport.phtml | 2 +- .../default/template/tax/rate/form.phtml | 2 +- .../default/template/tax/rate/title.phtml | 2 +- .../template/tax/toolbar/class/add.phtml | 2 +- .../template/tax/toolbar/class/save.phtml | 2 +- .../template/tax/toolbar/rate/add.phtml | 2 +- .../template/tax/toolbar/rate/save.phtml | 2 +- .../template/tax/toolbar/rule/add.phtml | 2 +- .../template/tax/toolbar/rule/save.phtml | 2 +- .../template/urlrewrite/categories.phtml | 2 +- .../default/template/urlrewrite/edit.phtml | 2 +- .../template/urlrewrite/selector.phtml | 2 +- .../default/template/weee/renderer/tax.phtml | 2 +- .../default/template/widget/accordion.phtml | 2 +- .../default/template/widget/breadcrumbs.phtml | 2 +- .../default/template/widget/form.phtml | 2 +- .../template/widget/form/container.phtml | 2 +- .../template/widget/form/element.phtml | 2 +- .../widget/form/element/gallery.phtml | 2 +- .../widget/form/renderer/element.phtml | 2 +- .../widget/form/renderer/fieldset.phtml | 5 +- .../form/renderer/fieldset/element.phtml | 2 +- .../default/template/widget/grid.phtml | 10 +- .../template/widget/grid/container.phtml | 2 +- .../template/widget/grid/massaction.phtml | 6 +- .../template/widget/grid/serializer.phtml | 2 +- .../widget/instance/edit/layout.phtml | 4 +- .../default/template/widget/instance/js.phtml | 4 +- .../default/template/widget/tabs.phtml | 2 +- .../default/template/widget/tabshoriz.phtml | 2 +- .../default/template/widget/tabsleft.phtml | 2 +- .../template/widget/view/container.phtml | 2 +- .../frontend/base/default/etc/widget.xml | 2 +- .../frontend/base/default/layout/bundle.xml | 5 +- .../frontend/base/default/layout/catalog.xml | 31 +- .../base/default/layout/cataloginventory.xml | 64 + .../base/default/layout/catalogsearch.xml | 13 +- .../frontend/base/default/layout/centinel.xml | 22 +- .../frontend/base/default/layout/checkout.xml | 7 +- .../base/default/layout/chronopay.xml | 42 + .../frontend/base/default/layout/cms.xml | 2 +- .../frontend/base/default/layout/contacts.xml | 2 +- .../frontend/base/default/layout/core.xml | 2 +- .../frontend/base/default/layout/customer.xml | 14 +- .../frontend/base/default/layout/cybermut.xml | 40 + .../base/default/layout/directory.xml | 7 +- .../base/default/layout/downloadable.xml | 5 +- .../frontend/base/default/layout/eway.xml | 53 + .../base/default/layout/googleanalytics.xml | 2 +- .../base/default/layout/googlecheckout.xml | 6 +- .../base/default/layout/googleoptimizer.xml | 15 +- .../frontend/base/default/layout/ideal.xml | 51 + .../base/default/layout/newsletter.xml | 12 +- .../default/layout/ogone.xml} | 59 +- .../base/default/layout/oscommerce.xml | 41 + .../frontend/base/default/layout/page.xml | 11 +- .../frontend/base/default/layout/paybox.xml | 56 + .../frontend/base/default/layout/payment.xml | 41 + .../frontend/base/default/layout/paypal.xml | 65 +- .../frontend/base/default/layout/paypaluk.xml | 38 +- .../frontend/base/default/layout/poll.xml | 2 +- .../base/default/layout/productalert.xml | 2 +- .../frontend/base/default/layout/protx.xml | 43 + .../frontend/base/default/layout/reports.xml | 2 +- .../frontend/base/default/layout/review.xml | 3 +- .../frontend/base/default/layout/rss.xml | 3 +- .../frontend/base/default/layout/sales.xml | 9 +- .../layout/sales/billing_agreement.xml | 55 + .../layout/sales/recurring_profile.xml | 170 + .../base/default/layout/sendfriend.xml | 2 +- .../frontend/base/default/layout/shipping.xml | 2 +- .../frontend/base/default/layout/tag.xml | 6 +- .../frontend/base/default/layout/weee.xml | 2 +- .../frontend/base/default/layout/wishlist.xml | 214 +- .../bundle/catalog/product/list/partof.phtml | 2 +- .../bundle/catalog/product/price.phtml | 2 +- .../bundle/catalog/product/view/price.phtml | 2 +- .../catalog/product/view/tierprices.phtml | 2 +- .../catalog/product/view/type/bundle.phtml | 3 +- .../view/type/bundle/option/checkbox.phtml | 2 +- .../view/type/bundle/option/multi.phtml | 2 +- .../view/type/bundle/option/radio.phtml | 2 +- .../view/type/bundle/option/select.phtml | 2 +- .../product/view/type/bundle/options.phtml | 2 +- .../order/items/creditmemo/default.phtml | 2 +- .../email/order/items/invoice/default.phtml | 2 +- .../email/order/items/order/default.phtml | 2 +- .../email/order/items/shipment/default.phtml | 2 +- .../bundle/rss/catalog/product/price.phtml | 2 +- .../order/creditmemo/items/renderer.phtml | 4 +- .../sales/order/invoice/items/renderer.phtml | 2 +- .../bundle/sales/order/items/renderer.phtml | 4 +- .../sales/order/shipment/items/renderer.phtml | 2 +- .../default/template/callouts/left_col.phtml | 2 +- .../default/template/callouts/right_col.phtml | 2 +- .../template/catalog/category/page.phtml | 2 +- .../template/catalog/category/view.phtml | 2 +- .../category/widget/link/link_block.phtml | 2 +- .../category/widget/link/link_inline.phtml | 2 +- .../template/catalog/layer/filter.phtml | 2 +- .../template/catalog/layer/state.phtml | 6 +- .../default/template/catalog/layer/view.phtml | 4 +- .../template/catalog/navigation/left.phtml | 4 +- .../template/catalog/navigation/top.phtml | 21 +- .../catalog/product/compare/list.phtml | 8 +- .../catalog/product/compare/sidebar.phtml | 6 +- .../template/catalog/product/gallery.phtml | 2 +- .../template/catalog/product/list.phtml | 19 +- .../catalog/product/list/related.phtml | 2 +- .../catalog/product/list/toolbar.phtml | 4 +- .../catalog/product/list/upsell.phtml | 2 +- .../template/catalog/product/new.phtml | 2 +- .../template/catalog/product/price.phtml | 32 +- .../template/catalog/product/view.phtml | 14 +- .../catalog/product/view/additional.phtml | 2 +- .../template/catalog/product/view/addto.phtml | 2 +- .../catalog/product/view/addtocart.phtml | 3 +- .../catalog/product/view/attributes.phtml | 4 +- .../catalog/product/view/description.phtml | 8 +- .../template/catalog/product/view/media.phtml | 2 +- .../catalog/product/view/options.phtml | 4 +- .../catalog/product/view/options/js.phtml | 2 +- .../product/view/options/type/date.phtml | 4 +- .../product/view/options/type/default.phtml | 2 +- .../product/view/options/type/file.phtml | 2 +- .../product/view/options/type/select.phtml | 2 +- .../product/view/options/type/text.phtml | 2 +- .../product/view/options/wrapper.phtml | 2 +- .../product/view/options/wrapper/bottom.phtml | 2 +- .../template/catalog/product/view/price.phtml | 2 +- .../catalog/product/view/price_clone.phtml | 2 +- .../catalog/product/view/tierprices.phtml | 2 +- .../product/view/type/configurable.phtml | 3 +- .../catalog/product/view/type/grouped.phtml | 3 +- .../view/type/options/configurable.phtml | 2 +- .../catalog/product/view/type/simple.phtml | 3 +- .../catalog/product/view/type/virtual.phtml | 3 +- .../product/widget/link/link_block.phtml | 2 +- .../product/widget/link/link_inline.phtml | 2 +- .../widget/new/column/new_default_list.phtml | 8 +- .../widget/new/column/new_images_list.phtml | 4 +- .../widget/new/column/new_names_list.phtml | 4 +- .../product/widget/new/content/new_grid.phtml | 40 +- .../product/widget/new/content/new_list.phtml | 10 +- .../template/catalog/rss/product/price.phtml | 2 +- .../template/catalog/seo/sitemap.phtml | 9 +- .../catalog/seo/sitemap/container.phtml | 6 +- .../default/template/catalog/seo/tree.phtml | 2 +- .../cataloginventory/stockqty/composite.phtml | 62 + .../cataloginventory/stockqty/default.phtml | 35 + .../catalogsearch/advanced/form.phtml | 2 +- .../catalogsearch/advanced/result.phtml | 2 +- .../template/catalogsearch/form.mini.phtml | 2 +- .../template/catalogsearch/result.phtml | 4 +- .../default/template/catalogsearch/term.phtml | 2 +- .../template/centinel/authentication.phtml | 75 +- .../centinel/authentication/complete.phtml | 23 +- .../centinel/authentication/start.phtml | 2 +- .../base/default/template/centinel/logo.phtml | 2 +- .../base/default/template/checkout/cart.phtml | 14 +- .../template/checkout/cart/coupon.phtml | 2 +- .../template/checkout/cart/crosssell.phtml | 2 +- .../template/checkout/cart/item/default.phtml | 50 +- .../template/checkout/cart/noItems.phtml | 4 +- .../checkout/cart/render/default.phtml | 2 +- .../checkout/cart/render/simple.phtml | 2 +- .../template/checkout/cart/shipping.phtml | 2 +- .../template/checkout/cart/sidebar.phtml | 6 +- .../checkout/cart/sidebar/default.phtml | 10 +- .../template/checkout/cart/totals.phtml | 2 +- .../multishipping/address/select.phtml | 2 +- .../checkout/multishipping/addresses.phtml | 10 +- .../checkout/multishipping/agreements.phtml | 2 +- .../checkout/multishipping/billing.phtml | 2 +- .../multishipping/billing/items.phtml | 4 +- .../checkout/multishipping/item/default.phtml | 2 +- .../checkout/multishipping/link.phtml | 4 +- .../checkout/multishipping/overview.phtml | 6 +- .../multishipping/overview/item.phtml | 2 +- .../checkout/multishipping/shipping.phtml | 4 +- .../checkout/multishipping/state.phtml | 2 +- .../checkout/multishipping/success.phtml | 2 +- .../default/template/checkout/onepage.phtml | 2 +- .../checkout/onepage/agreements.phtml | 2 +- .../template/checkout/onepage/billing.phtml | 6 +- .../template/checkout/onepage/failure.phtml | 4 +- .../template/checkout/onepage/link.phtml | 4 +- .../template/checkout/onepage/login.phtml | 2 +- .../template/checkout/onepage/payment.phtml | 2 +- .../checkout/onepage/payment/methods.phtml | 4 +- .../template/checkout/onepage/progress.phtml | 2 +- .../template/checkout/onepage/review.phtml | 2 +- .../checkout/onepage/review/info.phtml | 2 +- .../checkout/onepage/review/item.phtml | 2 +- .../checkout/onepage/review/totals.phtml | 2 +- .../template/checkout/onepage/shipping.phtml | 4 +- .../checkout/onepage/shipping_method.phtml | 2 +- .../onepage/shipping_method/additional.phtml | 2 +- .../onepage/shipping_method/available.phtml | 2 +- .../default/template/checkout/success.phtml | 28 +- .../template/checkout/total/default.phtml | 2 +- .../template/checkout/total/nominal.phtml | 56 + .../default/template/checkout/total/tax.phtml | 8 +- .../default/template/chronopay/form.phtml | 90 + .../default/template/chronopay/info.phtml | 34 + .../template/chronopay/standard/failure.phtml | 30 + .../template/chronopay/standard/form.phtml | 30 + .../base/default/template/cms/content.phtml | 2 +- .../template/cms/content_heading.phtml | 2 +- .../default/template/cms/default/home.phtml | 2 +- .../template/cms/default/no-route.phtml | 2 +- .../base/default/template/cms/meta.phtml | 2 +- .../template/cms/widget/link/link_block.phtml | 2 +- .../cms/widget/link/link_inline.phtml | 2 +- .../cms/widget/static_block/default.phtml | 2 +- .../base/default/template/contacts/form.phtml | 2 +- .../base/default/template/core/formkey.phtml | 2 +- .../base/default/template/core/link.phtml | 2 +- .../base/default/template/core/messages.phtml | 2 +- .../template/customer/account/dashboard.phtml | 2 +- .../customer/account/dashboard/address.phtml | 2 +- .../customer/account/dashboard/hello.phtml | 2 +- .../customer/account/dashboard/info.phtml | 2 +- .../account/dashboard/newsletter.phtml | 2 +- .../template/customer/account/link/back.phtml | 4 +- .../customer/account/navigation.phtml | 2 +- .../default/template/customer/address.phtml | 2 +- .../template/customer/address/book.phtml | 6 +- .../template/customer/address/edit.phtml | 10 +- .../default/template/customer/balance.phtml | 2 +- .../template/customer/form/address.phtml | 2 +- .../customer/form/changepassword.phtml | 2 +- .../template/customer/form/confirmation.phtml | 2 +- .../default/template/customer/form/edit.phtml | 4 +- .../customer/form/forgotpassword.phtml | 4 +- .../template/customer/form/login.phtml | 4 +- .../template/customer/form/mini.login.phtml | 2 +- .../template/customer/form/newsletter.phtml | 4 +- .../template/customer/form/register.phtml | 14 +- .../default/template/customer/logout.phtml | 6 +- .../default/template/customer/orders.phtml | 2 +- .../template/customer/widget/dob.phtml | 2 +- .../template/customer/widget/gender.phtml | 2 +- .../template/customer/widget/name.phtml | 2 +- .../template/customer/widget/taxvat.phtml | 2 +- .../default/template/customer/wishlist.phtml | 2 +- .../default/template/cybermut/error.phtml | 30 + .../base/default/template/cybermut/form.phtml | 30 + .../default/template/cybersource/form.phtml | 190 + .../default/template/cybersource/info.phtml | 38 + .../default/template/directory/currency.phtml | 2 +- .../template/directory/currency/switch.phtml | 2 +- .../directory/js/optional_zip_countries.phtml | 2 +- .../downloadable/catalog/product/links.phtml | 2 +- .../catalog/product/samples.phtml | 2 +- .../downloadable/catalog/product/type.phtml | 7 +- .../checkout/cart/item/default.phtml | 50 +- .../multishipping/item/downloadable.phtml | 2 +- .../checkout/onepage/review/item.phtml | 2 +- .../downloadable/checkout/success.phtml | 2 +- .../downloadable/customer/products/list.phtml | 6 +- .../order/items/creditmemo/downloadable.phtml | 2 +- .../order/items/invoice/downloadable.phtml | 2 +- .../order/items/order/downloadable.phtml | 2 +- .../items/renderer/downloadable.phtml | 2 +- .../invoice/items/renderer/downloadable.phtml | 2 +- .../order/items/renderer/downloadable.phtml | 2 +- .../email/order/creditmemo/items.phtml | 2 +- .../template/email/order/invoice/items.phtml | 2 +- .../default/template/email/order/items.phtml | 42 +- .../order/items/creditmemo/default.phtml | 2 +- .../email/order/items/invoice/default.phtml | 2 +- .../email/order/items/order/default.phtml | 4 +- .../email/order/items/shipment/default.phtml | 2 +- .../template/email/order/shipment/items.phtml | 2 +- .../template/email/order/shipment/track.phtml | 2 +- .../template/email/productalert/price.phtml | 10 +- .../template/email/productalert/stock.phtml | 12 +- .../base/default/template/eway/form.phtml | 91 + .../base/default/template/eway/info.phtml | 33 + .../template/eway/secure/failure.phtml | 31 + .../default/template/eway/secure/form.phtml | 30 + .../template/eway/shared/failure.phtml | 31 + .../default/template/eway/shared/form.phtml | 30 + .../base/default/template/flo2cash/form.phtml | 90 + .../base/default/template/flo2cash/info.phtml | 34 + .../default/template/giftmessage/inline.phtml | 10 +- .../template/googlecheckout/form.phtml | 4 +- .../template/googlecheckout/link.phtml | 24 +- .../template/ideal/advanced/failure.phtml | 31 + .../template/ideal/advanced/form.phtml | 42 + .../template/ideal/advanced/info.phtml | 33 + .../template/ideal/basic/failure.phtml | 31 + .../default/template/ideal/basic/form.phtml | 30 + .../template/newsletter/subscribe.phtml | 4 +- .../base/default/template/ogone/form.phtml | 33 + .../base/default/template/ogone/info.phtml | 27 + .../base/default/template/ogone/paypage.phtml | 28 + .../default/template/ogone/placeform.phtml | 45 + .../template/oscommerce/order/list.phtml | 56 + .../template/oscommerce/order/view.phtml | 141 + .../base/default/template/page/1column.phtml | 2 +- .../default/template/page/2columns-left.phtml | 2 +- .../template/page/2columns-right.phtml | 2 +- .../base/default/template/page/3columns.phtml | 2 +- .../base/default/template/page/empty.phtml | 2 +- .../template/page/html/breadcrumbs.phtml | 2 +- .../default/template/page/html/footer.phtml | 2 +- .../default/template/page/html/head.phtml | 4 +- .../default/template/page/html/header.phtml | 5 +- .../default/template/page/html/notices.phtml | 4 +- .../default/template/page/html/pager.phtml | 4 +- .../template/page/html/top.links.phtml | 7 +- .../default/template/page/html/wrapper.phtml | 2 +- .../default/template/page/js/calendar.phtml | 2 +- .../default/template/page/js/cookie.phtml | 2 +- .../base/default/template/page/popup.phtml | 2 +- .../base/default/template/page/print.phtml | 2 +- .../base/default/template/page/redirect.phtml | 2 +- .../default/template/page/switch/flags.phtml | 2 +- .../template/page/switch/languages.phtml | 2 +- .../default/template/page/switch/stores.phtml | 2 +- .../template/page/template/container.phtml | 2 +- .../template/page/template/links.phtml | 2 +- .../default/template/paybox/direct/form.phtml | 92 + .../default/template/paybox/direct/info.phtml | 34 + .../template/paybox/system/error.phtml | 31 + .../default/template/paybox/system/form.phtml | 30 + .../product/view/profile/options.phtml | 41 + .../product/view/profile/schedule.phtml | 39 + .../default/template/payment/form/cc.phtml | 201 +- .../template/payment/form/ccsave.phtml | 2 +- .../template/payment/form/checkmo.phtml | 27 +- .../template/payment/form/purchaseorder.phtml | 2 +- .../template/payment/info/checkmo.phtml | 16 +- .../template/payment/info/default.phtml | 2 +- .../template/payment/info/purchaseorder.phtml | 4 +- .../template/paypal/express/review.phtml | 78 +- .../paypal/express/review/details.phtml | 2 +- .../template/paypal/express/shortcut.phtml | 28 +- .../template/paypal/partner/logo.phtml | 34 + .../template/paypal/payment/mark.phtml | 5 +- .../template/paypal/payment/redirect.phtml | 11 +- .../base/default/template/poll/active.phtml | 2 +- .../base/default/template/poll/result.phtml | 2 +- .../default/template/productalert/price.phtml | 2 +- .../default/template/productalert/stock.phtml | 2 +- .../template/protx/standard/failure.phtml | 31 + .../template/protx/standard/form.phtml | 30 + .../default/template/rating/detailed.phtml | 2 +- .../base/default/template/rating/empty.phtml | 2 +- .../reports/home_product_compared.phtml | 6 +- .../reports/home_product_viewed.phtml | 6 +- .../template/reports/product_compared.phtml | 4 +- .../template/reports/product_viewed.phtml | 4 +- .../column/compared_default_list.phtml | 6 +- .../column/compared_images_list.phtml | 4 +- .../compared/column/compared_names_list.phtml | 4 +- .../compared/content/compared_grid.phtml | 6 +- .../compared/content/compared_list.phtml | 8 +- .../viewed/column/viewed_default_list.phtml | 6 +- .../viewed/column/viewed_images_list.phtml | 4 +- .../viewed/column/viewed_names_list.phtml | 4 +- .../widget/viewed/content/viewed_grid.phtml | 6 +- .../widget/viewed/content/viewed_list.phtml | 6 +- .../template/review/customer/list.phtml | 4 +- .../template/review/customer/recent.phtml | 2 +- .../template/review/customer/view.phtml | 2 +- .../base/default/template/review/form.phtml | 2 +- .../template/review/helper/summary.phtml | 2 +- .../review/helper/summary_short.phtml | 2 +- .../template/review/product/view/count.phtml | 2 +- .../template/review/product/view/list.phtml | 2 +- .../template/review/product/view/other.phtml | 2 +- .../base/default/template/review/view.phtml | 2 +- .../base/default/template/rss/list.phtml | 2 +- .../base/default/template/rss/nofeed.phtml | 2 +- .../default/template/rss/order/details.phtml | 4 +- .../sales/billing/agreement/view.phtml | 110 + .../template/sales/billing/agreements.phtml | 101 + .../template/sales/order/creditmemo.phtml | 4 +- .../sales/order/creditmemo/items.phtml | 2 +- .../creditmemo/items/renderer/default.phtml | 2 +- .../template/sales/order/details.phtml | 2 +- .../template/sales/order/history.phtml | 4 +- .../default/template/sales/order/info.phtml | 2 +- .../template/sales/order/invoice.phtml | 2 +- .../template/sales/order/invoice/items.phtml | 2 +- .../invoice/items/renderer/default.phtml | 2 +- .../default/template/sales/order/items.phtml | 2 +- .../sales/order/items/renderer/default.phtml | 2 +- .../default/template/sales/order/print.phtml | 2 +- .../sales/order/print/creditmemo.phtml | 2 +- .../template/sales/order/print/invoice.phtml | 2 +- .../template/sales/order/print/shipment.phtml | 5 +- .../default/template/sales/order/recent.phtml | 4 +- .../template/sales/order/shipment.phtml | 2 +- .../template/sales/order/shipment/items.phtml | 4 +- .../shipment/items/renderer/default.phtml | 2 +- .../default/template/sales/order/totals.phtml | 2 +- .../template/sales/order/trackinginfo.phtml | 2 +- .../default/template/sales/order/view.phtml | 64 +- .../payment/form/billing/agreement.phtml | 41 + .../template/sales/recurring/grid.phtml | 80 + .../sales/recurring/profile/view.phtml | 106 + .../sales/recurring/profile/view/info.phtml | 50 + .../template/sales/recurring/profiles.phtml | 41 + .../template/sales/reorder/sidebar.phtml | 16 +- .../default/template/sendfriend/send.phtml | 4 +- .../template/shipping/tracking/ajax.phtml | 2 +- .../template/shipping/tracking/popup.phtml | 2 +- .../base/default/template/tag/cloud.phtml | 4 +- .../template/tag/customer/recent.phtml | 2 +- .../default/template/tag/customer/tags.phtml | 4 +- .../default/template/tag/customer/view.phtml | 2 +- .../base/default/template/tag/list.phtml | 18 +- .../base/default/template/tag/popular.phtml | 2 +- .../template/tax/checkout/discount.phtml | 2 +- .../template/tax/checkout/grandtotal.phtml | 2 +- .../template/tax/checkout/shipping.phtml | 2 +- .../template/tax/checkout/subtotal.phtml | 2 +- .../default/template/tax/checkout/tax.phtml | 8 +- .../base/default/template/tax/order/tax.phtml | 8 +- .../template/wishlist/email/items.phtml | 2 +- .../default/template/wishlist/email/rss.phtml | 2 +- .../default/template/wishlist/shared.phtml | 2 +- .../default/template/wishlist/sharing.phtml | 2 +- .../default/template/wishlist/sidebar.phtml | 2 +- .../base/default/template/wishlist/view.phtml | 10 +- .../frontend/default/blank/etc/widget.xml | 2 +- .../frontend/default/default/etc/widget.xml | 2 +- .../frontend/default/iphone/etc/widget.xml | 2 +- .../frontend/default/iphone/layout/bundle.xml | 5 +- .../default/iphone/layout/catalog.xml | 27 +- .../default/iphone/layout/catalogsearch.xml | 9 +- .../default/iphone/layout/checkout.xml | 6 +- .../frontend/default/iphone/layout/cms.xml | 2 +- .../default/iphone/layout/contacts.xml | 2 +- .../frontend/default/iphone/layout/core.xml | 2 +- .../default/iphone/layout/customer.xml | 2 +- .../default/iphone/layout/directory.xml | 2 +- .../default/iphone/layout/downloadable.xml | 6 +- .../default/iphone/layout/giftmessage.xml | 2 +- .../default/iphone/layout/googleanalytics.xml | 2 +- .../default/iphone/layout/newsletter.xml | 2 +- .../{googlecheckout.xml => oscommerce.xml} | 24 +- .../frontend/default/iphone/layout/page.xml | 3 +- .../default/iphone/layout/paypaluk.xml | 70 - .../frontend/default/iphone/layout/poll.xml | 2 +- .../default/iphone/layout/productalert.xml | 2 +- .../default/iphone/layout/reports.xml | 2 +- .../frontend/default/iphone/layout/review.xml | 2 +- .../frontend/default/iphone/layout/rss.xml | 3 +- .../frontend/default/iphone/layout/sales.xml | 7 +- .../default/iphone/layout/sendfriend.xml | 2 +- .../default/iphone/layout/shipping.xml | 2 +- .../frontend/default/iphone/layout/tag.xml | 2 +- .../default/iphone/layout/wishlist.xml | 2 +- .../template/catalog/category/page.phtml | 2 +- .../template/catalog/category/view.phtml | 4 +- .../template/catalog/layer/filter.phtml | 2 +- .../iphone/template/catalog/layer/state.phtml | 4 +- .../iphone/template/catalog/layer/view.phtml | 4 +- .../template/catalog/navigation/left.phtml | 2 +- .../template/catalog/navigation/top.phtml | 2 +- .../catalog/product/compare/list.phtml | 8 +- .../catalog/product/compare/sidebar.phtml | 4 +- .../template/catalog/product/gallery.phtml | 2 +- .../template/catalog/product/list.phtml | 12 +- .../catalog/product/list/crosssell.phtml | 2 +- .../catalog/product/list/related.phtml | 2 +- .../catalog/product/list/toolbar.phtml | 2 +- .../catalog/product/list/upsell.phtml | 2 +- .../iphone/template/catalog/product/new.phtml | 2 +- .../template/catalog/product/price.phtml | 17 +- .../template/catalog/product/send.phtml | 2 +- .../template/catalog/product/view.phtml | 14 +- .../catalog/product/view/additional.phtml | 2 +- .../template/catalog/product/view/addto.phtml | 2 +- .../catalog/product/view/addtocart.phtml | 3 +- .../catalog/product/view/attributes.phtml | 2 +- .../catalog/product/view/bundle.phtml | 2 +- .../catalog/product/view/description.phtml | 4 +- .../template/catalog/product/view/media.phtml | 2 +- .../catalog/product/view/options.phtml | 2 +- .../product/view/options/type/date.phtml | 4 +- .../product/view/options/type/default.phtml | 2 +- .../product/view/options/type/file.phtml | 2 +- .../product/view/options/type/select.phtml | 2 +- .../product/view/options/type/text.phtml | 2 +- .../product/view/options/wrapper.phtml | 2 +- .../product/view/options/wrapper/bottom.phtml | 2 +- .../template/catalog/product/view/price.phtml | 2 +- .../catalog/product/view/price_clone.phtml | 2 +- .../catalog/product/view/tierprices.phtml | 2 +- .../product/view/type/configurable.phtml | 4 +- .../catalog/product/view/type/grouped.phtml | 3 +- .../view/type/options/configurable.phtml | 2 +- .../catalog/product/view/type/simple.phtml | 4 +- .../catalog/product/view/type/virtual.phtml | 4 +- .../iphone/template/catalog/seo/sitemap.phtml | 2 +- .../catalog/seo/sitemap/container.phtml | 2 +- .../iphone/template/catalog/seo/tree.phtml | 2 +- .../catalogsearch/advanced/form.phtml | 2 +- .../catalogsearch/advanced/result.phtml | 2 +- .../template/catalogsearch/form.mini.phtml | 2 +- .../template/catalogsearch/result.phtml | 2 +- .../iphone/template/catalogsearch/term.phtml | 2 +- .../iphone/template/checkout/cart.phtml | 8 +- .../template/checkout/cart/coupon.phtml | 2 +- .../template/checkout/cart/crosssell.phtml | 2 +- .../template/checkout/cart/item/default.phtml | 4 +- .../template/checkout/cart/noItems.phtml | 4 +- .../checkout/cart/render/default.phtml | 2 +- .../checkout/cart/render/simple.phtml | 2 +- .../template/checkout/cart/shipping.phtml | 2 +- .../template/checkout/cart/sidebar.phtml | 4 +- .../template/checkout/cart/totals.phtml | 2 +- .../iphone/template/checkout/links.phtml | 2 +- .../multishipping/address/select.phtml | 2 +- .../checkout/multishipping/addresses.phtml | 6 +- .../checkout/multishipping/billing.phtml | 2 +- .../checkout/multishipping/item/default.phtml | 2 +- .../checkout/multishipping/link.phtml | 4 +- .../checkout/multishipping/overview.phtml | 41 +- .../checkout/multishipping/shipping.phtml | 4 +- .../checkout/multishipping/state.phtml | 2 +- .../checkout/multishipping/success.phtml | 2 +- .../iphone/template/checkout/onepage.phtml | 2 +- .../template/checkout/onepage/billing.phtml | 6 +- .../template/checkout/onepage/link.phtml | 4 +- .../template/checkout/onepage/login.phtml | 2 +- .../template/checkout/onepage/payment.phtml | 2 +- .../checkout/onepage/payment/methods.phtml | 2 +- .../template/checkout/onepage/progress.phtml | 2 +- .../template/checkout/onepage/review.phtml | 34 +- .../checkout/onepage/review/info.phtml | 36 +- .../checkout/onepage/review/item.phtml | 2 +- .../checkout/onepage/review/totals.phtml | 2 +- .../template/checkout/onepage/shipping.phtml | 2 +- .../checkout/onepage/shipping_method.phtml | 2 +- .../onepage/shipping_method/additional.phtml | 2 +- .../onepage/shipping_method/available.phtml | 2 +- .../iphone/template/checkout/success.phtml | 2 +- .../default/iphone/template/cms/content.phtml | 2 +- .../iphone/template/cms/content_heading.phtml | 2 +- .../default/iphone/template/cms/meta.phtml | 2 +- .../iphone/template/contacts/form.phtml | 2 +- .../iphone/template/core/formkey.phtml | 2 +- .../default/iphone/template/core/link.phtml | 2 +- .../iphone/template/core/messages.phtml | 2 +- .../template/customer/account/dashboard.phtml | 2 +- .../customer/account/dashboard/address.phtml | 2 +- .../customer/account/dashboard/hello.phtml | 2 +- .../customer/account/dashboard/info.phtml | 2 +- .../account/dashboard/newsletter.phtml | 2 +- .../customer/account/dashboard/sidebar.phtml | 2 +- .../template/customer/account/link/back.phtml | 4 +- .../customer/account/navigation.phtml | 2 +- .../iphone/template/customer/address.phtml | 2 +- .../template/customer/address/book.phtml | 6 +- .../template/customer/address/edit.phtml | 6 +- .../iphone/template/customer/balance.phtml | 2 +- .../iphone/template/customer/dashboard.phtml | 2 +- .../template/customer/form/address.phtml | 2 +- .../customer/form/changepassword.phtml | 2 +- .../iphone/template/customer/form/edit.phtml | 4 +- .../customer/form/forgotpassword.phtml | 2 +- .../iphone/template/customer/form/login.phtml | 8 +- .../template/customer/form/mini.login.phtml | 2 +- .../customer/form/mini.newsletter.phtml | 2 +- .../template/customer/form/newsletter.phtml | 2 +- .../template/customer/form/register.phtml | 6 +- .../iphone/template/customer/logout.phtml | 6 +- .../iphone/template/customer/order/view.phtml | 2 +- .../iphone/template/customer/orders.phtml | 2 +- .../iphone/template/customer/widget/dob.phtml | 2 +- .../template/customer/widget/gender.phtml | 2 +- .../template/customer/widget/name.phtml | 2 +- .../template/customer/widget/taxvat.phtml | 2 +- .../iphone/template/customer/wishlist.phtml | 2 +- .../iphone/template/giftmessage/form.phtml | 6 +- .../iphone/template/giftmessage/helper.phtml | 2 +- .../iphone/template/giftmessage/inline.phtml | 2 +- .../iphone/template/googlecheckout/link.phtml | 24 +- .../template/newsletter/subscribe.phtml | 2 +- .../template/oscommerce/order/list.phtml | 56 + .../template/oscommerce/order/view.phtml | 139 + .../iphone/template/page/1column.phtml | 2 +- .../iphone/template/page/2columns-left.phtml | 2 +- .../iphone/template/page/2columns-right.phtml | 2 +- .../iphone/template/page/3columns.phtml | 2 +- .../iphone/template/page/dashboard.phtml | 2 +- .../template/page/html/breadcrumbs.phtml | 4 +- .../iphone/template/page/html/footer.phtml | 2 +- .../iphone/template/page/html/head.phtml | 2 +- .../iphone/template/page/html/header.phtml | 5 +- .../iphone/template/page/html/notices.phtml | 4 +- .../iphone/template/page/html/pager.phtml | 2 +- .../iphone/template/page/html/top.links.phtml | 2 +- .../iphone/template/page/html/wrapper.phtml | 2 +- .../iphone/template/page/js/calendar.phtml | 2 +- .../iphone/template/page/one-column.phtml | 2 +- .../default/iphone/template/page/print.phtml | 2 +- .../iphone/template/page/switch/flags.phtml | 2 +- .../template/page/switch/languages.phtml | 2 +- .../iphone/template/page/switch/stores.phtml | 2 +- .../template/page/template/container.phtml | 2 +- .../iphone/template/page/template/links.phtml | 2 +- .../iphone/template/payment/form/cc.phtml | 2 +- .../iphone/template/payment/form/ccsave.phtml | 2 +- .../template/payment/form/checkmo.phtml | 2 +- .../template/payment/form/purchaseorder.phtml | 2 +- .../template/payment/info/checkmo.phtml | 2 +- .../template/payment/info/purchaseorder.phtml | 2 +- .../default/iphone/template/poll/active.phtml | 2 +- .../default/iphone/template/poll/result.phtml | 2 +- .../iphone/template/productalert/price.phtml | 2 +- .../iphone/template/productalert/stock.phtml | 2 +- .../iphone/template/rating/detailed.phtml | 2 +- .../iphone/template/rating/empty.phtml | 2 +- .../reports/home_product_compared.phtml | 12 +- .../reports/home_product_viewed.phtml | 12 +- .../template/reports/product_compared.phtml | 4 +- .../template/reports/product_viewed.phtml | 4 +- .../template/review/customer/list.phtml | 2 +- .../template/review/customer/recent.phtml | 2 +- .../template/review/customer/view.phtml | 2 +- .../default/iphone/template/review/form.phtml | 2 +- .../template/review/helper/summary.phtml | 2 +- .../review/helper/summary_short.phtml | 2 +- .../default/iphone/template/review/list.phtml | 2 +- .../template/review/product/detailed.phtml | 2 +- .../default/iphone/template/review/view.phtml | 2 +- .../default/iphone/template/rss/list.phtml | 2 +- .../iphone/template/rss/order/details.phtml | 4 +- .../template/sales/order/creditmemo.phtml | 2 +- .../iphone/template/sales/order/details.phtml | 2 +- .../iphone/template/sales/order/history.phtml | 4 +- .../iphone/template/sales/order/info.phtml | 2 +- .../iphone/template/sales/order/invoice.phtml | 2 +- .../iphone/template/sales/order/items.phtml | 2 +- .../sales/order/items/renderer/default.phtml | 2 +- .../iphone/template/sales/order/print.phtml | 2 +- .../sales/order/print/creditmemo.phtml | 2 +- .../template/sales/order/print/invoice.phtml | 2 +- .../template/sales/order/print/shipment.phtml | 2 +- .../iphone/template/sales/order/recent.phtml | 4 +- .../template/sales/order/shipment.phtml | 2 +- .../iphone/template/sales/order/totals.phtml | 2 +- .../template/sales/order/trackinginfo.phtml | 2 +- .../iphone/template/sales/order/view.phtml | 2 +- .../template/sales/reorder/sidebar.phtml | 2 +- .../iphone/template/sendfriend/send.phtml | 2 +- .../template/shipping/tracking/popup.phtml | 2 +- .../default/iphone/template/tag/cloud.phtml | 4 +- .../iphone/template/tag/customer/edit.phtml | 2 +- .../iphone/template/tag/customer/recent.phtml | 2 +- .../iphone/template/tag/customer/tags.phtml | 4 +- .../iphone/template/tag/customer/view.phtml | 4 +- .../default/iphone/template/tag/list.phtml | 9 +- .../default/iphone/template/tag/mytags.phtml | 2 +- .../default/iphone/template/tag/popular.phtml | 2 +- .../iphone/template/tag/product/result.phtml | 2 +- .../default/iphone/template/tag/result.phtml | 2 +- .../default/iphone/template/tag/search.phtml | 2 +- .../template/tax/checkout/discount.phtml | 2 +- .../template/tax/checkout/grandtotal.phtml | 2 +- .../template/tax/checkout/shipping.phtml | 2 +- .../template/tax/checkout/subtotal.phtml | 2 +- .../iphone/template/tax/checkout/tax.phtml | 8 +- .../iphone/template/tax/order/tax.phtml | 8 +- .../template/wishlist/email/items.phtml | 2 +- .../iphone/template/wishlist/email/rss.phtml | 2 +- .../iphone/template/wishlist/shared.phtml | 2 +- .../iphone/template/wishlist/sharing.phtml | 2 +- .../iphone/template/wishlist/sidebar.phtml | 2 +- .../iphone/template/wishlist/view.phtml | 4 +- .../frontend/default/modern/etc/widget.xml | 2 +- .../default/modern/layout/catalog.xml | 30 +- .../default/modern/layout/catalogsearch.xml | 11 +- .../default/modern/layout/checkout.xml | 3 +- .../default/modern/layout/contacts.xml | 2 +- .../default/modern/layout/customer.xml | 2 +- .../default/modern/layout/newsletter.xml | 2 +- .../frontend/default/modern/layout/page.xml | 11 +- .../default/modern/layout/payment.xml | 38 + .../frontend/default/modern/layout/review.xml | 2 +- .../frontend/default/modern/layout/rss.xml | 3 +- .../frontend/default/modern/layout/sales.xml | 7 +- .../default/modern/layout/sendfriend.xml | 2 +- .../frontend/default/modern/layout/tag.xml | 6 +- .../default/modern/layout/wishlist.xml | 214 +- .../template/catalog/product/list.phtml | 14 +- .../catalog/product/list/upsell.phtml | 2 +- .../template/catalog/product/view.phtml | 6 +- .../template/catalog/product/view/media.phtml | 4 +- .../template/catalog/product/view/tabs.phtml | 2 +- .../template/catalogsearch/form.mini.phtml | 2 +- .../modern/template/checkout/cart.phtml | 14 +- .../template/newsletter/subscribe.phtml | 2 +- .../modern/template/page/3columns.phtml | 2 +- .../modern/template/page/html/footer.phtml | 2 +- .../modern/template/page/html/header.phtml | 5 +- .../default/modern/template/sample/home.phtml | 2 +- .../install/default/default/layout/main.xml | 2 +- .../default/template/install/begin.phtml | 4 +- .../default/template/install/config.phtml | 12 +- .../template/install/create_admin.phtml | 2 +- .../default/template/install/download.phtml | 10 +- .../default/template/install/end.phtml | 2 +- .../default/template/install/locale.phtml | 2 +- .../default/template/install/state.phtml | 2 +- .../default/default/template/page.phtml | 4 +- app/etc/config.xml | 10 +- app/etc/local.xml.additional | 3 +- app/etc/modules/Mage_All.xml | 169 +- app/etc/modules/Mage_Api.xml | 2 +- app/etc/modules/Mage_Bundle.xml | 2 +- app/etc/modules/Mage_Centinel.xml | 4 +- app/etc/modules/Mage_Chronopay.xml | 38 + app/etc/modules/Mage_Compiler.xml | 2 +- app/etc/modules/Mage_Cybermut.xml | 38 + app/etc/modules/Mage_Cybersource.xml | 38 + app/etc/modules/Mage_Downloadable.xml | 2 +- app/etc/modules/Mage_Eway.xml | 38 + app/etc/modules/Mage_Flo2Cash.xml | 38 + app/etc/modules/Mage_Ideal.xml | 38 + app/etc/modules/Mage_Ogone.xml | 39 + app/etc/modules/Mage_Oscommerce.xml | 41 + app/etc/modules/Mage_Paybox.xml | 38 + app/etc/modules/Mage_Protx.xml | 38 + app/etc/modules/Mage_Strikeiron.xml | 38 + app/etc/modules/Mage_Weee.xml | 2 +- app/etc/modules/Mage_Widget.xml | 2 +- app/locale/en_US/Mage_AdminNotification.csv | 25 +- app/locale/en_US/Mage_Adminhtml.csv | 476 +- app/locale/en_US/Mage_Api.csv | 45 +- app/locale/en_US/Mage_Backup.csv | 20 +- app/locale/en_US/Mage_Bundle.csv | 13 +- app/locale/en_US/Mage_Catalog.csv | 318 +- app/locale/en_US/Mage_CatalogInventory.csv | 30 +- app/locale/en_US/Mage_CatalogRule.csv | 36 +- app/locale/en_US/Mage_CatalogSearch.csv | 13 +- app/locale/en_US/Mage_Centinel.csv | 5 +- app/locale/en_US/Mage_Checkout.csv | 71 +- app/locale/en_US/Mage_Chronopay.csv | 49 + app/locale/en_US/Mage_Cms.csv | 49 +- app/locale/en_US/Mage_Compiler.csv | 6 +- app/locale/en_US/Mage_Core.csv | 156 +- app/locale/en_US/Mage_Cron.csv | 18 +- app/locale/en_US/Mage_Customer.csv | 148 +- app/locale/en_US/Mage_Cybermut.csv | 35 + app/locale/en_US/Mage_Cybersource.csv | 41 + app/locale/en_US/Mage_Dataflow.csv | 36 +- app/locale/en_US/Mage_Directory.csv | 20 +- app/locale/en_US/Mage_Downloadable.csv | 35 +- app/locale/en_US/Mage_Eav.csv | 77 +- app/locale/en_US/Mage_Eway.csv | 38 + app/locale/en_US/Mage_Flo2Cash.csv | 27 + app/locale/en_US/Mage_GiftMessage.csv | 14 +- app/locale/en_US/Mage_GoogleAnalytics.csv | 2 +- app/locale/en_US/Mage_GoogleBase.csv | 32 +- app/locale/en_US/Mage_GoogleCheckout.csv | 22 +- app/locale/en_US/Mage_GoogleOptimizer.csv | 4 +- app/locale/en_US/Mage_Ideal.csv | 60 + app/locale/en_US/Mage_Index.csv | 16 +- app/locale/en_US/Mage_Install.csv | 46 +- app/locale/en_US/Mage_Log.csv | 4 +- app/locale/en_US/Mage_Media.csv | 4 +- app/locale/en_US/Mage_Newsletter.csv | 50 +- app/locale/en_US/Mage_Ogone.csv | 73 + app/locale/en_US/Mage_Oscommerce.csv | 128 + app/locale/en_US/Mage_Page.csv | 2 +- app/locale/en_US/Mage_Paybox.csv | 106 + app/locale/en_US/Mage_Paygate.csv | 45 +- app/locale/en_US/Mage_Payment.csv | 89 +- app/locale/en_US/Mage_Paypal.csv | 319 +- app/locale/en_US/Mage_PaypalUk.csv | 15 +- app/locale/en_US/Mage_Poll.csv | 10 +- app/locale/en_US/Mage_ProductAlert.csv | 26 +- app/locale/en_US/Mage_Protx.csv | 31 + app/locale/en_US/Mage_Reports.csv | 58 +- app/locale/en_US/Mage_Review.csv | 16 +- app/locale/en_US/Mage_Rss.csv | 3 +- app/locale/en_US/Mage_Rule.csv | 1 + app/locale/en_US/Mage_Sales.csv | 370 +- app/locale/en_US/Mage_SalesRule.csv | 45 +- app/locale/en_US/Mage_Sendfriend.csv | 34 +- app/locale/en_US/Mage_Shipping.csv | 32 +- app/locale/en_US/Mage_Sitemap.csv | 18 +- app/locale/en_US/Mage_Strikeiron.csv | 47 + app/locale/en_US/Mage_Tag.csv | 22 +- app/locale/en_US/Mage_Tax.csv | 55 +- app/locale/en_US/Mage_Usa.csv | 51 +- app/locale/en_US/Mage_Weee.csv | 1 + app/locale/en_US/Mage_Widget.csv | 4 +- app/locale/en_US/Mage_Wishlist.csv | 28 +- app/locale/en_US/Phoenix_Moneybookers.csv | 21 +- .../email/moneybookers_activateemail.html | 6 + .../email/strikeiron_email_warning.html | 10 + errors/404.php | 2 +- errors/503.php | 2 +- errors/default/404.phtml | 2 +- errors/default/503.phtml | 2 +- errors/default/css/styles.css | 2 +- errors/default/page.phtml | 4 +- errors/default/report.phtml | 2 +- errors/local.xml.sample | 2 +- errors/processor.php | 49 +- errors/report.php | 2 +- includes/config.php | 56 +- index.php | 4 +- js/calendar/calendar-setup.js | 2 +- js/calendar/calendar.js | 6 +- js/lib/ccard.js | 28 + js/lib/dropdown.js | 26 +- js/lib/flex.js | 8 +- js/mage/adminhtml/accordion.js | 2 +- js/mage/adminhtml/browser.js | 9 +- js/mage/adminhtml/events.js | 3 +- js/mage/adminhtml/flexuploader.js | 2 +- js/mage/adminhtml/form.js | 34 +- js/mage/adminhtml/giftmessage.js | 2 +- js/mage/adminhtml/grid.js | 10 +- js/mage/adminhtml/hash.js | 2 +- js/mage/adminhtml/image.js | 2 +- js/mage/adminhtml/loader.js | 2 +- js/mage/adminhtml/magento-all.js | 2 +- js/mage/adminhtml/moneybookers.js | 16 +- js/mage/adminhtml/product.js | 11 +- js/mage/adminhtml/rules.js | 2 +- js/mage/adminhtml/sales.js | 5 +- js/mage/adminhtml/sales/centinel.js | 2 +- js/mage/adminhtml/scrollbar.js | 2 +- js/mage/adminhtml/tabs.js | 2 +- js/mage/adminhtml/tools.js | 42 +- js/mage/adminhtml/uploader.js | 2 +- js/mage/adminhtml/variables.js | 5 +- .../plugins/magentovariable/editor_plugin.js | 2 +- .../plugins/magentovariable/img/icon.gif | Bin 631 -> 91 bytes .../plugins/magentowidget/editor_plugin.js | 2 +- js/mage/adminhtml/wysiwyg/tiny_mce/setup.js | 22 +- .../themes/advanced/skins/default/content.css | 2 +- .../themes/advanced/skins/default/dialog.css | 2 +- js/mage/adminhtml/wysiwyg/widget.js | 11 +- js/mage/centinel.js | 112 + js/mage/cookies.js | 2 +- js/mage/translate.js | 2 +- js/mage/translate_inline.css | 2 +- js/mage/translate_inline.js | 2 +- js/prototype/validation.js | 48 +- js/prototype/window.js | 10 +- js/prototype/windows/themes/magento.css | 165 +- js/tiny_mce/blank.htm | 9 - js/tiny_mce/classes/AddOnManager.js | 56 +- js/tiny_mce/classes/CommandManager.js | 13 +- js/tiny_mce/classes/ControlManager.js | 50 +- js/tiny_mce/classes/Developer.js | 9 +- js/tiny_mce/classes/Editor.js | 929 +- js/tiny_mce/classes/EditorCommands.js | 1197 +-- js/tiny_mce/classes/EditorManager.js | 288 +- js/tiny_mce/classes/ForceBlocks.js | 200 +- js/tiny_mce/classes/Formatter.js | 1497 +++ js/tiny_mce/classes/LegacyInput.js | 62 + js/tiny_mce/classes/Popup.js | 68 +- js/tiny_mce/classes/UndoManager.js | 290 +- js/tiny_mce/classes/WindowManager.js | 38 +- js/tiny_mce/classes/adapter/jquery/adapter.js | 118 +- .../classes/adapter/jquery/jquery.tinymce.js | 336 +- .../classes/adapter/prototype/adapter.js | 13 +- js/tiny_mce/classes/commands/BlockQuote.js | 135 - js/tiny_mce/classes/commands/CutCopyPaste.js | 24 - .../classes/commands/InsertHorizontalRule.js | 15 - js/tiny_mce/classes/commands/RemoveFormat.js | 173 - js/tiny_mce/classes/commands/UndoRedo.js | 38 - js/tiny_mce/classes/dom/DOMUtils.js | 677 +- js/tiny_mce/classes/dom/Element.js | 344 +- js/tiny_mce/classes/dom/EventUtils.js | 48 +- js/tiny_mce/classes/dom/Range.js | 631 +- js/tiny_mce/classes/dom/RangeUtils.js | 200 + js/tiny_mce/classes/dom/Schema.js | 185 + js/tiny_mce/classes/dom/ScriptLoader.js | 456 +- js/tiny_mce/classes/dom/Selection.js | 619 +- js/tiny_mce/classes/dom/Serializer.js | 290 +- js/tiny_mce/classes/dom/StringWriter.js | 36 +- js/tiny_mce/classes/dom/TreeWalker.js | 64 + js/tiny_mce/classes/dom/TridentSelection.js | 411 +- js/tiny_mce/classes/dom/XMLWriter.js | 34 +- js/tiny_mce/classes/tinymce.js | 1048 +- js/tiny_mce/classes/ui/Button.js | 29 +- js/tiny_mce/classes/ui/ColorSplitButton.js | 67 +- js/tiny_mce/classes/ui/Container.js | 36 +- js/tiny_mce/classes/ui/Control.js | 50 +- js/tiny_mce/classes/ui/DropMenu.js | 40 +- js/tiny_mce/classes/ui/ListBox.js | 116 +- js/tiny_mce/classes/ui/Menu.js | 45 +- js/tiny_mce/classes/ui/MenuButton.js | 40 +- js/tiny_mce/classes/ui/MenuItem.js | 34 +- js/tiny_mce/classes/ui/NativeListBox.js | 44 +- js/tiny_mce/classes/ui/Separator.js | 33 +- js/tiny_mce/classes/ui/SplitButton.js | 29 +- js/tiny_mce/classes/ui/Toolbar.js | 25 +- js/tiny_mce/classes/util/Cookie.js | 31 +- js/tiny_mce/classes/util/Dispatcher.js | 25 +- js/tiny_mce/classes/util/JSON.js | 22 +- js/tiny_mce/classes/util/JSONP.js | 9 +- js/tiny_mce/classes/util/JSONRequest.js | 26 +- js/tiny_mce/classes/util/URI.js | 52 +- js/tiny_mce/classes/util/XHR.js | 24 +- js/tiny_mce/classes/xml/Parser.js | 9 +- js/tiny_mce/jquery.tinymce.js | 2 +- js/tiny_mce/langs/en.js | 19 +- .../plugins/advhr/editor_plugin_src.js | 9 +- js/tiny_mce/plugins/advhr/rule.htm | 9 +- .../plugins/advimage/editor_plugin_src.js | 9 +- js/tiny_mce/plugins/advimage/image.htm | 9 +- js/tiny_mce/plugins/advimage/js/image.js | 2 +- .../plugins/advlink/editor_plugin_src.js | 9 +- js/tiny_mce/plugins/advlink/js/advlink.js | 2 +- js/tiny_mce/plugins/advlink/link.htm | 9 +- js/tiny_mce/plugins/advlist/editor_plugin.js | 1 + .../plugins/advlist/editor_plugin_src.js | 154 + .../plugins/autoresize/editor_plugin.js | 2 +- .../plugins/autoresize/editor_plugin_src.js | 52 +- js/tiny_mce/plugins/autosave/editor_plugin.js | 2 +- .../plugins/autosave/editor_plugin_src.js | 405 +- js/tiny_mce/plugins/autosave/langs/en.js | 4 + .../plugins/bbcode/editor_plugin_src.js | 9 +- js/tiny_mce/plugins/compat2x/editor_plugin.js | 1 - .../plugins/compat2x/editor_plugin_src.js | 616 -- .../plugins/contextmenu/editor_plugin_src.js | 38 +- .../directionality/editor_plugin_src.js | 9 +- js/tiny_mce/plugins/emotions/editor_plugin.js | 2 +- .../plugins/emotions/editor_plugin_src.js | 13 +- js/tiny_mce/plugins/example/dialog.htm | 9 +- .../plugins/example/editor_plugin_src.js | 9 +- .../plugins/fullpage/editor_plugin_src.js | 9 +- js/tiny_mce/plugins/fullpage/fullpage.htm | 9 +- js/tiny_mce/plugins/fullpage/js/fullpage.js | 26 +- .../plugins/fullscreen/editor_plugin_src.js | 9 +- js/tiny_mce/plugins/fullscreen/fullscreen.htm | 1 - .../plugins/iespell/editor_plugin_src.js | 9 +- .../plugins/inlinepopups/editor_plugin_src.js | 9 +- .../insertdatetime/editor_plugin_src.js | 9 +- .../plugins/layer/editor_plugin_src.js | 9 +- .../plugins/legacyoutput/editor_plugin.js | 1 + .../plugins/legacyoutput/editor_plugin_src.js | 136 + js/tiny_mce/plugins/media/editor_plugin.js | 2 +- .../plugins/media/editor_plugin_src.js | 27 +- js/tiny_mce/plugins/media/media.htm | 9 +- .../plugins/nonbreaking/editor_plugin_src.js | 9 +- .../plugins/noneditable/editor_plugin_src.js | 9 +- .../plugins/pagebreak/editor_plugin_src.js | 9 +- js/tiny_mce/plugins/paste/editor_plugin.js | 2 +- .../plugins/paste/editor_plugin_src.js | 659 +- js/tiny_mce/plugins/paste/pastetext.htm | 10 +- js/tiny_mce/plugins/paste/pasteword.htm | 10 +- .../plugins/preview/editor_plugin_src.js | 9 +- .../plugins/print/editor_plugin_src.js | 9 +- js/tiny_mce/plugins/safari/blank.htm | 1 - js/tiny_mce/plugins/safari/editor_plugin.js | 1 - .../plugins/safari/editor_plugin_src.js | 438 - js/tiny_mce/plugins/save/editor_plugin_src.js | 9 +- .../plugins/searchreplace/editor_plugin.js | 2 +- .../searchreplace/editor_plugin_src.js | 11 +- .../plugins/searchreplace/js/searchreplace.js | 4 + .../plugins/searchreplace/searchreplace.htm | 13 +- .../plugins/spellchecker/editor_plugin_src.js | 9 +- .../plugins/style/editor_plugin_src.js | 9 +- js/tiny_mce/plugins/style/props.htm | 12 +- js/tiny_mce/plugins/tabfocus/editor_plugin.js | 2 +- .../plugins/tabfocus/editor_plugin_src.js | 11 +- js/tiny_mce/plugins/table/cell.htm | 9 +- js/tiny_mce/plugins/table/editor_plugin.js | 2 +- .../plugins/table/editor_plugin_src.js | 1818 ++-- js/tiny_mce/plugins/table/js/cell.js | 63 +- js/tiny_mce/plugins/table/js/merge_cells.js | 38 +- js/tiny_mce/plugins/table/js/row.js | 69 +- js/tiny_mce/plugins/table/js/table.js | 33 +- js/tiny_mce/plugins/table/merge_cells.htm | 11 +- js/tiny_mce/plugins/table/row.htm | 9 +- js/tiny_mce/plugins/table/table.htm | 9 +- js/tiny_mce/plugins/template/editor_plugin.js | 2 +- .../plugins/template/editor_plugin_src.js | 17 +- js/tiny_mce/plugins/template/template.htm | 10 +- .../plugins/visualchars/editor_plugin_src.js | 9 +- .../plugins/wordcount/editor_plugin.js | 1 + .../plugins/wordcount/editor_plugin_src.js | 98 + js/tiny_mce/plugins/xhtmlxtras/abbr.htm | 13 +- js/tiny_mce/plugins/xhtmlxtras/acronym.htm | 13 +- js/tiny_mce/plugins/xhtmlxtras/attributes.htm | 9 +- js/tiny_mce/plugins/xhtmlxtras/cite.htm | 13 +- js/tiny_mce/plugins/xhtmlxtras/del.htm | 14 +- .../plugins/xhtmlxtras/editor_plugin.js | 2 +- .../plugins/xhtmlxtras/editor_plugin_src.js | 14 +- js/tiny_mce/plugins/xhtmlxtras/ins.htm | 14 +- js/tiny_mce/plugins/xhtmlxtras/js/abbr.js | 13 +- js/tiny_mce/plugins/xhtmlxtras/js/acronym.js | 11 +- .../plugins/xhtmlxtras/js/attributes.js | 11 +- js/tiny_mce/plugins/xhtmlxtras/js/cite.js | 11 +- js/tiny_mce/plugins/xhtmlxtras/js/del.js | 11 +- .../plugins/xhtmlxtras/js/element_common.js | 16 +- js/tiny_mce/plugins/xhtmlxtras/js/ins.js | 11 +- js/tiny_mce/themes/advanced/about.htm | 4 +- js/tiny_mce/themes/advanced/anchor.htm | 9 +- js/tiny_mce/themes/advanced/color_picker.htm | 6 +- .../themes/advanced/editor_template.js | 2 +- .../themes/advanced/editor_template_src.js | 358 +- js/tiny_mce/themes/advanced/image.htm | 9 +- js/tiny_mce/themes/advanced/img/icons.gif | Bin 11505 -> 11794 bytes js/tiny_mce/themes/advanced/js/anchor.js | 14 +- js/tiny_mce/themes/advanced/js/charmap.js | 10 + js/tiny_mce/themes/advanced/js/image.js | 4 +- js/tiny_mce/themes/advanced/js/link.js | 8 +- js/tiny_mce/themes/advanced/link.htm | 9 +- .../themes/advanced/skins/default/content.css | 9 +- .../themes/advanced/skins/default/dialog.css | 7 +- .../themes/advanced/skins/default/ui.css | 9 +- .../themes/advanced/skins/o2k7/content.css | 9 +- .../themes/advanced/skins/o2k7/dialog.css | 5 +- js/tiny_mce/themes/advanced/skins/o2k7/ui.css | 6 +- js/tiny_mce/themes/advanced/source_editor.htm | 9 +- .../themes/simple/editor_template_src.js | 10 +- js/tiny_mce/tiny_mce.js | 2 +- js/tiny_mce/tiny_mce_dev.js | 58 +- js/tiny_mce/tiny_mce_jquery.js | 2 +- js/tiny_mce/tiny_mce_jquery_src.js | 9194 +++++++++-------- js/tiny_mce/tiny_mce_popup.js | 2 +- js/tiny_mce/tiny_mce_prototype.js | 2 +- js/tiny_mce/tiny_mce_prototype_src.js | 9171 ++++++++-------- js/tiny_mce/tiny_mce_src.js | 9145 ++++++++-------- js/tiny_mce/utils/editable_selects.js | 9 +- js/tiny_mce/utils/form_utils.js | 11 +- js/tiny_mce/utils/mctabs.js | 9 +- js/tiny_mce/utils/validate.js | 9 +- js/varien/accordion.js | 2 +- js/varien/form.js | 2 +- js/varien/iehover-fix.js | 2 +- js/varien/js.js | 28 +- js/varien/menu.js | 115 +- js/varien/payment.js | 2 +- js/varien/product.js | 6 +- js/varien/telephone.js | 2 +- js/varien/weee.js | 2 +- lib/Varien/Crypt/Mcrypt.php | 20 +- lib/Varien/Data/Collection/Db.php | 23 +- lib/Varien/Data/Form.php | 3 + lib/Varien/Data/Form/Abstract.php | 3 - lib/Varien/Data/Form/Element/Abstract.php | 3 + lib/Varien/Data/Form/Element/Date.php | 19 +- lib/Varien/Data/Form/Element/Editor.php | 15 +- lib/Varien/Data/Form/Element/Text.php | 2 +- lib/Varien/Data/Form/Element/Time.php | 3 +- lib/Varien/Db/Adapter/Pdo/Mysql.php | 248 + lib/Varien/Db/Ddl/Table.php | 567 + lib/Varien/Db/Select.php | 23 +- lib/Varien/Debug.php | 10 +- lib/Varien/File/Uploader.php | 11 +- lib/Varien/Io/File.php | 8 +- lib/Varien/Io/Sftp.php | 201 +- lib/Varien/Object.php | 147 +- lib/Varien/Object/Mapper.php | 2 +- lib/Varien/Simplexml/Element.php | 28 +- lib/Zend/Cache/Backend/Memcached.php | 56 +- lib/Zend/Locale/Format.php | 4 +- lib/Zend/Validate/Hostname.php | 4 +- lib/phpseclib/Crypt/AES.php | 479 + lib/phpseclib/Crypt/DES.php | 945 ++ lib/phpseclib/Crypt/Hash.php | 816 ++ lib/phpseclib/Crypt/RC4.php | 493 + lib/phpseclib/Crypt/RSA.php | 2119 ++++ lib/phpseclib/Crypt/Random.php | 129 + lib/phpseclib/Crypt/Rijndael.php | 1242 +++ lib/phpseclib/Crypt/TripleDES.php | 690 ++ lib/phpseclib/Math/BigInteger.php | 3545 +++++++ lib/phpseclib/Net/SFTP.php | 1461 +++ lib/phpseclib/Net/SSH1.php | 1159 +++ lib/phpseclib/Net/SSH2.php | 2302 +++++ .../PHP/Compat/Function/array_fill.php | 41 + .../PHP/Compat/Function/bcpowmod.php | 66 + .../PHP/Compat/Function/str_split.php | 59 + pkginfo/Mage_Cybermut.txt | 1 + pkginfo/Mage_Paybox.txt | 1 + skin/adminhtml/default/default/below_ie7.css | 2 +- skin/adminhtml/default/default/boxes.css | 146 +- skin/adminhtml/default/default/custom.css | 22 + skin/adminhtml/default/default/iestyles.css | 4 +- .../default/images/btn_add-variable_icon.gif | Bin 0 -> 80 bytes .../default/default/images/btn_go.gif | Bin 0 -> 204 bytes .../default/default/images/button-close.png | Bin 0 -> 410 bytes .../images/entry_edit_head_arrow_down2.gif | Bin 0 -> 670 bytes .../default/default/images/paypal_logo.gif | Bin 0 -> 1994 bytes .../default/default/images/paypal_section.png | Bin 0 -> 1846 bytes .../default/default/images/paypal_tick.gif | Bin 0 -> 941 bytes .../default/default/images/tooltip_bg.gif | Bin 0 -> 294 bytes .../default/default/images/tooltip_corner.gif | Bin 0 -> 854 bytes .../default/default/images/tooltip_top.gif | Bin 0 -> 295 bytes .../default/default/images/window_close.png | Bin 0 -> 872 bytes .../default/default/images/window_content.png | Bin 0 -> 158 bytes .../default/default/images/window_top.png | Bin 0 -> 166 bytes .../default/images/wysiwyg/skin_image.png | Bin 0 -> 1837 bytes skin/frontend/base/default/css/widgets.css | 2 +- skin/frontend/base/default/js/bundle.js | 12 +- .../base/default/js/checkout/review.js | 2 +- skin/frontend/base/default/js/giftmessage.js | 2 +- skin/frontend/base/default/js/ie6.js | 20 +- skin/frontend/base/default/js/opcheckout.js | 9 +- skin/frontend/default/blank/css/print.css | 2 +- skin/frontend/default/blank/css/styles-ie.css | 10 +- skin/frontend/default/blank/css/styles.css | 83 +- .../images/i_availability_only_arrow.gif | Bin 0 -> 113 bytes skin/frontend/default/blue/css/styles-ie.css | 13 +- skin/frontend/default/blue/css/styles.css | 106 +- .../blue/images/i_availability_only.gif | Bin 0 -> 562 bytes .../blue/images/i_availability_only_arrow.gif | Bin 0 -> 113 bytes skin/frontend/default/default/css/print.css | 2 +- .../default/default/css/styles-ie.css | 13 +- skin/frontend/default/default/css/styles.css | 101 +- .../default/default/images/bkg_nav2.gif | Bin 0 -> 67 bytes .../default/images/i_availability_only.gif | Bin 0 -> 562 bytes .../images/i_availability_only_arrow.gif | Bin 0 -> 113 bytes skin/frontend/default/iphone/css/clears.css | 2 +- skin/frontend/default/iphone/css/iphone.css | 17 +- skin/frontend/default/iphone/js/opcheckout.js | 9 +- skin/frontend/default/iphone/js/search.js | 2 +- skin/frontend/default/modern/css/print.css | 2 +- .../frontend/default/modern/css/styles-ie.css | 12 +- skin/frontend/default/modern/css/styles.css | 94 +- skin/frontend/default/modern/css/widgets.css | 2 +- .../modern/images/i_availability_only.gif | Bin 0 -> 562 bytes .../images/i_availability_only_arrow.gif | Bin 0 -> 113 bytes skin/install/default/default/css/reset.css | 2 +- 5412 files changed, 124892 insertions(+), 37428 deletions(-) create mode 100644 RELEASE_NOTES.txt create mode 100644 app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Attribute/Urlkey.php create mode 100644 app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Recurring.php create mode 100644 app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser.php create mode 100644 app/code/core/Mage/Adminhtml/Block/Report/Sales/Bestsellers.php create mode 100644 app/code/core/Mage/Adminhtml/Block/Report/Sales/Bestsellers/Grid.php create mode 100644 app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Price.php create mode 100644 app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Transactions.php create mode 100644 app/code/core/Mage/Adminhtml/Block/Sales/Transactions.php create mode 100644 app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Child/Grid.php create mode 100644 app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Detail.php create mode 100644 app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Detail/Grid.php create mode 100644 app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Grid.php create mode 100644 app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Heading.php create mode 100644 app/code/core/Mage/Adminhtml/controllers/Report/StatisticsController.php create mode 100644 app/code/core/Mage/Adminhtml/controllers/Sales/Billing/AgreementController.php create mode 100644 app/code/core/Mage/Adminhtml/controllers/Sales/Recurring/ProfileController.php create mode 100644 app/code/core/Mage/Adminhtml/controllers/Sales/TransactionsController.php create mode 100644 app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.11-0.1.12.php create mode 100644 app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Recurring.php create mode 100644 app/code/core/Mage/Catalog/Model/Template/Filter.php create mode 100644 app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.21-1.4.0.0.22.php create mode 100644 app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.22-1.4.0.0.23.php create mode 100644 app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.23-1.4.0.0.24.php create mode 100644 app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.24-1.4.0.0.25.php create mode 100644 app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.25-1.4.0.0.26.php create mode 100644 app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.26-1.4.0.0.27.php create mode 100644 app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.27-1.4.0.0.28.php create mode 100644 app/code/core/Mage/CatalogInventory/Block/Adminhtml/Form/Field/Customergroup.php create mode 100644 app/code/core/Mage/CatalogInventory/Block/Adminhtml/Form/Field/Minsaleqty.php create mode 100644 app/code/core/Mage/CatalogInventory/Block/Stockqty/Abstract.php create mode 100644 app/code/core/Mage/CatalogInventory/Block/Stockqty/Composite.php create mode 100644 app/code/core/Mage/CatalogInventory/Block/Stockqty/Default.php create mode 100644 app/code/core/Mage/CatalogInventory/Block/Stockqty/Type/Configurable.php create mode 100644 app/code/core/Mage/CatalogInventory/Block/Stockqty/Type/Grouped.php create mode 100644 app/code/core/Mage/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php create mode 100644 app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.5-0.7.6.php create mode 100644 app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.6-0.7.7.php create mode 100644 app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.7-0.7.8.php create mode 100644 app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.8-0.7.9.php create mode 100644 app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.9-0.7.10.php create mode 100644 app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext/Engine.php create mode 100644 app/code/core/Mage/Centinel/Model/State/Jcb.php create mode 100644 app/code/core/Mage/Checkout/Block/Total/Nominal.php create mode 100644 app/code/core/Mage/Chronopay/Block/Form.php create mode 100644 app/code/core/Mage/Chronopay/Block/Info.php create mode 100644 app/code/core/Mage/Chronopay/Block/Standard/Failure.php create mode 100644 app/code/core/Mage/Chronopay/Block/Standard/Form.php create mode 100644 app/code/core/Mage/Chronopay/Block/Standard/Redirect.php create mode 100644 app/code/core/Mage/Chronopay/Helper/Data.php create mode 100644 app/code/core/Mage/Chronopay/Model/Api/Debug.php create mode 100644 app/code/core/Mage/Chronopay/Model/Config.php create mode 100644 app/code/core/Mage/Chronopay/Model/Gateway.php create mode 100644 app/code/core/Mage/Chronopay/Model/Gateway/Request.php create mode 100644 app/code/core/Mage/Chronopay/Model/Gateway/Result.php create mode 100644 app/code/core/Mage/Chronopay/Model/Mysql4/Api/Debug.php create mode 100644 app/code/core/Mage/Chronopay/Model/Mysql4/Api/Debug/Collection.php create mode 100644 app/code/core/Mage/Chronopay/Model/Mysql4/Setup.php create mode 100644 app/code/core/Mage/Chronopay/Model/Source/Cctype.php create mode 100644 app/code/core/Mage/Chronopay/Model/Source/Language.php create mode 100644 app/code/core/Mage/Chronopay/Model/Source/PaymentAction.php create mode 100644 app/code/core/Mage/Chronopay/Model/Standard.php create mode 100644 app/code/core/Mage/Chronopay/controllers/StandardController.php create mode 100644 app/code/core/Mage/Chronopay/etc/config.xml rename app/code/core/Mage/{PaypalUk => Chronopay}/etc/system.xml (61%) create mode 100644 app/code/core/Mage/Chronopay/sql/chronopay_setup/mysql4-install-0.1.0.php create mode 100644 app/code/core/Mage/Core/Model/Log/Adapter.php create mode 100644 app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.6-1.4.0.0.7.php create mode 100644 app/code/core/Mage/Cybermut/Block/Error.php create mode 100644 app/code/core/Mage/Cybermut/Block/Form.php create mode 100644 app/code/core/Mage/Cybermut/Block/Redirect.php create mode 100644 app/code/core/Mage/Cybermut/Helper/Data.php create mode 100644 app/code/core/Mage/Cybermut/Model/Api/Debug.php create mode 100644 app/code/core/Mage/Cybermut/Model/Mysql4/Api/Debug.php create mode 100644 app/code/core/Mage/Cybermut/Model/Mysql4/Api/Debug/Collection.php create mode 100644 app/code/core/Mage/Cybermut/Model/Mysql4/Setup.php create mode 100644 app/code/core/Mage/Cybermut/Model/Payment.php create mode 100644 app/code/core/Mage/Cybermut/Model/Source/Bank.php create mode 100644 app/code/core/Mage/Cybermut/Model/Source/Language.php create mode 100644 app/code/core/Mage/Cybermut/controllers/PaymentController.php create mode 100644 app/code/core/Mage/Cybermut/etc/config.xml create mode 100644 app/code/core/Mage/Cybermut/etc/system.xml create mode 100644 app/code/core/Mage/Cybermut/sql/cybermut_setup/mysql4-install-0.1.0.php create mode 100644 app/code/core/Mage/Cybersource/Block/Form.php create mode 100644 app/code/core/Mage/Cybersource/Block/Info.php create mode 100644 app/code/core/Mage/Cybersource/Helper/Data.php rename app/code/core/Mage/{Paypal/Model/Mysql4 => Cybersource/Model}/Api/Debug.php (77%) create mode 100644 app/code/core/Mage/Cybersource/Model/Api/ExtendedSoapClient.php create mode 100644 app/code/core/Mage/Cybersource/Model/Config.php create mode 100644 app/code/core/Mage/Cybersource/Model/Mysql4/Api/Debug.php create mode 100644 app/code/core/Mage/Cybersource/Model/Mysql4/Api/Debug/Collection.php create mode 100644 app/code/core/Mage/Cybersource/Model/Mysql4/Setup.php create mode 100644 app/code/core/Mage/Cybersource/Model/Soap.php create mode 100644 app/code/core/Mage/Cybersource/Model/Source/Cctype.php create mode 100644 app/code/core/Mage/Cybersource/Model/Source/PaymentAction.php create mode 100644 app/code/core/Mage/Cybersource/etc/config.xml create mode 100644 app/code/core/Mage/Cybersource/etc/system.xml create mode 100644 app/code/core/Mage/Cybersource/sql/cybersource_setup/mysql4-install-0.7.0.php create mode 100644 app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-install-1.4.0.0.php create mode 100644 app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-1.3.9-1.4.0.0.php create mode 100644 app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php create mode 100644 app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Serialized.php create mode 100644 app/code/core/Mage/Eway/Block/Form.php create mode 100644 app/code/core/Mage/Eway/Block/Info.php create mode 100644 app/code/core/Mage/Eway/Block/Secure/Failure.php create mode 100644 app/code/core/Mage/Eway/Block/Secure/Form.php create mode 100644 app/code/core/Mage/Eway/Block/Secure/Redirect.php create mode 100644 app/code/core/Mage/Eway/Block/Shared/Failure.php create mode 100644 app/code/core/Mage/Eway/Block/Shared/Form.php create mode 100644 app/code/core/Mage/Eway/Block/Shared/Redirect.php create mode 100644 app/code/core/Mage/Eway/Controller/Abstract.php rename app/code/core/Mage/{Paygate/Model/Payflow/Pro/Result.php => Eway/Helper/Data.php} (79%) create mode 100644 app/code/core/Mage/Eway/Model/Api/Debug.php create mode 100644 app/code/core/Mage/Eway/Model/Direct.php create mode 100644 app/code/core/Mage/Eway/Model/Mysql4/Api/Debug.php create mode 100644 app/code/core/Mage/Eway/Model/Mysql4/Api/Debug/Collection.php create mode 100644 app/code/core/Mage/Eway/Model/Mysql4/Setup.php create mode 100644 app/code/core/Mage/Eway/Model/Secure.php create mode 100644 app/code/core/Mage/Eway/Model/Shared.php rename app/code/core/Mage/{Paygate/Model/Payflow => Eway/Model}/Source/Cctype.php (75%) create mode 100644 app/code/core/Mage/Eway/controllers/SecureController.php create mode 100644 app/code/core/Mage/Eway/controllers/SharedController.php create mode 100644 app/code/core/Mage/Eway/etc/config.xml create mode 100644 app/code/core/Mage/Eway/etc/system.xml create mode 100644 app/code/core/Mage/Eway/sql/eway_setup/mysql4-install-0.1.0.php create mode 100644 app/code/core/Mage/Flo2Cash/Block/Form.php create mode 100644 app/code/core/Mage/Flo2Cash/Block/Info.php create mode 100644 app/code/core/Mage/Flo2Cash/Helper/Data.php create mode 100644 app/code/core/Mage/Flo2Cash/Model/Api/Debug.php create mode 100644 app/code/core/Mage/Flo2Cash/Model/Mysql4/Api/Debug.php create mode 100644 app/code/core/Mage/Flo2Cash/Model/Mysql4/Api/Debug/Collection.php create mode 100644 app/code/core/Mage/Flo2Cash/Model/Mysql4/Setup.php create mode 100644 app/code/core/Mage/Flo2Cash/Model/Source/Cctype.php rename app/code/core/Mage/{Paygate/Model/Payflow => Flo2Cash/Model}/Source/PaymentAction.php (65%) create mode 100644 app/code/core/Mage/Flo2Cash/Model/Web.php create mode 100644 app/code/core/Mage/Flo2Cash/etc/config.xml create mode 100644 app/code/core/Mage/Flo2Cash/etc/system.xml create mode 100644 app/code/core/Mage/Flo2Cash/sql/flo2cash_setup/mysql4-install-0.1.0.php create mode 100644 app/code/core/Mage/Flo2Cash/sql/flo2cash_setup/mysql4-upgrade-0.1.0-0.1.1.php create mode 100644 app/code/core/Mage/Ideal/Block/Advanced/Failure.php create mode 100755 app/code/core/Mage/Ideal/Block/Advanced/Form.php create mode 100644 app/code/core/Mage/Ideal/Block/Advanced/Info.php create mode 100755 app/code/core/Mage/Ideal/Block/Advanced/Redirect.php create mode 100644 app/code/core/Mage/Ideal/Block/Basic/Failure.php create mode 100755 app/code/core/Mage/Ideal/Block/Basic/Form.php create mode 100755 app/code/core/Mage/Ideal/Block/Basic/Redirect.php create mode 100755 app/code/core/Mage/Ideal/Helper/Data.php create mode 100755 app/code/core/Mage/Ideal/Model/Advanced.php create mode 100755 app/code/core/Mage/Ideal/Model/Api/Advanced.php create mode 100755 app/code/core/Mage/Ideal/Model/Api/Advanced/AcquirerStatusRequest.php create mode 100755 app/code/core/Mage/Ideal/Model/Api/Advanced/AcquirerStatusResponse.php create mode 100755 app/code/core/Mage/Ideal/Model/Api/Advanced/AcquirerTrxRequest.php create mode 100755 app/code/core/Mage/Ideal/Model/Api/Advanced/AcquirerTrxResponse.php create mode 100755 app/code/core/Mage/Ideal/Model/Api/Advanced/DirectoryRequest.php create mode 100755 app/code/core/Mage/Ideal/Model/Api/Advanced/DirectoryResponse.php create mode 100755 app/code/core/Mage/Ideal/Model/Api/Advanced/Issuer.php create mode 100755 app/code/core/Mage/Ideal/Model/Api/Advanced/Request.php create mode 100755 app/code/core/Mage/Ideal/Model/Api/Advanced/Response.php create mode 100755 app/code/core/Mage/Ideal/Model/Api/Advanced/Security.php create mode 100644 app/code/core/Mage/Ideal/Model/Api/Debug.php create mode 100755 app/code/core/Mage/Ideal/Model/Basic.php create mode 100644 app/code/core/Mage/Ideal/Model/Mysql4/Api/Debug.php create mode 100644 app/code/core/Mage/Ideal/Model/Mysql4/Api/Debug/Collection.php create mode 100755 app/code/core/Mage/Ideal/Model/Mysql4/Setup.php create mode 100644 app/code/core/Mage/Ideal/Model/Observer.php create mode 100644 app/code/core/Mage/Ideal/Model/Source/Language.php create mode 100755 app/code/core/Mage/Ideal/controllers/AdvancedController.php create mode 100755 app/code/core/Mage/Ideal/controllers/BasicController.php create mode 100755 app/code/core/Mage/Ideal/etc/config.xml create mode 100755 app/code/core/Mage/Ideal/etc/system.xml create mode 100755 app/code/core/Mage/Ideal/sql/ideal_setup/mysql4-install-0.1.0.php create mode 100644 app/code/core/Mage/Ogone/Block/Form.php create mode 100644 app/code/core/Mage/Ogone/Block/Info.php create mode 100644 app/code/core/Mage/Ogone/Block/Paypage.php create mode 100644 app/code/core/Mage/Ogone/Block/Placeform.php create mode 100644 app/code/core/Mage/Ogone/Helper/Data.php create mode 100644 app/code/core/Mage/Ogone/Model/Api.php create mode 100644 app/code/core/Mage/Ogone/Model/Api/Debug.php create mode 100644 app/code/core/Mage/Ogone/Model/Config.php create mode 100644 app/code/core/Mage/Ogone/Model/Mysql4/Api/Debug.php create mode 100644 app/code/core/Mage/Ogone/Model/Source/PaymentAction.php create mode 100644 app/code/core/Mage/Ogone/Model/Source/Pmlist.php create mode 100644 app/code/core/Mage/Ogone/Model/Source/Template.php create mode 100644 app/code/core/Mage/Ogone/controllers/ApiController.php create mode 100644 app/code/core/Mage/Ogone/etc/config.xml create mode 100644 app/code/core/Mage/Ogone/etc/system.xml create mode 100644 app/code/core/Mage/Ogone/sql/ogone_setup/mysql4-install-0.0.1.php create mode 100644 app/code/core/Mage/Oscommerce/Block/Adminhtml/Import.php create mode 100644 app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit.php create mode 100644 app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit/Form.php create mode 100644 app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit/Tab/General.php create mode 100644 app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit/Tab/Run.php create mode 100644 app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit/Tabs.php create mode 100644 app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Grid.php create mode 100644 app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Run.php create mode 100644 app/code/core/Mage/Oscommerce/Block/Adminhtml/Order.php create mode 100644 app/code/core/Mage/Oscommerce/Block/Adminhtml/Order/Grid.php create mode 100644 app/code/core/Mage/Oscommerce/Block/Adminhtml/Order/View.php create mode 100644 app/code/core/Mage/Oscommerce/Block/Order/List.php create mode 100644 app/code/core/Mage/Oscommerce/Block/Order/View.php create mode 100644 app/code/core/Mage/Oscommerce/Helper/Data.php create mode 100644 app/code/core/Mage/Oscommerce/Model/Config.php create mode 100644 app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce.php create mode 100755 app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Collection.php create mode 100644 app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Order.php create mode 100644 app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Order/Collection.php create mode 100755 app/code/core/Mage/Oscommerce/Model/Oscommerce.php create mode 100644 app/code/core/Mage/Oscommerce/Model/Oscommerce/Order.php create mode 100644 app/code/core/Mage/Oscommerce/Model/Session.php create mode 100644 app/code/core/Mage/Oscommerce/controllers/Adminhtml/ImportController.php create mode 100644 app/code/core/Mage/Oscommerce/controllers/Adminhtml/OrderController.php create mode 100644 app/code/core/Mage/Oscommerce/controllers/OrderController.php create mode 100644 app/code/core/Mage/Oscommerce/etc/adminhtml.xml create mode 100644 app/code/core/Mage/Oscommerce/etc/charsets.xml create mode 100755 app/code/core/Mage/Oscommerce/etc/config.xml create mode 100755 app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-install-0.8.0.php create mode 100755 app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.0-0.8.1.php create mode 100644 app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.1-0.8.2.php create mode 100644 app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.2-0.8.3.php create mode 100644 app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.3-0.8.4.php create mode 100644 app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.4-0.8.5.php create mode 100644 app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.5-0.8.6.php create mode 100644 app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.6-0.8.7.php create mode 100644 app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.7-0.8.8.php create mode 100644 app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.8-0.8.9.php create mode 100644 app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.9-0.8.10.php create mode 100644 app/code/core/Mage/Paybox/Block/Adminhtml/Cart/Type.php create mode 100644 app/code/core/Mage/Paybox/Block/Adminhtml/Cart/Type/Select.php create mode 100644 app/code/core/Mage/Paybox/Block/Direct/Form.php create mode 100644 app/code/core/Mage/Paybox/Block/Direct/Info.php create mode 100644 app/code/core/Mage/Paybox/Block/System/Error.php create mode 100644 app/code/core/Mage/Paybox/Block/System/Failure.php create mode 100644 app/code/core/Mage/Paybox/Block/System/Form.php create mode 100644 app/code/core/Mage/Paybox/Block/System/Redirect.php rename app/code/core/Mage/{Paygate/Model/Payflow/Pro/Request.php => Paybox/Helper/Data.php} (79%) create mode 100644 app/code/core/Mage/Paybox/Model/Api/Debug.php create mode 100644 app/code/core/Mage/Paybox/Model/Direct.php create mode 100644 app/code/core/Mage/Paybox/Model/Mysql4/Api/Debug.php rename app/code/core/Mage/{Paypal => Paybox}/Model/Mysql4/Api/Debug/Collection.php (76%) create mode 100644 app/code/core/Mage/Paybox/Model/Mysql4/Question/Number.php create mode 100644 app/code/core/Mage/Paybox/Model/Mysql4/Setup.php create mode 100644 app/code/core/Mage/Paybox/Model/Question/Number.php create mode 100644 app/code/core/Mage/Paybox/Model/Source/CartType.php create mode 100644 app/code/core/Mage/Paybox/Model/Source/Cctype.php create mode 100644 app/code/core/Mage/Paybox/Model/Source/Language.php create mode 100644 app/code/core/Mage/Paybox/Model/Source/ManagementMode.php create mode 100644 app/code/core/Mage/Paybox/Model/Source/MethodCall.php create mode 100644 app/code/core/Mage/Paybox/Model/Source/PaymentAction.php create mode 100644 app/code/core/Mage/Paybox/Model/Source/PaymentMode.php create mode 100644 app/code/core/Mage/Paybox/Model/Source/PaymentType.php create mode 100644 app/code/core/Mage/Paybox/Model/System.php create mode 100644 app/code/core/Mage/Paybox/controllers/SystemController.php create mode 100644 app/code/core/Mage/Paybox/etc/config.xml create mode 100644 app/code/core/Mage/Paybox/etc/currency.xml create mode 100644 app/code/core/Mage/Paybox/etc/system.xml create mode 100644 app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-install-0.1.0.php create mode 100644 app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.0-0.1.1.php create mode 100644 app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.1-0.1.2.php create mode 100644 app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.2-0.1.3.php create mode 100644 app/code/core/Mage/Payment/Block/Catalog/Product/View/Profile.php create mode 100644 app/code/core/Mage/Payment/Model/Billing/Agreement.php create mode 100644 app/code/core/Mage/Payment/Model/Billing/Agreement/MethodInterface.php create mode 100644 app/code/core/Mage/Payment/Model/Billing/AgreementAbstract.php create mode 100644 app/code/core/Mage/Payment/Model/Recurring/Profile.php create mode 100644 app/code/core/Mage/Payment/Model/Recurring/Profile/MethodInterface.php create mode 100644 app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Details.php create mode 100644 app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Details/Form.php create mode 100644 app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Report.php create mode 100644 app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Report/Grid.php create mode 100644 app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/ApiWizard.php create mode 100644 app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Global.php create mode 100644 app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Hint.php create mode 100644 app/code/core/Mage/Paypal/Block/Logo.php delete mode 100644 app/code/core/Mage/Paypal/Controller/Ipn/Abstract.php create mode 100644 app/code/core/Mage/Paypal/Model/Method/Agreement.php create mode 100644 app/code/core/Mage/Paypal/Model/Mysql4/Report/Settlement.php rename app/code/core/Mage/Paypal/Model/{Api/Debug.php => Mysql4/Report/Settlement/Row.php} (77%) create mode 100644 app/code/core/Mage/Paypal/Model/Mysql4/Report/Settlement/Row/Collection.php create mode 100644 app/code/core/Mage/Paypal/Model/Observer.php rename app/code/core/Mage/{Paygate/Model/Payflow/Pro.php => Paypal/Model/Payflowpro.php} (76%) create mode 100644 app/code/core/Mage/Paypal/Model/Report/Settlement.php create mode 100644 app/code/core/Mage/Paypal/Model/Report/Settlement/Row.php create mode 100644 app/code/core/Mage/Paypal/Model/System/Config/Backend/Cron.php create mode 100644 app/code/core/Mage/Paypal/Model/System/Config/Backend/MerchantCountry.php create mode 100644 app/code/core/Mage/Paypal/Model/System/Config/Source/BuyerCountry.php create mode 100644 app/code/core/Mage/Paypal/Model/System/Config/Source/FetchingSchedule.php create mode 100644 app/code/core/Mage/Paypal/Model/System/Config/Source/Logo.php create mode 100644 app/code/core/Mage/Paypal/Model/System/Config/Source/MerchantCountry.php create mode 100644 app/code/core/Mage/Paypal/controllers/Adminhtml/Paypal/ReportsController.php create mode 100644 app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-install-1.4.0.0.php delete mode 100644 app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-0.7.3-0.7.4.php create mode 100644 app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php rename app/code/core/Mage/PaypalUk/{controllers/IpnController.php => Block/Express/Shortcut.php} (60%) delete mode 100644 app/code/core/Mage/PaypalUk/Model/Config.php create mode 100644 app/code/core/Mage/Protx/Block/Standard/Failure.php create mode 100644 app/code/core/Mage/Protx/Block/Standard/Form.php create mode 100644 app/code/core/Mage/Protx/Block/Standard/Redirect.php create mode 100644 app/code/core/Mage/Protx/Helper/Data.php create mode 100644 app/code/core/Mage/Protx/Model/Api/Debug.php create mode 100644 app/code/core/Mage/Protx/Model/Config.php create mode 100644 app/code/core/Mage/Protx/Model/Mysql4/Api/Debug.php create mode 100644 app/code/core/Mage/Protx/Model/Mysql4/Api/Debug/Collection.php create mode 100644 app/code/core/Mage/Protx/Model/Mysql4/Setup.php create mode 100644 app/code/core/Mage/Protx/Model/Session.php create mode 100644 app/code/core/Mage/Protx/Model/Source/ModeAction.php create mode 100644 app/code/core/Mage/Protx/Model/Source/PaymentAction.php create mode 100644 app/code/core/Mage/Protx/Model/Standard.php create mode 100644 app/code/core/Mage/Protx/controllers/StandardController.php create mode 100644 app/code/core/Mage/Protx/etc/config.xml create mode 100644 app/code/core/Mage/Protx/etc/system.xml create mode 100644 app/code/core/Mage/Protx/sql/protx_setup/mysql4-install-0.1.0.php create mode 100644 app/code/core/Mage/Reports/Model/Mysql4/Report/Abstract.php create mode 100644 app/code/core/Mage/Rss/Model/System/Config/Backend/Links.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/Grid.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View/Form.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View/Tab/Info.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View/Tab/Orders.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View/Tabs.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Customer/Edit/Tab/Agreement.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/Edit/Form.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/Grid.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Getawayinfo.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Info.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Items.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Tab/Info.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Tab/Orders.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Report/Filter/Form.php create mode 100644 app/code/core/Mage/Sales/Block/Adminhtml/Report/Filter/Form/Order.php create mode 100644 app/code/core/Mage/Sales/Block/Billing/Agreement/View.php create mode 100644 app/code/core/Mage/Sales/Block/Billing/Agreements.php create mode 100644 app/code/core/Mage/Sales/Block/Payment/Form/Billing/Agreement.php create mode 100644 app/code/core/Mage/Sales/Block/Payment/Info/Billing/Agreement.php create mode 100644 app/code/core/Mage/Sales/Block/Recurring/Profile/View.php create mode 100644 app/code/core/Mage/Sales/Block/Recurring/Profiles.php create mode 100644 app/code/core/Mage/Sales/Model/Billing/Agreement.php create mode 100644 app/code/core/Mage/Sales/Model/Mysql4/Billing/Agreement.php create mode 100644 app/code/core/Mage/Sales/Model/Mysql4/Billing/Agreement/Collection.php create mode 100644 app/code/core/Mage/Sales/Model/Mysql4/Collection/Abstract.php create mode 100644 app/code/core/Mage/Sales/Model/Mysql4/Order/Abstract.php create mode 100644 app/code/core/Mage/Sales/Model/Mysql4/Order/Collection/Abstract.php create mode 100644 app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Grid/Collection.php create mode 100644 app/code/core/Mage/Sales/Model/Mysql4/Order/Grid/Collection.php create mode 100644 app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Grid/Collection.php create mode 100644 app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Grid/Collection.php create mode 100644 app/code/core/Mage/Sales/Model/Mysql4/Recurring/Profile.php create mode 100644 app/code/core/Mage/Sales/Model/Mysql4/Recurring/Profile/Collection.php create mode 100644 app/code/core/Mage/Sales/Model/Mysql4/Recurring/Profile/Info.php create mode 100644 app/code/core/Mage/Sales/Model/Mysql4/Report/Abstract.php create mode 100644 app/code/core/Mage/Sales/Model/Mysql4/Report/Bestsellers.php create mode 100644 app/code/core/Mage/Sales/Model/Mysql4/Report/Bestsellers/Collection.php create mode 100644 app/code/core/Mage/Sales/Model/Mysql4/Report/Order.php create mode 100644 app/code/core/Mage/Sales/Model/Payment/Method/Billing/AgreementAbstract.php create mode 100644 app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal.php create mode 100644 app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/Collector.php create mode 100644 app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/Recurring/Initial.php create mode 100644 app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/Recurring/Trial.php create mode 100644 app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/RecurringAbstract.php create mode 100644 app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/Shipping.php create mode 100644 app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/Subtotal.php create mode 100644 app/code/core/Mage/Sales/Model/Recurring/Profile.php create mode 100644 app/code/core/Mage/Sales/Model/Service/Order.php create mode 100644 app/code/core/Mage/Sales/controllers/Billing/AgreementController.php create mode 100644 app/code/core/Mage/Sales/controllers/Recurring/ProfileController.php create mode 100644 app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-1.4.0.0.php create mode 100644 app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.3.99-1.4.0.0.php create mode 100644 app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php create mode 100644 app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.1-1.4.0.2.php create mode 100644 app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.2-1.4.0.3.php create mode 100644 app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.3-1.4.0.4.php create mode 100644 app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.4-1.4.0.5.php create mode 100644 app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.5-1.4.0.6.php create mode 100644 app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.6-1.4.0.7.php create mode 100644 app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.7-1.4.0.8.php create mode 100644 app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.8-1.4.0.15.php create mode 100644 app/code/core/Mage/SalesRule/Model/Coupon.php create mode 100644 app/code/core/Mage/SalesRule/Model/Coupon/Codegenerator.php create mode 100644 app/code/core/Mage/SalesRule/Model/Coupon/CodegeneratorInterface.php create mode 100644 app/code/core/Mage/SalesRule/Model/Mysql4/Coupon.php create mode 100644 app/code/core/Mage/SalesRule/Model/Mysql4/Coupon/Collection.php create mode 100644 app/code/core/Mage/SalesRule/Model/Mysql4/Coupon/Usage.php create mode 100644 app/code/core/Mage/SalesRule/Model/Mysql4/Report/Rule.php create mode 100644 app/code/core/Mage/SalesRule/Model/Quote/Nominal/Discount.php create mode 100644 app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-install-1.4.0.0.0.php create mode 100644 app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-1.4.0.0.0-1.4.0.0.1.php create mode 100644 app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-1.4.0.0.1-1.4.0.0.2.php create mode 100644 app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-1.4.0.0.2-1.4.0.0.3.php create mode 100644 app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-1.4.0.0.3-1.4.0.0.4.php create mode 100644 app/code/core/Mage/Strikeiron/Helper/Data.php create mode 100644 app/code/core/Mage/Strikeiron/Model/Currency/Import/Strikeiron.php create mode 100644 app/code/core/Mage/Strikeiron/Model/Mysql4/Taxrate.php create mode 100644 app/code/core/Mage/Strikeiron/Model/Mysql4/Taxrate/Collection.php create mode 100644 app/code/core/Mage/Strikeiron/Model/Service/AddressVerification.php create mode 100644 app/code/core/Mage/Strikeiron/Model/Service/Base.php create mode 100644 app/code/core/Mage/Strikeiron/Model/Service/EmailVerification.php create mode 100644 app/code/core/Mage/Strikeiron/Model/Service/ForeignExchangeRates.php create mode 100644 app/code/core/Mage/Strikeiron/Model/Service/SalesUseTax.php create mode 100644 app/code/core/Mage/Strikeiron/Model/Service/SalesUseTaxBasic.php create mode 100644 app/code/core/Mage/Strikeiron/Model/Service/SalesUseTaxComplete.php create mode 100644 app/code/core/Mage/Strikeiron/Model/Service/UsAddressVerification.php create mode 100644 app/code/core/Mage/Strikeiron/Model/Session.php create mode 100644 app/code/core/Mage/Strikeiron/Model/Source/ErrorAddressAction.php create mode 100644 app/code/core/Mage/Strikeiron/Model/Source/SalesTaxType.php create mode 100644 app/code/core/Mage/Strikeiron/Model/Source/Salestaxminmax.php create mode 100644 app/code/core/Mage/Strikeiron/Model/Source/UndeterminedEmailAction.php create mode 100644 app/code/core/Mage/Strikeiron/Model/Strikeiron.php rename app/code/core/Mage/{PaypalUk/Model/Api/Debug.php => Strikeiron/Model/Taxrate.php} (78%) create mode 100644 app/code/core/Mage/Strikeiron/controllers/TestController.php create mode 100644 app/code/core/Mage/Strikeiron/etc/adminhtml.xml create mode 100644 app/code/core/Mage/Strikeiron/etc/config.xml create mode 100644 app/code/core/Mage/Strikeiron/etc/system.xml create mode 100644 app/code/core/Mage/Strikeiron/sql/strikeiron_setup/mysql4-install-0.9.1.php create mode 100644 app/code/core/Mage/Tag/Model/Indexer/Summary.php create mode 100644 app/code/core/Mage/Tag/Model/Mysql4/Indexer/Summary.php create mode 100644 app/code/core/Mage/Tag/sql/tag_setup/mysql4-upgrade-0.7.5-0.7.6.php create mode 100644 app/code/core/Mage/Tag/sql/tag_setup/mysql4-upgrade-0.7.6-0.7.7.php create mode 100644 app/code/core/Mage/Tax/Model/Mysql4/Report/Tax.php create mode 100644 app/code/core/Mage/Tax/Model/Mysql4/Sales/Order/Tax.php create mode 100644 app/code/core/Mage/Tax/Model/Mysql4/Sales/Order/Tax/Collection.php delete mode 100644 app/code/core/Mage/Tax/Model/Mysql4/Tax.php create mode 100644 app/code/core/Mage/Tax/Model/Sales/Order/Tax.php create mode 100644 app/code/core/Mage/Tax/Model/Sales/Total/Quote/Nominal/Subtotal.php create mode 100644 app/code/core/Mage/Tax/Model/Sales/Total/Quote/Nominal/Tax.php create mode 100644 app/code/core/Mage/Tax/Model/Sales/Total/Quote/Shipping.php create mode 100644 app/code/core/Mage/Tax/sql/tax_setup/mysql4-install-1.4.0.0.php create mode 100644 app/code/core/Mage/Tax/sql/tax_setup/mysql4-upgrade-0.7.11-0.7.12.php create mode 100644 app/code/core/Mage/Tax/sql/tax_setup/mysql4-upgrade-0.7.12-0.7.13.php create mode 100644 app/code/core/Mage/Tax/sql/tax_setup/mysql4-upgrade-1.3.9-1.4.0.php create mode 100644 app/code/core/Mage/Weee/Model/Total/Quote/Nominal/Weee.php create mode 100644 app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.7-0.7.8.php create mode 100644 app/design/adminhtml/default/default/layout/report.xml create mode 100644 app/design/adminhtml/default/default/template/chronopay/form.phtml create mode 100644 app/design/adminhtml/default/default/template/chronopay/info.phtml create mode 100644 app/design/adminhtml/default/default/template/chronopay/pdf/info.phtml create mode 100644 app/design/adminhtml/default/default/template/cybersource/form.phtml create mode 100644 app/design/adminhtml/default/default/template/cybersource/info.phtml create mode 100644 app/design/adminhtml/default/default/template/cybersource/pdf/info.phtml create mode 100644 app/design/adminhtml/default/default/template/eway/form.phtml create mode 100644 app/design/adminhtml/default/default/template/eway/info.phtml create mode 100644 app/design/adminhtml/default/default/template/eway/pdf/info.phtml create mode 100644 app/design/adminhtml/default/default/template/flo2cash/form.phtml create mode 100644 app/design/adminhtml/default/default/template/flo2cash/info.phtml create mode 100644 app/design/adminhtml/default/default/template/flo2cash/pdf/info.phtml create mode 100644 app/design/adminhtml/default/default/template/ideal/advanced/info.phtml create mode 100644 app/design/adminhtml/default/default/template/ideal/advanced/pdf/info.phtml create mode 100644 app/design/adminhtml/default/default/template/ogone/info.phtml create mode 100755 app/design/adminhtml/default/default/template/oscommerce/convert/run.phtml create mode 100644 app/design/adminhtml/default/default/template/oscommerce/order/view.phtml create mode 100644 app/design/adminhtml/default/default/template/paybox/adminhtml/cart/type/select.phtml create mode 100644 app/design/adminhtml/default/default/template/paybox/direct/form.phtml create mode 100644 app/design/adminhtml/default/default/template/paybox/direct/info.phtml create mode 100644 app/design/adminhtml/default/default/template/paybox/direct/pdf/info.phtml create mode 100644 app/design/adminhtml/default/default/template/paypal/system/config/api_wizard.phtml create mode 100644 app/design/adminhtml/default/default/template/paypal/system/config/fieldset/global.phtml create mode 100644 app/design/adminhtml/default/default/template/paypal/system/config/fieldset/hint.phtml create mode 100644 app/design/adminhtml/default/default/template/sales/billing/agreement/form.phtml create mode 100644 app/design/adminhtml/default/default/template/sales/billing/agreement/view/form.phtml create mode 100644 app/design/adminhtml/default/default/template/sales/billing/agreement/view/tab/info.phtml create mode 100644 app/design/adminhtml/default/default/template/sales/payment/form/billing/agreement.phtml create mode 100644 app/design/adminhtml/default/default/template/sales/recurring/profile/view.phtml create mode 100644 app/design/adminhtml/default/default/template/sales/recurring/profile/view/info.phtml create mode 100644 app/design/adminhtml/default/default/template/sales/transactions/detail.phtml create mode 100644 app/design/frontend/base/default/layout/cataloginventory.xml create mode 100644 app/design/frontend/base/default/layout/chronopay.xml create mode 100644 app/design/frontend/base/default/layout/cybermut.xml create mode 100644 app/design/frontend/base/default/layout/eway.xml create mode 100644 app/design/frontend/base/default/layout/ideal.xml rename app/design/frontend/{default/iphone/layout/paypal.xml => base/default/layout/ogone.xml} (51%) create mode 100644 app/design/frontend/base/default/layout/oscommerce.xml create mode 100644 app/design/frontend/base/default/layout/paybox.xml create mode 100644 app/design/frontend/base/default/layout/payment.xml create mode 100644 app/design/frontend/base/default/layout/protx.xml create mode 100644 app/design/frontend/base/default/layout/sales/billing_agreement.xml create mode 100644 app/design/frontend/base/default/layout/sales/recurring_profile.xml create mode 100644 app/design/frontend/base/default/template/cataloginventory/stockqty/composite.phtml create mode 100644 app/design/frontend/base/default/template/cataloginventory/stockqty/default.phtml create mode 100644 app/design/frontend/base/default/template/checkout/total/nominal.phtml create mode 100644 app/design/frontend/base/default/template/chronopay/form.phtml create mode 100644 app/design/frontend/base/default/template/chronopay/info.phtml create mode 100644 app/design/frontend/base/default/template/chronopay/standard/failure.phtml create mode 100644 app/design/frontend/base/default/template/chronopay/standard/form.phtml create mode 100644 app/design/frontend/base/default/template/cybermut/error.phtml create mode 100644 app/design/frontend/base/default/template/cybermut/form.phtml create mode 100644 app/design/frontend/base/default/template/cybersource/form.phtml create mode 100644 app/design/frontend/base/default/template/cybersource/info.phtml create mode 100644 app/design/frontend/base/default/template/eway/form.phtml create mode 100644 app/design/frontend/base/default/template/eway/info.phtml create mode 100644 app/design/frontend/base/default/template/eway/secure/failure.phtml create mode 100644 app/design/frontend/base/default/template/eway/secure/form.phtml create mode 100644 app/design/frontend/base/default/template/eway/shared/failure.phtml create mode 100644 app/design/frontend/base/default/template/eway/shared/form.phtml create mode 100644 app/design/frontend/base/default/template/flo2cash/form.phtml create mode 100644 app/design/frontend/base/default/template/flo2cash/info.phtml create mode 100644 app/design/frontend/base/default/template/ideal/advanced/failure.phtml create mode 100755 app/design/frontend/base/default/template/ideal/advanced/form.phtml create mode 100644 app/design/frontend/base/default/template/ideal/advanced/info.phtml create mode 100644 app/design/frontend/base/default/template/ideal/basic/failure.phtml create mode 100755 app/design/frontend/base/default/template/ideal/basic/form.phtml create mode 100644 app/design/frontend/base/default/template/ogone/form.phtml create mode 100644 app/design/frontend/base/default/template/ogone/info.phtml create mode 100644 app/design/frontend/base/default/template/ogone/paypage.phtml create mode 100644 app/design/frontend/base/default/template/ogone/placeform.phtml create mode 100644 app/design/frontend/base/default/template/oscommerce/order/list.phtml create mode 100644 app/design/frontend/base/default/template/oscommerce/order/view.phtml create mode 100644 app/design/frontend/base/default/template/paybox/direct/form.phtml create mode 100644 app/design/frontend/base/default/template/paybox/direct/info.phtml create mode 100644 app/design/frontend/base/default/template/paybox/system/error.phtml create mode 100644 app/design/frontend/base/default/template/paybox/system/form.phtml create mode 100644 app/design/frontend/base/default/template/payment/catalog/product/view/profile/options.phtml create mode 100644 app/design/frontend/base/default/template/payment/catalog/product/view/profile/schedule.phtml create mode 100644 app/design/frontend/base/default/template/paypal/partner/logo.phtml create mode 100644 app/design/frontend/base/default/template/protx/standard/failure.phtml create mode 100644 app/design/frontend/base/default/template/protx/standard/form.phtml create mode 100644 app/design/frontend/base/default/template/sales/billing/agreement/view.phtml create mode 100644 app/design/frontend/base/default/template/sales/billing/agreements.phtml create mode 100644 app/design/frontend/base/default/template/sales/payment/form/billing/agreement.phtml create mode 100644 app/design/frontend/base/default/template/sales/recurring/grid.phtml create mode 100644 app/design/frontend/base/default/template/sales/recurring/profile/view.phtml create mode 100644 app/design/frontend/base/default/template/sales/recurring/profile/view/info.phtml create mode 100644 app/design/frontend/base/default/template/sales/recurring/profiles.phtml rename app/design/frontend/default/iphone/layout/{googlecheckout.xml => oscommerce.xml} (60%) delete mode 100644 app/design/frontend/default/iphone/layout/paypaluk.xml create mode 100644 app/design/frontend/default/iphone/template/oscommerce/order/list.phtml create mode 100644 app/design/frontend/default/iphone/template/oscommerce/order/view.phtml create mode 100644 app/design/frontend/default/modern/layout/payment.xml create mode 100644 app/etc/modules/Mage_Chronopay.xml create mode 100644 app/etc/modules/Mage_Cybermut.xml create mode 100644 app/etc/modules/Mage_Cybersource.xml create mode 100644 app/etc/modules/Mage_Eway.xml create mode 100644 app/etc/modules/Mage_Flo2Cash.xml create mode 100644 app/etc/modules/Mage_Ideal.xml create mode 100644 app/etc/modules/Mage_Ogone.xml create mode 100644 app/etc/modules/Mage_Oscommerce.xml create mode 100644 app/etc/modules/Mage_Paybox.xml create mode 100644 app/etc/modules/Mage_Protx.xml create mode 100644 app/etc/modules/Mage_Strikeiron.xml create mode 100644 app/locale/en_US/Mage_Chronopay.csv create mode 100644 app/locale/en_US/Mage_Cybermut.csv create mode 100644 app/locale/en_US/Mage_Cybersource.csv create mode 100644 app/locale/en_US/Mage_Eway.csv create mode 100644 app/locale/en_US/Mage_Flo2Cash.csv create mode 100644 app/locale/en_US/Mage_Ideal.csv create mode 100644 app/locale/en_US/Mage_Ogone.csv create mode 100644 app/locale/en_US/Mage_Oscommerce.csv create mode 100644 app/locale/en_US/Mage_Paybox.csv create mode 100644 app/locale/en_US/Mage_Protx.csv create mode 100644 app/locale/en_US/Mage_Strikeiron.csv create mode 100644 app/locale/en_US/template/email/moneybookers_activateemail.html create mode 100644 app/locale/en_US/template/email/strikeiron_email_warning.html create mode 100644 js/lib/ccard.js create mode 100644 js/mage/centinel.js delete mode 100644 js/tiny_mce/blank.htm create mode 100644 js/tiny_mce/classes/Formatter.js create mode 100644 js/tiny_mce/classes/LegacyInput.js delete mode 100644 js/tiny_mce/classes/commands/BlockQuote.js delete mode 100644 js/tiny_mce/classes/commands/CutCopyPaste.js delete mode 100644 js/tiny_mce/classes/commands/InsertHorizontalRule.js delete mode 100644 js/tiny_mce/classes/commands/RemoveFormat.js delete mode 100644 js/tiny_mce/classes/commands/UndoRedo.js create mode 100644 js/tiny_mce/classes/dom/RangeUtils.js create mode 100644 js/tiny_mce/classes/dom/Schema.js create mode 100644 js/tiny_mce/classes/dom/TreeWalker.js create mode 100644 js/tiny_mce/plugins/advlist/editor_plugin.js create mode 100644 js/tiny_mce/plugins/advlist/editor_plugin_src.js create mode 100644 js/tiny_mce/plugins/autosave/langs/en.js delete mode 100644 js/tiny_mce/plugins/compat2x/editor_plugin.js delete mode 100644 js/tiny_mce/plugins/compat2x/editor_plugin_src.js create mode 100644 js/tiny_mce/plugins/legacyoutput/editor_plugin.js create mode 100644 js/tiny_mce/plugins/legacyoutput/editor_plugin_src.js delete mode 100644 js/tiny_mce/plugins/safari/blank.htm delete mode 100644 js/tiny_mce/plugins/safari/editor_plugin.js delete mode 100644 js/tiny_mce/plugins/safari/editor_plugin_src.js create mode 100644 js/tiny_mce/plugins/wordcount/editor_plugin.js create mode 100644 js/tiny_mce/plugins/wordcount/editor_plugin_src.js create mode 100644 lib/Varien/Db/Ddl/Table.php create mode 100644 lib/phpseclib/Crypt/AES.php create mode 100644 lib/phpseclib/Crypt/DES.php create mode 100644 lib/phpseclib/Crypt/Hash.php create mode 100644 lib/phpseclib/Crypt/RC4.php create mode 100644 lib/phpseclib/Crypt/RSA.php create mode 100644 lib/phpseclib/Crypt/Random.php create mode 100644 lib/phpseclib/Crypt/Rijndael.php create mode 100644 lib/phpseclib/Crypt/TripleDES.php create mode 100644 lib/phpseclib/Math/BigInteger.php create mode 100644 lib/phpseclib/Net/SFTP.php create mode 100644 lib/phpseclib/Net/SSH1.php create mode 100644 lib/phpseclib/Net/SSH2.php create mode 100644 lib/phpseclib/PHP/Compat/Function/array_fill.php create mode 100644 lib/phpseclib/PHP/Compat/Function/bcpowmod.php create mode 100644 lib/phpseclib/PHP/Compat/Function/str_split.php create mode 100644 pkginfo/Mage_Cybermut.txt create mode 100644 pkginfo/Mage_Paybox.txt create mode 100644 skin/adminhtml/default/default/custom.css create mode 100644 skin/adminhtml/default/default/images/btn_add-variable_icon.gif create mode 100644 skin/adminhtml/default/default/images/btn_go.gif create mode 100644 skin/adminhtml/default/default/images/button-close.png create mode 100644 skin/adminhtml/default/default/images/entry_edit_head_arrow_down2.gif create mode 100644 skin/adminhtml/default/default/images/paypal_logo.gif create mode 100644 skin/adminhtml/default/default/images/paypal_section.png create mode 100644 skin/adminhtml/default/default/images/paypal_tick.gif create mode 100644 skin/adminhtml/default/default/images/tooltip_bg.gif create mode 100644 skin/adminhtml/default/default/images/tooltip_corner.gif create mode 100644 skin/adminhtml/default/default/images/tooltip_top.gif create mode 100644 skin/adminhtml/default/default/images/window_close.png create mode 100644 skin/adminhtml/default/default/images/window_content.png create mode 100644 skin/adminhtml/default/default/images/window_top.png create mode 100644 skin/adminhtml/default/default/images/wysiwyg/skin_image.png create mode 100644 skin/frontend/default/blank/images/i_availability_only_arrow.gif create mode 100644 skin/frontend/default/blue/images/i_availability_only.gif create mode 100644 skin/frontend/default/blue/images/i_availability_only_arrow.gif create mode 100644 skin/frontend/default/default/images/bkg_nav2.gif create mode 100644 skin/frontend/default/default/images/i_availability_only.gif create mode 100644 skin/frontend/default/default/images/i_availability_only_arrow.gif create mode 100644 skin/frontend/default/modern/images/i_availability_only.gif create mode 100644 skin/frontend/default/modern/images/i_availability_only_arrow.gif diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt new file mode 100644 index 0000000000..821277eeee --- /dev/null +++ b/RELEASE_NOTES.txt @@ -0,0 +1,642 @@ +==== 1.4.1.0 ==== + +=== Improvements === +* Added ability to use static URLs for media in WYSIWYG or image browser. Added ability to enable parsing {{store}} and {{media}} directives on catalog frontend. +* URL rewrites history: ability to auto-generate custom rewrite with redirect from old to new URL when changing product URL-key +* Added ability to exclude a category from navigation menu +* Various improvements in system configuration UI. Introduced ability to make actual configuration structure to be independent on the system.xml structure +* Added "Only X left" inventory feature +* Implemented Centinel functionality in iphone theme +* Upgraded TinyMCE to v.3.3.2 +* Improved PayPal integration, includes: +** Recurring payment profiles entity and purchasing of "subscription" products. In checkout they are treated as "nominal" items. +** Billing agreements +** "Pending Review" order state, "Pending Review" and "Suspected Fraud" order statuses and logic related with this. Triggers by PayPal IPR, FMF and Unilateral payments. +** Functionality of transactions listing/searching and fetching from gateway +** Fetching PayPal settlement reports via SFTP +** Various improvements of PayPal integration on the frontend and admin UI +* Added notice about creating offline creditmemo from order view page. +* Added getter for recurring payment methods in payment helper. +* Implemented abstract block ability to have arbitrary groups of child blocks and a method that returns such a group. Implemented a method that fetches data from child block by specified alias. +* Implemented ability to specify "sort_order" instead of "before" and "after" in the totals declaration. All nominal totals declaration utilize "sort_order" +* Added getter for specified object data by key in core/template block: method getObjectData() +* Defined payment methods grouping, implemented getter for payment method list (with option to group them). Added ability to render grouped options in the "select" grid filter. +** Moneybookers: utilized the payment methods grouping for all its methods; removed redundant "translate" attribute in the methods definition in config. +*** Utilized payment methods grouping for PayPal peyment methods. +* Added more verbosity to PayPal NVP and IPN debugging + +=== Changes === +* Sales module database structure changed from EAV into flat tables +* Product custom URL rewrites redirect to SEF URL, rather than to catalog/product/view/id/ +* Reimplemented frontend top menu rendering logic (cross-browser and usability improvements) +* Reviewed [logic of the sales reports|http://www.magentocommerce.com/wiki/doc/sales_reports_specifications]: Orders, Tax, Invoiced, Shipping, Refunds, Coupons +* Reimplemented bestsellers report +* Implemented 3D Secure validation for Maestro International and JCB cards +* (!) Changed Shopping cart methods output (top + bottom): removed
  • -dependance from templates in other modules \-> moved to Checkout module +* Moved the Payflow Pro payment method to PayPal module +* Refactored sales/service_quote model: instead of submit() method the submitAll() should be used. It can submit nominal items separately from the order. The methods for submitting nominal items and order separately - are available as well. +* Refactored onepage checkout model to use the new method sales/service_quote::submitAll(), added recurring profiles and billing agreements passing through the process until the success page +* Utilized child blocks grouping to improve flexibility of rendering additional information in catalog/product/view template. The group is called "detailed_info"; any block from layout may insert itself to this group. +* Removed redundant wrappers hard-coded into some catalog templates. Template of parent block is responsible for wrapping. +* Refactored onepage checkout success block and template: simplified fetching related checkout information, added ability to render billing agreement and recurring profiles that might be created with the payment placement. + +=== Fixes === +* Fixed read/write connection issue during new customer order place. See http://www.magentocommerce.com/boards/viewthread/19363/P0/ +* Fixed tax rule ZIP range matching (numeric values were matched as strings) +* Various tax fixes +* Optimized search reindex process + +=== Known Issues === +* PayPal and Payflow pro modules are officially backwards incompatible. +* The `sales_order_aggregated_created` table was re-created with new columns, it is not backwards compatible. + +=== Upgrade Path === +* Once upgraded, go to system configuration section and re-enter all PayPal-related settings carefully. Make sure to specify the proper merchant country and email. + + + + +==== 1.4.x-devel-69025 ==== + +=== Improvements === +* PayPal integration: +** Settlement reports fetching from SFTP +** Billing Agreements +* Added website and store data to backend model when invoking in system configuration block +* Added "original_data" key to elements when generating system configuration form + +=== Changes === +* Mage_Sales_Model_Order_Payment::canCapture() - move methodInstance::_canCapture before authorization transaction check +* Sales/Payment changes: +** Implemented pending payment review functionality. Includes "Payment Review" order state and statuses "Payment Review" and "Suspected Fraud". In this state the order cannot be fulfilled until the payment is approved. +** Holding orders on pending transactions was replaced in favor of "Payment Review" state. The 'fraud' status was removed from 'holded' order state. +** Transactions resource model unsets the "isObjectNew" if it had a lookup of autoincrement key before saving +** Payment capture and capture notification mark invoice as paid only if needed: when it is pending and the transaction is not pending +** fixed float casting error in Mage_Sales_Model_Order_Payment::_isCaptureFinal() +** fixed showing up credit card type in CC payment block, if there is no credit card type information +* PayPal Instant Payment Review and Fraud Management: +** implemented methods for handling PayPal-specific payment statuses +** added more data importing to payment info in PayPal: payment status, pending reason, "is_fraud_detected" +** added importing of all required for payment processing information in different points of WPP API calls +** implemented IPR and FMF handling for Website Payments Pro methods family (Express Checkout, Direct Payments) +* Fixed PayPal payment info block to not render redundant CC-related information (it extends CC info block) +* (!) Changed Shopping cart methods output (top + bottom): removed
  • -dependance from templates in other modules -> moved to Checkout module +* Added throwing exception on an incorrect attempt of unholding order (TRJ-148987). + + + + +==== 1.4.x-devel-68590 ==== + +=== Improvements === + * Implemented serializing/unserializing model fields on abstract level. See Mage_Core_Model_Mysql4_Abstract::$_serializableFields + * Implemented recurring payment profiles entity and purchasing of "subscription" products. In checkout they are treated as "nominal" items + * Implemented functionality of transactions listing/searching and fetching from gateway + * Upgraded TinyMCE to v.3.3.2 + * Added ability to parse "{{media}}" and "{{store}}" CMS directives in the catalog + * Added ability to insert media content as static URLs in WYSIWYG or media browser mode + * Implemented "Pending Review" order state, "Pending Review" and "Suspected Fraud" order statuses and logic related with this + * Added ability to set fieldset always expanded ( node in system configuration for fieldset) + * Added ability to set number of "levels up" to form javascript dependencies controller block + * EAV: implemented a 'serialized' backend model + * Added ability to separate actual configuration path and form field path in system.xml - use node + * Added ability to render "tooltips" in system configuration fieldsets - use node + * Enhanced PayPal integration: + * frontend and backend UI experience of PayPal solutions + * Instant update API integrataion + * Recurring payments integration + * Instant Payment Review and Fraud Management Filters integration + * EC unilateral payments integration + * Transactions fetching for PayPal WPP methods + +=== Changes === + * Reimplemented PayPal system configuration in a dedicated section. + * Moved Payflow Pro payment method into PayPal module. Got rid of obsolete system configuration fields of this method. + * Refactored implementation of serializing 'additional_information' field in sales/order_payment, sales/quote_payment and sales/order_payment_transaction + * Introduced "Is Nominal" term in sales logic: + * Nominal items participate in catalog, but during checkout and order processing they have zero row total. + * Implemented separate shopping cart and address totals for nominal items: nominal totals, various changes/adjustments in existing totals + * Added ability to calculate shipping charges for a quote/address item individually (on code level, utilized by the nominal items) + * Reviewed credit card types supported by PayPal payment methods + * Changed skin styles from "tax-total" to more generic "summary-total" (it is used now not only for tax totals, but for nominal items as well) + * Moved field comments (aka "notes") of the product edit form from the last column under the field element. + * Varien_Data_Form_Element_Time: added a hidden element with ID to maintain HTML consistency + * Varien_Data_Form - changed logic of adding suffix/prefix to an element: when element doesn't have a name, the suffix will be result + * Varien_Data_Form_Abstract and Varien_Data_Form_Element_Abstract: moved adding 'required-entry' class to the element to the moment of its generation instead of the moment of its adding. It adds more flexibility to change properties when the object is not yet rendered. + * Added to Varien_Data_Collection_Db::_beforeLoad(), moved 'core_collection_abstract_load_before' event dispatching to Mage_Core_Model_Mysql4_Collection_Abstract::_beforeLoad() + +=== Fixes === + * Fixed #21225: catalogProductUpdate / catalogProductCreate and tier_price attribute + * Fixed #16596: category.assignedProducts always returns an empty result + * Fixed js reference to non-existing element when CVV verification disabled and gateway supports SS-type credit cards + +=== Known Issues === + * PayPal modules and Payflow Pro payment method backwards compatibility is officially not retained. + * Nominal item total calculations do not work properly for multishipping checkout. + + + + +==== 1.4.x-devel-67099 ==== + +=== Improvements === + * Added isModuleEnabled() to core helper; Added ability to hide configuration fields if related module is not enabled (use 'if_module_enabled' node in system.xml) + * Implemented IDNA domains support in registration and login forms (see also #20203) + +=== Fixes === + * Fixed #22490: .Biz domain email addresses cause checkout to throw error and return to main Checkout page. Fixed path argument passed to include function in Zend_Validate_Hostname::isValid() to be valid whether source code compiler is used or not + * Fixed Negative value in Shopping Cart in case Tax Calculation Method Based On Unit Price + * Fixed Subtotal (Incl.Tax) = -$0.01 during created credit memo with refund shipping + * Fixed: 100% discount of products -> the amounts of Tax and Grand Totals are or negative or not corectly + + + + +==== 1.4.x-devel-66609 ==== + +=== Improvements === + * Implemented 3D Secure validation for Maestro International and JCB cards + * Added comments to system configuration fields "Catalog" > "Price" > "Catalog Price Scope" and "Currency Setup" > "Currency Options" > "Base Currency" that explain that base currency scope depends on the catalog prices scope. + * Added note to reports that aggregated data depends on timezone and must be re-aggregated completely after global timezone change. + +=== Changes === + * Cleaned up iphone theme from redundant files + * Added Maestro International card type to credit card based payment methods (abstract). + * Changed option "Notify Customer" into two options "Notify Customer by Email" and "Visible on Frontend" when adding an order comment. All comments that had the old value = 0, will be not visible on the frontend. + * System configuration option "Sales" -> "Dashboard" -> "Use Aggregated Data" is marked as "beta" + * Added "delta" rounding during shipping excluding/including tax calculation + * Added discount tax as line item in PayPal + * Reviewed logic of the sales reports: + * Orders + * Tax + * Invoiced + * Shipping + * Refunds + * Coupons + +=== Fixes === + * Fixed issue when product quantity was incorrectly updated in stock after an order is placed for a configurable and a bundle products + * Fixed #20697: wrong url rewrite resource model + * Fixed duplicating of coupon code in shopping cart view + * Fixed Catalog RSS feed showing prices including and excluding tax + * Fixed #21501: Problem with translate inline and translations + * Fixed setting URL key when using quick-create for simple products of the configurable. + * Fixed adding comments to sales documents (invoices, shipments, credit memos) + * Fixed #21816: Google Analytics Issue with Registration Checkout and Already Logged In + * Fixed issue with number of orders that were created by Google Checkout + * Fixed #22199: Duplicated Code - Useless Check + * Fixed applied tax saving for shipping tax + * Fixed issue that invoiced orders after cancelling become completed + * Fixed #21533: Missing tranlation for "This date is a required value" in javascript + * Fixed: Sales report last update date doesn't change after re-aggregating + * Fixed rounding special price of selections in bundle product view + * Fixed one day forward shift of dates in sales reports when showing empty rows + * Fixed missed calculation of base_total_canceled & total_canceled fields on order cancellation + * Fixed wrong calculation of base_discount_canceled & base_discount_canceled because of negative values of base_discount_amount in the sales order tables + +=== Known Issues === + * The `sales_order_aggregated_created` table was re-created with new columns, it is not backwards compatible. + + + +==== 1.4.x-devel-66014 ==== + +=== Improvements === + * Enabled "Refresh" mass-action as default in cache management grid + * Implemented Centinel functionality in iphone theme + * Optimized search reindex process a bit + +=== Changes === + * Added 3rd optional argument to javascript function toggleValueElements(checkbox, container, excludedElements) in tools.js (products mass-update javascript) + * Fixed #9600: Security compromised, Guest can subscribe a client to the newsletter + * Checking if subscribing email adress does not belong to another user + * If confirmation option selected and subscribing email is not user's login email - then confirmation is needed + * Fixed #21304: Security compromised, guest can spam any email address + * New config field added into cms -> customer -> newsletter "Allow Guest Subscription" + +=== Fixes === + * Fixed order taxes report with Match Period To = Order Updated Date (typo) + * Fixed issue when invoiced and not shipped yet orders after cancelling becomes completed + * Fixed #21533: Missing tranlation for "This date is a required value" in javascript + * Fixed stock management checking for a stock item when the stock management is disabled for this item (the check should be bypassed) + * Fixed "New Products" RSS: added grouped and bundle products + * Fixed the feed so that it contains grouped products now + * The feed now shows the same products as shown in category view or "New products" widget (before the fix, incomplete products might be shown) + * Fixed: virtual / downloadable product isn't deleted from the shopping cart, if change qty to '0' + * Fixed #21866: 'Master Card' misspelling, should be spelled 'MasterCard' in credit card drop down options in checkout + * Fixed #21771: Adjustment Refund & Adjustment Fee not showing in View Credit Memo + * Fixed admin timeout issue inside iframe of Centinel validation + * Fixed/reviewed tax calculation for components: + * shipping price including tax in checkout process block + * order/invoice/creditmemo shipping incl tax calculation + * applied tax saving for shipping tax + * applied tax saving for shipping tax + * Fixed #16577: Dual Order with same Product + * Fixed: #14502: Newsletter un-subscription message on customer account inappropriate + +=== Known Issues === + * PayPal Direct PayFlow Edition may stuck with processing orders, if transactions are processed at manager.paypal.com. The problem is that IPN does not contain PNREF - the PayFlow transaction ID. This issue won't be fixed neither on PayPal, nor on Magento side. The only recommendation to merchant is to either process orders on Magento side only or on manager.paypal.com only. + + + + +==== 1.4.x-devel-65494 ==== + +=== Improvements === + * Added ability to have a comment for promotion rule fielset, similar to generic fieldset. + * Added method for getting self child selection options recursively for promotion rule combines + * Optimized catalog search system configuration fields sort order to make it more extendable. + * Added icon for some buttons in admin that don't do some action instantly, but redirect to other page. + * Added cache key generation on core template block level + * Added ability to register product ids for last viewed products index + * Added ability to disable observer call with disabled node (after backwards compatibility violation discovered) + * Performance improvements on Mage_Catalog_Helper_Output::productAttribute method level + * Added ability to use lazy connection instantiation on EAV resource models + * Added "_isStraight" flag support on Mage_Core_Controller_Request_Http - allows to process request without additional logic (url rewrites, custom design visitor logging) + +=== Changes === + * Sales reports refactoring after migration to flat sales structure: added a few indexes, optimized statistics reaggregation, fixed issue with generating statistics in wrong timezone (it was in UTC, but needs to be in the admin timezone) + * Added Mage_Core_Helper_Abstract::stripTags() and utilized it in templates instead of strip_tags() + * Improved and optimized base design package templates and layouts, minor fixes in payment method templates. + * Moved fireEvent() function from adminhtml/events.js to a more generic js.js for future use + * Added Mage_Core_Model_Config_Data::getFieldsetDataValue($key) - ability to get a neighbour system configuration value in backend model, when saving system configuration + * Reviewed Magento user interface text labels and messages for proper grammar, informativeness and capital letters usage. + * Reimplemented top menu rendering logic: implemented Mage_Catalog_Block_Navigation::_renderCategoryMenuItemHtml(), deprecated Mage_Catalog_Block_Navigation::drawItem() and reimplemented to work through _renderCategoryMenuItemHtml for compatibility + * Added url rewrites on last viewed products collection + * Reimplemented products bestsellers report: report uses pre-aggregated data to improve performance + * Moved logic of reaggregating reports data from sales report controller into separate controller, added bestsellers report handling there + +=== Fixes === + * Fixed #20782: Wrong prices exc. tax with discount in cart + * Fixed #21099: Wrong subtotal for manual order entry with manual price + * Fixed #21271: Price inc tax and exc. tax same for grouped product + * Fixed grid js object name in grid pager: now it uses block method instead of direct building + * Fixed changing notification when editing a product in various tabs: + * Downloadable products: links title (element had no id attribute and thus was omitted by the event dispatcher init code) + * Custom options: whatever was added with "Add option" + * Bundles: whatever was added with "Add option" + * All date input fields when using the calendar widget + * Prices: tiered prices box, all rows added with "Add tier" + * Fixed #6321: Add RSS urls to head section + * Fixed #21831: Tax Calculation Version 1.4.0.1 still incorrect + * Fixed #12067: iPhone Terms and Conditions Box + * Fixed #20631: Order totals when creating order from admin do not reflect currently selected currency + * Fixed #21777: Catalog pricerules + * Fixed #14591: Incorrect SKU for Configurable Product with Custom Options + * Fixed #20832: PayPal Standard tax issue: implemented proper tax and discounts validation/transferring with cart line items + * Fixed #17451: Header Links (top.links.phtml) does not output correctly because it is using the model code (the Toplinks block is deprecated) + * Fixed #21302: PayPal PayFlow Pro: card expiration date format should be MMYY, not MMYYYY. Also fixed country code typo issue. + * Fixed #21686: Typo in tag.xml + * Fixed extra quoting in select html element + * Fixed XHTML validation errors in admin in some places + * Fixed #21912: calculation error transfer between multishipping address + * Fixed typo in PayPal NVP API that caused impossibility to do partial captures + + + + +==== 1.4.x-devel-64603 ==== + +=== Improvements === + * Implemented 3D Secure validation for the JCB credit cards + * Added "Only X Left" feature - an option to show on a product view page how many items remains in stock, if it is lower than specific threshold. + * (in progress) implementation of #7741: Customer group increase order size . The feature is called "Qty Increments" - to trade items in boxes only. I.e. allow to purchase 6, 12, 18 items etc... + +=== Changes === + * Refactored frontend navigation menu HTML structure and javascripts: the menu expands and collapses with small delay making it more accessible for users. Fixed possible compatibility issue in Mage_Catalog_Block_Navigation::drawItem() and marked as deprecated after 1.4. Removed local calls of onmouseover/onmouseout events to improve SEO. + * Added ability to assign id for field containers (TR tag) using node 1 in system configuration + * Moving widgets.css below in the code for proper styles overriding. + * Moved JCB credit card declaration and implementation into the Mage_Payment module. Removed it from other modules (they will inherit JCB card from "CC" payment method) + * Modified Varien_Object_Mapper to check arrays using array_key_exists() instead of isset() + * Indexer changes (related to the #21031): + * Removed DROP/CREATE statements for index temporary tables + * Created static index temporary tables (InnoDB and MEMORY) and separated using those tables in reindexiAll() and reindexEntities() + * Added ability to set a comment in adminhtml generic fieldset renderer + +=== Fixes === + * Fixed #21313: Display price including TAX + * Fixed #21632: Associated products don't get cached + * Minor bugfixes in 3D Secure integration (API debugging, improvements in css and javascript) + * 3D Secure integraion - fixed confused constant values in centinel service model + * Fixed autocomplete in year field on new user registration + * Fixed _isCaptureNeeded validation for PayPal pro (exception during invoicing captured transaction) + * Fixed typo in PayPal Direct API variable "AUTHSTATUS3DS" (error in official documentation) + * Moneybookers: + * fixed translations in the activation email + * minor fixes in account confirmation javascript + * Fixed #21752: Moneybookers configuration per store + * Fixed #21302: PayPal PayFlow Pro: card expiration date format should be MMYY, not MMYYYY + * Fixed #20932: unique key in catalog_product_link + * Fixed #21031: Simultaneous product->save() causes "Base table or view already exists: 1050 Table catalog_product_index_price_idx' already exists + + + + +==== 1.4.x-devel-64038 ==== + +=== Improvements === + * Minor CSS improvements in frontend themes + * Image/media browser minor UI improvements + * Added default placeholder for skin images in wysiwyg + * Minor style improvements for widgets insertion overlay + * Implemented 3D Secure transactions debugging + * Added ability to set a writer adapter to the Mage::log() and to use Mage::log() regardless of system configuration settings + * Added Magento Variable icon for WYSIWYG + * Added ability to append custom class name to main pop-up window container + * Added explanation comments for Centinel Api Custom URL + +=== Changes === + * Added element as parameter of system configuration field getCommentText method + * Added ability to use isObjectNew method of model for object save on resource model level + * Added additional blocks support on order history and last orders blocks level + * Made encryption key length check binary-safe + * Added full exception trace logging to cron_schedule table + * Moved shopping cart price rule coupon to separate table, improved shopping cart price rule management UI + * Added ability to specify model for system config field comment generation (system.xml): + * module/model + * requires getCommentText method definition from defined model + * Changed the way how payment methods debug transactions: instead of database the debug information is written into var/log/payment_.log + * Updated text labels in sales reports: terminology for "report type" (period matches to) + * Added new column 'updated_at' for wishlist table. Changed controller and model logic to save new data. + +=== Fixes === + * Fixed #21250: HTML code displaying like text in descriptions / List View Displaying HTML Entity Values + * Fixed #21251: html code shows in category product listing + * Fixed: Unit Price in Shopping Cart is incorrect when applying a Coupon Code + * Fixed #18536: Rounding error on Shipping Tax calculations + * Fixed bugs with row based tax calculation and shipping tax calculation + * Fixed width/height in WYSIWYG image insertion + * Fixed authorize.net payment transaction saving during capture + * Fixed #20890: Incorrect function name + * Fixed #21055: No Navigation on Advanced Search Results + * Fixed #20912: memory_limit suffix other than 'M' + * Fixed #20884: JS bug in Widget/Grid/Column/Action.php + * Fixed #7228: Credit Memo - Adjustment Fee $ or % + * Fixed #20832: paypal - standard Tax issue + * (in progress) UI minor fixes in 3D Secure validation process + * Added forgotten Moneybookers email template + + + + +==== 1.4.x-devel-63512 ==== + +=== Improvements === + * Implemented #6321: Add RSS urls to head section + * Implemented #7293: Track IP in abandoned cart + * (in progress) Ability to not include a category into navigation menu + +=== Changes === + * Refactored Sales module resource from EAV into flat structure. + * Sales entities data structure changes: + * Dashboard optimization + configuration option "Use Aggregated Data" for dashboard + * Inventory: moved stock items qty manipulations out of transaction, fixed qty upgrade logic (x+delta) + * Added configuration option "Automatically return Credit Memo item to Stock" for refunds autogeneration + * Removed downloadable products FK relation with sales module + * Sales order tax logic moved to tax module and relation with sales module by FK + * Sales, SalesRule and Checkout modules changes: + * Added product customer group property validation on sales rules level + * Added ability to assign quote object to checkout cart model + * Prevented redundant customer model load in customer address + * Optimized saveDownloadableOrderItem item in downloadable product observer + * Prevented double "order by" in collection select statement + * Added _beforeLoad support and not changed object save protection on core abstract level + * Extended abstract collection with add/remove fields to/from select + * Escaped html entities in mail form in 404, 503 and report.php error pages, prevented errors if global array $_SERVER is undefined + * Minor text changes in PayPal modules + * Added not existin observers methods calls protection + * Separated tax shipping total from tax subtotal. Now taxes for store prices (code tax_subtotal) calculates before shipping, then calculates shipping (code shipping) and taxes for shipping (code tax_shipping) and then calculates customer taxes (code tax). + + +=== Fixes === + * Fixed #21061: Global country tax applied instead of specific state tax + * Fixed catalog price rules different sorting when applying the rule vs. saving the product + * Fixed #20603: Async Google Analytics throws js error (_gaq not defined) + * Fixed SQL error possibility when adding bundle to cart + * Fixed #16684: ini_set of auto_detect_line_endings during Varien_Io_File::streamReadCsv + * Fixed #17748: Category chooser at price rules + * Fixed #20161: Special From Date for website + * Fixed Fatal error: Call to undefined method Mage_Admin_Model_Observer::actionPostDispatchAdmin() in \app\code\core\Mage\Core\Model\App.php on line 1207 (backward compatibility) + + + + +==== 1.4.x-devel-62916 ==== + +=== Improvements === + * Improved visual design of widget and variable insertion, and media browser overlay + * Product custom URL rewrites redirect to SEF URL, rather than to catalog/product/view/id/ + * URL rewrites history: ability to auto-generate custom rewrite with redirect from old to new URL when changing product URL-key + * Optimized getAttributeRawValue() method in catalog module for retrieving more then one attributes + +=== Changes === + * Added javascript validation for JCB cards + * Changed confusing error message about quantity in shopping cart into proper one + * Added comments collection loading when invoice, credit memo or shipment created with adding comment: needed before adding first comment. + * Added Varien_Db_Ddl_Table + * Added method createTable from DDL to Varien_Db_Apater_Pdo_Mysql + * Removed getting Varien_Object id in Varien_Debug + +=== Fixes === + * Fixed read/write connection issue during new customer order place. See http://www.magentocommerce.com/boards/viewthread/19363/P0/ + * Fixed confusion with admin page title when editing product + * Fixed bug in Mage_Bundle_Model_Product_Type::getSelectionsCollection(): retrieved collection depends on passed optionIds only on first method call + * Fixed: New products RSS feed appears instead of the Special products RSS feed + * Fixed tax rule ZIP range matching (numeric values were matched as strings) + * Fixed #14055: New orders RSS feed displaying incorrect customer name + * Fixed #19192: Error when product inventory messed up on viewing order. + * Fixed minor visual design issues in themes and skins + * Fixed getting secure host URL in 404, 503 and report.php error pages + * Fixed up filtering of filenames of uploaded files + * Fixed position issue for cross-sell products + * Fixed #20372: importing images + * Fixed: #17845: Validation and Ampersand Flaws in Layered Navigation and other locations that use the fake query string + * Fixed #15592: Mage_Adminhtml_Model_System_Config_Source_Shipping_Allowedmethods::toOptionArray() not compatiable with parent method + * Made proper validate() independent of submit in form.js (Visions contribution) + * Fixed incorrect js logic on order create backend page (Visions contribution): + * Fixed: when create order, it is not possible to resubmit after initial validation failed (because submit button is disabled) + * Improved client side validation that new order has shipping address (it is required to click "get shipping method and rates" + * Improved client side validation that payment method is selected (like in checkout of frontend) + * Improved usability of sales admin (Visions patch): + * added ability to export csv or excel for orders, shipments, creditmemos, invoices + * made filter for creditmemo and shipment type text so it is possible to just enter one id and find object looking for (unified with orders and invoices, there it is already text not number) + * Fixed #17659: UPS Minimum Weight Required for Negotiated Rates + * Fixed #20580: Index module not translated + +=== Known Issues === + * It is impossible to run more than one 3D Secure card validations simultaneously in one session. Not fixable. + + + + +==== 1.4.0.1 ==== + +=== Changes === + + * The error report exception printing is disabled by default for security reasons. To print the error report, copy the errors/local.xml.sample to errors/local.xml + * XSS vulnerabilities review + * Added Phoenix_Moneybookers payment method module (from now bundled in Magento out of the box) + +=== Fixes === + + * Fixed #20680: Catalog - Google Sitemap + * Fixed #20024: Error message 'Data saving problem' when try to checkout with multiple addresses (when address deleted during multishipping process) + * Fixed #20625: Fatal error: Exception thrown without a stack frame in Unknown on line 0 (Fixed cache backend instantiation when a shared PEAR library is in the include path) + * Fixed issues of upgrading from 1.3.x to 1.4.x through Magento Connect in some installations + * Fixed #20659: Unable to choose images for upload (duplicates: #20588, #20573, #20616, #20595) + * Fixed shell cron script runner + * Refixed #17963: Ampersand in Search Breadcrumb: Double-encoded + +=== Upgrade Notes === + + * We highly recommend disabling Magento cache before upgrading + * In layout of any custom theme the usage of catalog/product_list_toolbar block should be changed to page/html_pager: + 1) Replace the catalog/product/list/toolbar.phtml of your theme by the new one + 2) Update catalog.xml layout: should be replaced into + + + + +==== 1.4.0.0 ==== + +=== 1.4 Major Improvements since 1.3 === + * Implemented 3D Secure credit card validation (Visa and Mastercard) + * Full reimplementation of PayPal modules, includes lot of new functionality and numerous bugfixes + * Full review of frontend themes, introduced design cross-package fallback and the base/default theme. Includes SEO and accessibility enhancements. Changes are oriented to dramatically reduce themes maintenance. + * Added ability to define arbitrary cache backends + * Optimized performance of sales reports, added new sales report types + * Added image/media uploader/browser, that can browse entire media folder + * Optimized performance of search indexer + * Made order processing workflow more informative and severe + * Reimplemented 404 and report pages, introduced 503 page, specifically for maintenance purposes + * Improved javascript files merging, added CSS files merging + * Added Widgets functionality, added several widgets out of the box + * Added Custom Variables functionality + * Added lot of new System Configuration options + * Improved order placement reliability + * Added WYSIWYG for CMS and Catalog + * Optimized cache initialization during startup + * Optimized export from grids in admin area + * Improved tax and discount totals calculation + * Replaced admin notification flash popup into a simple HTML overlay + * Implemented product and category URLs per store view + * Added ability to configure entry point using virtualhost environment configuration, rather than creating another physical entry point + * Optimized simple product view without custom options + +=== Coommunity Edition Changes since 1.4.0.0-rc1 === + +== Improvements == + * Implemented 3D Secure credit card (Visa, Mastercard) validation for payment methods: + * Saved CC + * PayPal Website Payments Pro - Direct Payments + * PayPal Website Payments Pro (Payflow Edition) - Direct Paymens + * Payflow Pro + * Improved modern theme: significantly reduced number of files in virtue of cross-package fallback to base/default theme + * Implemented #11012: Support canonical link tag + * Implemented WYSIWYG for newsletter templates + * Minor improvements in sales reports + * Renamed button "Refund" to "Refund Offline" on Credit Memo page for order + * 19963: Mage_Eav_Model_Entity_Setup::addAttributeToGroup() (visions patch) + * improved print.css for CE themes + * SEO and accessibility improvements in default/default, default/modern and default/blank themes + * left and right callouts templates, both callouts images and links are now controlled via catalog.xml + * Added relevant page titles in admin area + * Implemented column decorators and ability to use getter callback in admin grids + * Made fetching payment methods sort order properly: via getConfigData() rather getStoreConfig() (optimization for 3rd-party customizations) + * Implemented ability for page/html_wrapper block to not render the wrapper tag, made it output children sorted + * Implemented wrappers for inserting additional blocks in: + * before shopping cart line items list + * before onepage checkout login/registration form + * before customer registration form + * before newsletter subcription form (customer "My Account") + * before product review form + * before product tag submission form (product view page) + * Implemented giropay integration with PayPal Express Checkout + * Added before/after initialize and before/after validate events to opcheckout.js + * Optimized products toolbar functionality, prevent saving to session default grid parameters (for sorting, pager etc.) + * Added filter by website in "Last ordered items" block + +== Changes === + * PayPal Website Payments Pro (Payflow Edition) is completely rewritten, as extending Mage_Paypal module. With breaking code backwards compatibility. + * Mage_Core_Model_Flag - moved setting flag_code to _construct() + * AmazonPayments module is removed from package and will be available as a separate extension on Magento Connect + * #19595: Varien_File_Uploader_Image not working - class is deprecated and should not be used + * Marked dead code Mage_Checkout_Model_Type_Abstract::_emailOrderConfirmation() as deprecated + * Reimplemented 404, 503 and report.php error pages: now fully configurable from errors/local.xml, with ability to override theme per entry point or even store view + * error report doesn't disclose the trace by default anymore + * Added to Catalog Product Price indexer upgrade operation by removing old temporary index tables if exists + * Product image uploader security measurements: + * disabled ability to run php scripts in "media" folder + * added callback validation to File/Uploader.php + * added image file validation to Catalog/Product/GalleryController.php + * Prevented flushing output buffer caused by exceptions in templates included by core/template block + * added default _type param to Design Package getters in core/design_package model + * Added additional qty parameter to event 'catalog_product_get_final_price' + * Updated sales sql-upgrades: fixed missing table prefixes in some places, rewrote adding foreign keys via methods + * Implemented 'any-value-validate' logic for Catalog Rules; common methods moved to parent (Mage_CatalogRule_Model_Rule_Condition_Product) class + * Expanded width of fields on product and category edit pages + * Added ability to render number sign in currency and number grid renderers + * Fixed datetime grid renderer to make it use getters (see parent class) + * Added Mage_Core_Block_Abstract::escapeHtml() instead of htmlEscape() + * Added ability to make output optional in page/html_pager block (when items total quantity is less than page size) + * Added ability disable product list toolbar params saving to session + * Added sorting by param name to query params part of url + * Made page/html_wrapper block treat children empty output as if there are no children. + * Implemented dynamic BN codes for PayPal. Pattern: Varien_Cart_(EC|DP|WPS)[_] where country code is one of 18 country codes currently PayPal has localized market sites. * Fixed session cookie renew functionality, added ability define cookie settings for javescript methods + * When LN filter for an anchor category is active not allow to use display mode "Static Block Only" + * Sales: made online operations and notifications updating "online" totals, instead of totals mixed with online/offline sales documents. Removed updating "base_amount_canceled" total update when voided payment (this was backwards compatibility violation) + +== Fixes == + * Fixed 'tax_rate_data_fetch' event params + * Minor fixes in PayPal Express Checkout and PayPal Direct (non-reported bugs, terminology issues) + * Fixed #16210: Input field size decreased in category products grid + * Fixed #17281: Google Checkout: Incorrect assigning of [parent_id] + * Fixed #14251: Google Checkout still does not allow free shipping + * Fixed #11412: Rounding error in tax and shipping calculation + * Fixed #11836: No authentication on customer reviews url + * Fixed #13511: "Default web url" does not work as expected + * Fixed #14469: Newly created products for configurable products do not stick + * Fixed #14915: Invoice payment capture _needToAddDummy bug + * Fixed #15235: Special price bug with multiple websites + * Fixed #16425: printing in admin breaks top menu + * Fixed #16499: Require customer login for reviews not 100% working + * Fixed #17058: Currency Switch won't work on first time in shop frontend (session id issue) + * Fixed #17504: Birthday getting swapped (Month and Day) + * Fixed #17720: core_flag primary key is a smallint and has a max value of 65535 + * Fixed #17793: Google Base Special Price not mapped to Price + * Fixed #Fixed #18127: Bundle Products pricing incorrectly when not required + * Fixed #18341: Bugs in dataflow: number of records + * Fixed #18745: Customer Import shouldn't send email + * Fixed #18868: Unable to use Mage::log() before config is read + * Fixed #19290: Changing 'My Account' info may destroy log in when password is blank + * Fixed some XSS vulnerabilities in admin + * Fixed #19448: Incorrect handling of empty attributes under PHP 5.2.0 + * Fixed #19449: Google Base + * Fixed USPS First Class International and USPS Express Mail International shipping method that stopped working after gateway changes + * Fixed #19512: /index.php/checkout/onepage/getAddress/address/ allows everyone logged in to get all addresses + * Tax rates edit form won't clean on validation error anymore + * Fixed #19702: getLastOrderId missing parameter + * Fixed #19729: unable to translate "Display product options in" and "Product Type" + * Fixed #19753: Compare products page breaks if no attributes are marked as "Comparable" + * Fixed #19791: Shipment tracking not displayed from admin panel with store code in URLs enabled + * Fixed #19838: missing two escape characters in validation.js at the validate-email regex + * Fixed #19873: Minor warning fix + * Fixed #19904: please remove double file extensions in filenames of uploaded files + * Fixed #19954: Undefined variable + * Fixed #19960: Google Analytics Asynchronous Tracking Code + * Fixed #19964: cart sidebar shows zero total when displayed including tax + * Fixed #19969: Css is wong for gift-message-form + * Fixed #20023: Admin login is very slow when widgets.magentocommerce.com is down + * Fixed #20080: Dataflow Profiles Need to be Sorted + * Fixed #20250: Search'n'replace oversight + * A few fixes in URL rewrites logic + * Fixed #20350: WRONG "XML_PATH_SCHEDULE_GENERATE_EVERY" + * Fixed #20361: Move Category Failed + * Fixed #6564: Transactional Email Templates Using alt="Magento" + * Fixed #8514: Negative Number in Sorting + * Fixed Price indexer website date/rate + * Fixed tier_price and website table names in Catalog Product Price Default indexer + * Fixed command line installation - fatal caused by improper website initialization + * Implemented correct setting attributes to entity including situation when there are no attribute value for default sore + * Fixed #19263: Adminhtml Html Error: Double + * Fixed "undefined index" notice when saving Table Rates without uploading import rates file. diff --git a/app/Mage.php b/app/Mage.php index 9b14dff814..b1ce249c5e 100644 --- a/app/Mage.php +++ b/app/Mage.php @@ -138,7 +138,7 @@ final class Mage public static function getVersion() { $i = self::getVersionInfo(); - return trim("{$i['major']}.{$i['minor']}.{$i['revision']}.{$i['patch']}-{$i['stability']}{$i['number']}", '.-'); + return trim("{$i['major']}.{$i['minor']}.{$i['revision']}" . ($i['patch'] != '' ? ".{$i['patch']}" : "") . "-{$i['stability']}{$i['number']}", '.-'); } /** @@ -152,8 +152,8 @@ public static function getVersionInfo() return array( 'major' => '1', 'minor' => '4', - 'revision' => '0', - 'patch' => '1', + 'revision' => '1', + 'patch' => '0', 'stability' => '', 'number' => '', ); @@ -658,8 +658,9 @@ public static function isInstalled($options = array()) * @param string $message * @param integer $level * @param string $file + * @param bool $forceLog */ - public static function log($message, $level = null, $file = '') + public static function log($message, $level = null, $file = '', $forceLog = false) { if (!self::getConfig()) { return; @@ -675,7 +676,7 @@ public static function log($message, $level = null, $file = '') $logActive = true; } - if (!self::$_isDeveloperMode && !$logActive) { + if (!self::$_isDeveloperMode && !$logActive && !$forceLog) { return; } @@ -699,7 +700,13 @@ public static function log($message, $level = null, $file = '') $format = '%timestamp% %priorityName% (%priority%): %message%' . PHP_EOL; $formatter = new Zend_Log_Formatter_Simple($format); - $writer = new Zend_Log_Writer_Stream($logFile); + $writerModel = (string)self::getConfig()->getNode('global/log/core/writer_model'); + if (!self::$_app || !$writerModel) { + $writer = new Zend_Log_Writer_Stream($logFile); + } + else { + $writer = new $writerModel($logFile); + } $writer->setFormatter($formatter); $loggers[$file] = new Zend_Log($writer); } diff --git a/app/code/community/Phoenix/Moneybookers/Helper/Data.php b/app/code/community/Phoenix/Moneybookers/Helper/Data.php index 663662d601..e92b517440 100644 --- a/app/code/community/Phoenix/Moneybookers/Helper/Data.php +++ b/app/code/community/Phoenix/Moneybookers/Helper/Data.php @@ -42,22 +42,28 @@ class Phoenix_Moneybookers_Helper_Data extends Mage_Payment_Helper_Data public function activateEmail() { $storeId = Mage::app()->getStore()->getId(); - $mailTemplate = Mage::getModel('core/email_template'); - $mailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => $storeId)) + $translate = Mage::getSingleton('core/translate'); + /* @var $translate Mage_Core_Model_Translate */ + $translate->setTranslateInline(false); + + Mage::getModel('core/email_template') + ->setDesignConfig(array('area' => 'frontend', 'store' => $storeId)) ->sendTransactional( 'moneybookers_activateemail', Mage::getStoreConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_IDENTITY, $storeId), $this->_activationEmailTo, - $this->_activationEmailTo, + null, array( - 'subject' => $this->_activationEmailSubject, - 'email_addr' => Mage::getStoreConfig(self::XML_PATH_EMAIL), - 'url' => Mage::getBaseUrl(), + 'subject' => $this->_activationEmailSubject, + 'email_addr' => Mage::getStoreConfig(self::XML_PATH_EMAIL), + 'url' => Mage::getBaseUrl(), 'customer_id' => Mage::getStoreConfig(self::XML_PATH_CUSTOMER_ID), - 'language' => Mage::getModel('core/locale')->getDefaultLocale() + 'language' => Mage::getModel('core/locale')->getDefaultLocale() ) ); + + $translate->setTranslateInline(true); } /** diff --git a/app/code/community/Phoenix/Moneybookers/Model/Abstract.php b/app/code/community/Phoenix/Moneybookers/Model/Abstract.php index b1b324c3fb..9a281d4649 100644 --- a/app/code/community/Phoenix/Moneybookers/Model/Abstract.php +++ b/app/code/community/Phoenix/Moneybookers/Model/Abstract.php @@ -42,7 +42,7 @@ abstract class Phoenix_Moneybookers_Model_Abstract extends Mage_Payment_Model_Me protected $_paymentMethod = 'abstract'; protected $_defaultLocale = 'en'; - protected $_supportedLocales = array('cn', 'cz', 'en', 'es', 'de', 'fr', 'gr', 'it', 'nl', 'ro', 'ru', 'pl', 'tr'); + protected $_supportedLocales = array('cn', 'cz', 'da', 'en', 'es', 'fi', 'de', 'fr', 'gr', 'it', 'nl', 'ro', 'ru', 'pl', 'sv', 'tr'); protected $_hidelogin = '1'; protected $_order; diff --git a/app/code/community/Phoenix/Moneybookers/Model/Event.php b/app/code/community/Phoenix/Moneybookers/Model/Event.php index 09d3927166..e6f3a8c838 100644 --- a/app/code/community/Phoenix/Moneybookers/Model/Event.php +++ b/app/code/community/Phoenix/Moneybookers/Model/Event.php @@ -85,11 +85,11 @@ public function processStatusEvent() $msg = ''; switch($params['status']) { case self::MONEYBOOKERS_STATUS_FAIL: //fail - $msg = Mage::helper('moneybookers')->__('Payment failed'); + $msg = Mage::helper('moneybookers')->__('Payment failed.'); $this->_processCancel($msg); break; case self::MONEYBOOKERS_STATUS_CANCEL: //cancel - $msg = Mage::helper('moneybookers')->__('Payment was canceled'); + $msg = Mage::helper('moneybookers')->__('Payment was canceled.'); $this->_processCancel($msg); break; case self::MONEYBOOKERS_STATUS_PENDING: //pending @@ -116,7 +116,7 @@ public function processStatusEvent() public function cancelEvent() { try { $this->_validateEventData(false); - $this->_processCancel('Payment was canceled'); + $this->_processCancel('Payment was canceled.'); return Mage::helper('moneybookers')->__('The order has been canceled.'); } catch (Mage_Core_Exception $e) { return $e->getMessage(); @@ -199,7 +199,7 @@ protected function _validateEventData($fullCheck = true) // get request variables $params = $this->_eventData; if (empty($params)) { - Mage::throwException('Request doesn\'t contain any elements.'); + Mage::throwException('Request does not contain any elements.'); } // check order ID @@ -217,12 +217,12 @@ protected function _validateEventData($fullCheck = true) if ($fullCheck) { // check payment status if (empty($params['status'])) { - Mage::throwException('Unknown payment status'); + Mage::throwException('Unknown payment status.'); } // check transaction signature if (empty($params['md5sig'])) { - Mage::throwException('Invalid transaction signature'); + Mage::throwException('Invalid transaction signature.'); } $checkParams = array('merchant_id', 'transaction_id', 'secret', 'mb_amount', 'mb_currency', 'status'); @@ -245,7 +245,7 @@ protected function _validateEventData($fullCheck = true) // check transaction amount if currency matches if ($this->_order->getOrderCurrencyCode() == $params['mb_currency']) { if (round($this->_order->getGrandTotal(), 2) != $params['mb_amount']) { - Mage::throwException('Transaction amount doesn\'t match.'); + Mage::throwException('Transaction amount does not match.'); } } } diff --git a/app/code/community/Phoenix/Moneybookers/controllers/ProcessingController.php b/app/code/community/Phoenix/Moneybookers/controllers/ProcessingController.php index 63b83667ea..66aa9b619d 100644 --- a/app/code/community/Phoenix/Moneybookers/controllers/ProcessingController.php +++ b/app/code/community/Phoenix/Moneybookers/controllers/ProcessingController.php @@ -52,7 +52,7 @@ public function paymentAction() Mage::throwException('No order for processing found'); } $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, - Mage::helper('moneybookers')->__('Customer was redirected to Moneybookers.') + Mage::helper('moneybookers')->__('The customer was redirected to Moneybookers.') ); $order->save(); diff --git a/app/code/community/Phoenix/Moneybookers/etc/config.xml b/app/code/community/Phoenix/Moneybookers/etc/config.xml index b8aeb97103..364e9a7206 100644 --- a/app/code/community/Phoenix/Moneybookers/etc/config.xml +++ b/app/code/community/Phoenix/Moneybookers/etc/config.xml @@ -55,6 +55,11 @@ + + + Moneybookers + + @@ -143,172 +148,189 @@ moneybookers/acc + mbookers moneybookers/csi + mbookers moneybookers/did + mbookers moneybookers/dnk + mbookers moneybookers/ebt + mbookers moneybookers/ent + mbookers moneybookers/gcb + mbookers moneybookers/gir + mbookers moneybookers/idl + mbookers moneybookers/lsr + mbookers moneybookers/npy + mbookers moneybookers/pli + mbookers moneybookers/psp + mbookers moneybookers/pwy + mbookers moneybookers/sft + mbookers moneybookers/so2 + mbookers moneybookers/wlt + mbookers 0 - + 0 moneybookers/acc Credit Card / Visa, Mastercard, AMEX, JCB, Diners 0 - + 0 moneybookers/csi CartaSi 1 IT - + 0 moneybookers/did Lastschrift (ELV) 1 DE - + 0 moneybookers/dnk Dankort 1 DK - + 0 moneybookers/ebt Nordea Solo 1 SE - + 0 moneybookers/ent eNETS 1 SG - + 0 moneybookers/gcb Carte Bleue 1 FR - + 0 moneybookers/gir Giropay 1 DE - + 0 moneybookers/idl iDeal 1 NL - + 0 moneybookers/lsr Laser 1 IE - + 0 moneybookers/npy EPS Online-Ãœberweisung 1 AT - + 0 moneybookers/pli POLi 1 AU - + 0 moneybookers/psp Postepay 1 IT - + 0 moneybookers/pwy All Polish Banks 1 PL - + 0 moneybookers/sft Sofortüberweisung 1 DE - + 0 moneybookers/so2 Nordea Solo 1 FI - + 0 moneybookers/wlt Moneybookers eWallet diff --git a/app/code/community/Phoenix/Moneybookers/etc/system.xml b/app/code/community/Phoenix/Moneybookers/etc/system.xml index 4d17a7ccd4..c582c016ca 100644 --- a/app/code/community/Phoenix/Moneybookers/etc/system.xml +++ b/app/code/community/Phoenix/Moneybookers/etc/system.xml @@ -27,8 +27,8 @@ text 990 1 - 0 - 0 + 1 + 1 @@ -40,7 +40,7 @@ - here for a free account if you don’t have one yet.]]> + here for a free account if you don’t have one yet.]]> text 1 1 @@ -80,7 +80,7 @@ 201 1 1 - 0 + 1 @@ -89,7 +89,7 @@ 1 1 1 - 0 + 1 @@ -97,7 +97,7 @@ 3 1 1 - 0 + 1 <label>Title</label> @@ -105,7 +105,7 @@ <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>0</show_in_store> + <show_in_store>1</show_in_store> @@ -114,7 +114,7 @@ adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 + 1 @@ -123,7 +123,7 @@ adminhtml/system_config_source_country 1 1 - 0 + 1 1 @@ -134,7 +134,7 @@ 252 1 1 - 0 + 1 @@ -143,7 +143,7 @@ 1 1 1 - 0 + 1 @@ -151,7 +151,7 @@ 3 1 1 - 0 + 1 <label>Title</label> @@ -159,7 +159,7 @@ <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>0</show_in_store> + <show_in_store>1</show_in_store> @@ -168,7 +168,7 @@ adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 + 1 @@ -177,7 +177,7 @@ adminhtml/system_config_source_country 1 1 - 0 + 1 1 @@ -188,7 +188,7 @@ 211 1 1 - 0 + 1 @@ -197,7 +197,7 @@ 1 1 1 - 0 + 1 @@ -205,7 +205,7 @@ 3 1 1 - 0 + 1 <label>Title</label> @@ -213,7 +213,7 @@ <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>0</show_in_store> + <show_in_store>1</show_in_store> @@ -222,7 +222,7 @@ adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 + 1 @@ -231,7 +231,7 @@ adminhtml/system_config_source_country 1 1 - 0 + 1 1 @@ -242,7 +242,7 @@ 241 1 1 - 0 + 1 @@ -251,7 +251,7 @@ 1 1 1 - 0 + 1 @@ -259,7 +259,7 @@ 3 1 1 - 0 + 1 <label>Title</label> @@ -267,7 +267,7 @@ <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>0</show_in_store> + <show_in_store>1</show_in_store> @@ -276,7 +276,7 @@ adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 + 1 @@ -285,7 +285,7 @@ adminhtml/system_config_source_country 1 1 - 0 + 1 1 @@ -296,7 +296,7 @@ 271 1 1 - 0 + 1 @@ -305,7 +305,7 @@ 1 1 1 - 0 + 1 @@ -313,7 +313,7 @@ 3 1 1 - 0 + 1 <label>Title</label> @@ -321,7 +321,7 @@ <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>0</show_in_store> + <show_in_store>1</show_in_store> @@ -330,7 +330,7 @@ adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 + 1 @@ -339,7 +339,7 @@ adminhtml/system_config_source_country 1 1 - 0 + 1 1 @@ -350,7 +350,7 @@ 261 1 1 - 0 + 1 @@ -359,7 +359,7 @@ 1 1 1 - 0 + 1 @@ -367,7 +367,7 @@ 3 1 1 - 0 + 1 <label>Title</label> @@ -375,7 +375,7 @@ <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>0</show_in_store> + <show_in_store>1</show_in_store> @@ -384,7 +384,7 @@ adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 + 1 @@ -393,7 +393,7 @@ adminhtml/system_config_source_country 1 1 - 0 + 1 1 @@ -404,7 +404,7 @@ 231 1 1 - 0 + 1 @@ -413,7 +413,7 @@ 1 1 1 - 0 + 1 @@ -421,7 +421,7 @@ 3 1 1 - 0 + 1 <label>Title</label> @@ -429,7 +429,7 @@ <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>0</show_in_store> + <show_in_store>1</show_in_store> @@ -438,7 +438,7 @@ adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 + 1 @@ -447,7 +447,7 @@ adminhtml/system_config_source_country 1 1 - 0 + 1 1 @@ -458,7 +458,7 @@ 212 1 1 - 0 + 1 @@ -467,7 +467,7 @@ 1 1 1 - 0 + 1 @@ -475,7 +475,7 @@ 3 1 1 - 0 + 1 <label>Title</label> @@ -483,7 +483,7 @@ <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>0</show_in_store> + <show_in_store>1</show_in_store> @@ -492,7 +492,7 @@ adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 + 1 @@ -501,7 +501,7 @@ adminhtml/system_config_source_country 1 1 - 0 + 1 1 @@ -512,7 +512,7 @@ 291 1 1 - 0 + 1 @@ -521,7 +521,7 @@ 1 1 1 - 0 + 1 @@ -529,7 +529,7 @@ 3 1 1 - 0 + 1 <label>Title</label> @@ -537,7 +537,7 @@ <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>0</show_in_store> + <show_in_store>1</show_in_store> @@ -546,7 +546,7 @@ adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 + 1 @@ -555,7 +555,7 @@ adminhtml/system_config_source_country 1 1 - 0 + 1 1 @@ -566,7 +566,7 @@ 221 1 1 - 0 + 1 @@ -575,7 +575,7 @@ 1 1 1 - 0 + 1 @@ -583,7 +583,7 @@ 3 1 1 - 0 + 1 <label>Title</label> @@ -591,7 +591,7 @@ <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>0</show_in_store> + <show_in_store>1</show_in_store> @@ -600,7 +600,7 @@ adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 + 1 @@ -609,7 +609,7 @@ adminhtml/system_config_source_country 1 1 - 0 + 1 1 @@ -620,7 +620,7 @@ 301 1 1 - 0 + 1 @@ -629,7 +629,7 @@ 1 1 1 - 0 + 1 @@ -637,7 +637,7 @@ 3 1 1 - 0 + 1 <label>Title</label> @@ -645,7 +645,7 @@ <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>0</show_in_store> + <show_in_store>1</show_in_store> @@ -654,7 +654,7 @@ adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 + 1 @@ -663,7 +663,7 @@ adminhtml/system_config_source_country 1 1 - 0 + 1 1 @@ -674,7 +674,7 @@ 311 1 1 - 0 + 1 @@ -683,7 +683,7 @@ 1 1 1 - 0 + 1 @@ -691,7 +691,7 @@ 3 1 1 - 0 + 1 <label>Title</label> @@ -699,7 +699,7 @@ <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>0</show_in_store> + <show_in_store>1</show_in_store> @@ -708,7 +708,7 @@ adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 + 1 @@ -717,7 +717,7 @@ adminhtml/system_config_source_country 1 1 - 0 + 1 1 @@ -728,7 +728,7 @@ 251 1 1 - 0 + 1 @@ -737,7 +737,7 @@ 1 1 1 - 0 + 1 @@ -745,7 +745,7 @@ 3 1 1 - 0 + 1 <label>Title</label> @@ -753,7 +753,7 @@ <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>0</show_in_store> + <show_in_store>1</show_in_store> @@ -762,7 +762,7 @@ adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 + 1 @@ -771,7 +771,7 @@ adminhtml/system_config_source_country 1 1 - 0 + 1 1 @@ -782,7 +782,7 @@ 321 1 1 - 0 + 1 @@ -791,7 +791,7 @@ 1 1 1 - 0 + 1 @@ -799,7 +799,7 @@ 3 1 1 - 0 + 1 <label>Title</label> @@ -807,7 +807,7 @@ <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>0</show_in_store> + <show_in_store>1</show_in_store> @@ -816,7 +816,7 @@ adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 + 1 @@ -825,7 +825,7 @@ adminhtml/system_config_source_country 1 1 - 0 + 1 1 @@ -836,7 +836,7 @@ 213 1 1 - 0 + 1 @@ -845,7 +845,7 @@ 1 1 1 - 0 + 1 @@ -853,7 +853,7 @@ 3 1 1 - 0 + 1 <label>Title</label> @@ -861,7 +861,7 @@ <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>0</show_in_store> + <show_in_store>1</show_in_store> @@ -870,7 +870,7 @@ adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 + 1 @@ -879,7 +879,7 @@ adminhtml/system_config_source_country 1 1 - 0 + 1 1 @@ -890,7 +890,7 @@ 281 1 1 - 0 + 1 @@ -899,7 +899,7 @@ 1 1 1 - 0 + 1 @@ -907,7 +907,7 @@ 3 1 1 - 0 + 1 <label>Title</label> @@ -915,7 +915,7 @@ <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>0</show_in_store> + <show_in_store>1</show_in_store> @@ -924,7 +924,7 @@ adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 + 1 @@ -933,7 +933,7 @@ adminhtml/system_config_source_country 1 1 - 0 + 1 1 @@ -944,7 +944,7 @@ 331 1 1 - 0 + 1 @@ -953,7 +953,7 @@ 1 1 1 - 0 + 1 @@ -961,7 +961,7 @@ 3 1 1 - 0 + 1 <label>Title</label> @@ -969,7 +969,7 @@ <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>0</show_in_store> + <show_in_store>1</show_in_store> @@ -978,7 +978,7 @@ adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 + 1 @@ -987,7 +987,7 @@ adminhtml/system_config_source_country 1 1 - 0 + 1 1 diff --git a/app/code/core/Mage/Admin/Model/Acl.php b/app/code/core/Mage/Admin/Model/Acl.php index 854051cc57..4754cfc56e 100644 --- a/app/code/core/Mage/Admin/Model/Acl.php +++ b/app/code/core/Mage/Admin/Model/Acl.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Acl/Assert/Ip.php b/app/code/core/Mage/Admin/Model/Acl/Assert/Ip.php index 00f5ace01a..629b3e62e5 100644 --- a/app/code/core/Mage/Admin/Model/Acl/Assert/Ip.php +++ b/app/code/core/Mage/Admin/Model/Acl/Assert/Ip.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Acl/Assert/Time.php b/app/code/core/Mage/Admin/Model/Acl/Assert/Time.php index ec0bcf6055..7b5d8d5dbd 100644 --- a/app/code/core/Mage/Admin/Model/Acl/Assert/Time.php +++ b/app/code/core/Mage/Admin/Model/Acl/Assert/Time.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Acl/Resource.php b/app/code/core/Mage/Admin/Model/Acl/Resource.php index cc539ea6ef..ab1a66ef0a 100644 --- a/app/code/core/Mage/Admin/Model/Acl/Resource.php +++ b/app/code/core/Mage/Admin/Model/Acl/Resource.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Acl/Role.php b/app/code/core/Mage/Admin/Model/Acl/Role.php index 6928fc108d..a50216e6f5 100644 --- a/app/code/core/Mage/Admin/Model/Acl/Role.php +++ b/app/code/core/Mage/Admin/Model/Acl/Role.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Acl/Role/Generic.php b/app/code/core/Mage/Admin/Model/Acl/Role/Generic.php index 7dbe7486bb..cb91256d47 100644 --- a/app/code/core/Mage/Admin/Model/Acl/Role/Generic.php +++ b/app/code/core/Mage/Admin/Model/Acl/Role/Generic.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Acl/Role/Group.php b/app/code/core/Mage/Admin/Model/Acl/Role/Group.php index 035d5d19cd..5250a9baf0 100644 --- a/app/code/core/Mage/Admin/Model/Acl/Role/Group.php +++ b/app/code/core/Mage/Admin/Model/Acl/Role/Group.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Acl/Role/Registry.php b/app/code/core/Mage/Admin/Model/Acl/Role/Registry.php index 09441f208c..cd77a72499 100644 --- a/app/code/core/Mage/Admin/Model/Acl/Role/Registry.php +++ b/app/code/core/Mage/Admin/Model/Acl/Role/Registry.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Acl/Role/User.php b/app/code/core/Mage/Admin/Model/Acl/Role/User.php index dcf99703d1..319f420d5c 100644 --- a/app/code/core/Mage/Admin/Model/Acl/Role/User.php +++ b/app/code/core/Mage/Admin/Model/Acl/Role/User.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Config.php b/app/code/core/Mage/Admin/Model/Config.php index e3bf2990cb..52d554688f 100644 --- a/app/code/core/Mage/Admin/Model/Config.php +++ b/app/code/core/Mage/Admin/Model/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Mysql4/Acl.php b/app/code/core/Mage/Admin/Model/Mysql4/Acl.php index 9884d1bdb4..82e71c10fd 100644 --- a/app/code/core/Mage/Admin/Model/Mysql4/Acl.php +++ b/app/code/core/Mage/Admin/Model/Mysql4/Acl.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Mysql4/Acl/Role.php b/app/code/core/Mage/Admin/Model/Mysql4/Acl/Role.php index 3b4baf525f..68c7cbc667 100644 --- a/app/code/core/Mage/Admin/Model/Mysql4/Acl/Role.php +++ b/app/code/core/Mage/Admin/Model/Mysql4/Acl/Role.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Mysql4/Acl/Role/Collection.php b/app/code/core/Mage/Admin/Model/Mysql4/Acl/Role/Collection.php index 1164dc6dba..3c3ace0602 100644 --- a/app/code/core/Mage/Admin/Model/Mysql4/Acl/Role/Collection.php +++ b/app/code/core/Mage/Admin/Model/Mysql4/Acl/Role/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Mysql4/Permissions/Collection.php b/app/code/core/Mage/Admin/Model/Mysql4/Permissions/Collection.php index 1f12bb85f3..627824d818 100644 --- a/app/code/core/Mage/Admin/Model/Mysql4/Permissions/Collection.php +++ b/app/code/core/Mage/Admin/Model/Mysql4/Permissions/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Mysql4/Role.php b/app/code/core/Mage/Admin/Model/Mysql4/Role.php index dccea2f2c7..a0083331e5 100644 --- a/app/code/core/Mage/Admin/Model/Mysql4/Role.php +++ b/app/code/core/Mage/Admin/Model/Mysql4/Role.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Mysql4/Role/Collection.php b/app/code/core/Mage/Admin/Model/Mysql4/Role/Collection.php index ef8e3c171e..386d4cb719 100644 --- a/app/code/core/Mage/Admin/Model/Mysql4/Role/Collection.php +++ b/app/code/core/Mage/Admin/Model/Mysql4/Role/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Mysql4/Roles.php b/app/code/core/Mage/Admin/Model/Mysql4/Roles.php index 58ecd66ab5..5c042fbb01 100644 --- a/app/code/core/Mage/Admin/Model/Mysql4/Roles.php +++ b/app/code/core/Mage/Admin/Model/Mysql4/Roles.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Mysql4/Roles/Collection.php b/app/code/core/Mage/Admin/Model/Mysql4/Roles/Collection.php index 323a3fc720..0a949ba5d2 100644 --- a/app/code/core/Mage/Admin/Model/Mysql4/Roles/Collection.php +++ b/app/code/core/Mage/Admin/Model/Mysql4/Roles/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Mysql4/Roles/User/Collection.php b/app/code/core/Mage/Admin/Model/Mysql4/Roles/User/Collection.php index e545733f7a..63cb13dccd 100644 --- a/app/code/core/Mage/Admin/Model/Mysql4/Roles/User/Collection.php +++ b/app/code/core/Mage/Admin/Model/Mysql4/Roles/User/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Mysql4/Rules.php b/app/code/core/Mage/Admin/Model/Mysql4/Rules.php index 251c46605e..a0e94e0bcf 100644 --- a/app/code/core/Mage/Admin/Model/Mysql4/Rules.php +++ b/app/code/core/Mage/Admin/Model/Mysql4/Rules.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Mysql4/Rules/Collection.php b/app/code/core/Mage/Admin/Model/Mysql4/Rules/Collection.php index c6b4685a96..1b76a1f781 100644 --- a/app/code/core/Mage/Admin/Model/Mysql4/Rules/Collection.php +++ b/app/code/core/Mage/Admin/Model/Mysql4/Rules/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Mysql4/User.php b/app/code/core/Mage/Admin/Model/Mysql4/User.php index 38f2cecffd..386d7eb8fd 100644 --- a/app/code/core/Mage/Admin/Model/Mysql4/User.php +++ b/app/code/core/Mage/Admin/Model/Mysql4/User.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Mysql4/User/Collection.php b/app/code/core/Mage/Admin/Model/Mysql4/User/Collection.php index d01fb689b0..b39f1a91f1 100644 --- a/app/code/core/Mage/Admin/Model/Mysql4/User/Collection.php +++ b/app/code/core/Mage/Admin/Model/Mysql4/User/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Observer.php b/app/code/core/Mage/Admin/Model/Observer.php index fb8f2c6f91..1644cb358e 100644 --- a/app/code/core/Mage/Admin/Model/Observer.php +++ b/app/code/core/Mage/Admin/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -81,4 +81,14 @@ public function actionPreDispatchAdmin($event) $session->refreshAcl(); } + + /** + * Unset session first visit flag after displaying page + * + * @deprecated after 1.4.0.1, logic moved to admin session + * @param Varien_Event_Observer $event + */ + public function actionPostDispatchAdmin($event) + { + } } diff --git a/app/code/core/Mage/Admin/Model/Role.php b/app/code/core/Mage/Admin/Model/Role.php index 20b03a910a..81351b013e 100644 --- a/app/code/core/Mage/Admin/Model/Role.php +++ b/app/code/core/Mage/Admin/Model/Role.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Roles.php b/app/code/core/Mage/Admin/Model/Roles.php index c26fa7d9a3..b6d2c29d0b 100644 --- a/app/code/core/Mage/Admin/Model/Roles.php +++ b/app/code/core/Mage/Admin/Model/Roles.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Rules.php b/app/code/core/Mage/Admin/Model/Rules.php index 4a69fdefc8..4d492921de 100644 --- a/app/code/core/Mage/Admin/Model/Rules.php +++ b/app/code/core/Mage/Admin/Model/Rules.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/Session.php b/app/code/core/Mage/Admin/Model/Session.php index 9f2140ced9..7cbebe1112 100644 --- a/app/code/core/Mage/Admin/Model/Session.php +++ b/app/code/core/Mage/Admin/Model/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/Model/User.php b/app/code/core/Mage/Admin/Model/User.php index 9e093ffdc5..6eecf223e6 100644 --- a/app/code/core/Mage/Admin/Model/User.php +++ b/app/code/core/Mage/Admin/Model/User.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -236,7 +236,7 @@ public function authenticate($username, $password) Mage::throwException(Mage::helper('adminhtml')->__('This account is inactive.')); } if (!$this->hasAssigned2Role($this->getId())) { - Mage::throwException(Mage::helper('adminhtml')->__('Access Denied.')); + Mage::throwException(Mage::helper('adminhtml')->__('Access denied.')); } $result = true; } @@ -408,7 +408,7 @@ public function validate() } if ($this->userExists()) { - $errors[] = Mage::helper('adminhtml')->__('User with the same User Name or Email aleady exists'); + $errors[] = Mage::helper('adminhtml')->__('A user with the same user name or email aleady exists.'); } if (empty($errors)) { diff --git a/app/code/core/Mage/Admin/etc/config.xml b/app/code/core/Mage/Admin/etc/config.xml index 7dff9283a5..f32cec09ea 100644 --- a/app/code/core/Mage/Admin/etc/config.xml +++ b/app/code/core/Mage/Admin/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Admin/sql/admin_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Admin/sql/admin_setup/mysql4-install-0.7.0.php index e64ffcb41f..ad1f7946e0 100644 --- a/app/code/core/Mage/Admin/sql/admin_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Admin/sql/admin_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/sql/admin_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/Admin/sql/admin_setup/mysql4-upgrade-0.7.0-0.7.1.php index d1bd8b2b45..cae86380cc 100644 --- a/app/code/core/Mage/Admin/sql/admin_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/Admin/sql/admin_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Admin/sql/admin_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/Admin/sql/admin_setup/mysql4-upgrade-0.7.1-0.7.2.php index ec725f1034..44c559c79b 100644 --- a/app/code/core/Mage/Admin/sql/admin_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/Admin/sql/admin_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Admin - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/AdminNotification/Helper/Data.php b/app/code/core/Mage/AdminNotification/Helper/Data.php index 971c5e58c4..4ca99e64ee 100644 --- a/app/code/core/Mage/AdminNotification/Helper/Data.php +++ b/app/code/core/Mage/AdminNotification/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_AdminNotification - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/AdminNotification/Model/Feed.php b/app/code/core/Mage/AdminNotification/Model/Feed.php index 2bf867652c..f995cd862d 100644 --- a/app/code/core/Mage/AdminNotification/Model/Feed.php +++ b/app/code/core/Mage/AdminNotification/Model/Feed.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_AdminNotification - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/AdminNotification/Model/Inbox.php b/app/code/core/Mage/AdminNotification/Model/Inbox.php index a74b72e2ab..44107d55be 100644 --- a/app/code/core/Mage/AdminNotification/Model/Inbox.php +++ b/app/code/core/Mage/AdminNotification/Model/Inbox.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_AdminNotification - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/AdminNotification/Model/Mysql4/Inbox.php b/app/code/core/Mage/AdminNotification/Model/Mysql4/Inbox.php index 66a286b333..dbb8ed5d89 100644 --- a/app/code/core/Mage/AdminNotification/Model/Mysql4/Inbox.php +++ b/app/code/core/Mage/AdminNotification/Model/Mysql4/Inbox.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_AdminNotification - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/AdminNotification/Model/Mysql4/Inbox/Collection.php b/app/code/core/Mage/AdminNotification/Model/Mysql4/Inbox/Collection.php index f5fb63e5d9..e16c6ee6c1 100644 --- a/app/code/core/Mage/AdminNotification/Model/Mysql4/Inbox/Collection.php +++ b/app/code/core/Mage/AdminNotification/Model/Mysql4/Inbox/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_AdminNotification - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/AdminNotification/Model/Observer.php b/app/code/core/Mage/AdminNotification/Model/Observer.php index 518062c8fc..339d5d2fe5 100644 --- a/app/code/core/Mage/AdminNotification/Model/Observer.php +++ b/app/code/core/Mage/AdminNotification/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_AdminNotification - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/AdminNotification/Model/Survey.php b/app/code/core/Mage/AdminNotification/Model/Survey.php index d0ce1f4204..5d0466abd9 100644 --- a/app/code/core/Mage/AdminNotification/Model/Survey.php +++ b/app/code/core/Mage/AdminNotification/Model/Survey.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_AdminNotification - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/AdminNotification/etc/adminhtml.xml b/app/code/core/Mage/AdminNotification/etc/adminhtml.xml index 28a4dd0812..98f03d6ba2 100644 --- a/app/code/core/Mage/AdminNotification/etc/adminhtml.xml +++ b/app/code/core/Mage/AdminNotification/etc/adminhtml.xml @@ -1,4 +1,4 @@ - + diff --git a/app/code/core/Mage/AdminNotification/etc/config.xml b/app/code/core/Mage/AdminNotification/etc/config.xml index ca99192da4..d7f1dde028 100644 --- a/app/code/core/Mage/AdminNotification/etc/config.xml +++ b/app/code/core/Mage/AdminNotification/etc/config.xml @@ -1,4 +1,4 @@ - + diff --git a/app/code/core/Mage/AdminNotification/etc/system.xml b/app/code/core/Mage/AdminNotification/etc/system.xml index 3fc8e7066e..0d63ce4e50 100644 --- a/app/code/core/Mage/AdminNotification/etc/system.xml +++ b/app/code/core/Mage/AdminNotification/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_AdminNotification - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -38,7 +38,7 @@ 0 - + select adminhtml/system_config_source_yesno 1 @@ -47,7 +47,7 @@ 0 - + select adminhtml/system_config_source_notification_frequency 2 @@ -56,7 +56,7 @@ 0 - + label adminhtml/system_config_form_field_notification 3 diff --git a/app/code/core/Mage/AdminNotification/sql/adminnotification_setup/mysql4-install-1.0.0.php b/app/code/core/Mage/AdminNotification/sql/adminnotification_setup/mysql4-install-1.0.0.php index 3e5e54d36b..403a68fda9 100644 --- a/app/code/core/Mage/AdminNotification/sql/adminnotification_setup/mysql4-install-1.0.0.php +++ b/app/code/core/Mage/AdminNotification/sql/adminnotification_setup/mysql4-install-1.0.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_AdminNotification - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Abstract.php index d05de0e08e..82c188e39d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Block/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Buttons.php b/app/code/core/Mage/Adminhtml/Block/Api/Buttons.php index bfdbdd0f73..e0db50babe 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/Buttons.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/Buttons.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Editroles.php b/app/code/core/Mage/Adminhtml/Block/Api/Editroles.php index 2067e48fcd..61c4362d24 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/Editroles.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/Editroles.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Edituser.php b/app/code/core/Mage/Adminhtml/Block/Api/Edituser.php index ba9737459d..5ec0db4f12 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/Edituser.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/Edituser.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Grid/Role.php b/app/code/core/Mage/Adminhtml/Block/Api/Grid/Role.php index 277b941c66..6a2c444a1b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/Grid/Role.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/Grid/Role.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Role.php b/app/code/core/Mage/Adminhtml/Block/Api/Role.php index d93cf0e7ef..93cd907c26 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/Role.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/Role.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php b/app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php index aa94255ad3..0cdc3aa686 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Roles.php b/app/code/core/Mage/Adminhtml/Block/Api/Roles.php index 6c68ea6588..754989d28e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/Roles.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/Roles.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Roleinfo.php b/app/code/core/Mage/Adminhtml/Block/Api/Tab/Roleinfo.php index 09d5757915..190bed8b34 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Roleinfo.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/Tab/Roleinfo.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesedit.php b/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesedit.php index da1327580f..abd256b0c6 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesedit.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesedit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesusers.php b/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesusers.php index d1ea44a431..45f26e90df 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesusers.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesusers.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Userroles.php b/app/code/core/Mage/Adminhtml/Block/Api/Tab/Userroles.php index 0b980c3604..496fa7ded8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/Tab/Userroles.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/Tab/Userroles.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Block_Api_Tab_Userroles extends Mage_Adminhtml_Block_Widget_Tabs diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User.php b/app/code/core/Mage/Adminhtml/Block/Api/User.php index 3580b46865..af031eab92 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/User.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/User.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit.php b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit.php index ea5aac4a3b..d4cb43eff7 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Form.php index 4f2223c629..07c89c9585 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Main.php b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Main.php index 7ccaa0002b..d72b01c94a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Main.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Main.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -91,15 +91,15 @@ protected function _prepareForm() if ($model->getUserId()) { $fieldset->addField('password', 'password', array( 'name' => 'new_api_key', - 'label' => Mage::helper('adminhtml')->__('New Api Key'), + 'label' => Mage::helper('adminhtml')->__('New API Key'), 'id' => 'new_pass', - 'title' => Mage::helper('adminhtml')->__('New Api Key'), + 'title' => Mage::helper('adminhtml')->__('New API Key'), 'class' => 'input-text validate-password', )); $fieldset->addField('confirmation', 'password', array( 'name' => 'api_key_confirmation', - 'label' => Mage::helper('adminhtml')->__('Api Key Confirmation'), + 'label' => Mage::helper('adminhtml')->__('API Key Confirmation'), 'id' => 'confirmation', 'class' => 'input-text validate-cpassword', )); @@ -107,17 +107,17 @@ protected function _prepareForm() else { $fieldset->addField('password', 'password', array( 'name' => 'api_key', - 'label' => Mage::helper('adminhtml')->__('Api Key'), + 'label' => Mage::helper('adminhtml')->__('API Key'), 'id' => 'customer_pass', - 'title' => Mage::helper('adminhtml')->__('Api Key'), + 'title' => Mage::helper('adminhtml')->__('API Key'), 'class' => 'input-text required-entry validate-password', 'required' => true, )); $fieldset->addField('confirmation', 'password', array( 'name' => 'api_key_confirmation', - 'label' => Mage::helper('adminhtml')->__('Api Key Confirmation'), + 'label' => Mage::helper('adminhtml')->__('API Key Confirmation'), 'id' => 'confirmation', - 'title' => Mage::helper('adminhtml')->__('Api Key Confirmation'), + 'title' => Mage::helper('adminhtml')->__('API Key Confirmation'), 'class' => 'input-text required-entry validate-cpassword', 'required' => true, )); diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Roles.php b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Roles.php index 6c51fe6afb..38ca041955 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Roles.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Roles.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tabs.php b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tabs.php index 2d0b5654a8..a380a7f49b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Api/User/Grid.php b/app/code/core/Mage/Adminhtml/Block/Api/User/Grid.php index 49506c7fac..80569613cc 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/User/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/User/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Users.php b/app/code/core/Mage/Adminhtml/Block/Api/Users.php index ee6e7a17af..b53ed6072b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/Users.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/Users.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Backup.php b/app/code/core/Mage/Adminhtml/Block/Backup.php index b071a00504..c4aa363fc4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Backup.php +++ b/app/code/core/Mage/Adminhtml/Block/Backup.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Backup/Grid.php b/app/code/core/Mage/Adminhtml/Block/Backup/Grid.php index c741f98a78..76413087b6 100644 --- a/app/code/core/Mage/Adminhtml/Block/Backup/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Backup/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -65,7 +65,7 @@ protected function _prepareColumns() )); $this->addColumn('size', array( - 'header' => Mage::helper('backup')->__('Size, byte'), + 'header' => Mage::helper('backup')->__('Size, Bytes'), 'index' => 'size', 'type' => 'number', 'sortable' => false, diff --git a/app/code/core/Mage/Adminhtml/Block/Cache.php b/app/code/core/Mage/Adminhtml/Block/Cache.php index 7ca05983fb..130f38319f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cache.php +++ b/app/code/core/Mage/Adminhtml/Block/Cache.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -41,7 +41,7 @@ public function __construct() 'class' => 'delete', )); - $message = Mage::helper('core')->__('Cache storage can contain another data. Are you sure that you want flush it?'); + $message = Mage::helper('core')->__('Cache storage may contain another data. Are you sure that you want flush it?'); $this->_addButton('flush_system', array( 'label' => Mage::helper('core')->__('Flush Cache Storage'), 'onclick' => 'confirmSetLocation(\''.$message.'\', \'' . $this->getFlushStorageUrl() .'\')', diff --git a/app/code/core/Mage/Adminhtml/Block/Cache/Additional.php b/app/code/core/Mage/Adminhtml/Block/Cache/Additional.php index b7942c194c..a8ae7792d9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cache/Additional.php +++ b/app/code/core/Mage/Adminhtml/Block/Cache/Additional.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Cache/Grid.php b/app/code/core/Mage/Adminhtml/Block/Cache/Grid.php index 386a07b69c..89a2f1de35 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cache/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Cache/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -174,6 +174,7 @@ protected function _prepareMassaction() $this->getMassactionBlock()->addItem('refresh', array( 'label' => Mage::helper('index')->__('Refresh'), 'url' => $this->getUrl('*/*/massRefresh'), + 'selected' => true, )); return $this; diff --git a/app/code/core/Mage/Adminhtml/Block/Cache/Notifications.php b/app/code/core/Mage/Adminhtml/Block/Cache/Notifications.php index 170b504d2e..0bc9baebe9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cache/Notifications.php +++ b/app/code/core/Mage/Adminhtml/Block/Cache/Notifications.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog.php b/app/code/core/Mage/Adminhtml/Block/Catalog.php index 75931749f7..b0b65a3022 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Abstract.php index ed91e0678d..b1961d0b40 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -139,8 +139,9 @@ public function getRootByIds($ids) { $root = Mage::registry('root'); if (null === $root) { - $tree = Mage::getResourceSingleton('catalog/category_tree') - ->loadByIds($ids); + $categoryTreeResource = Mage::getResourceSingleton('catalog/category_tree'); + $ids = $categoryTreeResource->getExistingCategoryIdsBySpecifiedIds($ids); + $tree = $categoryTreeResource->loadByIds($ids); $rootId = Mage_Catalog_Model_Category::TREE_ROOT_ID; $root = $tree->getNodeById($rootId); if ($root && $rootId != Mage_Catalog_Model_Category::TREE_ROOT_ID) { diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Checkboxes/Tree.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Checkboxes/Tree.php index 3d0875175d..4cde9e642a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Checkboxes/Tree.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Checkboxes/Tree.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit.php index c2ae48c0b1..323d54f919 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php index cdf87d7b86..4a645cec06 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -180,7 +180,7 @@ public function getHeader() if ($this->hasStoreRootCategory()) { return $this->getCategoryId() ? $this->getCategoryName() : Mage::helper('catalog')->__('New Category'); } - return Mage::helper('catalog')->__('Set Root Category For Store'); + return Mage::helper('catalog')->__('Set Root Category for Store'); } public function getDeleteUrl(array $args = array()) diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Image.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Image.php index 4c4cc7057e..fb5b257203 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Image.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Image.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Available.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Available.php index b779d06859..bb45b2ff5e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Available.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Available.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -56,7 +56,7 @@ public function getElementHtml() $html .= ' disabled="disabled"'; } - $html .= 'onclick="toggleValueElements(this, this.parentNode);" class="checkbox" type="checkbox">'; + $html .= ' onclick="toggleValueElements(this, this.parentNode);" class="checkbox" type="checkbox" />'; $html .= ' '; diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Default.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Default.php index 8964fdade3..cb68ff80c4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Default.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Helper/Sortby/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -54,7 +54,7 @@ public function getElementHtml() if ($this->getReadonly()) { $html .= ' disabled="disabled"'; } - $html .= 'onclick="toggleValueElements(this, this.parentNode);" class="checkbox" type="checkbox">'; + $html .= ' onclick="toggleValueElements(this, this.parentNode);" class="checkbox" type="checkbox" />'; diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Attributes.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Attributes.php index f065296a1f..b3bc9f022f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Attributes.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Attributes.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -109,7 +109,7 @@ protected function _prepareForm() { )); } } - + $this->_setFieldset($attributes, $fieldset); foreach ($attributes as $attribute) { @@ -121,6 +121,10 @@ protected function _prepareForm() { 'name' => 'url_key', 'value' => $this->getCategory()->getUrlKey() )); + } else { + $form->getElement('url_key')->setRenderer( + $this->getLayout()->createBlock('adminhtml/catalog_form_renderer_attribute_urlkey') + ); } } } @@ -133,6 +137,10 @@ protected function _prepareForm() { } } + if (!$this->getCategory()->getId()){ + $this->getCategory()->setIncludeInMenu(1); + } + $form->addValues($this->getCategory()->getData()); $form->setFieldNameSuffix('general'); diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Design.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Design.php index d237c795cf..5183cc9fa8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Design.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Design.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Block_Catalog_Category_Tab_Design extends Mage_Adminhtml_Block_Catalog_Form diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/General.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/General.php index 49a786738b..e3bdd0de9d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/General.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/General.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php index 5e518e5bf7..2b97d65741 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tabs.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tabs.php index df67e08299..106ce3d187 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php index dd2e9014f2..965342a8f0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Widget/Chooser.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Widget/Chooser.php index 3f1936a850..ec2cb3c047 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Widget/Chooser.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Widget/Chooser.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -113,7 +113,9 @@ public function getNodeClickListener() if ($this->getUseMassaction()) { $js = ' function (node, e) { - node.ui.toggleCheck(true); + if (node.ui.toggleCheck) { + node.ui.toggleCheck(true); + } } '; } else { diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Form.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Form.php index c9bd0945fe..f98e06cf3b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Attribute/Urlkey.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Attribute/Urlkey.php new file mode 100644 index 0000000000..cd1435bef9 --- /dev/null +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Attribute/Urlkey.php @@ -0,0 +1,65 @@ + + */ + +class Mage_Adminhtml_Block_Catalog_Form_Renderer_Attribute_Urlkey + extends Mage_Adminhtml_Block_Catalog_Form_Renderer_Fieldset_Element +{ + public function getElementHtml() + { + $element = $this->getElement(); + if(!$element->getValue()) { + return parent::getElementHtml(); + } + $element->setOnkeyup("onUrlkeyChanged('" . $element->getHtmlId() . "')"); + $element->setOnchange("onUrlkeyChanged('" . $element->getHtmlId() . "')"); + + $data = array( + 'name' => $element->getData('name') . '_create_redirect', + 'disabled' => true, + ); + $hidden = new Varien_Data_Form_Element_Hidden($data); + $hidden->setForm($element->getForm()); + + $storeId = $element->getForm()->getDataObject()->getStoreId(); + $data['html_id'] = $element->getHtmlId() . '_create_redirect'; + $data['label'] = Mage::helper('catalog')->__('Create Permanent Redirect for old URL'); + $data['value'] = $element->getValue(); + $data['checked'] = Mage::helper('catalog')->shouldSaveUrlRewritesHistory($storeId); + $checkbox = new Varien_Data_Form_Element_Checkbox($data); + $checkbox->setForm($element->getForm()); + + return parent::getElementHtml() . $hidden->getElementHtml() . $checkbox->getElementHtml() . $checkbox->getLabelHtml(); + } +} diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Config/DateFieldsOrder.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Config/DateFieldsOrder.php index de77324552..402b8c85e2 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Config/DateFieldsOrder.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Config/DateFieldsOrder.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Config/YearRange.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Config/YearRange.php index 2bdff4f940..afedf29a5f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Config/YearRange.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Config/YearRange.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Fieldset/Element.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Fieldset/Element.php index 8dd5d0a722..90447be1f0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Fieldset/Element.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Fieldset/Element.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Googleoptimizer/Import.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Googleoptimizer/Import.php index 0e7754cad6..ad3acd1718 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Googleoptimizer/Import.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Form/Renderer/Googleoptimizer/Import.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg.php index 3c629547b4..4c67f51978 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,10 +42,13 @@ public function getAfterElementHtml() { $html = parent::getAfterElementHtml(); if ($this->getIsWysiwygEnabled()) { + $disabled = ($this->getDisabled() || $this->getReadonly()); $html .= Mage::getSingleton('core/layout') ->createBlock('adminhtml/widget_button', '', array( 'label' => Mage::helper('catalog')->__('WYSIWYG Editor'), 'type' => 'button', + 'disabled' => $disabled, + 'class' => ($disabled) ? 'disabled' : '', 'onclick' => 'catalogWysiwygEditor.open(\''.Mage::helper('adminhtml')->getUrl('*/*/wysiwyg').'\', \''.$this->getHtmlId().'\')' ))->toHtml(); } diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg/Content.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg/Content.php index 5f694e99f0..49a5ae005a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg/Content.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg/Content.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -44,8 +44,13 @@ protected function _prepareForm() { $form = new Varien_Data_Form(array('id' => 'wysiwyg_edit_form', 'action' => $this->getData('action'), 'method' => 'post')); - $config['add_variables'] = false; - $config['add_widgets'] = false; + $config['document_base_url'] = $this->getData('store_media_url'); + $config['store_id'] = $this->getData('store_id'); + $config['add_variables'] = false; + $config['add_widgets'] = false; + $config['add_directives'] = true; + $config['use_container'] = true; + $config['container_class'] = 'hor-scroll'; $form->addField($this->getData('editor_element_id'), 'editor', array( 'name' => 'content', diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product.php index c45d2f08dc..7103af6e6b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute.php index 2d50ea5e4e..30a139abe8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit.php index 4f04508fb8..e94a2aa9de 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -57,7 +57,7 @@ public function __construct() $this->_addButton( 'save_and_edit_button', array( - 'label' => Mage::helper('catalog')->__('Save And Continue Edit'), + 'label' => Mage::helper('catalog')->__('Save and Continue Edit'), 'onclick' => 'saveAndContinueEdit()', 'class' => 'save' ), diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Form.php index 38a1eb7f90..42def14c88 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Front.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Front.php index 55836239ac..0d657cf53c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Front.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Front.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -56,29 +56,29 @@ protected function _prepareForm() $fieldset->addField('is_searchable', 'select', array( 'name' => 'is_searchable', - 'label' => Mage::helper('catalog')->__('Use in quick search'), - 'title' => Mage::helper('catalog')->__('Use in quick search'), + 'label' => Mage::helper('catalog')->__('Use in Quick Search'), + 'title' => Mage::helper('catalog')->__('Use in Quick Search'), 'values' => $yesno, )); $fieldset->addField('is_visible_in_advanced_search', 'select', array( 'name' => 'is_visible_in_advanced_search', - 'label' => Mage::helper('catalog')->__('Use in advanced search'), - 'title' => Mage::helper('catalog')->__('Use in advanced search'), + 'label' => Mage::helper('catalog')->__('Use in Advanced Search'), + 'title' => Mage::helper('catalog')->__('Use in Advanced Search'), 'values' => $yesno, )); $fieldset->addField('is_comparable', 'select', array( 'name' => 'is_comparable', - 'label' => Mage::helper('catalog')->__('Comparable on Front-end'), - 'title' => Mage::helper('catalog')->__('Comparable on Front-end'), + 'label' => Mage::helper('catalog')->__('Comparable on the Frontend'), + 'title' => Mage::helper('catalog')->__('Comparable on the Frontend'), 'values' => $yesno, )); $fieldset->addField('is_filterable', 'select', array( 'name' => 'is_filterable', - 'label' => Mage::helper('catalog')->__("Use In Layered Navigation
    (Can be used only with catalog input type 'Dropdown')"), + 'label' => Mage::helper('catalog')->__("Use in Layered Navigation
    (Can be used only with catalog input type 'Dropdown')"), 'title' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown'), 'values' => array( array('value' => '0', 'label' => Mage::helper('catalog')->__('No')), diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php index c7f857e82a..867135a779 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -128,15 +128,15 @@ protected function _prepareForm() $fieldset->addField('is_searchable', 'select', array( 'name' => 'is_searchable', - 'label' => Mage::helper('catalog')->__('Use in quick search'), - 'title' => Mage::helper('catalog')->__('Use in quick search'), + 'label' => Mage::helper('catalog')->__('Use in Quick Search'), + 'title' => Mage::helper('catalog')->__('Use in Quick Search'), 'values' => $yesnoSource, )); $fieldset->addField('is_visible_in_advanced_search', 'select', array( 'name' => 'is_visible_in_advanced_search', - 'label' => Mage::helper('catalog')->__('Use in advanced search'), - 'title' => Mage::helper('catalog')->__('Use in advanced search'), + 'label' => Mage::helper('catalog')->__('Use in Advanced Search'), + 'title' => Mage::helper('catalog')->__('Use in Advanced Search'), 'values' => $yesnoSource, )); @@ -167,17 +167,17 @@ protected function _prepareForm() 'values' => $yesnoSource, )); - $fieldset->addField('is_used_for_price_rules', 'select', array( - 'name' => 'is_used_for_price_rules', - 'label' => Mage::helper('catalog')->__('Use for Price Rule Conditions'), - 'title' => Mage::helper('catalog')->__('Use for Price Rule Conditions'), + $fieldset->addField('is_used_for_promo_rules', 'select', array( + 'name' => 'is_used_for_promo_rules', + 'label' => Mage::helper('catalog')->__('Use for Promo Rule Conditions'), + 'title' => Mage::helper('catalog')->__('Use for Promo Rule Conditions'), 'values' => $yesnoSource, )); $fieldset->addField('position', 'text', array( 'name' => 'position', 'label' => Mage::helper('catalog')->__('Position'), - 'title' => Mage::helper('catalog')->__('Position In Layered Navigation'), + 'title' => Mage::helper('catalog')->__('Position in Layered Navigation'), 'note' => Mage::helper('catalog')->__('Position of attribute in layered navigation block'), 'class' => 'validate-digits', )); @@ -191,8 +191,8 @@ protected function _prepareForm() $htmlAllowed = $fieldset->addField('is_html_allowed_on_front', 'select', array( 'name' => 'is_html_allowed_on_front', - 'label' => Mage::helper('catalog')->__('Allow HTML-tags on Front-end'), - 'title' => Mage::helper('catalog')->__('Allow HTML-tags on Front-end'), + 'label' => Mage::helper('catalog')->__('Allow HTML Tags on Frontend'), + 'title' => Mage::helper('catalog')->__('Allow HTML Tags on Frontend'), 'values' => $yesnoSource, )); if (!$attributeObject->getId() || $attributeObject->getIsWysiwygEnabled()) { @@ -208,15 +208,15 @@ protected function _prepareForm() $fieldset->addField('used_in_product_listing', 'select', array( 'name' => 'used_in_product_listing', - 'label' => Mage::helper('catalog')->__('Used in product listing'), - 'title' => Mage::helper('catalog')->__('Used in product listing'), + 'label' => Mage::helper('catalog')->__('Used in Product Listing'), + 'title' => Mage::helper('catalog')->__('Used in Product Listing'), 'note' => Mage::helper('catalog')->__('Depends on design theme'), 'values' => $yesnoSource, )); $fieldset->addField('used_for_sort_by', 'select', array( 'name' => 'used_for_sort_by', - 'label' => Mage::helper('catalog')->__('Used for sorting in product listing'), - 'title' => Mage::helper('catalog')->__('Used for sorting in product listing'), + 'label' => Mage::helper('catalog')->__('Used for Sorting in Product Listing'), + 'title' => Mage::helper('catalog')->__('Used for Sorting in Product Listing'), 'note' => Mage::helper('catalog')->__('Depends on design theme'), 'values' => $yesnoSource, )); @@ -234,6 +234,8 @@ protected function _prepareForm() $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence') ->addFieldMap("is_wysiwyg_enabled", 'wysiwyg_enabled') ->addFieldMap("is_html_allowed_on_front", 'html_allowed_on_front') + ->addFieldMap("frontend_input", 'frontend_input_type') + ->addFieldDependence('wysiwyg_enabled', 'frontend_input_type', 'textarea') ->addFieldDependence('html_allowed_on_front', 'wysiwyg_enabled', '0') ); diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Options.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Options.php index 2bd0b4dcd4..ad0898a8dd 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Options.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Options.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/System.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/System.php index 521d92b0db..e35b1bb69c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/System.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/System.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tabs.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tabs.php index 6460a66723..d1e1dd72e2 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Grid.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Grid.php index 237b5b39d3..7362d423a0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -94,7 +94,7 @@ protected function _prepareColumns() ), 'is_user_defined'); $this->addColumnAfter('is_filterable', array( - 'header'=>Mage::helper('catalog')->__('Use In Layered Navigation'), + 'header'=>Mage::helper('catalog')->__('Use in Layered Navigation'), 'sortable'=>true, 'index'=>'is_filterable', 'type' => 'options', diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Attributes.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Attributes.php index d31d38cb4a..c20f627f9b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Attributes.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Attributes.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Created.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Created.php index c741db121a..8ae0021fa0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Created.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Created.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Grid.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Grid.php index 898ed37e65..5194cbc250 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php index 91a083cd99..ec8bcfb284 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formattribute.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formattribute.php index 8641478c35..feff0d6fba 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formattribute.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formattribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formgroup.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formgroup.php index b0028485a0..6343748ee3 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formgroup.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formgroup.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formset.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formset.php index ca8e168881..abd094c94f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formset.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formset.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -46,7 +46,8 @@ protected function _prepareForm() $fieldset = $form->addFieldset('set_name', array('legend'=> Mage::helper('catalog')->__('Edit Set Name'))); $fieldset->addField('attribute_set_name', 'text', array( - 'label' => Mage::helper('catalog')->__('Name
    (For internal use)'), + 'label' => Mage::helper('catalog')->__('Name'), + 'note' => Mage::helper('catalog')->__('For internal use.'), 'name' => 'attribute_set_name', 'required' => true, 'class' => 'required-entry', diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Tree/Attribute.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Tree/Attribute.php index 534db4b3b1..e22a3e0a00 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Tree/Attribute.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Tree/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Tree/Group.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Tree/Group.php index 97863c23cf..ead4f7d413 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Tree/Group.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Tree/Group.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Add.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Add.php index 4721156070..1d7fec4f8f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Add.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Add.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main.php index 91a70c3e96..14809d9e82 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main/Filter.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main/Filter.php index 0b49910538..919363065a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main/Filter.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main/Filter.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Created.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Created.php index 0d37623ff1..dc488921f0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Created.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Created.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit.php index 15382d6a87..b580699c90 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -96,7 +96,7 @@ protected function _prepareLayout() $this->setChild('save_and_edit_button', $this->getLayout()->createBlock('adminhtml/widget_button') ->setData(array( - 'label' => Mage::helper('catalog')->__('Save And Continue Edit'), + 'label' => Mage::helper('catalog')->__('Save and Continue Edit'), 'onclick' => 'saveAndContinueEdit(\''.$this->getSaveAndContinueUrl().'\')', 'class' => 'save' )) diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute.php index 7376318b2e..ecc9f19484 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Attributes.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Attributes.php index 52136a46d9..0670432aa8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Attributes.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Attributes.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -44,7 +44,7 @@ protected function _construct() protected function _prepareForm() { - $this->setFormExcludedFieldList(array('tier_price','gallery', 'media_gallery')); + $this->setFormExcludedFieldList(array('tier_price','gallery', 'media_gallery', 'recurring_profile')); Mage::dispatchEvent('adminhtml_catalog_product_form_prepare_excluded_field_list', array('object'=>$this)); $form = new Varien_Data_Form(); diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Inventory.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Inventory.php index 604adebe5e..f9832504ec 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Inventory.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Inventory.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Websites.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Websites.php index 98d496e39f..706e6cd69f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Websites.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Websites.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tabs.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tabs.php index 6a57501a46..2f65b23c4a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Js.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Js.php index fbc78cecc3..90414aa088 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Js.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Js.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Ajax/Serializer.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Ajax/Serializer.php index f71ac45da9..fafbc2fefe 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Ajax/Serializer.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Ajax/Serializer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts.php index 6ba957ba8c..c562e88de4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -52,14 +52,14 @@ protected function _prepareLayout() if ($alertPriceAllow) { $accordion->addItem('price', array( - 'title' => Mage::helper('adminhtml')->__('Price alert subscription was saved successfully'), + 'title' => Mage::helper('adminhtml')->__('Price alert subscription was saved.'), 'content' => $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_alerts_price')->toHtml() . '
    ', 'open' => true )); } if ($alertStockAllow) { $accordion->addItem('stock', array( - 'title' => Mage::helper('adminhtml')->__('Stock notification was saved successfully'), + 'title' => Mage::helper('adminhtml')->__('Stock notification was saved.'), 'content' => $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_alerts_stock'), 'open' => true )); diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts/Price.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts/Price.php index 51b6bad272..802cc1690b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts/Price.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts/Stock.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts/Stock.php index 7f671e8c2a..a346cabde7 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts/Stock.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts/Stock.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -43,7 +43,7 @@ public function __construct() $this->setDefaultSort('desc'); $this->setUseAjax(true); $this->setFilterVisibility(false); - $this->setEmptyText(Mage::helper('catalog')->__('There are no customers for this alert')); + $this->setEmptyText(Mage::helper('catalog')->__('There are no customers for this alert.')); } protected function _prepareCollection() diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes.php index 5849b55757..9587e7c8a2 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -64,12 +64,24 @@ protected function _prepareForm() $this->_setFieldset($attributes, $fieldset, array('gallery')); + if ($urlKey = $form->getElement('url_key')) { + $urlKey->setRenderer( + $this->getLayout()->createBlock('adminhtml/catalog_form_renderer_attribute_urlkey') + ); + } + if ($tierPrice = $form->getElement('tier_price')) { $tierPrice->setRenderer( $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_price_tier') ); } + if ($recurringProfile = $form->getElement('recurring_profile')) { + $recurringProfile->setRenderer( + $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_price_recurring') + ); + } + /** * Add new attribute button if not image tab */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes/Create.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes/Create.php index c9baebe02e..443d99465f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes/Create.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes/Create.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Categories.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Categories.php index d42cbff1c2..6e1445752c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Categories.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Categories.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Crosssell.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Crosssell.php index fc264565af..bc9226957e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Crosssell.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Crosssell.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -95,8 +95,8 @@ protected function _prepareCollection() $collection = Mage::getModel('catalog/product_link')->useCrossSellLinks() ->getProductCollection() ->setProduct($this->_getProduct()) + ->setPositionOrder() ->addAttributeToSelect('*'); - if ($this->isReadonly()) { $productIds = $this->_getSelectedProducts(); if (empty($productIds)) { @@ -105,6 +105,7 @@ protected function _prepareCollection() $collection->addFieldToFilter('entity_id', array('in'=>$productIds)); } + $this->setCollection($collection); return parent::_prepareCollection(); diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Inventory.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Inventory.php index 529f35cae9..7521c1e79e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Inventory.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Inventory.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options.php index 82ba7aa000..032fabd310 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Option.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Option.php index 3c4d4e32d4..caf77bc0a2 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Option.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Option.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Abstract.php index 72dacd2e70..b3338b3ad6 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Date.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Date.php index 9b24c7bc11..f97c0e443c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Date.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Date.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/File.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/File.php index e1ed76789c..216b5dad71 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/File.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/File.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Select.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Select.php index 0262a0edd3..1fa25ba798 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Select.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Select.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Text.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Text.php index 0e87f68990..3ef622f21d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Text.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Type/Text.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price.php index 0fc236bfee..8cc56e7537 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -41,8 +41,8 @@ protected function _prepareForm() $fieldset = $form->addFieldset('tiered_price', array('legend'=>Mage::helper('catalog')->__('Tier Pricing'))); $fieldset->addField('default_price', 'label', array( - 'label'=> Mage::helper('catalog')->__('Default price'), - 'title'=> Mage::helper('catalog')->__('Default price'), + 'label'=> Mage::helper('catalog')->__('Default Price'), + 'title'=> Mage::helper('catalog')->__('Default Price'), 'name'=>'default_price', 'bold'=>true, 'value'=>$product->getPrice() diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Recurring.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Recurring.php new file mode 100644 index 0000000000..8d53918bc8 --- /dev/null +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Recurring.php @@ -0,0 +1,49 @@ +output = ''; + Mage::dispatchEvent('catalog_product_edit_form_render_recurring', array( + 'result' => $result, + 'product_element' => $this->_element, + 'product' => Mage::registry('current_product'), + )); + return $result->output; + } +} diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Tier.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Tier.php index a277c31fa5..35d3f6b8a0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Tier.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Tier.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Related.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Related.php index eb2a62232a..ac4db82e99 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Related.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Related.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Reviews.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Reviews.php index 31e1ad3ca1..2292dff4f8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Reviews.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Reviews.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Settings.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Settings.php index 4ce85f88d3..ba8ae8d2f3 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Settings.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Settings.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config.php index ea09d62248..cd2499a0f1 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid.php index 88b73b6400..26e89193f8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Filter/Inventory.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Filter/Inventory.php index 96e77999c1..344a7709e1 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Filter/Inventory.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Filter/Inventory.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -44,11 +44,11 @@ protected function _getOptions() ), array( 'value' => 1, - 'label' => Mage::helper('catalog')->__('In stock') + 'label' => Mage::helper('catalog')->__('In Stock') ), array( 'value' => 0, - 'label' => Mage::helper('catalog')->__('Out of stock') + 'label' => Mage::helper('catalog')->__('Out of Stock') ) ); } diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php index 7db5702a40..d30642626c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Checkbox.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Inventory.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Inventory.php index e965ad92d8..5d514ddfcd 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Inventory.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Renderer/Inventory.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Simple.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Simple.php index ae32b57536..bf5cfe75eb 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Simple.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Simple.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Group.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Group.php index 2f50ff072f..8b885a56c8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Group.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Group.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Settings.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Settings.php index c42d1d62ab..dd8816e22f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Settings.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Settings.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -121,7 +121,7 @@ protected function _prepareForm() } else { $fieldset->addField('note_text', 'note', array( - 'text' => $this->__('This attribute set don\'t have attributes which we can use for configurable product') + 'text' => $this->__('This attribute set does not have attributes which we can use for configurable product') )); $fieldset->addField('back_button', 'note', array( 'text' => $this->getChildHtml('back_button'), diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Tag.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Tag.php index ad2c1806f5..b601cc89d1 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Tag.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Tag.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Tag/Customer.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Tag/Customer.php index 92b361b3c4..c4fa62f4ed 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Tag/Customer.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Tag/Customer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Upsell.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Upsell.php index 8ec8174cca..f4e75c23dc 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Upsell.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Upsell.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Websites.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Websites.php index 59a8982808..d71f5345e3 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Websites.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Websites.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs.php index 25b3e5ee46..2dd513f492 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs/Configurable.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs/Configurable.php index c4550b7492..6f4436244e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs/Configurable.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs/Configurable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs/Grouped.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs/Grouped.php index 532c94adad..49643b9b8a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs/Grouped.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs/Grouped.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Frontend/Product/Watermark.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Frontend/Product/Watermark.php index 5e6277a1fa..b32ce16f4a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Frontend/Product/Watermark.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Frontend/Product/Watermark.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php index 78680c7c85..87f21dd6f2 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -69,7 +69,9 @@ protected function _prepareCollection() if ($store->getId()) { //$collection->setStoreId($store->getId()); + $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID; $collection->addStoreFilter($store); + $collection->joinAttribute('name', 'catalog_product/name', 'entity_id', null, 'inner', $adminStore); $collection->joinAttribute('custom_name', 'catalog_product/name', 'entity_id', null, 'inner', $store->getId()); $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner', $store->getId()); $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner', $store->getId()); @@ -122,7 +124,7 @@ protected function _prepareColumns() if ($store->getId()) { $this->addColumn('custom_name', array( - 'header'=> Mage::helper('catalog')->__('Name In %s', $store->getName()), + 'header'=> Mage::helper('catalog')->__('Name in %s', $store->getName()), 'index' => 'custom_name', )); } @@ -260,7 +262,7 @@ protected function _prepareMassaction() if (Mage::getSingleton('admin/session')->isAllowed('catalog/update_attributes')){ $this->getMassactionBlock()->addItem('attributes', array( - 'label' => Mage::helper('catalog')->__('Update attributes'), + 'label' => Mage::helper('catalog')->__('Update Attributes'), 'url' => $this->getUrl('*/catalog_product_action_attribute/edit', array('_current'=>true)) )); } diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Apply.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Apply.php index 97c3b1d56f..c2634c90e3 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Apply.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Apply.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Boolean.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Boolean.php index c000dc4e6e..d9bd68e528 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Boolean.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Boolean.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php index 287540bfd2..4010525dbf 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery/Content.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery/Content.php index e1a6a08a42..601b669068 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery/Content.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery/Content.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Image.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Image.php index 9915f02a76..700aeec402 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Image.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Image.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Price.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Price.php index 884f8da343..2ea5e89520 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Price.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -71,7 +71,7 @@ protected function _getTaxObservingCode($attribute) { $spanId = "dynamic-tax-{$attribute->getAttributeCode()}"; - $html = ""; + $html = ""; return $html; } diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Widget/Chooser.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Widget/Chooser.php index 6e750df9a7..7b65cdc619 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Widget/Chooser.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Widget/Chooser.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Widget/Chooser/Container.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Widget/Chooser/Container.php index 4630235720..60edf587b7 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Widget/Chooser/Container.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Widget/Chooser/Container.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Search.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Search.php index fada21bddd..a7b1ab5818 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Search.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Search.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Search/Edit.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Search/Edit.php index 8572d239ee..417bf6012d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Search/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Search/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Search/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Search/Edit/Form.php index c09ade11df..c39beb8802 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Search/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Search/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -105,8 +105,8 @@ protected function _prepareForm() if ($model->getId()) { $fieldset->addField('num_results', 'text', array( 'name' => 'num_results', - 'label' => Mage::helper('catalog')->__('Number of results
    (For last time placed)'), - 'title' => Mage::helper('catalog')->__('Number of results
    (For last time placed)'), + 'label' => Mage::helper('catalog')->__('Number of results
    (For the last time placed)'), + 'title' => Mage::helper('catalog')->__('Number of results
    (For the last time placed)'), 'required' => true, )); diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Search/Grid.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Search/Grid.php index 73f10ff2b3..f508b42a59 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Search/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Search/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -101,7 +101,7 @@ protected function _prepareColumns() )); $this->addColumn('synonym_for', array( - 'header' => Mage::helper('catalog')->__('Synonym for'), + 'header' => Mage::helper('catalog')->__('Synonym For'), 'align' => 'left', 'index' => 'synonym_for', 'width' => '160px' diff --git a/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement.php b/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement.php index a282aefb38..af400359cd 100644 --- a/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement.php +++ b/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Edit.php b/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Edit.php index 17f5172582..4c353b4be5 100644 --- a/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Edit/Form.php index 2440f288b2..dd760e934b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -117,8 +117,8 @@ protected function _prepareForm() $fieldset->addField('checkbox_text', 'editor', array( 'name' => 'checkbox_text', - 'label' => Mage::helper('checkout')->__('Checkbox text'), - 'title' => Mage::helper('checkout')->__('Checkbox text'), + 'label' => Mage::helper('checkout')->__('Checkbox Text'), + 'title' => Mage::helper('checkout')->__('Checkbox Text'), 'rows' => '5', 'cols' => '30', 'wysiwyg' => false, diff --git a/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Grid.php b/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Grid.php index b0f3a0052c..4ccc5cce1b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Checkout/Agreement/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Block_Checkout_Agreement_Grid extends Mage_Adminhtml_Block_Widget_Grid diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Block.php b/app/code/core/Mage/Adminhtml/Block/Cms/Block.php index e752168be9..53a869eb68 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Block.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Block.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit.php b/app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit.php index 72b4006ca8..2fe28f5f37 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -45,7 +45,7 @@ public function __construct() $this->_updateButton('delete', 'label', Mage::helper('cms')->__('Delete Block')); $this->_addButton('saveandcontinue', array( - 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'), + 'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'), 'onclick' => 'saveAndContinueEdit()', 'class' => 'save', ), -100); diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit/Form.php index 2ad1a81670..3a5d9c36e6 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Block/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Block/Grid.php b/app/code/core/Mage/Adminhtml/Block/Cms/Block/Grid.php index 6aa1c037d2..82bb2e6815 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Block/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Block/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Block/Widget/Chooser.php b/app/code/core/Mage/Adminhtml/Block/Cms/Block/Widget/Chooser.php index 33da9bbae9..524589c932 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Block/Widget/Chooser.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Block/Widget/Chooser.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page.php b/app/code/core/Mage/Adminhtml/Block/Cms/Page.php index c802d05f5e..5f5af7be70 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Page.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Page.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit.php b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit.php index 36ed254fe6..ef66ac59fb 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -44,7 +44,7 @@ public function __construct() if ($this->_isAllowedAction('save')) { $this->_updateButton('save', 'label', Mage::helper('cms')->__('Save Page')); $this->_addButton('saveandcontinue', array( - 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'), + 'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'), 'onclick' => 'saveAndContinueEdit()', 'class' => 'save', ), -100); diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Form.php index 8ca0024bd9..88a1f28998 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php index 0cbf92aec3..fa06da8e07 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Design.php b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Design.php index 1f5ee5e5c2..6c363e3d6a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Design.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Design.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Block_Cms_Page_Edit_Tab_Design diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php index d84ff34cce..b5a58577a3 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Meta.php b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Meta.php index 9f373d5161..200740f390 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Meta.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Meta.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tabs.php b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tabs.php index 21ce6f6098..a3a1e53f12 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Grid.php b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Grid.php index 00cf2852fd..ce8600c074 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Grid/Renderer/Action.php b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Grid/Renderer/Action.php index 97428eabfb..48f040c329 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Grid/Renderer/Action.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Grid/Renderer/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Widget/Chooser.php b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Widget/Chooser.php index 78fee55feb..e4885e1a0b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Widget/Chooser.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Widget/Chooser.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content.php b/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content.php index e81adb0458..3c8c7abc85 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Files.php b/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Files.php index 3a6cf8b770..77fb2352a1 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Files.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Files.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Newfolder.php b/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Newfolder.php index ecce77582d..154e744f83 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Newfolder.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Newfolder.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Uploader.php b/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Uploader.php index d09c57e0a1..27f30a208f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Uploader.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Uploader.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Tree.php b/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Tree.php index c4c7b051ab..6181d579b0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Tree.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Tree.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer.php b/app/code/core/Mage/Adminhtml/Block/Customer.php index 9a5a9986a1..e11f6a1adc 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit.php index ba4735aded..bf2a4e9676 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -91,7 +91,7 @@ protected function _prepareLayout() { if (!Mage::registry('current_customer')->isReadonly()) { $this->_addButton('save_and_continue', array( - 'label' => Mage::helper('customer')->__('Save And Continue Edit'), + 'label' => Mage::helper('customer')->__('Save and Continue Edit'), 'onclick' => 'saveAndContinueEdit(\''.$this->_getSaveAndContinueUrl().'\')', 'class' => 'save' ), 10); diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Form.php index d812fa9cfe..3190f3d9af 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Newpass.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Newpass.php index 0ca1b77ddf..61e5ce3061 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Newpass.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Newpass.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Region.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Region.php index 674e84cddf..94c5d87094 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Region.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Region.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php index 8a825914e4..180147591a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -128,7 +128,7 @@ public function initForm() // prepare send welcome email checkbox $fieldset->addField('sendemail', 'checkbox', array( - 'label' => Mage::helper('customer')->__('Send welcome email'), + 'label' => Mage::helper('customer')->__('Send Welcome Email'), 'name' => 'sendemail', 'id' => 'sendemail', )); diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Addresses.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Addresses.php index 1984fe9cc4..ce5047f504 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Addresses.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Addresses.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Cart.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Cart.php index 1aa058b9f1..86fdb6b623 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Cart.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Cart.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Carts.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Carts.php index b9556c6af8..de010a4f81 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Carts.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Carts.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter.php index 048373ff90..5c231e7094 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -66,7 +66,7 @@ public function initForm() if($changedDate = $this->getStatusChangedDate()) { $fieldset->addField('change_status_date', 'label', array( - 'label' => $subscriber->isSubscribed() ? Mage::helper('customer')->__('Last date subscribed') : Mage::helper('customer')->__('Last date unsubscribed'), + 'label' => $subscriber->isSubscribed() ? Mage::helper('customer')->__('Last Date Subscribed') : Mage::helper('customer')->__('Last Date Unsubscribed'), 'value' => $changedDate, 'bold' => true ) diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid.php index ee057c3e2f..06a1b95766 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Filter/Status.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Filter/Status.php index 29b0c7a41e..fc5612b173 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Filter/Status.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Filter/Status.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Action.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Action.php index 56bdfec7fc..03d47cbbb5 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Action.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Status.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Status.php index 95dcb694f0..a9e0be4945 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Status.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Renderer/Status.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Orders.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Orders.php index 325c66b8db..2efe25afde 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Orders.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Orders.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -44,25 +44,17 @@ public function __construct() protected function _prepareCollection() { - //TODO: add full name logic - $collection = Mage::getResourceModel('sales/order_collection') - ->addAttributeToSelect('increment_id') - ->addAttributeToSelect('created_at') - ->addAttributeToSelect('grand_total') - ->addAttributeToSelect('order_currency_code') - ->addAttributeToSelect('store_id') - ->joinAttribute('billing_firstname', 'order_address/firstname', 'billing_address_id', null, 'left') - ->joinAttribute('billing_lastname', 'order_address/lastname', 'billing_address_id', null, 'left') - ->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left') - ->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left') - ->addExpressionAttributeToSelect('billing_name', - 'CONCAT({{billing_firstname}}, " ", {{billing_lastname}})', - array('billing_firstname', 'billing_lastname')) - ->addExpressionAttributeToSelect('shipping_name', - 'CONCAT({{shipping_firstname}}, " ", {{shipping_lastname}})', - array('shipping_firstname', 'shipping_lastname')) - - ->addAttributeToFilter('customer_id', Mage::registry('current_customer')->getEntityId()) + $collection = Mage::getResourceModel('sales/order_grid_collection') + ->addFieldToSelect('entity_id') + ->addFieldToSelect('increment_id') + ->addFieldToSelect('customer_id') + ->addFieldToSelect('created_at') + ->addFieldToSelect('grand_total') + ->addFieldToSelect('order_currency_code') + ->addFieldToSelect('store_id') + ->addFieldToSelect('billing_name') + ->addFieldToSelect('shipping_name') + ->addFieldToFilter('customer_id', Mage::registry('current_customer')->getId()) ; $this->setCollection($collection); return parent::_prepareCollection(); diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Reviews.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Reviews.php index 051bb02e91..9679f2ece3 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Reviews.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Reviews.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Tag.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Tag.php index 04b782bcf9..f04682eea5 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Tag.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Tag.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Tags.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Tags.php index 1e91ec0ee5..bd0a4f2c17 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Tags.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Tags.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View.php index a2d4c7e2cf..bac0345ab3 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -156,7 +156,7 @@ public function getBillingAddressHtml() $html = $address->format('html'); } else { - $html = Mage::helper('customer')->__('Customer doesn\'t have default billing address'); + $html = Mage::helper('customer')->__('The customer does not have default billing address.'); } return $html; } diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Accordion.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Accordion.php index d2d5788097..ed2b394e05 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Accordion.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Accordion.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Cart.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Cart.php index dc366c270a..6f5a7c98d5 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Cart.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Cart.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Orders.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Orders.php index 4c5c0ebe92..fa08cee459 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Orders.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Orders.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -53,24 +53,8 @@ protected function _preparePage() protected function _prepareCollection() { - //TODO: add full name logic - $collection = Mage::getResourceModel('sales/order_collection') - ->addAttributeToSelect('increment_id') - ->addAttributeToSelect('created_at') - ->addAttributeToSelect('grand_total') - ->addAttributeToSelect('order_currency_code') - ->addAttributeToSelect('store_id') - ->joinAttribute('billing_firstname', 'order_address/firstname', 'billing_address_id', null, 'left') - ->joinAttribute('billing_lastname', 'order_address/lastname', 'billing_address_id', null, 'left') - ->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left') - ->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left') - ->addExpressionAttributeToSelect('billing_name', - 'CONCAT({{billing_firstname}}, " ", {{billing_lastname}})', - array('billing_firstname', 'billing_lastname')) - ->addExpressionAttributeToSelect('shipping_name', - 'CONCAT({{shipping_firstname}}, " ", {{shipping_lastname}})', - array('shipping_firstname', 'shipping_lastname')) - ->addAttributeToFilter('customer_id', Mage::registry('current_customer')->getId()); + $collection = Mage::getResourceModel('sales/order_grid_collection') + ->addFieldToFilter('customer_id', Mage::registry('current_customer')->getId()); $this->setCollection($collection); return parent::_prepareCollection(); } @@ -86,7 +70,7 @@ protected function _prepareColumns() )); $this->addColumn('created_at', array( - 'header' => Mage::helper('customer')->__('Purchased at'), + 'header' => Mage::helper('customer')->__('Purchased At'), 'index' => 'created_at', 'type' => 'datetime', )); diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Sales.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Sales.php index f0006eba84..73b013bdf4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Sales.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Sales.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php index 85ce0304c4..59315559c2 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Wishlist.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Wishlist.php index e73f0c8738..a379385270 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Wishlist.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Wishlist.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Wishlist/Grid/Renderer/Description.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Wishlist/Grid/Renderer/Description.php index a794c90ebf..7c3aa2f209 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Wishlist/Grid/Renderer/Description.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Wishlist/Grid/Renderer/Description.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tabs.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tabs.php index 1dd7aaaff5..470fb9d292 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Grid.php b/app/code/core/Mage/Adminhtml/Block/Customer/Grid.php index 64bc8e5193..6eea2e69ad 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -180,12 +180,12 @@ protected function _prepareMassaction() )); $this->getMassactionBlock()->addItem('newsletter_subscribe', array( - 'label' => Mage::helper('customer')->__('Subscribe to newsletter'), + 'label' => Mage::helper('customer')->__('Subscribe to Newsletter'), 'url' => $this->getUrl('*/*/massSubscribe') )); $this->getMassactionBlock()->addItem('newsletter_unsubscribe', array( - 'label' => Mage::helper('customer')->__('Unsubscribe from newsletter'), + 'label' => Mage::helper('customer')->__('Unsubscribe from Newsletter'), 'url' => $this->getUrl('*/*/massUnsubscribe') )); @@ -193,7 +193,7 @@ protected function _prepareMassaction() array_unshift($groups, array('label'=> '', 'value'=> '')); $this->getMassactionBlock()->addItem('assign_group', array( - 'label' => Mage::helper('customer')->__('Assign a customer group'), + 'label' => Mage::helper('customer')->__('Assign a Customer Group'), 'url' => $this->getUrl('*/*/massAssignGroup'), 'additional' => array( 'visibility' => array( diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Grid/Filter/Country.php b/app/code/core/Mage/Adminhtml/Block/Customer/Grid/Filter/Country.php index b022abe124..cb2111e5d2 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Grid/Filter/Country.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Grid/Filter/Country.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Group.php b/app/code/core/Mage/Adminhtml/Block/Customer/Group.php index d026d71b35..148a3e0338 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Group.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Group.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Group/Edit.php b/app/code/core/Mage/Adminhtml/Block/Customer/Group/Edit.php index 5ee18b3c81..b550354f78 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Group/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Group/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Group/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Customer/Group/Edit/Form.php index 5ddca44af8..4514f83bf4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Group/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Group/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -61,8 +61,8 @@ protected function _prepareLayout() $fieldset->addField('tax_class_id', 'select', array( 'name' => 'tax_class', - 'label' => Mage::helper('customer')->__('Tax class'), - 'title' => Mage::helper('customer')->__('Tax class'), + 'label' => Mage::helper('customer')->__('Tax Class'), + 'title' => Mage::helper('customer')->__('Tax Class'), 'class' => 'required-entry', 'required' => true, 'values' => Mage::getSingleton('tax/class_source_customer')->toOptionArray() diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Group/Grid.php b/app/code/core/Mage/Adminhtml/Block/Customer/Group/Grid.php index 9d06d6fd6e..f26db7f44b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Group/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Group/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Online.php b/app/code/core/Mage/Adminhtml/Block/Customer/Online.php index 22b8a46257..08525b6e2c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Online.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Online.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Online/Filter.php b/app/code/core/Mage/Adminhtml/Block/Customer/Online/Filter.php index 6e09862697..3acb2cb9c8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Online/Filter.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Online/Filter.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid.php b/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid.php index a47fb8b4ba..759cf59589 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -141,7 +141,7 @@ protected function _prepareColumns() )); $this->addColumn('last_url', array( - 'header' => Mage::helper('customer')->__('Last Url'), + 'header' => Mage::helper('customer')->__('Last URL'), 'type' => 'wrapline', 'lineLength' => '60', 'default' => Mage::helper('customer')->__('n/a'), diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Ip.php b/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Ip.php index e95ec04acf..2847e2f609 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Ip.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Ip.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Type.php b/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Type.php index 4b5b4c9475..9e73127394 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Type.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Url.php b/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Url.php index cf85beed21..4a8246fa08 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Url.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Online/Grid/Renderer/Url.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard.php b/app/code/core/Mage/Adminhtml/Block/Dashboard.php index f61d80c588..b4a4753543 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Abstract.php index 446bb32bdb..111b20bbd3 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Bar.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Bar.php index fe66fd3edc..749e8f430c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Bar.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Bar.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Diagrams.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Diagrams.php index d2d8dc8bdf..8baefc8e47 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Diagrams.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Diagrams.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php index 368be3f28e..877f7f7cfc 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Grid.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Grid.php index 60bc360850..3bbb352117 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Grids.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Grids.php index 2a399fb595..9a2fbf83d0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Grids.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Grids.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Orders/Grid.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Orders/Grid.php index f7300f10d7..b32ddd19da 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Orders/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Orders/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -43,14 +43,10 @@ public function __construct() protected function _prepareCollection() { - //TODO: add full name logic $collection = Mage::getResourceModel('reports/order_collection') ->addItemCountExpr() - ->addExpressionAttributeToSelect('customer', - "IFNULL(CONCAT({{customer_firstname}},' ',{{customer_lastname}}), '{$this->__('Guest')}')", - array('customer_firstname','customer_lastname') - ) - ->setOrder('created_at'); + ->joinCustomerName('customer') + ->orderByCreatedAt(); if($this->getParam('store') || $this->getParam('website') || $this->getParam('group')) { if ($this->getParam('store')) { @@ -63,13 +59,9 @@ protected function _prepareCollection() $collection->addAttributeToFilter('store_id', array('in' => $storeIds)); } - $collection->addExpressionAttributeToSelect('revenue', - '({{base_grand_total}})', - array('base_grand_total')); + $collection->addRevenueToSelect(); } else { - $collection->addExpressionAttributeToSelect('revenue', - '({{base_grand_total}}*{{base_to_global_rate}})', - array('base_grand_total', 'base_to_global_rate')); + $collection->addRevenueToSelect(true); } $this->setCollection($collection); @@ -77,17 +69,30 @@ protected function _prepareCollection() return parent::_prepareCollection(); } + /** + * Prepares page sizes for dashboard grid with las 5 orders + * + * @return void + */ + protected function _preparePage() + { + $this->getCollection()->setPageSize($this->getParam($this->getVarNameLimit(), $this->_defaultLimit)); + // Remove count of total orders $this->getCollection()->setCurPage($this->getParam($this->getVarNamePage(), $this->_defaultPage)); + } + protected function _prepareColumns() { $this->addColumn('customer', array( 'header' => $this->__('Customer'), 'sortable' => false, - 'index' => 'customer' + 'index' => 'customer', + 'default' => $this->__('Guest'), )); $this->addColumn('items', array( 'header' => $this->__('Items'), 'align' => 'right', + 'type' => 'number', 'sortable' => false, 'index' => 'items_count' )); diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Sales.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Sales.php index d5f3efa612..18ada207db 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Sales.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Sales.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -50,20 +50,19 @@ protected function _prepareLayout() ->calculateSales($isFilter); if ($this->getRequest()->getParam('store')) { - $collection->addAttributeToFilter('store_id', $this->getRequest()->getParam('store')); + $collection->addFieldToFilter('store_id', $this->getRequest()->getParam('store')); } else if ($this->getRequest()->getParam('website')){ $storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds(); - $collection->addAttributeToFilter('store_id', array('in' => $storeIds)); + $collection->addFieldToFilter('store_id', array('in' => $storeIds)); } else if ($this->getRequest()->getParam('group')){ $storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds(); - $collection->addAttributeToFilter('store_id', array('in' => $storeIds)); + $collection->addFieldToFilter('store_id', array('in' => $storeIds)); } $collection->load(); - $collectionArray = $collection->toArray(); - $sales = array_pop($collectionArray); + $sales = $collection->getFirstItem(); - $this->addTotal($this->__('Lifetime Sales'), $sales['lifetime']); - $this->addTotal($this->__('Average Orders'), $sales['average']); + $this->addTotal($this->__('Lifetime Sales'), $sales->getLifetime()); + $this->addTotal($this->__('Average Orders'), $sales->getAverage()); } } diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Last.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Last.php index 1a25139642..0192918b49 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Last.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Last.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Renderer/Searchquery.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Renderer/Searchquery.php index ab64e06ee7..b09868bed7 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Renderer/Searchquery.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Renderer/Searchquery.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Top.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Top.php index 0a66025b86..415cff9ef9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Top.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Searches/Top.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Amounts.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Amounts.php index 0ae1ca0fe4..8a39baeb39 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Amounts.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Amounts.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Customers/Most.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Customers/Most.php index 9071b0a87f..51c35a1fd8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Customers/Most.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Customers/Most.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Customers/Newest.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Customers/Newest.php index 8379015989..73193b78ad 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Customers/Newest.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Customers/Newest.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -44,9 +44,7 @@ public function __construct() protected function _prepareCollection() { $collection = Mage::getResourceModel('reports/customer_collection') - ->addCustomerName() - ->joinOrders() - ->addOrdersCount(); + ->addCustomerName(); $storeFilter = 0; if ($this->getParam('store')) { @@ -60,7 +58,7 @@ protected function _prepareCollection() $collection->addAttributeToFilter('store_id', array('in' => $storeIds)); } - $collection->addSumAvgTotals($storeFilter) + $collection->addOrdersStatistics($storeFilter) ->orderByCustomerRegistration(); $this->setCollection($collection); diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Orders.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Orders.php index aa1936bfe4..706c1d4c51 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Orders.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Orders.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Products/Ordered.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Products/Ordered.php index 8721c3f548..bdf4eae266 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Products/Ordered.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Products/Ordered.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -53,12 +53,10 @@ protected function _prepareCollection() $storeId = (int)$this->getParam('store'); } - $collection = Mage::getResourceModel('reports/product_collection') - ->addOrderedQty() - ->addAttributeToSelect(array('name', 'price')) - ->setStoreId($storeId) + $collection = Mage::getResourceModel('sales/report_bestsellers_collection') + ->setModel('catalog/product') ->addStoreFilter($storeId) - ->setOrder('ordered_qty', 'desc'); + ; $this->setCollection($collection); @@ -69,27 +67,27 @@ protected function _prepareColumns() { $this->addColumn('name', array( - 'header' =>Mage::helper('reports')->__('Product Name'), + 'header' => Mage::helper('sales')->__('Product Name'), 'sortable' => false, - 'index' =>'name' + 'index' => 'product_name' )); $this->addColumn('price', array( - 'header' =>Mage::helper('reports')->__('Price'), - 'width' =>'120px', - 'type' =>'currency', + 'header' => Mage::helper('sales')->__('Price'), + 'width' => '120px', + 'type' => 'currency', 'currency_code' => (string) Mage::app()->getStore((int)$this->getParam('store'))->getBaseCurrencyCode(), 'sortable' => false, - 'index' =>'price' + 'index' => 'product_price' )); $this->addColumn('ordered_qty', array( - 'header' =>Mage::helper('reports')->__('Quantity Ordered'), - 'width' =>'120px', - 'align' =>'right', + 'header' => Mage::helper('sales')->__('Quantity Ordered'), + 'width' => '120px', + 'align' => 'right', 'sortable' => false, - 'index' =>'ordered_qty', - 'type' =>'number' + 'index' => 'qty_ordered', + 'type' => 'number' )); $this->setFilterVisibility(false); diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Products/Viewed.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Products/Viewed.php index e4c515a07b..0012898e4b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Products/Viewed.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Tab/Products/Viewed.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Totals.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Totals.php index be7db0ce5b..149a524ae1 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Totals.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Totals.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -52,22 +52,26 @@ protected function _prepareLayout() ->calculateTotals($isFilter); if ($this->getRequest()->getParam('store')) { - $collection->addAttributeToFilter('store_id', $this->getRequest()->getParam('store')); + $collection->addFieldToFilter('store_id', $this->getRequest()->getParam('store')); } else if ($this->getRequest()->getParam('website')){ $storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds(); - $collection->addAttributeToFilter('store_id', array('in' => $storeIds)); + $collection->addFieldToFilter('store_id', array('in' => $storeIds)); } else if ($this->getRequest()->getParam('group')){ $storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds(); - $collection->addAttributeToFilter('store_id', array('in' => $storeIds)); + $collection->addFieldToFilter('store_id', array('in' => $storeIds)); + } elseif (!$collection->isLive()) { + $collection->addFieldToFilter('store_id', + array('eq' => Mage::app()->getStore(Mage_Core_Model_Store::ADMIN_CODE)->getId()) + ); } $collection->load(); - $collectionArray = $collection->toArray(); - $totals = array_pop($collectionArray); - $this->addTotal($this->__('Revenue'), $totals['revenue']); - $this->addTotal($this->__('Tax'), $totals['tax']); - $this->addTotal($this->__('Shipping'), $totals['shipping']); - $this->addTotal($this->__('Quantity'), $totals['quantity']*1, true); + $totals = $collection->getFirstItem(); + + $this->addTotal($this->__('Revenue'), $totals->getRevenue()); + $this->addTotal($this->__('Tax'), $totals->getTax()); + $this->addTotal($this->__('Shipping'), $totals->getShipping()); + $this->addTotal($this->__('Quantity'), $totals->getQuantity()*1, true); } } diff --git a/app/code/core/Mage/Adminhtml/Block/Denied.php b/app/code/core/Mage/Adminhtml/Block/Denied.php index 43436c576f..f29003593f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Denied.php +++ b/app/code/core/Mage/Adminhtml/Block/Denied.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Html/Date.php b/app/code/core/Mage/Adminhtml/Block/Html/Date.php index 05a1df1daa..20b32d9540 100644 --- a/app/code/core/Mage/Adminhtml/Block/Html/Date.php +++ b/app/code/core/Mage/Adminhtml/Block/Html/Date.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Html/Select.php b/app/code/core/Mage/Adminhtml/Block/Html/Select.php index 714871d9e2..167e161a80 100644 --- a/app/code/core/Mage/Adminhtml/Block/Html/Select.php +++ b/app/code/core/Mage/Adminhtml/Block/Html/Select.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Media/Editor.php b/app/code/core/Mage/Adminhtml/Block/Media/Editor.php index e2d39b8232..96983ebafb 100644 --- a/app/code/core/Mage/Adminhtml/Block/Media/Editor.php +++ b/app/code/core/Mage/Adminhtml/Block/Media/Editor.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Media/Uploader.php b/app/code/core/Mage/Adminhtml/Block/Media/Uploader.php index 1491db7ec5..51b071bcb7 100644 --- a/app/code/core/Mage/Adminhtml/Block/Media/Uploader.php +++ b/app/code/core/Mage/Adminhtml/Block/Media/Uploader.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Messages.php b/app/code/core/Mage/Adminhtml/Block/Messages.php index d7c9054414..8545383945 100644 --- a/app/code/core/Mage/Adminhtml/Block/Messages.php +++ b/app/code/core/Mage/Adminhtml/Block/Messages.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem.php index aa3949bde7..7e50c298cb 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem/Grid.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem/Grid.php index 0a78f699ef..a14eb219a4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -40,7 +40,7 @@ public function __construct() $this->setSaveParametersInSession(true); $this->setMessageBlockVisibility(true); $this->setUseAjax(true); - $this->setEmptyText(Mage::helper('newsletter')->__('No problems found')); + $this->setEmptyText(Mage::helper('newsletter')->__('No problems found.')); } protected function _prepareCollection() diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem/Grid/Filter/Checkbox.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem/Grid/Filter/Checkbox.php index bc0f7f0fb5..0f4e17f7e6 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem/Grid/Filter/Checkbox.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem/Grid/Filter/Checkbox.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem/Grid/Renderer/Checkbox.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem/Grid/Renderer/Checkbox.php index f6e780d686..fc61ef680c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem/Grid/Renderer/Checkbox.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Problem/Grid/Renderer/Checkbox.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue.php index 86596d12a2..9b7e8f1427 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Edit.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Edit.php index eb4722c58b..cb02882568 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -97,7 +97,7 @@ protected function _prepareLayout() $this->setChild('save_and_resume', $this->getLayout()->createBlock('adminhtml/widget_button') ->setData(array( - 'label' => Mage::helper('newsletter')->__('Save And Resume'), + 'label' => Mage::helper('newsletter')->__('Save and Resume'), 'onclick' => 'queueControl.resume()', 'class' => 'save' )) diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Edit/Form.php index da872be27c..3436afa2a7 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Grid.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Grid.php index b463de3fdc..fbebf59e76 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Grid/Renderer/Action.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Grid/Renderer/Action.php index f08d704ae5..51e6800f29 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Grid/Renderer/Action.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Grid/Renderer/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber.php index fe1ab41000..2f3a9d14da 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -89,7 +89,7 @@ public function getShowQueueAdd() * * @return array */ - public function getQueueAsOptions( ) + public function getQueueAsOptions() { return $this->getQueueCollection()->toOptionArray(); } diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid.php index 5c390b9ced..c2153f00f6 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -94,13 +94,13 @@ protected function _prepareColumns() )); $this->addColumn('firstname', array( - 'header' => Mage::helper('newsletter')->__('Customer Firstname'), + 'header' => Mage::helper('newsletter')->__('Customer First Name'), 'index' => 'customer_firstname', 'default' => '----' )); $this->addColumn('lastname', array( - 'header' => Mage::helper('newsletter')->__('Customer Lastname'), + 'header' => Mage::helper('newsletter')->__('Customer Last Name'), 'index' => 'customer_lastname', 'default' => '----' )); @@ -110,7 +110,7 @@ protected function _prepareColumns() 'index' => 'subscriber_status', 'type' => 'options', 'options' => array( - Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE => Mage::helper('newsletter')->__('Not activated'), + Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE => Mage::helper('newsletter')->__('Not Activated'), Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED => Mage::helper('newsletter')->__('Subscribed'), Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED => Mage::helper('newsletter')->__('Unsubscribed'), ) diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Filter/Checkbox.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Filter/Checkbox.php index 894a3c086f..2feb8e039e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Filter/Checkbox.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Filter/Checkbox.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Filter/Website.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Filter/Website.php index f148f2d123..79b3e1be90 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Filter/Website.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Filter/Website.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Renderer/Checkbox.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Renderer/Checkbox.php index 1d7bcd7520..3c401259d4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Renderer/Checkbox.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Renderer/Checkbox.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Template.php index dbe472bf1b..e88d300ba8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Template.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Edit.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Edit.php index 3926e5c73e..0b1a89cbbb 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -93,7 +93,7 @@ protected function _prepareLayout() $this->setChild('to_html_button', $this->getLayout()->createBlock('adminhtml/widget_button') ->setData(array( - 'label' => Mage::helper('newsletter')->__('Return Html Version'), + 'label' => Mage::helper('newsletter')->__('Return HTML Version'), 'onclick' => 'templateControl.unStripTags();', 'id' => 'convert_button_back', 'style' => 'display:none', diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Edit/Form.php index 47141f8462..224ad5d2ae 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid.php index 0aae0a6222..3d4bf52aa8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php index 5a0f23b1cd..fa60d4def9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Sender.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Sender.php index 8e7b4cef6a..80c6032a1c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Sender.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Sender.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Preview.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Preview.php index 120d337ad9..00e3008499 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Preview.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Preview.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Baseurl.php b/app/code/core/Mage/Adminhtml/Block/Notification/Baseurl.php index 038e40363f..f7389f2578 100644 --- a/app/code/core/Mage/Adminhtml/Block/Notification/Baseurl.php +++ b/app/code/core/Mage/Adminhtml/Block/Notification/Baseurl.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Grid.php b/app/code/core/Mage/Adminhtml/Block/Notification/Grid.php index d55a6f51a7..12b8e7a6b6 100644 --- a/app/code/core/Mage/Adminhtml/Block/Notification/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Notification/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Actions.php b/app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Actions.php index 80e7cd598f..e9bd5cf3a3 100644 --- a/app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Actions.php +++ b/app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Actions.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Notice.php b/app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Notice.php index d89eda81e3..c3c4e972e2 100644 --- a/app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Notice.php +++ b/app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Notice.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Severity.php b/app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Severity.php index c031935d76..21dcf061e3 100644 --- a/app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Severity.php +++ b/app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Severity.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Inbox.php b/app/code/core/Mage/Adminhtml/Block/Notification/Inbox.php index 8cc20adfe1..b64482c85e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Notification/Inbox.php +++ b/app/code/core/Mage/Adminhtml/Block/Notification/Inbox.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Survey.php b/app/code/core/Mage/Adminhtml/Block/Notification/Survey.php index e97ee271d9..8d80b3e7e8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Notification/Survey.php +++ b/app/code/core/Mage/Adminhtml/Block/Notification/Survey.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Toolbar.php b/app/code/core/Mage/Adminhtml/Block/Notification/Toolbar.php index f3aa85dbd9..0f27a66863 100644 --- a/app/code/core/Mage/Adminhtml/Block/Notification/Toolbar.php +++ b/app/code/core/Mage/Adminhtml/Block/Notification/Toolbar.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Notification/Window.php b/app/code/core/Mage/Adminhtml/Block/Notification/Window.php index aa9d7fe35b..2592b3dc96 100644 --- a/app/code/core/Mage/Adminhtml/Block/Notification/Window.php +++ b/app/code/core/Mage/Adminhtml/Block/Notification/Window.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Page.php b/app/code/core/Mage/Adminhtml/Block/Page.php index 3159a95ad2..c9a27711be 100644 --- a/app/code/core/Mage/Adminhtml/Block/Page.php +++ b/app/code/core/Mage/Adminhtml/Block/Page.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Page/Footer.php b/app/code/core/Mage/Adminhtml/Block/Page/Footer.php index 895e8911a1..fac5ae3a34 100644 --- a/app/code/core/Mage/Adminhtml/Block/Page/Footer.php +++ b/app/code/core/Mage/Adminhtml/Block/Page/Footer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Page/Head.php b/app/code/core/Mage/Adminhtml/Block/Page/Head.php index 0002799658..506a34b7e1 100644 --- a/app/code/core/Mage/Adminhtml/Block/Page/Head.php +++ b/app/code/core/Mage/Adminhtml/Block/Page/Head.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Page/Header.php b/app/code/core/Mage/Adminhtml/Block/Page/Header.php index f83a5a84e7..6519097192 100644 --- a/app/code/core/Mage/Adminhtml/Block/Page/Header.php +++ b/app/code/core/Mage/Adminhtml/Block/Page/Header.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Page/Menu.php b/app/code/core/Mage/Adminhtml/Block/Page/Menu.php index 9c4d9b7b6e..89ecd881c2 100644 --- a/app/code/core/Mage/Adminhtml/Block/Page/Menu.php +++ b/app/code/core/Mage/Adminhtml/Block/Page/Menu.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -65,15 +65,18 @@ public function getCacheLifetime() } /** - * Retrieve key for cache + * Get Key pieces for caching block content * - * @return string + * @return array */ - public function getCacheKey() + public function getCacheKeyInfo() { - // getting roles for current user, for now one role per user - $id = Mage::getSingleton('admin/session')->getUser()->getId(); - return 'admin_top_nav_'.$this->getActive().'_'.$id.'_'.Mage::app()->getLocale()->getLocaleCode(); + return array( + 'admin_top_nav', + $this->getActive(), + Mage::getSingleton('admin/session')->getUser()->getId(), + Mage::app()->getLocale()->getLocaleCode() + ); } /** diff --git a/app/code/core/Mage/Adminhtml/Block/Page/Notices.php b/app/code/core/Mage/Adminhtml/Block/Page/Notices.php index 30e8e39fd9..c78194d378 100644 --- a/app/code/core/Mage/Adminhtml/Block/Page/Notices.php +++ b/app/code/core/Mage/Adminhtml/Block/Page/Notices.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/Buttons.php b/app/code/core/Mage/Adminhtml/Block/Permissions/Buttons.php index 504c8c6de6..c34507a857 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/Buttons.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/Buttons.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/Editroles.php b/app/code/core/Mage/Adminhtml/Block/Permissions/Editroles.php index b3964bdb58..5b5e307953 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/Editroles.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/Editroles.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/Edituser.php b/app/code/core/Mage/Adminhtml/Block/Permissions/Edituser.php index 9dcc0ceb0d..dc5caec5f2 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/Edituser.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/Edituser.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/Grid/Role.php b/app/code/core/Mage/Adminhtml/Block/Permissions/Grid/Role.php index 5e853ce662..1169cf2c4e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/Grid/Role.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/Grid/Role.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/Grid/User.php b/app/code/core/Mage/Adminhtml/Block/Permissions/Grid/User.php index a4f27e0a74..8766847a27 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/Grid/User.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/Grid/User.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/Role.php b/app/code/core/Mage/Adminhtml/Block/Permissions/Role.php index c3e4f77868..a6cc290ef4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/Role.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/Role.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/Role/Grid/User.php b/app/code/core/Mage/Adminhtml/Block/Permissions/Role/Grid/User.php index 1bd3fb5d8f..e763e883c7 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/Role/Grid/User.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/Role/Grid/User.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/Roles.php b/app/code/core/Mage/Adminhtml/Block/Permissions/Roles.php index 168ff32981..1e00b90b5d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/Roles.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/Roles.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Roleinfo.php b/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Roleinfo.php index 071937e2c6..9092cee197 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Roleinfo.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Roleinfo.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Rolesedit.php b/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Rolesedit.php index 8ec5729838..b1b8667e7c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Rolesedit.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Rolesedit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Rolesusers.php b/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Rolesusers.php index e7c2f82f46..a13f172b0d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Rolesusers.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Rolesusers.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Useredit.php b/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Useredit.php index dbe252c964..5ea476a802 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Useredit.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Useredit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Block_Permissions_Tab_Useredit extends Mage_Adminhtml_Block_Widget_Form @@ -131,9 +131,9 @@ protected function _prepareForm() $fieldset->addField('is_active', 'select', array( 'name' => 'is_active', - 'label' => Mage::helper('adminhtml')->__('This account is'), + 'label' => Mage::helper('adminhtml')->__('This Account is'), 'id' => 'is_active', - 'title' => Mage::helper('adminhtml')->__('Account status'), + 'title' => Mage::helper('adminhtml')->__('Account Status'), 'class' => 'input-select', 'required' => false, 'style' => 'width: 80px', diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Userroles.php b/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Userroles.php index e5eeb2e9f0..adfa1ae9e4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Userroles.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Userroles.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Block_Permissions_Tab_Userroles extends Mage_Adminhtml_Block_Widget_Tabs diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/User.php b/app/code/core/Mage/Adminhtml/Block/Permissions/User.php index 7b32804dd4..1d283f5c44 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/User.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/User.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit.php b/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit.php index 15f9d94b07..6e90344720 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Form.php index c8863950c8..33293e55fd 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Tab/Main.php b/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Tab/Main.php index 79a62c7913..2887bc0d1b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Tab/Main.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Tab/Main.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -128,7 +128,7 @@ protected function _prepareForm() 'name' => 'is_active', 'label' => Mage::helper('adminhtml')->__('This account is'), 'id' => 'is_active', - 'title' => Mage::helper('adminhtml')->__('Account status'), + 'title' => Mage::helper('adminhtml')->__('Account Status'), 'class' => 'input-select', 'style' => 'width: 80px', 'options' => array('1' => Mage::helper('adminhtml')->__('Active'), '0' => Mage::helper('adminhtml')->__('Inactive')), diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Tab/Roles.php b/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Tab/Roles.php index 0f908af179..a172485584 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Tab/Roles.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Tab/Roles.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Tabs.php b/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Tabs.php index 850389f72b..53317a8316 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/User/Grid.php b/app/code/core/Mage/Adminhtml/Block/Permissions/User/Grid.php index 36696e034a..9f4629490c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/User/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/User/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/Usernroles.php b/app/code/core/Mage/Adminhtml/Block/Permissions/Usernroles.php index 7494e56dfe..f6de230cc9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/Usernroles.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/Usernroles.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Block_Permissions_UsernRoles extends Mage_Adminhtml_Block_Template diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/Users.php b/app/code/core/Mage/Adminhtml/Block/Permissions/Users.php index a3cebb659a..86a7db7321 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/Users.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/Users.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Answer/Edit.php b/app/code/core/Mage/Adminhtml/Block/Poll/Answer/Edit.php index c6f376469e..e56e95ebf3 100644 --- a/app/code/core/Mage/Adminhtml/Block/Poll/Answer/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Poll/Answer/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Answer/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Poll/Answer/Edit/Form.php index 1ce0e26f8a..eb6dabf25c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Poll/Answer/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Poll/Answer/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Edit.php b/app/code/core/Mage/Adminhtml/Block/Poll/Edit.php index f53035549f..6154ee61b8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Poll/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Poll/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Form.php index 8b8a5c616a..e519685611 100644 --- a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers.php b/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers.php index e1015f7e89..209d59e4dd 100644 --- a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers.php +++ b/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/Form.php b/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/Form.php index f3ccfaf658..b3e04c45f7 100644 --- a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/Grid.php b/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/Grid.php index 62bcd64f47..ec8c54976e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/List.php b/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/List.php index 8708d37a59..f7c9005450 100644 --- a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/List.php +++ b/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Answers/List.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Form.php b/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Form.php index 0e82ee3f09..0a63aa1739 100644 --- a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tab/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tabs.php b/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tabs.php index ba8bdd3ce3..2f96955bab 100644 --- a/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/Poll/Edit/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Grid.php b/app/code/core/Mage/Adminhtml/Block/Poll/Grid.php index 2d4e057bdb..3760998ba0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Poll/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Poll/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Poll/Poll.php b/app/code/core/Mage/Adminhtml/Block/Poll/Poll.php index b58cae5f23..c2ba57e4d5 100644 --- a/app/code/core/Mage/Adminhtml/Block/Poll/Poll.php +++ b/app/code/core/Mage/Adminhtml/Block/Poll/Poll.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog.php b/app/code/core/Mage/Adminhtml/Block/Promo/Catalog.php index 6d0ee2df93..0126c61d6b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Catalog.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit.php b/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit.php index f4ec61d8d3..145f3cedd9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -59,7 +59,7 @@ public function __construct() 'onclick'=>"$('rule_auto_apply').value=1; editForm.submit()", )); $this->_addButton('save_and_continue', array( - 'label' => Mage::helper('catalogrule')->__('Save And Continue Edit'), + 'label' => Mage::helper('catalogrule')->__('Save and Continue Edit'), 'onclick' => 'saveAndContinueEdit()', 'class' => 'save' ), 10); diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Form.php index 2c0aeeb819..5fcb9f099c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Actions.php b/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Actions.php index 3d481011fb..f2b123e9ec 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Actions.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Actions.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -85,15 +85,15 @@ protected function _prepareForm() $form->setHtmlIdPrefix('rule_'); - $fieldset = $form->addFieldset('action_fieldset', array('legend'=>Mage::helper('salesrule')->__('Update prices using the following information'))); + $fieldset = $form->addFieldset('action_fieldset', array('legend'=>Mage::helper('salesrule')->__('Update Prices Using the Following Information'))); $fieldset->addField('simple_action', 'select', array( 'label' => Mage::helper('salesrule')->__('Apply'), 'name' => 'simple_action', 'options' => array( - 'by_percent' => Mage::helper('salesrule')->__('By Percentage of the original price'), + 'by_percent' => Mage::helper('salesrule')->__('By Percentage of the Original Price'), 'by_fixed' => Mage::helper('salesrule')->__('By Fixed Amount'), - 'to_percent' => Mage::helper('salesrule')->__('To Percentage of the original price'), + 'to_percent' => Mage::helper('salesrule')->__('To Percentage of the Original Price'), 'to_fixed' => Mage::helper('salesrule')->__('To Fixed Amount'), ), )); @@ -102,12 +102,12 @@ protected function _prepareForm() 'name' => 'discount_amount', 'required' => true, 'class' => 'validate-not-negative-number', - 'label' => Mage::helper('salesrule')->__('Discount amount'), + 'label' => Mage::helper('salesrule')->__('Discount Amount'), )); $fieldset->addField('stop_rules_processing', 'select', array( - 'label' => Mage::helper('salesrule')->__('Stop further rules processing'), - 'title' => Mage::helper('salesrule')->__('Stop further rules processing'), + 'label' => Mage::helper('salesrule')->__('Stop Further Rules Processing'), + 'title' => Mage::helper('salesrule')->__('Stop Further Rules Processing'), 'name' => 'stop_rules_processing', 'options' => array( '1' => Mage::helper('salesrule')->__('Yes'), diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Conditions.php b/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Conditions.php index e2f28c7d35..415d365cbb 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Conditions.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Conditions.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -112,8 +112,8 @@ protected function _prepareForm() $fieldset = $form->addFieldset('options_fieldset', array('legend'=>Mage::helper('catalogrule')->__('Options'))); $fieldset->addField('stop_rules_processing', 'select', array( - 'label' => Mage::helper('catalogrule')->__('Stop further rules processing'), - 'title' => Mage::helper('catalogrule')->__('Stop further rules processing'), + 'label' => Mage::helper('catalogrule')->__('Stop Further Rules Processing'), + 'title' => Mage::helper('catalogrule')->__('Stop Further Rules Processing'), 'name' => 'stop_rules_processing', 'required' => true, 'options' => array( diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php b/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php index 0c24a68e62..eb983bed8a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tabs.php b/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tabs.php index c9952a6da2..0b5685ca9d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Grid.php b/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Grid.php index d6d920c38b..604bcdbba3 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote.php b/app/code/core/Mage/Adminhtml/Block/Promo/Quote.php index de736ecf6d..ba9f0a3461 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Quote.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Quote.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit.php b/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit.php index 1cb14b05ff..36525a8725 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -57,7 +57,7 @@ public function __construct() $this->_removeButton('reset'); } else { $this->_addButton('save_and_continue', array( - 'label' => Mage::helper('salesrule')->__('Save And Continue Edit'), + 'label' => Mage::helper('salesrule')->__('Save and Continue Edit'), 'onclick' => 'saveAndContinueEdit()', 'class' => 'save' ), 10); diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Form.php index 77d54b5b36..eea713d732 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php b/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php index 423054b75e..43199f808f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -101,13 +101,13 @@ protected function _prepareForm() 'name' => 'discount_amount', 'required' => true, 'class' => 'validate-not-negative-number', - 'label' => Mage::helper('salesrule')->__('Discount amount'), + 'label' => Mage::helper('salesrule')->__('Discount Amount'), )); $model->setDiscountAmount($model->getDiscountAmount()*1); $fieldset->addField('discount_qty', 'text', array( 'name' => 'discount_qty', - 'label' => Mage::helper('salesrule')->__('Maximum Qty Discount is Applied to'), + 'label' => Mage::helper('salesrule')->__('Maximum Qty Discount is Applied To'), )); $model->setDiscountQty($model->getDiscountQty()*1); @@ -124,8 +124,8 @@ protected function _prepareForm() )); $fieldset->addField('simple_free_shipping', 'select', array( - 'label' => Mage::helper('salesrule')->__('Free shipping'), - 'title' => Mage::helper('salesrule')->__('Free shipping'), + 'label' => Mage::helper('salesrule')->__('Free Shipping'), + 'title' => Mage::helper('salesrule')->__('Free Shipping'), 'name' => 'simple_free_shipping', 'options' => array( 0 => Mage::helper('salesrule')->__('No'), @@ -135,8 +135,8 @@ protected function _prepareForm() )); $fieldset->addField('stop_rules_processing', 'select', array( - 'label' => Mage::helper('salesrule')->__('Stop further rules processing'), - 'title' => Mage::helper('salesrule')->__('Stop further rules processing'), + 'label' => Mage::helper('salesrule')->__('Stop Further Rules Processing'), + 'title' => Mage::helper('salesrule')->__('Stop Further Rules Processing'), 'name' => 'stop_rules_processing', 'options' => array( '1' => Mage::helper('salesrule')->__('Yes'), @@ -154,8 +154,8 @@ protected function _prepareForm() $fieldset->addField('actions', 'text', array( 'name' => 'actions', - 'label' => Mage::helper('salesrule')->__('Apply to'), - 'title' => Mage::helper('salesrule')->__('Apply to'), + 'label' => Mage::helper('salesrule')->__('Apply To'), + 'title' => Mage::helper('salesrule')->__('Apply To'), 'required' => true, ))->setRule($model)->setRenderer(Mage::getBlockSingleton('rule/actions')); diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Conditions.php b/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Conditions.php index c6cbd036ab..83b3dbf0b9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Conditions.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Conditions.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -105,8 +105,8 @@ protected function _prepareForm() $fieldset->addField('actions', 'text', array( 'name' => 'actions', - 'label' => Mage::helper('salesrule')->__('Apply to'), - 'title' => Mage::helper('salesrule')->__('Apply to'), + 'label' => Mage::helper('salesrule')->__('Apply To'), + 'title' => Mage::helper('salesrule')->__('Apply To'), 'required' => true, ))->setRule($model)->setRenderer(Mage::getBlockSingleton('rule/actions')); */ diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Labels.php b/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Labels.php index 8eb7e9cacf..60b9e29464 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Labels.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Labels.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php b/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php index c86ba38d0a..b87eaa5826 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -164,19 +164,27 @@ protected function _prepareForm() 'values' => $customerGroups, )); - $fieldset->addField('coupon_code', 'text', array( + $couponTypeFiled = $fieldset->addField('coupon_type', 'select', array( + 'name' => 'coupon_type', + 'label' => Mage::helper('salesrule')->__('Coupon'), + 'required' => true, + 'options' => Mage::getModel('salesrule/rule')->getCouponTypes(), + )); + + $couponCodeFiled = $fieldset->addField('coupon_code', 'text', array( 'name' => 'coupon_code', - 'label' => Mage::helper('salesrule')->__('Coupon code'), + 'label' => Mage::helper('salesrule')->__('Coupon Code'), + 'required' => true, )); - $fieldset->addField('uses_per_coupon', 'text', array( + $usesPerCouponFiled = $fieldset->addField('uses_per_coupon', 'text', array( 'name' => 'uses_per_coupon', - 'label' => Mage::helper('salesrule')->__('Uses per coupon'), + 'label' => Mage::helper('salesrule')->__('Uses per Coupon'), )); $fieldset->addField('uses_per_customer', 'text', array( 'name' => 'uses_per_customer', - 'label' => Mage::helper('salesrule')->__('Uses per customer'), + 'label' => Mage::helper('salesrule')->__('Uses per Customer'), )); $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT); @@ -229,6 +237,23 @@ protected function _prepareForm() $this->setForm($form); + // field dependencies + $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence') + ->addFieldMap($couponTypeFiled->getHtmlId(), $couponTypeFiled->getName()) + ->addFieldMap($couponCodeFiled->getHtmlId(), $couponCodeFiled->getName()) + ->addFieldMap($usesPerCouponFiled->getHtmlId(), $usesPerCouponFiled->getName()) + ->addFieldDependence( + $couponCodeFiled->getName(), + $couponTypeFiled->getName(), + Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC) + ->addFieldDependence( + $usesPerCouponFiled->getName(), + $couponTypeFiled->getName(), + Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC) + ); + + Mage::dispatchEvent('adminhtml_promo_quote_edit_tab_main_prepare_form', array('form' => $form)); + return parent::_prepareForm(); } } diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tabs.php b/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tabs.php index 235b32f112..da967428c8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Grid.php b/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Grid.php index b1b8bda243..0fe29133b0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -71,7 +71,7 @@ protected function _prepareColumns() 'header' => Mage::helper('salesrule')->__('Coupon Code'), 'align' => 'left', 'width' => '150px', - 'index' => 'coupon_code', + 'index' => 'code', )); $this->addColumn('from_date', array( @@ -102,7 +102,7 @@ protected function _prepareColumns() 0 => 'Inactive', ), )); - + $this->addColumn('sort_order', array( 'header' => Mage::helper('salesrule')->__('Priority'), 'align' => 'right', diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser.php b/app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser.php new file mode 100644 index 0000000000..8f35a68585 --- /dev/null +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser.php @@ -0,0 +1,177 @@ +setDefaultSort('rule_id'); + $this->setDefaultDir('ASC'); + $this->setUseAjax(true); + } + + /** + * Prepare chooser element HTML + * + * @param Varien_Data_Form_Element_Abstract $element Form Element + * @return Varien_Data_Form_Element_Abstract + */ + public function prepareElementHtml(Varien_Data_Form_Element_Abstract $element) + { + $uniqId = Mage::helper('core')->uniqHash($element->getId()); + $sourceUrl = $this->getUrl('*/promo_quote/chooser', array('uniq_id' => $uniqId)); + + $chooser = $this->getLayout()->createBlock('widget/adminhtml_widget_chooser') + ->setElement($element) + ->setTranslationHelper($this->getTranslationHelper()) + ->setConfig($this->getConfig()) + ->setFieldsetId($this->getFieldsetId()) + ->setSourceUrl($sourceUrl) + ->setUniqId($uniqId); + + if ($element->getValue()) { + $rule = Mage::getModel('salesrule/rule')->load((int)$element->getValue()); + if ($rule->getId()) { + $chooser->setLabel($rule->getName()); + } + } + + $element->setData('after_element_html', $chooser->toHtml()); + return $element; + } + + /** + * Grid Row JS Callback + * + * @return string + */ + public function getRowClickCallback() + { + $chooserJsObject = $this->getId(); + $js = ' + function (grid, event) { + var trElement = Event.findElement(event, "tr"); + var ruleName = trElement.down("td").next().innerHTML; + var ruleId = trElement.down("td").innerHTML.replace(/^\s+|\s+$/g,""); + '.$chooserJsObject.'.setElementValue(ruleId); + '.$chooserJsObject.'.setElementLabel(ruleName); + '.$chooserJsObject.'.close(); + } + '; + return $js; + } + + /** + * Prepare rules collection + * + * @return Mage_Adminhtml_Block_Widget_Grid + */ + protected function _prepareCollection() + { + $collection = Mage::getModel('salesrule/rule')->getResourceCollection(); + $this->setCollection($collection); + + return parent::_prepareCollection(); + } + + /** + * Prepare columns for rules grid + * + * @return Mage_Adminhtml_Block_Widget_Grid + */ + protected function _prepareColumns() + { + $this->addColumn('rule_id', array( + 'header' => Mage::helper('salesrule')->__('ID'), + 'align' => 'right', + 'width' => '50px', + 'index' => 'rule_id', + )); + + $this->addColumn('name', array( + 'header' => Mage::helper('salesrule')->__('Rule Name'), + 'align' => 'left', + 'index' => 'name', + )); + + $this->addColumn('coupon_code', array( + 'header' => Mage::helper('salesrule')->__('Coupon Code'), + 'align' => 'left', + 'width' => '150px', + 'index' => 'code', + )); + + $this->addColumn('from_date', array( + 'header' => Mage::helper('salesrule')->__('Date Start'), + 'align' => 'left', + 'width' => '120px', + 'type' => 'date', + 'index' => 'from_date', + )); + + $this->addColumn('to_date', array( + 'header' => Mage::helper('salesrule')->__('Date Expire'), + 'align' => 'left', + 'width' => '120px', + 'type' => 'date', + 'default' => '--', + 'index' => 'to_date', + )); + + $this->addColumn('is_active', array( + 'header' => Mage::helper('salesrule')->__('Status'), + 'align' => 'left', + 'width' => '80px', + 'index' => 'is_active', + 'type' => 'options', + 'options' => array( + 1 => 'Active', + 0 => 'Inactive', + ), + )); + + return parent::_prepareColumns(); + } + + /** + * Prepare grid URL + * + * @return string + */ + public function getGridUrl() + { + return $this->getUrl('*/promo_quote/chooser', array('_current' => true)); + } +} diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser/Daterange.php b/app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser/Daterange.php index e95ba9b998..7991b6cc49 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser/Daterange.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser/Daterange.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser/Sku.php b/app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser/Sku.php index fd3081cc21..11014c7252 100644 --- a/app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser/Sku.php +++ b/app/code/core/Mage/Adminhtml/Block/Promo/Widget/Chooser/Sku.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Rating/Edit.php b/app/code/core/Mage/Adminhtml/Block/Rating/Edit.php index f41e7581cd..f81c19343e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Rating/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Rating/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Form.php index 6dfd9c0447..9ddf8ae9df 100644 --- a/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tab/Form.php b/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tab/Form.php index 42b680046e..4836672bb6 100644 --- a/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tab/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tab/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tab/Options.php b/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tab/Options.php index 80b1dfc100..dda310937f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tab/Options.php +++ b/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tab/Options.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tabs.php b/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tabs.php index bb5d1daafa..8c68243a52 100644 --- a/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Rating/Grid.php b/app/code/core/Mage/Adminhtml/Block/Rating/Grid.php index 3866923a90..547d19be64 100644 --- a/app/code/core/Mage/Adminhtml/Block/Rating/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Rating/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Rating/Rating.php b/app/code/core/Mage/Adminhtml/Block/Rating/Rating.php index 318c5acc3a..3c7b7e2f9f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Rating/Rating.php +++ b/app/code/core/Mage/Adminhtml/Block/Rating/Rating.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Config/Form/Field/MtdStart.php b/app/code/core/Mage/Adminhtml/Block/Report/Config/Form/Field/MtdStart.php index f9e5df22f4..377ee7d867 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Config/Form/Field/MtdStart.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Config/Form/Field/MtdStart.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Config/Form/Field/YtdStart.php b/app/code/core/Mage/Adminhtml/Block/Report/Config/Form/Field/YtdStart.php index d80cce7983..3e455825fd 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Config/Form/Field/YtdStart.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Config/Form/Field/YtdStart.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Customer/Accounts.php b/app/code/core/Mage/Adminhtml/Block/Report/Customer/Accounts.php index af3545276c..71afb08369 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Customer/Accounts.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Customer/Accounts.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Customer/Accounts/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Customer/Accounts/Grid.php index 6acdd7daab..c65d890da4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Customer/Accounts/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Customer/Accounts/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Customer/Orders.php b/app/code/core/Mage/Adminhtml/Block/Report/Customer/Orders.php index 8db8de0733..376fbe7fe1 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Customer/Orders.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Customer/Orders.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Customer/Orders/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Customer/Orders/Grid.php index 6ed222d897..1e1dc3b764 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Customer/Orders/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Customer/Orders/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Customer/Totals.php b/app/code/core/Mage/Adminhtml/Block/Report/Customer/Totals.php index c087deb5b9..f7c4d16c85 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Customer/Totals.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Customer/Totals.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -37,7 +37,7 @@ class Mage_Adminhtml_Block_Report_Customer_Totals extends Mage_Adminhtml_Block_W public function __construct() { $this->_controller = 'report_customer_totals'; - $this->_headerText = Mage::helper('reports')->__('Customers by orders total'); + $this->_headerText = Mage::helper('reports')->__('Customers by Orders Total'); parent::__construct(); $this->_removeButton('add'); } diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Customer/Totals/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Customer/Totals/Grid.php index fbb01ef024..30774403a7 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Customer/Totals/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Customer/Totals/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Filter/Form.php b/app/code/core/Mage/Adminhtml/Block/Report/Filter/Form.php index cc5c046f57..ce08a84c73 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Filter/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Filter/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -31,7 +31,6 @@ * @package Mage_Adminhtml * @author Magento Core Team */ - class Mage_Adminhtml_Block_Report_Filter_Form extends Mage_Adminhtml_Block_Widget_Form { /** @@ -39,6 +38,64 @@ class Mage_Adminhtml_Block_Report_Filter_Form extends Mage_Adminhtml_Block_Widge */ protected $_reportTypeOptions = array(); + /** + * Report field visibility + */ + protected $_fieldVisibility = array(); + + /** + * Report field opions + */ + protected $_fieldOptions = array(); + + /** + * Set field visibility + * + * @param string Field id + * @param bool Field visibility + */ + public function setFieldVisibility($fieldId, $visibility) + { + $this->_fieldVisibility[$fieldId] = (bool)$visibility; + } + + /** + * Get field visibility + * + * @param string Field id + * @param bool Default field visibility + * @return bool + */ + public function getFieldVisibility($fieldId, $defaultVisibility = true) + { + if (!array_key_exists($fieldId, $this->_fieldVisibility)) { + return $defaultVisibility; + } + return $this->_fieldVisibility[$fieldId]; + } + + /** + * Set field option(s) + * + * @param string $fieldId Field id + * @param mixed $option Field option name + * @param mixed $value Field option value + */ + public function setFieldOption($fieldId, $option, $value = null) + { + if (is_array($option)) { + $options = $option; + } else { + $options = array($option => $value); + } + if (!array_key_exists($fieldId, $this->_fieldOptions)) { + $this->_fieldOptions[$fieldId] = array(); + } + foreach ($options as $k => $v) { + $this->_fieldOptions[$fieldId][$k] = $v; + } + } + /** * Add report type option * @@ -52,6 +109,11 @@ public function addReportTypeOption($key, $value) return $this; } + /** + * Add fieldset with general report fields + * + * @return Mage_Adminhtml_Block_Report_Filter_Form + */ protected function _prepareForm() { $actionUrl = $this->getUrl('*/*/sales'); @@ -68,22 +130,10 @@ protected function _prepareForm() 'name' => 'store_ids' )); - $statuses = Mage::getModel('sales/order_config')->getStatuses(); - $values = array(); - foreach ($statuses as $code => $label) { - if (false === strpos($code, 'pending')) { - $values[] = array( - 'label' => Mage::helper('reports')->__($label), - 'value' => $code - ); - } - } - $fieldset->addField('report_type', 'select', array( 'name' => 'report_type', 'options' => $this->_reportTypeOptions, - 'label' => Mage::helper('reports')->__('Report Type'), - 'title' => Mage::helper('reports')->__('Report Type') + 'label' => Mage::helper('reports')->__('Match Period To'), )); $fieldset->addField('period_type', 'select', array( @@ -115,44 +165,65 @@ protected function _prepareForm() 'required' => true )); - $fieldset->addField('show_order_statuses', 'select', array( - 'name' => 'show_order_statuses', - 'label' => Mage::helper('reports')->__('Order Status'), - 'title' => Mage::helper('reports')->__('Order Status'), - 'options' => array( - '0' => Mage::helper('reports')->__('Any'), - '1' => Mage::helper('reports')->__('Specified'), - ), - 'note' => Mage::helper('reports')->__('Applies to Any of the Specified Order Statuses'), - )); - - $fieldset->addField('order_statuses', 'multiselect', array( - 'name' => 'order_statuses', - 'values' => $values, - 'display' => 'none' - )); - $fieldset->addField('show_empty_rows', 'select', array( 'name' => 'show_empty_rows', 'options' => array( - '1' => 'Yes', - '0' => 'No' + '1' => Mage::helper('reports')->__('Yes'), + '0' => Mage::helper('reports')->__('No') ), 'label' => Mage::helper('reports')->__('Empty Rows'), 'title' => Mage::helper('reports')->__('Empty Rows') )); - $form->addValues($this->getFilterData()->getData()); $form->setUseContainer(true); $this->setForm($form); - // define field dependencies - $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence') - ->addFieldMap("{$htmlIdPrefix}show_order_statuses", 'show_order_statuses') - ->addFieldMap("{$htmlIdPrefix}order_statuses", 'order_statuses') - ->addFieldDependence('order_statuses', 'show_order_statuses', '1') - ); - return parent::_prepareForm(); } + + /** + * Initialize form fileds values + * Method will be called after prepareForm and can be used for field values initialization + * + * @return Mage_Adminhtml_Block_Widget_Form + */ + protected function _initFormValues() + { + $this->getForm()->addValues($this->getFilterData()->getData()); + return parent::_initFormValues(); + } + + /** + * This method is called before rendering HTML + * + * @return Mage_Adminhtml_Block_Widget_Form + */ + protected function _beforeToHtml() + { + $result = parent::_beforeToHtml(); + + /** @var Varien_Data_Form_Element_Fieldset $fieldset */ + $fieldset = $this->getForm()->getElement('base_fieldset'); + + if (is_object($fieldset) && $fieldset instanceof Varien_Data_Form_Element_Fieldset) { + // apply field visibility + foreach ($fieldset->getElements() as $field) { + if (!$this->getFieldVisibility($field->getId())) { + $fieldset->removeField($field->getId()); + } + } + // apply field options + foreach ($this->_fieldOptions as $fieldId => $fieldOptions) { + $field = $fieldset->getElements()->searchById($fieldId); + /** @var Varien_Object $field */ + if ($field) { + foreach ($fieldOptions as $k => $v) { + $field->setDataUsingMethod($k, $v); + } + } + } + } + + return $result; + } } diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Grid.php index c81456636e..2e56be17b2 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -147,7 +147,7 @@ protected function _prepareCollection() $collection->setInterval($from, $to); } catch (Exception $e) { - $this->_errors[] = Mage::helper('reports')->__('Invalid date specified'); + $this->_errors[] = Mage::helper('reports')->__('Invalid date specified.'); } } diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php index ddd7b0d620..4079a5736f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -72,6 +72,40 @@ protected function _getAggregatedColumns() return $this->_aggregatedColumns; } + /** + * Add column to grid + * Overriden to add support for visibility_filter column option + * It stands for conditional visibility of the column depending on filter field values + * Value of visibility_filter supports (filter_field_name => filter_field_value) pairs + * + * @param string $columnId + * @param array $column + * @return Mage_Adminhtml_Block_Report_Grid_Abstract + */ + public function addColumn($columnId, $column) + { + if (is_array($column) && array_key_exists('visibility_filter', $column)) { + $filterData = $this->getFilterData(); + $visibilityFilter = $column['visibility_filter']; + if (!is_array($visibilityFilter)) { + $visibilityFilter = array($visibilityFilter); + } + foreach ($visibilityFilter as $k => $v) { + if (is_int($k)) { + $filterFieldId = $v; + $filterFieldValue = true; + } else { + $filterFieldId = $k; + $filterFieldValue = $v; + } + if (!$filterData->hasData($filterFieldId) || $filterData->getData($filterFieldId) != $filterFieldValue) { + return $this; // don't add column + } + } + } + return parent::addColumn($columnId, $column); + } + protected function _prepareCollection() { $filterData = $this->getFilterData(); diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Blanknumber.php b/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Blanknumber.php index a177794c6b..4b0f6165ef 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Blanknumber.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Blanknumber.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Currency.php b/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Currency.php index a2b8511901..0305b3b294 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Currency.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Currency.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Customer.php b/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Customer.php index 6780f0a672..44e2b2ca11 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Customer.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Customer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -51,7 +51,7 @@ public function render(Varien_Object $row) return sprintf('%s', $this->getUrl('*/catalog_product_review', array('customerId' => $id)), - Mage::helper('adminhtml')->__('Show reviews') + Mage::helper('adminhtml')->__('Show Reviews') ); } } diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Product.php b/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Product.php index 261ce3e365..1843c88a23 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Product.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -47,7 +47,7 @@ public function render(Varien_Object $row) return sprintf('%s', $this->getUrl('*/catalog_product_review/', array('productId' => $id)), - Mage::helper('adminhtml')->__('Show reviews') + Mage::helper('adminhtml')->__('Show Reviews') ); } } diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product.php b/app/code/core/Mage/Adminhtml/Block/Report/Product.php index 102085f332..abdbe6b5c3 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Product.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product/Downloads.php b/app/code/core/Mage/Adminhtml/Block/Report/Product/Downloads.php index b2c27e1358..79c90682db 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Product/Downloads.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Product/Downloads.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product/Downloads/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Product/Downloads/Grid.php index bf5291fc0e..2d4c609e6c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Product/Downloads/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Product/Downloads/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product/Downloads/Renderer/Purchases.php b/app/code/core/Mage/Adminhtml/Block/Report/Product/Downloads/Renderer/Purchases.php index a1daeb1e09..ad050307f7 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Product/Downloads/Renderer/Purchases.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Product/Downloads/Renderer/Purchases.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Product/Grid.php index 3e21dbd43a..a6ab3702f0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Product/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Product/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product/Lowstock.php b/app/code/core/Mage/Adminhtml/Block/Report/Product/Lowstock.php index 0710fb6537..9623257d56 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Product/Lowstock.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Product/Lowstock.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product/Lowstock/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Product/Lowstock/Grid.php index e9c242b9e0..438054d6f6 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Product/Lowstock/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Product/Lowstock/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product/Ordered.php b/app/code/core/Mage/Adminhtml/Block/Report/Product/Ordered.php index 59a5b034cb..13251b7751 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Product/Ordered.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Product/Ordered.php @@ -20,18 +20,15 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Adminhtml bestsellers products report content block * - * @category Mage - * @package Mage_Adminhtml - * @author Magento Core Team + * @deprecated after 1.4.0.1 */ - class Mage_Adminhtml_Block_Report_Product_Ordered extends Mage_Adminhtml_Block_Widget_Grid_Container { public function __construct() diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product/Ordered/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Product/Ordered/Grid.php index fffbe89924..167e15479b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Product/Ordered/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Product/Ordered/Grid.php @@ -20,16 +20,14 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Adminhtml bestsellers products report grid block * - * @category Mage - * @package Mage_Adminhtml - * @author Magento Core Team + * @deprecated after 1.4.0.1 */ class Mage_Adminhtml_Block_Report_Product_Ordered_Grid extends Mage_Adminhtml_Block_Report_Grid { diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product/Sold.php b/app/code/core/Mage/Adminhtml/Block/Report/Product/Sold.php index 4e86ff85ab..066751de49 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Product/Sold.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Product/Sold.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product/Sold/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Product/Sold/Grid.php index a2a9ffea93..964cc88e6a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Product/Sold/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Product/Sold/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product/Viewed.php b/app/code/core/Mage/Adminhtml/Block/Report/Product/Viewed.php index 8fdc5569a7..8051dfd30d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Product/Viewed.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Product/Viewed.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Product/Viewed/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Product/Viewed/Grid.php index 0e73c5679d..a663e2b00e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Product/Viewed/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Product/Viewed/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Refresh/Statistics.php b/app/code/core/Mage/Adminhtml/Block/Report/Refresh/Statistics.php index a73f463ab7..9bb9d9c39b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Refresh/Statistics.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Refresh/Statistics.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Refresh/Statistics/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Refresh/Statistics/Grid.php index 5afaf923eb..6bb739ac67 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Refresh/Statistics/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Refresh/Statistics/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -58,39 +58,45 @@ protected function _prepareCollection() $data = array( array( 'id' => 'sales', - 'report' => Mage::helper('reports')->__('Sales'), - 'comment' => Mage::helper('reports')->__('Total Ordered Report'), + 'report' => Mage::helper('sales')->__('Orders'), + 'comment' => Mage::helper('sales')->__('Total Ordered Report'), 'updated_at' => $this->_getUpdatedAt(Mage_Reports_Model_Flag::REPORT_ORDER_FLAG_CODE) ), array( 'id' => 'tax', - 'report' => Mage::helper('reports')->__('Tax'), - 'comment' => Mage::helper('reports')->__('Order Taxes Report Grouped by Tax Rates'), + 'report' => Mage::helper('sales')->__('Tax'), + 'comment' => Mage::helper('sales')->__('Order Taxes Report Grouped by Tax Rates'), 'updated_at' => $this->_getUpdatedAt(Mage_Reports_Model_Flag::REPORT_TAX_FLAG_CODE) ), array( 'id' => 'shipping', - 'report' => Mage::helper('reports')->__('Shipping'), - 'comment' => Mage::helper('reports')->__('Total Shipped Report'), + 'report' => Mage::helper('sales')->__('Shipping'), + 'comment' => Mage::helper('sales')->__('Total Shipped Report'), 'updated_at' => $this->_getUpdatedAt(Mage_Reports_Model_Flag::REPORT_SHIPPING_FLAG_CODE) ), array( 'id' => 'invoiced', - 'report' => Mage::helper('reports')->__('Total Invoiced'), - 'comment' => Mage::helper('reports')->__('Total Invoiced VS Paid Report'), + 'report' => Mage::helper('sales')->__('Total Invoiced'), + 'comment' => Mage::helper('sales')->__('Total Invoiced VS Paid Report'), 'updated_at' => $this->_getUpdatedAt(Mage_Reports_Model_Flag::REPORT_INVOICE_FLAG_CODE) ), array( 'id' => 'refunded', - 'report' => Mage::helper('reports')->__('Total Refunded'), - 'comment' => Mage::helper('reports')->__('Total Refunded Report'), + 'report' => Mage::helper('sales')->__('Total Refunded'), + 'comment' => Mage::helper('sales')->__('Total Refunded Report'), 'updated_at' => $this->_getUpdatedAt(Mage_Reports_Model_Flag::REPORT_REFUNDED_FLAG_CODE) ), array( 'id' => 'coupons', - 'report' => Mage::helper('reports')->__('Coupons'), - 'comment' => Mage::helper('reports')->__('Promotion Coupons Usage Report'), - 'updated_at' => $this->_getUpdatedAt(Mage_Reports_Model_Flag::REPORT_COUPNS_FLAG_CODE) + 'report' => Mage::helper('sales')->__('Coupons'), + 'comment' => Mage::helper('sales')->__('Promotion Coupons Usage Report'), + 'updated_at' => $this->_getUpdatedAt(Mage_Reports_Model_Flag::REPORT_COUPONS_FLAG_CODE) + ), + array( + 'id' => 'bestsellers', + 'report' => Mage::helper('sales')->__('Bestsellers'), + 'comment' => Mage::helper('sales')->__('Products Bestsellers Report'), + 'updated_at' => $this->_getUpdatedAt(Mage_Reports_Model_Flag::REPORT_BESTSELLERS_FLAG_CODE) ) ); @@ -127,6 +133,7 @@ protected function _prepareColumns() 'index' => 'updated_at', 'type' => 'datetime', 'width' => 200, + 'default' => Mage::helper('reports')->__('undefined'), 'sortable' => false )); @@ -145,7 +152,7 @@ protected function _prepareMassaction() )); $this->getMassactionBlock()->addItem('refresh_recent', array( - 'label' => Mage::helper('reports')->__('Refresh Statistics for Last Day'), + 'label' => Mage::helper('reports')->__('Refresh Statistics for the Last Day'), 'url' => $this->getUrl('*/*/refreshRecent'), 'confirm' => Mage::helper('reports')->__('Are you sure?'), 'selected' => true diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Review/Customer.php b/app/code/core/Mage/Adminhtml/Block/Report/Review/Customer.php index 718330abb1..12b3a55c02 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Review/Customer.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Review/Customer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Review/Customer/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Review/Customer/Grid.php index 6ce55b9228..bb7b8eb542 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Review/Customer/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Review/Customer/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Review/Detail.php b/app/code/core/Mage/Adminhtml/Block/Report/Review/Detail.php index b86332be29..1b7e027fb4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Review/Detail.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Review/Detail.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Review/Detail/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Review/Detail/Grid.php index 5447261622..c6a233ae6a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Review/Detail/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Review/Detail/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -81,7 +81,7 @@ protected function _prepareColumns() )); $this->addColumn('created_at', array( - 'header' =>Mage::helper('reports')->__('Created at'), + 'header' =>Mage::helper('reports')->__('Created At'), 'index' =>'created_at', 'width' =>'200px', 'type' =>'datetime' diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Review/Product.php b/app/code/core/Mage/Adminhtml/Block/Report/Review/Product.php index 06187dfbc6..2083309e17 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Review/Product.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Review/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Review/Product/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Review/Product/Grid.php index 229fafb464..704b1471c8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Review/Product/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Review/Product/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -74,14 +74,14 @@ protected function _prepareColumns() )); $this->addColumn('avg_rating', array( - 'header' =>Mage::helper('reports')->__('Avg. rating'), + 'header' =>Mage::helper('reports')->__('Avg. Rating'), 'width' =>'50px', 'align' =>'right', 'index' =>'avg_rating' )); $this->addColumn('avg_rating_approved', array( - 'header' =>Mage::helper('reports')->__('Avg. approved rating'), + 'header' =>Mage::helper('reports')->__('Avg. Approved Rating'), 'width' =>'50px', 'align' =>'right', 'index' =>'avg_rating_approved' diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Bestsellers.php b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Bestsellers.php new file mode 100644 index 0000000000..7ae30625bc --- /dev/null +++ b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Bestsellers.php @@ -0,0 +1,56 @@ + + */ + +class Mage_Adminhtml_Block_Report_Sales_Bestsellers extends Mage_Adminhtml_Block_Widget_Grid_Container +{ + + public function __construct() + { + $this->_controller = 'report_sales_bestsellers'; + $this->_headerText = Mage::helper('sales')->__('Products Bestsellers Report'); + parent::__construct(); + $this->setTemplate('report/grid/container.phtml'); + $this->_removeButton('add'); + $this->addButton('filter_form_submit', array( + 'label' => Mage::helper('reports')->__('Show Report'), + 'onclick' => 'filterFormSubmit()' + )); + } + + public function getFilterUrl() + { + $this->getRequest()->setParam('filter', null); + return $this->getUrl('*/*/bestsellers', array('_current' => true)); + } +} diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Bestsellers/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Bestsellers/Grid.php new file mode 100644 index 0000000000..3749219349 --- /dev/null +++ b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Bestsellers/Grid.php @@ -0,0 +1,96 @@ + + */ +class Mage_Adminhtml_Block_Report_Sales_Bestsellers_Grid extends Mage_Adminhtml_Block_Report_Grid_Abstract +{ + protected $_columnGroupBy = 'period'; + + public function __construct() + { + parent::__construct(); + $this->setCountTotals(true); + } + + public function getResourceCollectionName() + { + return 'sales/report_bestsellers_collection'; + } + + protected function _prepareColumns() + { + $this->addColumn('period', array( + 'header' => Mage::helper('sales')->__('Period'), + 'index' => 'period', + 'width' => 100, + 'sortable' => false, + 'period_type' => $this->getPeriodType(), + 'renderer' => 'adminhtml/report_sales_grid_column_renderer_date', + 'totals_label' => Mage::helper('adminhtml')->__('Total'), + 'html_decorators' => array('nobr'), + )); + + $this->addColumn('product_name', array( + 'header' => Mage::helper('sales')->__('Product Name'), + 'index' => 'product_name', + 'type' => 'string', + 'sortable' => false + )); + + if ($this->getFilterData()->getStoreIds()) { + $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds())); + } + $currencyCode = $this->getCurrentCurrencyCode(); + + $this->addColumn('product_price', array( + 'header' => Mage::helper('sales')->__('Price'), + 'type' => 'currency', + 'currency_code' => $currencyCode, + 'index' => 'product_price', + 'sortable' => false + )); + + $this->addColumn('qty_ordered', array( + 'header' => Mage::helper('sales')->__('Quantity Ordered'), + 'index' => 'qty_ordered', + 'type' => 'number', + 'total' => 'sum', + 'sortable' => false + )); + + + $this->addExportType('*/*/exportBestsellersCsv', Mage::helper('adminhtml')->__('CSV')); + $this->addExportType('*/*/exportBestsellersExcel', Mage::helper('adminhtml')->__('Excel')); + + return parent::_prepareColumns(); + } +} diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Coupons.php b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Coupons.php index c3a681dbe9..d728a93fc7 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Coupons.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Coupons.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Coupons/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Coupons/Grid.php index 217db36c16..9c8aa8b058 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Coupons/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Coupons/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -52,24 +52,25 @@ public function getResourceCollectionName() protected function _prepareColumns() { $this->addColumn('period', array( - 'header' => Mage::helper('reports')->__('Period'), + 'header' => Mage::helper('salesrule')->__('Period'), 'index' => 'period', 'width' => 100, 'sortable' => false, 'period_type' => $this->getPeriodType(), 'renderer' => 'adminhtml/report_sales_grid_column_renderer_date', - 'totals_label' => Mage::helper('adminhtml')->__('Total'), - 'subtotals_label' => Mage::helper('adminhtml')->__('SubTotal') + 'totals_label' => Mage::helper('salesrule')->__('Total'), + 'subtotals_label' => Mage::helper('salesrule')->__('Subtotal'), + 'html_decorators' => array('nobr'), )); $this->addColumn('coupon_code', array( - 'header' => Mage::helper('reports')->__('Coupon Code'), + 'header' => Mage::helper('salesrule')->__('Coupon Code'), 'sortable' => false, 'index' => 'coupon_code' )); $this->addColumn('coupon_uses', array( - 'header' => Mage::helper('reports')->__('Number of Use'), + 'header' => Mage::helper('salesrule')->__('Number of Uses'), 'sortable' => false, 'index' => 'coupon_uses', 'total' => 'sum', @@ -79,37 +80,64 @@ protected function _prepareColumns() if ($this->getFilterData()->getStoreIds()) { $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds())); } - $currency_code = $this->getCurrentCurrencyCode(); + $currencyCode = $this->getCurrentCurrencyCode(); $this->addColumn('subtotal_amount', array( - 'header' => Mage::helper('reports')->__('Subtotal Amount'), + 'header' => Mage::helper('salesrule')->__('Sales Subtotal Amount'), 'sortable' => false, 'type' => 'currency', - 'currency_code' => $currency_code, + 'currency_code' => $currencyCode, 'total' => 'sum', 'index' => 'subtotal_amount' )); $this->addColumn('discount_amount', array( - 'header' => Mage::helper('reports')->__('Discount Amount'), + 'header' => Mage::helper('salesrule')->__('Sales Discount Amount'), 'sortable' => false, 'type' => 'currency', - 'currency_code' => $currency_code, + 'currency_code' => $currencyCode, 'total' => 'sum', 'index' => 'discount_amount' )); $this->addColumn('total_amount', array( - 'header' => Mage::helper('reports')->__('Total Amount'), + 'header' => Mage::helper('salesrule')->__('Sales Total Amount'), 'sortable' => false, 'type' => 'currency', - 'currency_code' => $currency_code, + 'currency_code' => $currencyCode, 'total' => 'sum', 'index' => 'total_amount' )); - $this->addExportType('*/*/exportCouponsCsv', Mage::helper('reports')->__('CSV')); - $this->addExportType('*/*/exportCouponsExcel', Mage::helper('reports')->__('Excel')); + $this->addColumn('subtotal_amount_actual', array( + 'header' => Mage::helper('salesrule')->__('Subtotal Amount'), + 'sortable' => false, + 'type' => 'currency', + 'currency_code' => $currencyCode, + 'total' => 'sum', + 'index' => 'subtotal_amount_actual' + )); + + $this->addColumn('discount_amount_actual', array( + 'header' => Mage::helper('salesrule')->__('Discount Amount'), + 'sortable' => false, + 'type' => 'currency', + 'currency_code' => $currencyCode, + 'total' => 'sum', + 'index' => 'discount_amount_actual' + )); + + $this->addColumn('total_amount_actual', array( + 'header' => Mage::helper('salesrule')->__('Total Amount'), + 'sortable' => false, + 'type' => 'currency', + 'currency_code' => $currencyCode, + 'total' => 'sum', + 'index' => 'total_amount_actual' + )); + + $this->addExportType('*/*/exportCouponsCsv', Mage::helper('adminhtml')->__('CSV')); + $this->addExportType('*/*/exportCouponsExcel', Mage::helper('adminhtml')->__('Excel')); return parent::_prepareColumns(); } diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Grid/Column/Renderer/Date.php b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Grid/Column/Renderer/Date.php index 74ee4fd311..f5900d5e72 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Grid/Column/Renderer/Date.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Grid/Column/Renderer/Date.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Invoiced.php b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Invoiced.php index 8cabc80590..88bd09e732 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Invoiced.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Invoiced.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -37,7 +37,7 @@ class Mage_Adminhtml_Block_Report_Sales_Invoiced extends Mage_Adminhtml_Block_Wi public function __construct() { $this->_controller = 'report_sales_invoiced'; - $this->_headerText = Mage::helper('reports')->__('Total Invoiced VS Paid Report'); + $this->_headerText = Mage::helper('reports')->__('Total Invoiced vs. Paid Report'); parent::__construct(); $this->setTemplate('report/grid/container.phtml'); $this->_removeButton('add'); diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Invoiced/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Invoiced/Grid.php index b571b446f6..ba26070739 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Invoiced/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Invoiced/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -57,11 +57,12 @@ protected function _prepareColumns() 'sortable' => false, 'period_type' => $this->getPeriodType(), 'renderer' => 'adminhtml/report_sales_grid_column_renderer_date', - 'totals_label' => Mage::helper('adminhtml')->__('Total') + 'totals_label' => Mage::helper('sales')->__('Total'), + 'html_decorators' => array('nobr'), )); $this->addColumn('orders_count', array( - 'header' => Mage::helper('reports')->__('Number of Orders'), + 'header' => Mage::helper('sales')->__('Number of Orders'), 'index' => 'orders_count', 'type' => 'number', 'total' => 'sum', @@ -69,7 +70,7 @@ protected function _prepareColumns() )); $this->addColumn('orders_invoiced', array( - 'header' => Mage::helper('reports')->__('Number of Invoiced Orders'), + 'header' => Mage::helper('sales')->__('Number of Invoiced Orders'), 'index' => 'orders_invoiced', 'type' => 'number', 'total' => 'sum', @@ -79,37 +80,37 @@ protected function _prepareColumns() if ($this->getFilterData()->getStoreIds()) { $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds())); } - $currency_code = $this->getCurrentCurrencyCode(); + $currencyCode = $this->getCurrentCurrencyCode(); $this->addColumn('invoiced', array( - 'header' => Mage::helper('reports')->__('Total Invoiced'), + 'header' => Mage::helper('sales')->__('Total Invoiced'), 'type' => 'currency', - 'currency_code' => $currency_code, + 'currency_code' => $currencyCode, 'index' => 'invoiced', 'total' => 'sum', 'sortable' => false )); $this->addColumn('invoiced_captured', array( - 'header' => Mage::helper('reports')->__('Total Invoiced Captured'), + 'header' => Mage::helper('sales')->__('Total Invoiced Paid'), 'type' => 'currency', - 'currency_code' => $currency_code, + 'currency_code' => $currencyCode, 'index' => 'invoiced_captured', 'total' => 'sum', 'sortable' => false )); $this->addColumn('invoiced_not_captured', array( - 'header' => Mage::helper('reports')->__('Total Invoiced not Captured'), + 'header' => Mage::helper('sales')->__('Total Invoiced not Paid'), 'type' => 'currency', - 'currency_code' => $currency_code, + 'currency_code' => $currencyCode, 'index' => 'invoiced_not_captured', 'total' => 'sum', 'sortable' => false )); - $this->addExportType('*/*/exportInvoicedCsv', Mage::helper('reports')->__('CSV')); - $this->addExportType('*/*/exportInvoicedExcel', Mage::helper('reports')->__('Excel')); + $this->addExportType('*/*/exportInvoicedCsv', Mage::helper('adminhtml')->__('CSV')); + $this->addExportType('*/*/exportInvoicedExcel', Mage::helper('adminhtml')->__('Excel')); return parent::_prepareColumns(); } diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Refunded.php b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Refunded.php index 13f78d96f3..40a60fad7b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Refunded.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Refunded.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Refunded/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Refunded/Grid.php index 7f428dfe88..9347d9bd68 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Refunded/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Refunded/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -57,11 +57,12 @@ protected function _prepareColumns() 'sortable' => false, 'period_type' => $this->getPeriodType(), 'renderer' => 'adminhtml/report_sales_grid_column_renderer_date', - 'totals_label' => Mage::helper('adminhtml')->__('Total') + 'totals_label' => Mage::helper('sales')->__('Total'), + 'html_decorators' => array('nobr'), )); $this->addColumn('orders_count', array( - 'header' => Mage::helper('reports')->__('Number of Refunded Orders'), + 'header' => Mage::helper('sales')->__('Number of Refunded Orders'), 'index' => 'orders_count', 'type' => 'number', 'total' => 'sum', @@ -71,37 +72,37 @@ protected function _prepareColumns() if ($this->getFilterData()->getStoreIds()) { $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds())); } - $currency_code = $this->getCurrentCurrencyCode(); + $currencyCode = $this->getCurrentCurrencyCode(); $this->addColumn('refunded', array( - 'header' => Mage::helper('reports')->__('Total Refunded'), + 'header' => Mage::helper('sales')->__('Total Refunded'), 'type' => 'currency', - 'currency_code' => $currency_code, + 'currency_code' => $currencyCode, 'index' => 'refunded', 'total' => 'sum', 'sortable' => false )); $this->addColumn('online_refunded', array( - 'header' => Mage::helper('reports')->__('Online Refunded'), + 'header' => Mage::helper('sales')->__('Online Refunded'), 'type' => 'currency', - 'currency_code' => $currency_code, + 'currency_code' => $currencyCode, 'index' => 'online_refunded', 'total' => 'sum', 'sortable' => false )); $this->addColumn('offline_refunded', array( - 'header' => Mage::helper('reports')->__('Offline Refunded'), + 'header' => Mage::helper('sales')->__('Offline Refunded'), 'type' => 'currency', - 'currency_code' => $currency_code, + 'currency_code' => $currencyCode, 'index' => 'offline_refunded', 'total' => 'sum', 'sortable' => false )); - $this->addExportType('*/*/exportRefundedCsv', Mage::helper('reports')->__('CSV')); - $this->addExportType('*/*/exportRefundedExcel', Mage::helper('reports')->__('Excel')); + $this->addExportType('*/*/exportRefundedCsv', Mage::helper('adminhtml')->__('CSV')); + $this->addExportType('*/*/exportRefundedExcel', Mage::helper('adminhtml')->__('Excel')); return parent::_prepareColumns(); } diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Sales.php b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Sales.php index c89e2f9c24..a5fa32bf5b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Sales.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Sales.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Sales/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Sales/Grid.php index 98dfad2530..94f0d22698 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Sales/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Sales/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -57,11 +57,12 @@ protected function _prepareColumns() 'sortable' => false, 'period_type' => $this->getPeriodType(), 'renderer' => 'adminhtml/report_sales_grid_column_renderer_date', - 'totals_label' => Mage::helper('adminhtml')->__('Total') + 'totals_label' => Mage::helper('sales')->__('Total'), + 'html_decorators' => array('nobr'), )); $this->addColumn('orders_count', array( - 'header' => Mage::helper('sales')->__('Number of Orders'), + 'header' => Mage::helper('sales')->__('Orders'), 'index' => 'orders_count', 'type' => 'number', 'total' => 'sum', @@ -69,102 +70,153 @@ protected function _prepareColumns() )); $this->addColumn('total_qty_ordered', array( - 'header' => Mage::helper('sales')->__('Items Ordered'), + 'header' => Mage::helper('sales')->__('Sales Items'), 'index' => 'total_qty_ordered', 'type' => 'number', 'total' => 'sum', 'sortable' => false )); + $this->addColumn('total_qty_invoiced', array( + 'header' => Mage::helper('sales')->__('Items'), + 'index' => 'total_qty_invoiced', + 'type' => 'number', + 'total' => 'sum', + 'sortable' => false, + 'visibility_filter' => array('show_actual_columns') + )); + if ($this->getFilterData()->getStoreIds()) { $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds())); } - $currency_code = $this->getCurrentCurrencyCode(); + $currencyCode = $this->getCurrentCurrencyCode(); - $this->addColumn('base_profit_amount', array( - 'header' => Mage::helper('sales')->__('Profit'), + $this->addColumn('total_income_amount', array( + 'header' => Mage::helper('sales')->__('Sales Total'), 'type' => 'currency', - 'currency_code' => $currency_code, - 'index' => 'base_profit_amount', + 'currency_code' => $currencyCode, + 'index' => 'total_income_amount', 'total' => 'sum', 'sortable' => false )); - $this->addColumn('base_subtotal_amount', array( - 'header' => Mage::helper('sales')->__('Subtotal'), + $this->addColumn('total_revenue_amount', array( + 'header' => Mage::helper('sales')->__('Revenue'), 'type' => 'currency', - 'currency_code' => $currency_code, - 'index' => 'base_subtotal_amount', + 'currency_code' => $currencyCode, + 'index' => 'total_revenue_amount', 'total' => 'sum', - 'sortable' => false + 'sortable' => false, + 'visibility_filter' => array('show_actual_columns') )); - $this->addColumn('base_tax_amount', array( - 'header' => Mage::helper('sales')->__('Tax'), + $this->addColumn('total_profit_amount', array( + 'header' => Mage::helper('sales')->__('Profit'), 'type' => 'currency', - 'currency_code' => $currency_code, - 'index' => 'base_tax_amount', + 'currency_code' => $currencyCode, + 'index' => 'total_profit_amount', 'total' => 'sum', - 'sortable' => false + 'sortable' => false, + 'visibility_filter' => array('show_actual_columns') )); - $this->addColumn('base_shipping_amount', array( - 'header' => Mage::helper('sales')->__('Shipping'), + $this->addColumn('total_invoiced_amount', array( + 'header' => Mage::helper('sales')->__('Invoiced'), 'type' => 'currency', - 'currency_code' => $currency_code, - 'index' => 'base_shipping_amount', + 'currency_code' => $currencyCode, + 'index' => 'total_invoiced_amount', 'total' => 'sum', 'sortable' => false )); - $this->addColumn('base_discount_amount', array( - 'header' => Mage::helper('sales')->__('Discounts'), + $this->addColumn('total_paid_amount', array( + 'header' => Mage::helper('sales')->__('Paid'), + 'type' => 'currency', + 'currency_code' => $currencyCode, + 'index' => 'total_paid_amount', + 'total' => 'sum', + 'sortable' => false, + 'visibility_filter' => array('show_actual_columns') + )); + + $this->addColumn('total_refunded_amount', array( + 'header' => Mage::helper('sales')->__('Refunded'), 'type' => 'currency', - 'currency_code' => $currency_code, - 'index' => 'base_discount_amount', + 'currency_code' => $currencyCode, + 'index' => 'total_refunded_amount', 'total' => 'sum', 'sortable' => false )); - $this->addColumn('base_grand_total_amount', array( - 'header' => Mage::helper('sales')->__('Total'), + $this->addColumn('total_tax_amount', array( + 'header' => Mage::helper('sales')->__('Sales Tax'), 'type' => 'currency', - 'currency_code' => $currency_code, - 'index' => 'base_grand_total_amount', + 'currency_code' => $currencyCode, + 'index' => 'total_tax_amount', 'total' => 'sum', 'sortable' => false )); - $this->addColumn('base_invoiced_amount', array( - 'header' => Mage::helper('sales')->__('Invoiced'), + $this->addColumn('total_tax_amount_actual', array( + 'header' => Mage::helper('sales')->__('Tax'), + 'type' => 'currency', + 'currency_code' => $currencyCode, + 'index' => 'total_tax_amount_actual', + 'total' => 'sum', + 'sortable' => false, + 'visibility_filter' => array('show_actual_columns') + )); + + $this->addColumn('total_shipping_amount', array( + 'header' => Mage::helper('sales')->__('Sales Shipping'), 'type' => 'currency', - 'currency_code' => $currency_code, - 'index' => 'base_invoiced_amount', + 'currency_code' => $currencyCode, + 'index' => 'total_shipping_amount', 'total' => 'sum', 'sortable' => false )); - $this->addColumn('base_refunded_amount', array( - 'header' => Mage::helper('sales')->__('Refunded'), + $this->addColumn('total_shipping_amount_actual', array( + 'header' => Mage::helper('sales')->__('Shipping'), 'type' => 'currency', - 'currency_code' => $currency_code, - 'index' => 'base_refunded_amount', + 'currency_code' => $currencyCode, + 'index' => 'total_shipping_amount_actual', + 'total' => 'sum', + 'sortable' => false, + 'visibility_filter' => array('show_actual_columns') + )); + + $this->addColumn('total_discount_amount', array( + 'header' => Mage::helper('sales')->__('Sales Discount'), + 'type' => 'currency', + 'currency_code' => $currencyCode, + 'index' => 'total_discount_amount', 'total' => 'sum', 'sortable' => false )); - $this->addColumn('base_canceled_amount', array( + $this->addColumn('total_discount_amount_actual', array( + 'header' => Mage::helper('sales')->__('Discount'), + 'type' => 'currency', + 'currency_code' => $currencyCode, + 'index' => 'total_discount_amount_actual', + 'total' => 'sum', + 'sortable' => false, + 'visibility_filter' => array('show_actual_columns') + )); + + $this->addColumn('total_canceled_amount', array( 'header' => Mage::helper('sales')->__('Canceled'), 'type' => 'currency', - 'currency_code' => $currency_code, - 'index' => 'base_canceled_amount', + 'currency_code' => $currencyCode, + 'index' => 'total_canceled_amount', 'total' => 'sum', 'sortable' => false )); - $this->addExportType('*/*/exportSalesCsv', Mage::helper('reports')->__('CSV')); - $this->addExportType('*/*/exportSalesExcel', Mage::helper('reports')->__('Excel')); + $this->addExportType('*/*/exportSalesCsv', Mage::helper('adminhtml')->__('CSV')); + $this->addExportType('*/*/exportSalesExcel', Mage::helper('adminhtml')->__('Excel')); return parent::_prepareColumns(); } diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Shipping.php b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Shipping.php index 924cc0aab8..8b9c819294 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Shipping.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Shipping.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Shipping/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Shipping/Grid.php index 43b734043f..52f6299b05 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Shipping/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Shipping/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -52,24 +52,25 @@ public function getResourceCollectionName() protected function _prepareColumns() { $this->addColumn('period', array( - 'header' => Mage::helper('adminhtml')->__('Period'), + 'header' => Mage::helper('sales')->__('Period'), 'index' => 'period', 'width' => 100, 'sortable' => false, 'period_type' => $this->getPeriodType(), 'renderer' => 'adminhtml/report_sales_grid_column_renderer_date', - 'totals_label' => Mage::helper('adminhtml')->__('Total'), - 'subtotals_label' => Mage::helper('adminhtml')->__('SubTotal') + 'totals_label' => Mage::helper('sales')->__('Total'), + 'subtotals_label' => Mage::helper('sales')->__('Subtotal'), + 'html_decorators' => array('nobr'), )); $this->addColumn('shipping_description', array( - 'header' => Mage::helper('adminhtml')->__('Carrier/Method'), + 'header' => Mage::helper('sales')->__('Carrier/Method'), 'index' => 'shipping_description', 'sortable' => false )); $this->addColumn('orders_count', array( - 'header' => Mage::helper('adminhtml')->__('Number of Orders'), + 'header' => Mage::helper('sales')->__('Number of Orders'), 'index' => 'orders_count', 'total' => 'sum', 'type' => 'number', @@ -82,7 +83,7 @@ protected function _prepareColumns() } $this->addColumn('total_shipping', array( - 'header' => Mage::helper('adminhtml')->__('Total Shipping'), + 'header' => Mage::helper('sales')->__('Total Sales Shipping'), 'type' => 'currency', 'currency_code' => $this->getCurrentCurrencyCode(), 'index' => 'total_shipping', @@ -90,6 +91,15 @@ protected function _prepareColumns() 'sortable' => false )); + $this->addColumn('total_shipping_actual', array( + 'header' => Mage::helper('sales')->__('Total Shipping'), + 'type' => 'currency', + 'currency_code' => $this->getCurrentCurrencyCode(), + 'index' => 'total_shipping_actual', + 'total' => 'sum', + 'sortable' => false + )); + $this->addExportType('*/*/exportShippingCsv', Mage::helper('adminhtml')->__('CSV')); $this->addExportType('*/*/exportShippingExcel', Mage::helper('adminhtml')->__('Excel')); diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Tax.php b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Tax.php index 5b19c5f7bd..34742176e7 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Tax.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Tax.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Tax/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Tax/Grid.php index 6152dd9a49..587365420e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Tax/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Tax/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -58,8 +58,9 @@ protected function _prepareColumns() 'sortable' => false, 'period_type' => $this->getPeriodType(), 'renderer' => 'adminhtml/report_sales_grid_column_renderer_date', - 'totals_label' => Mage::helper('adminhtml')->__('Total'), - 'subtotals_label' => Mage::helper('adminhtml')->__('SubTotal') + 'totals_label' => Mage::helper('sales')->__('Total'), + 'subtotals_label' => Mage::helper('sales')->__('Subtotal'), + 'html_decorators' => array('nobr'), )); $this->addColumn('code', array( @@ -99,8 +100,8 @@ protected function _prepareColumns() 'sortable' => false )); - $this->addExportType('*/*/exportTaxCsv', Mage::helper('reports')->__('CSV')); - $this->addExportType('*/*/exportTaxExcel', Mage::helper('reports')->__('Excel')); + $this->addExportType('*/*/exportTaxCsv', Mage::helper('adminhtml')->__('CSV')); + $this->addExportType('*/*/exportTaxExcel', Mage::helper('adminhtml')->__('Excel')); return parent::_prepareColumns(); } diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Search.php b/app/code/core/Mage/Adminhtml/Block/Report/Search.php index 552488d5d5..3fd1611a98 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Search.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Search.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Search/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Search/Grid.php index 19aad58753..68a203bb0f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Search/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Search/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Abandoned.php b/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Abandoned.php index c58ffcba8f..5f2285583d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Abandoned.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Abandoned.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Abandoned/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Abandoned/Grid.php index 296c2c0265..de811cb475 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Abandoned/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Abandoned/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -133,7 +133,7 @@ protected function _prepareColumns() )); $this->addColumn('created_at', array( - 'header' =>Mage::helper('reports')->__('Created at'), + 'header' =>Mage::helper('reports')->__('Created At'), 'width' =>'170px', 'type' =>'datetime', 'index' =>'created_at', @@ -142,7 +142,7 @@ protected function _prepareColumns() )); $this->addColumn('updated_at', array( - 'header' =>Mage::helper('reports')->__('Updated at'), + 'header' =>Mage::helper('reports')->__('Updated At'), 'width' =>'170px', 'type' =>'datetime', 'index' =>'updated_at', @@ -150,6 +150,13 @@ protected function _prepareColumns() 'sortable' =>false )); + $this->addColumn('remote_ip', array( + 'header' =>Mage::helper('reports')->__('IP Address'), + 'width' =>'80px', + 'index' =>'remote_ip', + 'sortable' =>false + )); + $this->addExportType('*/*/exportAbandonedCsv', Mage::helper('reports')->__('CSV')); $this->addExportType('*/*/exportAbandonedExcel', Mage::helper('reports')->__('Excel')); diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Customer.php b/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Customer.php index f210b5d4a5..8c983a4604 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Customer.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Customer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Customer/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Customer/Grid.php index 7100f64d12..4965b902fa 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Customer/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Customer/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Product.php b/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Product.php index d2ff23fa84..6402b251a2 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Product.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Product/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Product/Grid.php index 6af7d6d1cf..469a9738bc 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Product/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Product/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Customer.php b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Customer.php index dec716c18d..40c96831ec 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Customer.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Customer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Customer/Detail.php b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Customer/Detail.php index 5c7249b648..570dfcf84e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Customer/Detail.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Customer/Detail.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -41,7 +41,7 @@ public function __construct() $customer = Mage::getModel('customer/customer')->load($this->getRequest()->getParam('id')); $customerName = $customer->getName(); - $this->_headerText = Mage::helper('reports')->__('Tags submited by %s', $customerName); + $this->_headerText = Mage::helper('reports')->__('Tags Submitted by %s', $customerName); parent::__construct(); $this->_removeButton('add'); $this->setBackUrl($this->getUrl('*/report_tag/customer/')); diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Customer/Detail/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Customer/Detail/Grid.php index 1f88d35b44..7619eb4682 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Customer/Detail/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Customer/Detail/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -46,7 +46,7 @@ protected function _prepareCollection() ->getEntityCollection() ->joinAttribute('original_name', 'catalog_product/name', 'entity_id') ->addCustomerFilter($this->getRequest()->getParam('id')) - ->addStatusFilter(Mage::getModel('tag/tag')->getApprovedStatus()) + ->addStatusFilter(Mage_Tag_Model_Tag::STATUS_APPROVED) ->setDescOrder('DESC') ->addStoresVisibility() ->setActiveFilter() diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Customer/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Customer/Grid.php index e3400d7d27..a9809f0c93 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Customer/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Customer/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -45,7 +45,7 @@ protected function _prepareCollection() $collection = Mage::getResourceModel('reports/tag_customer_collection'); - $collection->addStatusFilter(Mage::getModel('tag/tag')->getApprovedStatus()) + $collection->addStatusFilter(Mage_Tag_Model_Tag::STATUS_APPROVED) ->addGroupByCustomer() ->addTagedCount(); diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Popular.php b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Popular.php index 3ee01b940d..19c65357f9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Popular.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Popular.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Popular/Detail.php b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Popular/Detail.php index 4799a86689..09162c4367 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Popular/Detail.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Popular/Detail.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Popular/Detail/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Popular/Detail/Grid.php index 30e1209635..0059020149 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Popular/Detail/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Popular/Detail/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Popular/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Popular/Grid.php index 66735975f4..db8cbfb795 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Popular/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Popular/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -54,12 +54,8 @@ protected function _prepareCollection() } $collection = Mage::getResourceModel('reports/tag_collection') - ->addSummary($storeId) - ->addStatusFilter(Mage::getModel('tag/tag')->getApprovedStatus()); - - if($storeId != '') { - $collection->addStoreFilter($storeId); - } + ->addPopularity($storeId) + ->addStatusFilter(Mage_Tag_Model_Tag::STATUS_APPROVED); $this->setCollection($collection); return parent::_prepareCollection(); @@ -81,22 +77,6 @@ protected function _prepareColumns() 'index' =>'popularity' )); - $this->addColumn('uses', array( - 'header' =>Mage::helper('reports')->__('Number Of Uses'), - 'width' =>'50px', - 'align' =>'right', - 'sortable' =>false, - 'index' =>'uses' - )); - - $this->addColumn('historical_uses', array( - 'header' =>Mage::helper('reports')->__('Number Of Historical Uses'), - 'width' =>'50px', - 'align' =>'right', - 'sortable' =>false, - 'index' =>'historical_uses' - )); - $this->addColumn('action', array( 'header' => Mage::helper('catalog')->__('Action'), diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Product.php b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Product.php index 9ab490de10..843a3075cd 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Product.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Product/Detail.php b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Product/Detail.php index 9c9dc5f6f1..ea9ec44428 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Product/Detail.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Product/Detail.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Product/Detail/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Product/Detail/Grid.php index 6bf00a6de6..c76a221dcd 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Product/Detail/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Product/Detail/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -66,7 +66,7 @@ protected function _prepareColumns() )); $this->addColumn('taged', array( - 'header' =>Mage::helper('reports')->__('Tag use'), + 'header' =>Mage::helper('reports')->__('Tag Use'), 'index' =>'taged', 'align' => 'right' )); diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Product/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Product/Grid.php index 1134f06ebc..6d229143df 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Tag/Product/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Tag/Product/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Wishlist.php b/app/code/core/Mage/Adminhtml/Block/Report/Wishlist.php index 58945efcea..26ef52d9ad 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Wishlist.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Wishlist.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Wishlist/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Wishlist/Grid.php index 06c67950cc..ae362eee8b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Wishlist/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Wishlist/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -94,7 +94,7 @@ protected function _prepareColumns() )); $this->addColumn('num_deleted', array( - 'header' =>Mage::helper('reports')->__('Number of times deleted'), + 'header' =>Mage::helper('reports')->__('Number of Times Deleted'), 'width' =>'50px', 'align' =>'right', 'sortable' =>false, diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Add.php b/app/code/core/Mage/Adminhtml/Block/Review/Add.php index da4b643345..924dc0d9fa 100644 --- a/app/code/core/Mage/Adminhtml/Block/Review/Add.php +++ b/app/code/core/Mage/Adminhtml/Block/Review/Add.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -53,6 +53,7 @@ public function __construct() '; $this->_formInitScripts[] = ' + // '; } diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Add/Form.php b/app/code/core/Mage/Adminhtml/Block/Review/Add/Form.php index 55145b2d79..cb357e9f37 100644 --- a/app/code/core/Mage/Adminhtml/Block/Review/Add/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Review/Add/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Edit.php b/app/code/core/Mage/Adminhtml/Block/Review/Edit.php index 41dc475b1d..8e4c718440 100644 --- a/app/code/core/Mage/Adminhtml/Block/Review/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Review/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Review/Edit/Form.php index c96f9abb08..ecb969cfb7 100644 --- a/app/code/core/Mage/Adminhtml/Block/Review/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Review/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -121,7 +121,7 @@ protected function _prepareForm() )); $fieldset->addField('title', 'text', array( - 'label' => Mage::helper('review')->__('Summary of review'), + 'label' => Mage::helper('review')->__('Summary of Review'), 'required' => true, 'name' => 'title', )); diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Grid.php b/app/code/core/Mage/Adminhtml/Block/Review/Grid.php index b2be8b61c9..3332e7eeab 100644 --- a/app/code/core/Mage/Adminhtml/Block/Review/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Review/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -225,7 +225,7 @@ protected function _prepareMassaction() ->toOptionArray(); array_unshift($statuses, array('label'=>'', 'value'=>'')); $this->getMassactionBlock()->addItem('update_status', array( - 'label' => Mage::helper('review')->__('Update status'), + 'label' => Mage::helper('review')->__('Update Status'), 'url' => $this->getUrl('*/*/massUpdateStatus', array('ret' => Mage::registry('usePendingFilter') ? 'pending' : 'index')), 'additional' => array( 'status' => array( diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Grid/Filter/Type.php b/app/code/core/Mage/Adminhtml/Block/Review/Grid/Filter/Type.php index 6e691b28b9..8458ee3466 100644 --- a/app/code/core/Mage/Adminhtml/Block/Review/Grid/Filter/Type.php +++ b/app/code/core/Mage/Adminhtml/Block/Review/Grid/Filter/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Grid/Renderer/Type.php b/app/code/core/Mage/Adminhtml/Block/Review/Grid/Renderer/Type.php index e9eedfafd3..1f1f1f6391 100644 --- a/app/code/core/Mage/Adminhtml/Block/Review/Grid/Renderer/Type.php +++ b/app/code/core/Mage/Adminhtml/Block/Review/Grid/Renderer/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Main.php b/app/code/core/Mage/Adminhtml/Block/Review/Main.php index b1890b0ef6..9f7cb36de4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Review/Main.php +++ b/app/code/core/Mage/Adminhtml/Block/Review/Main.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -51,14 +51,14 @@ public function __construct() if( Mage::registry('usePendingFilter') === true ) { if ($customerName) { - $this->_headerText = Mage::helper('review')->__('Pending reviews of customer `%s`', $customerName); + $this->_headerText = Mage::helper('review')->__('Pending Reviews of Customer `%s`', $customerName); } else { - $this->_headerText = Mage::helper('review')->__('Pending reviews'); + $this->_headerText = Mage::helper('review')->__('Pending Reviews'); } $this->_removeButton('add'); } else { if ($customerName) { - $this->_headerText = Mage::helper('review')->__('All reviews of customer `%s`', $customerName); + $this->_headerText = Mage::helper('review')->__('All Reviews of Customer `%s`', $customerName); } else { $this->_headerText = Mage::helper('review')->__('All Reviews'); } diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Product/Grid.php b/app/code/core/Mage/Adminhtml/Block/Review/Product/Grid.php index 66d5b6743a..1c5e1aec99 100644 --- a/app/code/core/Mage/Adminhtml/Block/Review/Product/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Review/Product/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -56,7 +56,7 @@ protected function _prepareColumns() if ((int)$this->getRequest()->getParam('store', 0)) { $this->addColumn('custom_name', array( - 'header' => Mage::helper('review')->__('Name In Store'), + 'header' => Mage::helper('review')->__('Name in Store'), 'index' => 'custom_name' )); } diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Rating/Detailed.php b/app/code/core/Mage/Adminhtml/Block/Review/Rating/Detailed.php index 9cc20f1b08..916019b949 100644 --- a/app/code/core/Mage/Adminhtml/Block/Review/Rating/Detailed.php +++ b/app/code/core/Mage/Adminhtml/Block/Review/Rating/Detailed.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Rating/Summary.php b/app/code/core/Mage/Adminhtml/Block/Review/Rating/Summary.php index f09f19b9bb..476f51921f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Review/Rating/Summary.php +++ b/app/code/core/Mage/Adminhtml/Block/Review/Rating/Summary.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales.php b/app/code/core/Mage/Adminhtml/Block/Sales.php index 4882ba27ca..a4775882a5 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Creditmemo.php b/app/code/core/Mage/Adminhtml/Block/Sales/Creditmemo.php index 04417d37d7..e64330acaf 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Creditmemo.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Creditmemo.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Creditmemo/Grid.php b/app/code/core/Mage/Adminhtml/Block/Sales/Creditmemo/Grid.php index 213c4b8f1a..73467aadaf 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Creditmemo/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Creditmemo/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -40,30 +40,30 @@ public function __construct() $this->setDefaultDir('DESC'); } + /** + * Retrieve collection class + * + * @return string + */ + protected function _getCollectionClass() + { + return 'sales/order_creditmemo_grid_collection'; + } + protected function _prepareCollection() { - //TODO: add full name logic - $collection = Mage::getResourceModel('sales/order_creditmemo_collection') - ->addAttributeToSelect('increment_id') - ->addAttributeToSelect('created_at') - ->addAttributeToSelect('order_currency_code') - ->addAttributeToSelect('state') - ->addAttributeToSelect('grand_total') - ->joinAttribute('billing_firstname', 'order_address/firstname', 'billing_address_id', null, 'left') - ->joinAttribute('billing_lastname', 'order_address/lastname', 'billing_address_id', null, 'left') - ->joinAttribute('order_increment_id', 'order/increment_id', 'order_id', null, 'left') - ->joinAttribute('order_created_at', 'order/created_at', 'order_id', null, 'left') - ; + $collection = Mage::getResourceModel($this->_getCollectionClass()); $this->setCollection($collection); return parent::_prepareCollection(); } + protected function _prepareColumns() { $this->addColumn('increment_id', array( 'header' => Mage::helper('sales')->__('Credit Memo #'), 'index' => 'increment_id', - 'type' => 'number', + 'type' => 'text', )); $this->addColumn('created_at', array( @@ -84,14 +84,9 @@ protected function _prepareColumns() 'type' => 'datetime', )); - $this->addColumn('billing_firstname', array( - 'header' => Mage::helper('sales')->__('Bill to First name'), - 'index' => 'billing_firstname', - )); - - $this->addColumn('billing_lastname', array( - 'header' => Mage::helper('sales')->__('Bill to Last name'), - 'index' => 'billing_lastname', + $this->addColumn('billing_name', array( + 'header' => Mage::helper('sales')->__('Bill to Name'), + 'index' => 'billing_name', )); $this->addColumn('state', array( @@ -118,7 +113,7 @@ protected function _prepareColumns() 'actions' => array( array( 'caption' => Mage::helper('sales')->__('View'), - 'url' => array('base'=>'*/*/view'), + 'url' => array('base'=>'*/sales_creditmemo/view'), 'field' => 'creditmemo_id' ) ), @@ -127,6 +122,9 @@ protected function _prepareColumns() 'is_system' => true )); + $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV')); + $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel')); + return parent::_prepareColumns(); } @@ -134,10 +132,11 @@ protected function _prepareMassaction() { $this->setMassactionIdField('entity_id'); $this->getMassactionBlock()->setFormFieldName('creditmemo_ids'); + $this->getMassactionBlock()->setUseSelectAll(false); $this->getMassactionBlock()->addItem('pdfcreditmemos_order', array( 'label'=> Mage::helper('sales')->__('PDF Credit Memos'), - 'url' => $this->getUrl('*/*/pdfcreditmemos'), + 'url' => $this->getUrl('*/sales_creditmemo/pdfcreditmemos'), )); return $this; @@ -145,7 +144,11 @@ protected function _prepareMassaction() public function getRowUrl($row) { - return $this->getUrl('*/*/view', + if (!Mage::getSingleton('admin/session')->isAllowed('sales/order/creditmemo')) { + return false; + } + + return $this->getUrl('*/sales_creditmemo/view', array( 'creditmemo_id'=> $row->getId(), ) diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Invoice.php b/app/code/core/Mage/Adminhtml/Block/Sales/Invoice.php index 4b04f96b19..4a07c1e57e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Invoice.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Invoice.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Invoice/Grid.php b/app/code/core/Mage/Adminhtml/Block/Sales/Invoice/Grid.php index 044e14a16d..5eea4b6a6e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Invoice/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Invoice/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,21 +42,19 @@ public function __construct() $this->setSaveParametersInSession(true); } + /** + * Retrieve collection class + * + * @return string + */ + protected function _getCollectionClass() + { + return 'sales/order_invoice_grid_collection'; + } + protected function _prepareCollection() { - //TODO: add full name logic - $collection = Mage::getResourceModel('sales/order_invoice_collection') - ->addAttributeToSelect('order_id') - ->addAttributeToSelect('increment_id') - ->addAttributeToSelect('created_at') - ->addAttributeToSelect('state') - ->addAttributeToSelect('grand_total') - ->addAttributeToSelect('order_currency_code') - ->joinAttribute('billing_firstname', 'order_address/firstname', 'billing_address_id', null, 'left') - ->joinAttribute('billing_lastname', 'order_address/lastname', 'billing_address_id', null, 'left') - ->joinAttribute('order_increment_id', 'order/increment_id', 'order_id', null, 'left') - ->joinAttribute('order_created_at', 'order/created_at', 'order_id', null, 'left') - ; + $collection = Mage::getResourceModel($this->_getCollectionClass()); $this->setCollection($collection); return parent::_prepareCollection(); } @@ -87,14 +85,9 @@ protected function _prepareColumns() 'type' => 'datetime', )); - $this->addColumn('billing_firstname', array( - 'header' => Mage::helper('sales')->__('Bill to First name'), - 'index' => 'billing_firstname', - )); - - $this->addColumn('billing_lastname', array( - 'header' => Mage::helper('sales')->__('Bill to Last name'), - 'index' => 'billing_lastname', + $this->addColumn('billing_name', array( + 'header' => Mage::helper('sales')->__('Bill to Name'), + 'index' => 'billing_name', )); $this->addColumn('state', array( @@ -121,7 +114,7 @@ protected function _prepareColumns() 'actions' => array( array( 'caption' => Mage::helper('sales')->__('View'), - 'url' => array('base'=>'*/*/view'), + 'url' => array('base'=>'*/sales_invoice/view'), 'field' => 'invoice_id' ) ), @@ -130,6 +123,9 @@ protected function _prepareColumns() 'is_system' => true )); + $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV')); + $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel')); + return parent::_prepareColumns(); } @@ -137,10 +133,11 @@ protected function _prepareMassaction() { $this->setMassactionIdField('entity_id'); $this->getMassactionBlock()->setFormFieldName('invoice_ids'); + $this->getMassactionBlock()->setUseSelectAll(false); $this->getMassactionBlock()->addItem('pdfinvoices_order', array( 'label'=> Mage::helper('sales')->__('PDF Invoices'), - 'url' => $this->getUrl('*/*/pdfinvoices'), + 'url' => $this->getUrl('*/sales_invoice/pdfinvoices'), )); return $this; @@ -148,7 +145,11 @@ protected function _prepareMassaction() public function getRowUrl($row) { - return $this->getUrl('*/*/view', + if (!Mage::getSingleton('admin/session')->isAllowed('sales/order/invoice')) { + return false; + } + + return $this->getUrl('*/sales_invoice/view', array( 'invoice_id'=> $row->getId(), ) diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php index e48aefca75..50842d947b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -233,7 +233,7 @@ public function getOrder() return $this->getItem()->getOrder(); } - Mage::throwException(Mage::helper('sales')->__('Can\'t get order instance')); + Mage::throwException(Mage::helper('sales')->__('Cannot get order instance')); } /** diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Default.php b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Default.php index 64385f7599..84cc378fae 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Default.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -83,9 +83,9 @@ public function getCustomizedOptionValue($optionInfo) public function getSku() { - if ($this->getItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) { + /*if ($this->getItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) { return $this->getItem()->getProductOptionByCode('simple_sku'); - } + }*/ return $this->getItem()->getSku(); } diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Name.php b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Name.php index cfc65c6cf9..944938257c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Name.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Name.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Name/Grouped.php b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Name/Grouped.php index 766b8105c7..2497996d61 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Name/Grouped.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Name/Grouped.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Qty.php b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Qty.php index 76a2472342..fa230fa381 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Qty.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Qty.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Renderer/Configurable.php b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Renderer/Configurable.php index 96ebf94e17..c1c3cc94f8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Renderer/Configurable.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Renderer/Configurable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Renderer/Default.php b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Renderer/Default.php index 50f92e0386..e9d6eecb81 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Renderer/Default.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Renderer/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order.php index a3f76415e2..59f25fd065 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Abstract.php index da42107479..ee68b52878 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -49,7 +49,7 @@ public function getOrder() if (Mage::registry('order')) { return Mage::registry('order'); } - Mage::throwException(Mage::helper('sales')->__('Can\'t get order instance')); + Mage::throwException(Mage::helper('sales')->__('Cannot get order instance')); } public function getPriceDataObject() @@ -100,14 +100,13 @@ public function getOrderInfoData() */ public function displayShippingPriceInclTax($order) { - $baseTax = $order->getBaseShippingTaxAmount(); - $tax = $order->getShippingTaxAmount(); - - return $this->displayPrices( - $order->getBaseShippingAmount()+$baseTax, - $order->getShippingAmount()+$tax, - false, - ' ' - ); + $shipping = $order->getShippingInclTax(); + if ($shipping) { + $baseShipping = $order->getBaseShippingInclTax(); + } else { + $shipping = $order->getShippingAmount()+$order->getShippingTaxAmount(); + $baseShipping = $order->getBaseShippingAmount()+$order->getBaseShippingTaxAmount(); + } + return $this->displayPrices($baseShipping, $shipping, false, ' '); } } diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Comments/View.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Comments/View.php index 40714d30f6..6ff93efd46 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Comments/View.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Comments/View.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -39,7 +39,7 @@ class Mage_Adminhtml_Block_Sales_Order_Comments_View extends Mage_Adminhtml_Bloc protected function _beforeToHtml() { if (!$this->getParentBlock()) { - Mage::throwException(Mage::helper('adminhtml')->__('Invalid parrent block for this block')); + Mage::throwException(Mage::helper('adminhtml')->__('Invalid parent block for this block.')); } $this->setEntity($this->getParentBlock()->getSource()); parent::_beforeToHtml(); diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create.php index 03a7102baa..dfff5f4226 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Abstract.php index a515686d7f..8c6d3ef840 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Address.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Address.php index 38f5fb7e66..0ca121806b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Address.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Address.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Method.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Method.php index 2fa603ff52..b869482bf8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Method.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Method.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Method/Form.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Method/Form.php index 76ee78d2b7..c217371b0c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Method/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Method/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Comment.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Comment.php index d4590e83c5..2a2bcbd016 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Comment.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Comment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Coupons.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Coupons.php index 53cc406657..8ca4b7b094 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Coupons.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Coupons.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Coupons/Form.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Coupons/Form.php index 6ec8dbf41d..ee83d19112 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Coupons/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Coupons/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Customer.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Customer.php index d86496a96c..301c3bd2b3 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Customer.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Customer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -43,7 +43,7 @@ public function __construct() public function getHeaderText() { - return Mage::helper('sales')->__('Please select a customer'); + return Mage::helper('sales')->__('Please Select a Customer'); } public function getButtonsHtml() diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Customer/Grid.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Customer/Grid.php index 708d5d0254..d8a73ca90f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Customer/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Customer/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Data.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Data.php index 04bbda3270..bf95bd7afd 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Data.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form.php index fbf69c4bad..6014f44cf9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form/Account.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form/Account.php index 7532e828ec..932dd985da 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form/Account.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form/Account.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form/Address.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form/Address.php index 52948e3e41..f4966cc9c9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form/Address.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form/Address.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage.php index 5c867f8cff..4598ca5ac4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage/Form.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage/Form.php index 4e5df5909f..81308f7833 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Header.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Header.php index 999cc935da..dd700ff6db 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Header.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Header.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items.php index 1120cc6986..6aa72eced8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items/Grid.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items/Grid.php index c581a0e18b..a656dbce1b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -51,12 +51,14 @@ public function getItems() $items = $this->getParentBlock()->getItems(); foreach ($items as $item) { $stockItem = $item->getProduct()->getStockItem(); - $check = $stockItem->checkQuoteItemQty($item->getQty(), $item->getQty(), $item->getQty()); - $item->setMessage($check->getMessage()); - $item->setHasError($check->getHasError()); - if ($item->getProduct()->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED) { - $item->setMessage(Mage::helper('adminhtml')->__('This product is currently disabled')); - $item->setHasError(true); + if ($stockItem instanceof Mage_CatalogInventory_Model_Stock_Item) { + $check = $stockItem->checkQuoteItemQty($item->getQty(), $item->getQty(), $item->getQty()); + $item->setMessage($check->getMessage()); + $item->setHasError($check->getHasError()); + if ($item->getProduct()->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED) { + $item->setMessage(Mage::helper('adminhtml')->__('This product is currently disabled.')); + $item->setHasError(true); + } } } return $items; @@ -79,7 +81,11 @@ public function getOriginalEditablePrice($item) } elseif ($item->hasCustomPrice()) { $result = $item->getCustomPrice()*1; } else { - $result = $item->getOriginalPrice()*1; + if (Mage::helper('tax')->priceIncludesTax($this->getStore())) { + $result = $item->getPriceInclTax()*1; + } else { + $result = $item->getOriginalPrice()*1; + } } return $result; } diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Load.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Load.php index 5ed16447f7..911b4575a6 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Load.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Load.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -39,7 +39,7 @@ protected function _toHtml() $result = array(); foreach ($this->getSortedChildren() as $name) { if (!$block = $this->getChild($name)) { - $result[$name] = Mage::helper('sales')->__('Invalid block: %s', $name); + $result[$name] = Mage::helper('sales')->__('Invalid block: %s.', $name); } else { $result[$name] = $block->toHtml(); } diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Messages.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Messages.php index eadeb06aa5..ade1e4608f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Messages.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Messages.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Newsletter.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Newsletter.php index f8e0eed241..94e65c3abe 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Newsletter.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Newsletter.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Newsletter/Form.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Newsletter/Form.php index 96d853bcb0..8e7edf72c3 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Newsletter/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Newsletter/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search.php index 75904613ea..5c36a2d216 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -43,7 +43,7 @@ public function __construct() public function getHeaderText() { - return Mage::helper('sales')->__('Please select products to add'); + return Mage::helper('sales')->__('Please Select Products to Add'); } public function getButtonsHtml() diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid.php index 354c67406e..b30c2c7d9c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -94,6 +94,7 @@ protected function _prepareCollection() ->addAttributeToSelect('name') ->addAttributeToSelect('sku') ->addAttributeToSelect('price') + ->addMinimalPrice() ->addAttributeToFilter('type_id', array_keys( Mage::getConfig()->getNode('adminhtml/sales/order/create/available_product_types')->asArray() )) @@ -139,7 +140,8 @@ protected function _prepareColumns() 'type' => 'currency', 'currency_code' => $this->getStore()->getCurrentCurrencyCode(), 'rate' => $this->getStore()->getBaseCurrency()->getRate($this->getStore()->getCurrentCurrencyCode()), - 'index' => 'price' + 'index' => 'price', + 'renderer' => 'adminhtml/sales_order_create_search_grid_renderer_price' )); $this->addColumn('in_products', array( diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Giftmessage.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Giftmessage.php index 33ac68fcb3..147386ed7e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Giftmessage.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Giftmessage.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Price.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Price.php new file mode 100644 index 0000000000..01e947f033 --- /dev/null +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Price.php @@ -0,0 +1,50 @@ + + */ +class Mage_Adminhtml_Block_Sales_Order_Create_Search_Grid_Renderer_Price extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Price +{ + /** + * Render minimal price for downloadable products + * + * @param Varien_Object $row + * @return string + */ + public function render(Varien_Object $row) + { + if ($row->getTypeId() == Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE) { + $row->setPrice($row->getMaxPrice()); + } + return parent::render($row); + } + +} diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Address.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Address.php index 5d75fe4934..1a7ba5bd02 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Address.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Address.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Method.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Method.php index 96c710de25..2b1eaff9e4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Method.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Method.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Method/Form.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Method/Form.php index cb80292815..09bb7d0775 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Method/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Method/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar.php index 07db49c21d..4edfa42576 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Abstract.php index b8dcddcbac..1ce400fd6f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Cart.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Cart.php index 49c3095366..7e623b5da1 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Cart.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Cart.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Compared.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Compared.php index c2712d5ff5..6da9cd0931 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Compared.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Compared.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -44,7 +44,7 @@ public function __construct() public function getHeaderText() { - return Mage::helper('sales')->__('Products in Compare List'); + return Mage::helper('sales')->__('Products in Comparison List'); } /** diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Pcompared.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Pcompared.php index 03d1f3a0dc..fa1cf1f55c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Pcompared.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Pcompared.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Pviewed.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Pviewed.php index 733c61290e..3c8defc144 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Pviewed.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Pviewed.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Reorder.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Reorder.php index 3c93c5f515..cfe43406ca 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Reorder.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Reorder.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -46,7 +46,7 @@ public function __construct() public function getHeaderText() { - return Mage::helper('sales')->__('Last ordered items'); + return Mage::helper('sales')->__('Last Ordered Items'); } /** @@ -58,11 +58,10 @@ public function getLastOrder() { $storeIds = $this->getQuote()->getStore()->getWebsite()->getStoreIds(); $collection = Mage::getResourceModel('sales/order_collection') - ->addAttributeToSelect('*') - ->addAttributeToFilter('customer_id', $this->getCustomerId()) - ->addAttributeToFilter('store_id', array('in' => $storeIds)) - ->addAttributeToSort('created_at', 'desc') - ->setPage(1, 1) + ->addFieldToFilter('customer_id', $this->getCustomerId()) + ->addFieldToFilter('store_id', array('in' => $storeIds)) + ->setOrder('created_at', 'desc') + ->setPageSize(1) ->load(); foreach ($collection as $order) { return $order; diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Viewed.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Viewed.php index cba8482125..daa6204a33 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Viewed.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Viewed.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Wishlist.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Wishlist.php index 42f6459a69..95c6a02df1 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Wishlist.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Wishlist.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Store.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Store.php index 2266324ff0..62f1e0c858 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Store.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Store.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -43,6 +43,6 @@ public function __construct() public function getHeaderText() { - return Mage::helper('sales')->__('Please select a store'); + return Mage::helper('sales')->__('Please Select a Store'); } } diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Store/Select.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Store/Select.php index 867381253c..13f4a99080 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Store/Select.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Store/Select.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals.php index cd801669cb..c68231931b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Default.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Default.php index b5e1c28342..331e358b7b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Default.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Discount.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Discount.php index 1a84d3a16f..2f68a2ae7a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Discount.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Discount.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Grandtotal.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Grandtotal.php index 107af083e9..1f1c27a94d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Grandtotal.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Grandtotal.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Shipping.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Shipping.php index baac389f52..d596798076 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Shipping.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Shipping.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Subtotal.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Subtotal.php index 4648386d43..a6183af62d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Subtotal.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Subtotal.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Table.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Table.php index 4f711a9224..88dc9bee25 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Table.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Table.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Tax.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Tax.php index 2270896301..1f02d5b629 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Tax.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals/Tax.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create.php index a582bd744a..5fe056d260 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Adjustments.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Adjustments.php index fb20eca7dc..803f8cf26e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Adjustments.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Adjustments.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Block_Sales_Order_Creditmemo_Create_Adjustments extends Mage_Adminhtml_Block_Template @@ -50,4 +50,38 @@ public function getSource() { return $this->_source; } + + /** + * Get credit memo shipping amount depend on configuration settings + * @return float + */ + public function getShippingAmount() + { + $config = Mage::getSingleton('tax/config'); + $source = $this->getSource(); + if ($config->displaySalesShippingInclTax($source->getOrder()->getStoreId())) { + $shipping = $source->getBaseShippingInclTax(); + } else { + $shipping = $source->getBaseShippingAmount(); + } + return $shipping*1; + } + + /** + * Get label for shipping total based on configuration settings + * @return string + */ + public function getShippingLabel() + { + $config = Mage::getSingleton('tax/config'); + $source = $this->getSource(); + if ($config->displaySalesShippingInclTax($source->getOrder()->getStoreId())) { + $label = $this->helper('sales')->__('Refund Shipping (Incl. Tax)'); + } elseif ($config->displaySalesShippingBoth($source->getOrder()->getStoreId())) { + $label = $this->helper('sales')->__('Refund Shipping (Excl. Tax)'); + } else { + $label = $this->helper('sales')->__('Refund Shipping'); + } + return $label; + } } diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Form.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Form.php index 2b495a5eac..f25668379c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Items.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Items.php index 27a386819c..309cfd3aad 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Items.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create/Items.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Totals.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Totals.php index e5c79d8799..bbebb8a5ef 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Totals.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Totals.php @@ -1,79 +1,79 @@ - - */ -class Mage_Adminhtml_Block_Sales_Order_Creditmemo_Totals extends Mage_Adminhtml_Block_Sales_Totals -{ - protected $_creditmemo; - - public function getCreditmemo() - { - if ($this->_creditmemo === null) { - if ($this->hasData('creditmemo')) { - $this->_creditmemo = $this->_getData('creditmemo'); - } elseif (Mage::registry('current_creditmemo')) { - $this->_creditmemo = Mage::registry('current_creditmemo'); - } elseif ($this->getParentBlock() && $this->getParentBlock()->getCreditmemo()) { - $this->_creditmemo = $this->getParentBlock()->getCreditmemo(); - } - } - return $this->_creditmemo; - } - - public function getSource() - { - return $this->getCreditmemo(); - } - - /** - * Initialize creditmemo totals array - * - * @return Mage_Sales_Block_Order_Totals - */ - protected function _initTotals() - { - parent::_initTotals(); - $this->addTotal(new Varien_Object(array( - 'code' => 'adjustment_positive', - 'value' => $this->getSource()->getAdjustmentFeePositive(), - 'base_value'=> $this->getSource()->getBaseAdjustmentFeePositive(), - 'label' => $this->helper('sales')->__('Adjustment Refund') - ))); - $this->addTotal(new Varien_Object(array( - 'code' => 'adjustment_negative', - 'value' => $this->getSource()->getAdjustmentFeeNegative(), - 'base_value'=> $this->getSource()->getBaseAdjustmentFeeNegative(), - 'label' => $this->helper('sales')->__('Adjustment Fee') - ))); - return $this; - } -} + + */ +class Mage_Adminhtml_Block_Sales_Order_Creditmemo_Totals extends Mage_Adminhtml_Block_Sales_Totals +{ + protected $_creditmemo; + + public function getCreditmemo() + { + if ($this->_creditmemo === null) { + if ($this->hasData('creditmemo')) { + $this->_creditmemo = $this->_getData('creditmemo'); + } elseif (Mage::registry('current_creditmemo')) { + $this->_creditmemo = Mage::registry('current_creditmemo'); + } elseif ($this->getParentBlock() && $this->getParentBlock()->getCreditmemo()) { + $this->_creditmemo = $this->getParentBlock()->getCreditmemo(); + } + } + return $this->_creditmemo; + } + + public function getSource() + { + return $this->getCreditmemo(); + } + + /** + * Initialize creditmemo totals array + * + * @return Mage_Sales_Block_Order_Totals + */ + protected function _initTotals() + { + parent::_initTotals(); + $this->addTotal(new Varien_Object(array( + 'code' => 'adjustment_positive', + 'value' => $this->getSource()->getAdjustmentPositive(), + 'base_value'=> $this->getSource()->getBaseAdjustmentPositive(), + 'label' => $this->helper('sales')->__('Adjustment Refund') + ))); + $this->addTotal(new Varien_Object(array( + 'code' => 'adjustment_negative', + 'value' => $this->getSource()->getAdjustmentNegative(), + 'base_value'=> $this->getSource()->getBaseAdjustmentNegative(), + 'label' => $this->helper('sales')->__('Adjustment Fee') + ))); + return $this; + } +} diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View.php index 8835212f27..2492de9bd7 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -114,19 +114,12 @@ public function getCreditmemo() public function getHeaderText() { if ($this->getCreditmemo()->getEmailSent()) { - $emailSent = Mage::helper('sales')->__('Credit Memo email sent'); + $emailSent = Mage::helper('sales')->__('the credit memo email was sent'); } else { - $emailSent = Mage::helper('sales')->__('Credit Memo email not sent'); + $emailSent = Mage::helper('sales')->__('the credit memo email is not sent'); } - - $header = Mage::helper('sales')->__('Credit Memo #%s | Date %s | Status %s (%s)', - $this->getCreditmemo()->getIncrementId(), - $this->formatDate($this->getCreditmemo()->getCreatedAtDate(), 'medium', true), - $this->getCreditmemo()->getStateName(), - $emailSent - ); - return $header; + return Mage::helper('sales')->__('Credit Memo #%1$s | %3$s | %2$s (%4$s)', $this->getCreditmemo()->getIncrementId(), $this->formatDate($this->getCreditmemo()->getCreatedAtDate(), 'medium', true), $this->getCreditmemo()->getStateName(), $emailSent); } /** @@ -207,6 +200,10 @@ public function getPrintUrl() public function updateBackButtonUrl($flag) { if ($flag) { + if ($this->getCreditmemo()->getBackUrl()) { + return $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getCreditmemo()->getBackUrl() . '\')'); + } + return $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getUrl('*/sales_creditmemo/') . '\')'); } return $this; diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Comments.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Comments.php index 1a43479583..b3fa868129 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Comments.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Comments.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Form.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Form.php index 7d2d14024c..f8c675a488 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Items.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Items.php index 934d4bf0d1..fb483cd94f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Items.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/View/Items.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php index eb2ed0a0a7..6d245c267e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -44,22 +44,19 @@ public function __construct() $this->setSaveParametersInSession(true); } + /** + * Retrieve collection class + * + * @return string + */ + protected function _getCollectionClass() + { + return 'sales/order_grid_collection'; + } + protected function _prepareCollection() { - // TODO: add full name logic - // TODO: encapsulate this logic into collection - $collection = Mage::getResourceModel('sales/order_collection') - ->addAttributeToSelect('*') - ->joinAttribute('billing_firstname', 'order_address/firstname', 'billing_address_id', null, 'left') - ->joinAttribute('billing_lastname', 'order_address/lastname', 'billing_address_id', null, 'left') - ->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left') - ->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left') - ->addExpressionAttributeToSelect('billing_name', - 'CONCAT({{billing_firstname}}, " ", {{billing_lastname}})', - array('billing_firstname', 'billing_lastname')) - ->addExpressionAttributeToSelect('shipping_name', - 'CONCAT({{shipping_firstname}}, IFNULL(CONCAT(\' \', {{shipping_lastname}}), \'\'))', - array('shipping_firstname', 'shipping_lastname')); + $collection = Mage::getResourceModel($this->_getCollectionClass()); $this->setCollection($collection); return parent::_prepareCollection(); } @@ -76,7 +73,7 @@ protected function _prepareColumns() if (!Mage::app()->isSingleStoreMode()) { $this->addColumn('store_id', array( - 'header' => Mage::helper('sales')->__('Purchased from (store)'), + 'header' => Mage::helper('sales')->__('Purchased From (Store)'), 'index' => 'store_id', 'type' => 'store', 'store_view'=> true, @@ -91,29 +88,11 @@ protected function _prepareColumns() 'width' => '100px', )); - /*$this->addColumn('billing_firstname', array( - 'header' => Mage::helper('sales')->__('Bill to First name'), - 'index' => 'billing_firstname', - )); - - $this->addColumn('billing_lastname', array( - 'header' => Mage::helper('sales')->__('Bill to Last name'), - 'index' => 'billing_lastname', - ));*/ $this->addColumn('billing_name', array( 'header' => Mage::helper('sales')->__('Bill to Name'), 'index' => 'billing_name', )); - /*$this->addColumn('shipping_firstname', array( - 'header' => Mage::helper('sales')->__('Ship to First name'), - 'index' => 'shipping_firstname', - )); - - $this->addColumn('shipping_lastname', array( - 'header' => Mage::helper('sales')->__('Ship to Last name'), - 'index' => 'shipping_lastname', - ));*/ $this->addColumn('shipping_name', array( 'header' => Mage::helper('sales')->__('Ship to Name'), 'index' => 'shipping_name', @@ -151,7 +130,7 @@ protected function _prepareColumns() 'actions' => array( array( 'caption' => Mage::helper('sales')->__('View'), - 'url' => array('base'=>'*/*/view'), + 'url' => array('base'=>'*/sales_order/view'), 'field' => 'order_id' ) ), @@ -163,6 +142,9 @@ protected function _prepareColumns() } $this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS')); + $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV')); + $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel')); + return parent::_prepareColumns(); } @@ -170,91 +152,56 @@ protected function _prepareMassaction() { $this->setMassactionIdField('entity_id'); $this->getMassactionBlock()->setFormFieldName('order_ids'); + $this->getMassactionBlock()->setUseSelectAll(false); if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) { $this->getMassactionBlock()->addItem('cancel_order', array( 'label'=> Mage::helper('sales')->__('Cancel'), - 'url' => $this->getUrl('*/*/massCancel'), + 'url' => $this->getUrl('*/sales_order/massCancel'), )); } if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) { $this->getMassactionBlock()->addItem('hold_order', array( 'label'=> Mage::helper('sales')->__('Hold'), - 'url' => $this->getUrl('*/*/massHold'), + 'url' => $this->getUrl('*/sales_order/massHold'), )); } if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) { $this->getMassactionBlock()->addItem('unhold_order', array( 'label'=> Mage::helper('sales')->__('Unhold'), - 'url' => $this->getUrl('*/*/massUnhold'), + 'url' => $this->getUrl('*/sales_order/massUnhold'), )); } $this->getMassactionBlock()->addItem('pdfinvoices_order', array( 'label'=> Mage::helper('sales')->__('Print Invoices'), - 'url' => $this->getUrl('*/*/pdfinvoices'), + 'url' => $this->getUrl('*/sales_order/pdfinvoices'), )); $this->getMassactionBlock()->addItem('pdfshipments_order', array( 'label'=> Mage::helper('sales')->__('Print Packingslips'), - 'url' => $this->getUrl('*/*/pdfshipments'), + 'url' => $this->getUrl('*/sales_order/pdfshipments'), )); $this->getMassactionBlock()->addItem('pdfcreditmemos_order', array( 'label'=> Mage::helper('sales')->__('Print Credit Memos'), - 'url' => $this->getUrl('*/*/pdfcreditmemos'), + 'url' => $this->getUrl('*/sales_order/pdfcreditmemos'), )); $this->getMassactionBlock()->addItem('pdfdocs_order', array( 'label'=> Mage::helper('sales')->__('Print All'), - 'url' => $this->getUrl('*/*/pdfdocs'), + 'url' => $this->getUrl('*/sales_order/pdfdocs'), )); -// $statuses = Mage::getSingleton('sales/order_config')->getStatuses(); -// array_unshift($statuses, array('value'=>'', 'label'=>'')); -// $this->getMassactionBlock()->addItem('change_status', array( -// 'label'=> Mage::helper('sales')->__('Change Status'), -// 'url' => $this->getUrl('*/*/massStatus'), -// 'additional' => array( -// 'visibility' => array( -// 'name' => 'status', -// 'type' => 'select', -// 'class' => 'required-entry', -// 'label' => Mage::helper('sales')->__('New Status'), -// 'values' => $statuses -// ) -// ) -// )); - -// $prints = array( -// 'empty' => array('value'=>'', 'label'=>''), -// 'order' => Mage::helper('sales')->__('Orders'), -// 'invoice' => Mage::helper('sales')->__('Invoices'), -// 'shipment' => Mage::helper('sales')->__('Shipments'), -// ); -// $this->getMassactionBlock()->addItem('print', array( -// 'label'=> Mage::helper('sales')->__('Print'), -// 'url' => $this->getUrl('*/*/massPrint'), -// 'additional' => array( -// 'visibility' => array( -// 'name' => 'document', -// 'type' => 'select', -// 'class' => 'required-entry', -// 'label' => Mage::helper('sales')->__('Document'), -// 'values' => $prints -// ) -// ) -// )); - return $this; } public function getRowUrl($row) { if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) { - return $this->getUrl('*/*/view', array('order_id' => $row->getId())); + return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId())); } return false; } diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create.php index ffa1920c51..32b85a3774 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Form.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Form.php index 2f7df5d036..300af78603 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Items.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Items.php index 4e287c00d8..4021893a76 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Items.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Items.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Tracking.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Tracking.php index 779e80cce7..40aebffa14 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Tracking.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Create/Tracking.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Totals.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Totals.php index 5a1f0fbde0..bc269f8512 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Totals.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/Totals.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View.php index b0cd4b4710..6db4cdf727 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -76,8 +76,8 @@ public function __construct() || !$this->getInvoice()->getIsUsedForRefund()) { $this->_addButton('capture', array( // capture? - 'label' => Mage::helper('sales')->__('Credit Memo...'), - 'class' => 'save', + 'label' => Mage::helper('sales')->__('Credit Memo'), + 'class' => 'go', 'onclick' => 'setLocation(\''.$this->getCreditMemoUrl().'\')' ) ); @@ -125,23 +125,12 @@ public function getInvoice() public function getHeaderText() { if ($this->getInvoice()->getEmailSent()) { - $emailSent = Mage::helper('sales')->__('Invoice email sent'); + $emailSent = Mage::helper('sales')->__('the invoice email was sent'); } else { - $emailSent = Mage::helper('sales')->__('Invoice email not sent'); + $emailSent = Mage::helper('sales')->__('the invoice email is not sent'); } - - $header = Mage::helper('sales')->__('Invoice #%s | %s (%s)', - $this->getInvoice()->getIncrementId(), - $this->getInvoice()->getStateName(), - $emailSent - ); - /*$header = Mage::helper('sales')->__('Invoice #%s | Order Date: %s | Customer Name: %s', - $this->getInvoice()->getIncrementId(), - $this->formatDate($this->getInvoice()->getOrder()->getCreatedAt(), 'medium', true), - $this->getInvoice()->getOrder()->getCustomerName() - );*/ - return $header; + return Mage::helper('sales')->__('Invoice #%1$s | %2$s | %4$s (%3$s)', $this->getInvoice()->getIncrementId(), $this->getInvoice()->getStateName(), $emailSent, $this->formatDate($this->getInvoice()->getCreatedAtDate(), 'medium', true)); } public function getBackUrl() @@ -195,6 +184,9 @@ public function getPrintUrl() public function updateBackButtonUrl($flag) { if ($flag) { + if ($this->getInvoice()->getBackUrl()) { + return $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getInvoice()->getBackUrl() . '\')'); + } return $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getUrl('*/sales_invoice/') . '\')'); } return $this; diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Comments.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Comments.php index 95c72c673c..215a378263 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Comments.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Comments.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Form.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Form.php index e106f53803..743cbbed9e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Items.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Items.php index 7f1c602e4c..2e5d87de0e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Items.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Invoice/View/Items.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Payment.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Payment.php index 332d6983e2..b3ebc1fedb 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Payment.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Payment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -39,7 +39,7 @@ class Mage_Adminhtml_Block_Sales_Order_Payment extends Mage_Adminhtml_Block_Temp protected function _beforeToHtml() { if (!$this->getParentBlock()) { - Mage::throwException(Mage::helper('adminhtml')->__('Invalid parrent block for this block')); + Mage::throwException(Mage::helper('adminhtml')->__('Invalid parent block for this block')); } $this->setPayment($this->getParentBlock()->getOrder()->getPayment()); parent::_beforeToHtml(); diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create.php index 0d97ec1f4b..b57e65d0dd 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Form.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Form.php index 8acbfc5f9f..b20de86130 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Items.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Items.php index ab33987c4c..dd913f9a8b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Items.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Items.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Tracking.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Tracking.php index d3470d025c..ac45fac0b6 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Tracking.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Tracking.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Tracking/Info.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Tracking/Info.php index 18a98ad22d..7e1067d0d0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Tracking/Info.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Tracking/Info.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View.php index a5bc1465be..8e5b80e4ae 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -76,14 +76,12 @@ public function getShipment() public function getHeaderText() { if ($this->getShipment()->getEmailSent()) { - $emailSent = Mage::helper('sales')->__('Shipment email sent'); + $emailSent = Mage::helper('sales')->__('the shipment email was sent'); } else { - $emailSent = Mage::helper('sales')->__('Shipment email not sent'); + $emailSent = Mage::helper('sales')->__('the shipment email is not sent'); } - - $header = Mage::helper('sales')->__('Shipment #%s (%s)', $this->getShipment()->getIncrementId(), $emailSent); - return $header; + return Mage::helper('sales')->__('Shipment #%1$s | %3$s (%2$s)', $this->getShipment()->getIncrementId(), $emailSent, $this->formatDate($this->getShipment()->getCreatedAtDate(), 'medium', true)); } public function getBackUrl() @@ -111,6 +109,9 @@ public function getPrintUrl() public function updateBackButtonUrl($flag) { if ($flag) { + if ($this->getShipment()->getBackUrl()) { + return $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getShipment()->getBackUrl() . '\')'); + } return $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getUrl('*/sales_shipment/') . '\')'); } return $this; diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Comments.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Comments.php index af99615eb6..c1bf261698 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Comments.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Comments.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Form.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Form.php index 49629e346e..3f8c34f69d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Items.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Items.php index f0bb3cbabf..20fb4a3322 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Items.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Items.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Tracking.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Tracking.php index 2c186a4071..b0462a54e0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Tracking.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Tracking.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totalbar.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totalbar.php index 5aca2d17bd..eaa9e530f9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totalbar.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totalbar.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,7 +42,7 @@ class Mage_Adminhtml_Block_Sales_Order_Totalbar extends Mage_Adminhtml_Block_Sal protected function _beforeToHtml() { if (!$this->getParentBlock()) { - Mage::throwException(Mage::helper('adminhtml')->__('Invalid parrent block for this block')); + Mage::throwException(Mage::helper('adminhtml')->__('Invalid parent block for this block.')); } $this->setOrder($this->getParentBlock()->getOrder()); $this->setSource($this->getParentBlock()->getSource()); diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totals.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totals.php index 7f48e438ec..fab5c6345b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totals.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totals.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totals/Item.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totals/Item.php index 12005fdfd9..ef39153ddf 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totals/Item.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totals/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totals/Tax.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totals/Tax.php index e939e38117..074ca6172d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totals/Tax.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Totals/Tax.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View.php index 696c3b9955..90f5fd4b89 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -50,20 +50,20 @@ public function __construct() if ($this->_isAllowedAction('edit') && $order->canEdit()) { $onclickJs = 'deleteConfirm(\'' - . Mage::helper('sales')->__('Are you sure? This order will be cancelled and a new one will be created instead') + . Mage::helper('sales')->__('Are you sure? This order will be canceled and a new one will be created instead') . '\', \'' . $this->getEditUrl() . '\');'; $this->_addButton('order_edit', array( 'label' => Mage::helper('sales')->__('Edit'), 'onclick' => $onclickJs, )); // see if order has non-editable products as items - $nonEditableTypes = array_keys(Mage::getResourceSingleton('sales/order')->aggregateProductsByTypes( + $nonEditableTypes = array_keys($this->getOrder()->getResource()->aggregateProductsByTypes( $order->getId(), array_keys(Mage::getConfig()->getNode('adminhtml/sales/order/create/available_product_types')->asArray()), false )); if ($nonEditableTypes) { $this->_updateButton('order_edit', 'onclick', 'if (!confirm(\'' . - Mage::helper('sales')->__('This order contains (%s) items and therefore cannot be edited through the admin interface at this time, if you wish to continue editing the (%s) items will be removed, the order will be cancelled and a new order will be placed', implode(', ', $nonEditableTypes), implode(', ', $nonEditableTypes)) . '\')) return false;' . $onclickJs + Mage::helper('sales')->__('This order contains (%s) items and therefore cannot be edited through the admin interface at this time, if you wish to continue editing the (%s) items will be removed, the order will be canceled and a new order will be placed.', implode(', ', $nonEditableTypes), implode(', ', $nonEditableTypes)) . '\')) return false;' . $onclickJs ); } } @@ -85,9 +85,11 @@ public function __construct() } if ($this->_isAllowedAction('creditmemo') && $order->canCreditmemo()) { + $message = Mage::helper('sales')->__('This will create an offline refund. To create an online refund, open an invoice and create credit memo for it. Do you wish to proceed?'); $this->_addButton('order_creditmemo', array( - 'label' => Mage::helper('sales')->__('Credit Memo...'), - 'onclick' => 'setLocation(\'' . $this->getCreditmemoUrl() . '\')', + 'label' => Mage::helper('sales')->__('Credit Memo'), + 'onclick' => "confirmSetLocation('{$message}', '{$this->getCreditmemoUrl()}')", + 'class' => 'go' )); } @@ -114,28 +116,52 @@ public function __construct() )); } + if ($this->_isAllowedAction('review_payment')) { + if ($order->canReviewPayment()) { + $message = Mage::helper('sales')->__('Are you sure you want to accept this payment?'); + $this->_addButton('accept_payment', array( + 'label' => Mage::helper('sales')->__('Accept Payment'), + 'onclick' => "confirmSetLocation('{$message}', '{$this->getReviewPaymentUrl('accept')}')", + )); + $message = Mage::helper('sales')->__('Are you sure you want to deny this payment?'); + $this->_addButton('deny_payment', array( + 'label' => Mage::helper('sales')->__('Deny Payment'), + 'onclick' => "confirmSetLocation('{$message}', '{$this->getReviewPaymentUrl('deny')}')", + )); + } + if ($order->canFetchPaymentReviewUpdate()) { + $this->_addButton('get_review_payment_update', array( + 'label' => Mage::helper('sales')->__('Get Payment Update'), + 'onclick' => 'setLocation(\'' . $this->getReviewPaymentUrl('update') . '\')', + )); + } + } + if ($this->_isAllowedAction('invoice') && $order->canInvoice()) { $_label = $order->getForcedDoShipmentWithInvoice() ? - Mage::helper('sales')->__('Invoice and Ship...') : - Mage::helper('sales')->__('Invoice...'); + Mage::helper('sales')->__('Invoice and Ship') : + Mage::helper('sales')->__('Invoice'); $this->_addButton('order_invoice', array( 'label' => $_label, 'onclick' => 'setLocation(\'' . $this->getInvoiceUrl() . '\')', + 'class' => 'go' )); } if ($this->_isAllowedAction('ship') && $order->canShip() && !$order->getForcedDoShipmentWithInvoice()) { $this->_addButton('order_ship', array( - 'label' => Mage::helper('sales')->__('Ship...'), + 'label' => Mage::helper('sales')->__('Ship'), 'onclick' => 'setLocation(\'' . $this->getShipUrl() . '\')', + 'class' => 'go' )); } if ($this->_isAllowedAction('reorder') && $order->canReorder()) { $this->_addButton('order_reorder', array( - 'label' => Mage::helper('sales')->__('Reorder...'), + 'label' => Mage::helper('sales')->__('Reorder'), 'onclick' => 'setLocation(\'' . $this->getReorderUrl() . '\')', + 'class' => 'go' )); } } @@ -167,12 +193,7 @@ public function getHeaderText() } else { $_extOrderId = ''; } - $text = Mage::helper('sales')->__('Order # %s %s| Order Date %s', - $this->getOrder()->getRealOrderId(), - $_extOrderId, - $this->formatDate($this->getOrder()->getCreatedAtDate(), 'medium', true) - ); - return $text; + return Mage::helper('sales')->__('Order # %s %s | %s', $this->getOrder()->getRealOrderId(), $_extOrderId, $this->formatDate($this->getOrder()->getCreatedAtDate(), 'medium', true)); } public function getUrl($params='', $params2=array()) @@ -243,4 +264,48 @@ protected function _isAllowedAction($action) { return Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/' . $action); } + + /** + * Return back url for view grid + * + * @return string + */ + public function getBackUrl() + { + if ($this->getOrder()->getBackUrl()) { + return $this->getOrder()->getBackUrl(); + } + + return $this->getUrl('*/*/'); + } + + public function getReviewPaymentUrl($action) + { + return $this->getUrl('*/*/reviewPayment', array('action' => $action)); + } +// +// /** +// * Return URL for accept payment action +// * +// * @return string +// */ +// public function getAcceptPaymentUrl() +// { +// return $this->getUrl('*/*/reviewPayment', array('action' => 'accept')); +// } +// +// /** +// * Return URL for deny payment action +// * +// * @return string +// */ +// public function getDenyPaymentUrl() +// { +// return $this->getUrl('*/*/reviewPayment', array('action' => 'deny')); +// } +// +// public function getPaymentReviewUpdateUrl() +// { +// return $this->getUrl('*/*/reviewPaymentUpdate'); +// } } diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Form.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Form.php index de8e6a27c7..f61e93c109 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Giftmessage.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Giftmessage.php index 89010e33a1..ebd13e3409 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Giftmessage.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Giftmessage.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/History.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/History.php index 9a4f7e49b9..e11d37f1fd 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/History.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/History.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Info.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Info.php index 15a1426c69..ec7098304f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Info.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Info.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -39,7 +39,7 @@ class Mage_Adminhtml_Block_Sales_Order_View_Info extends Mage_Adminhtml_Block_Sa protected function _beforeToHtml() { if (!$this->getParentBlock()) { - Mage::throwException(Mage::helper('adminhtml')->__('Invalid parrent block for this block')); + Mage::throwException(Mage::helper('adminhtml')->__('Invalid parent block for this block.')); } $this->setOrder($this->getParentBlock()->getOrder()); diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items.php index 053e8cf855..528938381b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -39,7 +39,7 @@ class Mage_Adminhtml_Block_Sales_Order_View_Items extends Mage_Adminhtml_Block_S protected function _beforeToHtml() { if (!$this->getParentBlock()) { - Mage::throwException(Mage::helper('adminhtml')->__('Invalid parrent block for this block')); + Mage::throwException(Mage::helper('adminhtml')->__('Invalid parent block for this block')); } $this->setOrder($this->getParentBlock()->getOrder()); parent::_beforeToHtml(); diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items/Renderer/Default.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items/Renderer/Default.php index 4530939f6c..6d6f2efd78 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items/Renderer/Default.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items/Renderer/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Messages.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Messages.php index baf9d463c0..9071846d52 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Messages.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Messages.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -45,9 +45,6 @@ public function _prepareLayout() * Check customer existing */ $customer = Mage::getModel('customer/customer')->load($this->_getOrder()->getCustomerId()); - if (!$customer->getId()) { - //$this->addNotice(Mage::helper('sales')->__(' The customer doesn\'t exist in the system anymore')); - } /** * Check Item products existing @@ -57,17 +54,6 @@ public function _prepareLayout() $productIds[] = $item->getProductId(); } -// $productCollection = Mage::getModel('catalog/product')->getCollection() -// ->addIdFilter($productIds) -// ->load(); -// -// foreach ($this->_getOrder()->getAllItems() as $item) { -// if (!$productCollection->getItemById($item->getProductId())) { -// /*$this->addNotice( -// Mage::helper('sales')->__('The item %s (SKU %s) doesn\'t exist in the catalog anymore', $item->getName(), $item->getSku()) -// );*/ -// } -// } return parent::_prepareLayout(); } diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Creditmemos.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Creditmemos.php index 5d63db45fd..2e6c85971e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Creditmemos.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Creditmemos.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,23 +42,30 @@ public function __construct() $this->setUseAjax(true); } + /** + * Retrieve collection class + * + * @return string + */ + protected function _getCollectionClass() + { + return 'sales/order_creditmemo_grid_collection'; + } + + protected function _prepareCollection() { - //TODO: add full name logic - $collection = Mage::getResourceModel('sales/order_creditmemo_collection') - ->addAttributeToSelect('increment_id') - ->addAttributeToSelect('created_at') - ->addAttributeToSelect('order_currency_code') - ->addAttributeToSelect('store_currency_code') - ->addAttributeToSelect('base_currency_code') - ->addAttributeToSelect('state') - ->addAttributeToSelect('grand_total') - ->addAttributeToSelect('base_grand_total') - ->joinAttribute('billing_firstname', 'order_address/firstname', 'billing_address_id', null, 'left') - ->joinAttribute('billing_lastname', 'order_address/lastname', 'billing_address_id', null, 'left') - ->addExpressionAttributeToSelect('billing_name', - 'CONCAT({{billing_firstname}}, " ", {{billing_lastname}})', - array('billing_firstname', 'billing_lastname')) + $collection = Mage::getResourceModel($this->_getCollectionClass()) + ->addFieldToSelect('entity_id') + ->addFieldToSelect('created_at') + ->addFieldToSelect('increment_id') + ->addFieldToSelect('order_currency_code') + ->addFieldToSelect('store_currency_code') + ->addFieldToSelect('base_currency_code') + ->addFieldToSelect('state') + ->addFieldToSelect('grand_total') + ->addFieldToSelect('base_grand_total') + ->addFieldToSelect('billing_name') ->setOrderFilter($this->getOrder()) ; $this->setCollection($collection); @@ -73,15 +80,6 @@ protected function _prepareColumns() 'index' => 'increment_id', )); - /*$this->addColumn('billing_firstname', array( - 'header' => Mage::helper('sales')->__('Bill to First name'), - 'index' => 'billing_firstname', - )); - - $this->addColumn('billing_lastname', array( - 'header' => Mage::helper('sales')->__('Bill to Last name'), - 'index' => 'billing_lastname', - ));*/ $this->addColumn('billing_name', array( 'header' => Mage::helper('sales')->__('Bill to Name'), 'index' => 'billing_name', diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/History.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/History.php index 668fc41155..efa07d07f9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/History.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/History.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -72,12 +72,12 @@ public function getFullHistory() foreach ($order->getCreditmemosCollection() as $_memo){ $history[$_memo->getEntityId()] = - $this->_prepareHistoryItem($this->__('Credit Memo #%s created', $_memo->getIncrementId()), + $this->_prepareHistoryItem($this->__('Credit memo #%s created', $_memo->getIncrementId()), $_memo->getEmailSent(), $_memo->getCreatedAtDate()); foreach ($_memo->getCommentsCollection() as $_comment){ $history[$_comment->getEntityId()] = - $this->_prepareHistoryItem($this->__('Credit Memo #%s comment added', $_memo->getIncrementId()), + $this->_prepareHistoryItem($this->__('Credit memo #%s comment added', $_memo->getIncrementId()), $_comment->getIsCustomerNotified(), $_comment->getCreatedAtDate(), $_comment->getComment()); } } @@ -139,7 +139,7 @@ public function getItemCreatedAt(array $item, $dateType = 'date', $format = 'med */ public function getItemTitle(array $item) { - return (isset($item['title']) ? $this->htmlEscape($item['title']) : ''); + return (isset($item['title']) ? $this->escapeHtml($item['title']) : ''); } /** @@ -162,7 +162,8 @@ public function isItemNotified(array $item, $isSimpleCheck = true) */ public function getItemComment(array $item) { - return (isset($item['comment']) ? $this->htmlEscape($item['comment']) : ''); + $allowedTags = array('b','br','strong','i','u'); + return (isset($item['comment']) ? $this->escapeHtml($item['comment'], $allowedTags) : ''); } /** diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Info.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Info.php index 98521ca3bf..bd71a3b9db 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Info.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Info.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Invoices.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Invoices.php index 712eb53b38..79c38c8a81 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Invoices.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Invoices.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,24 +42,30 @@ public function __construct() $this->setUseAjax(true); } + /** + * Retrieve collection class + * + * @return string + */ + protected function _getCollectionClass() + { + return 'sales/order_invoice_grid_collection'; + } + protected function _prepareCollection() { - //TODO: add full name logic - $collection = Mage::getResourceModel('sales/order_invoice_collection') - ->addAttributeToSelect('order_id') - ->addAttributeToSelect('increment_id') - ->addAttributeToSelect('created_at') - ->addAttributeToSelect('state') - ->addAttributeToSelect('grand_total') - ->addAttributeToSelect('base_grand_total') - ->addAttributeToSelect('store_currency_code') - ->addAttributeToSelect('base_currency_code') - ->addAttributeToSelect('order_currency_code') - ->joinAttribute('billing_firstname', 'order_address/firstname', 'billing_address_id', null, 'left') - ->joinAttribute('billing_lastname', 'order_address/lastname', 'billing_address_id', null, 'left') - ->addExpressionAttributeToSelect('billing_name', - 'CONCAT({{billing_firstname}}, " ", {{billing_lastname}})', - array('billing_firstname', 'billing_lastname')) + $collection = Mage::getResourceModel($this->_getCollectionClass()) + ->addFieldToSelect('entity_id') + ->addFieldToSelect('created_at') + ->addFieldToSelect('order_id') + ->addFieldToSelect('increment_id') + ->addFieldToSelect('state') + ->addFieldToSelect('grand_total') + ->addFieldToSelect('base_grand_total') + ->addFieldToSelect('store_currency_code') + ->addFieldToSelect('base_currency_code') + ->addFieldToSelect('order_currency_code') + ->addFieldToSelect('billing_name') ->setOrderFilter($this->getOrder()) ; $this->setCollection($collection); diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Shipments.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Shipments.php index 284a29e404..f8ce60261c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Shipments.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Shipments.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,18 +42,24 @@ public function __construct() $this->setUseAjax(true); } + /** + * Retrieve collection class + * + * @return string + */ + protected function _getCollectionClass() + { + return 'sales/order_shipment_grid_collection'; + } + protected function _prepareCollection() { - //TODO: add full name logic - $collection = Mage::getResourceModel('sales/order_shipment_collection') - ->addAttributeToSelect('increment_id') - ->addAttributeToSelect('created_at') - ->addAttributeToSelect('total_qty') - ->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left') - ->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left') - ->addExpressionAttributeToSelect('shipping_name', - 'CONCAT({{shipping_firstname}}, " ", {{shipping_lastname}})', - array('shipping_firstname', 'shipping_lastname')) + $collection = Mage::getResourceModel($this->_getCollectionClass()) + ->addFieldToSelect('entity_id') + ->addFieldToSelect('created_at') + ->addFieldToSelect('increment_id') + ->addFieldToSelect('total_qty') + ->addFieldToSelect('shipping_name') ->setOrderFilter($this->getOrder()) ; $this->setCollection($collection); diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Transactions.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Transactions.php new file mode 100644 index 0000000000..23df4b038b --- /dev/null +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/Transactions.php @@ -0,0 +1,98 @@ + + */ +class Mage_Adminhtml_Block_Sales_Order_View_Tab_Transactions + extends Mage_Adminhtml_Block_Sales_Transactions_Grid + implements Mage_Adminhtml_Block_Widget_Tab_Interface +{ + + /** + * Retrieve grid url + * + * @return string + */ + public function getGridUrl() + { + return $this->getUrl('*/sales_order/transactions', array('_current' => true)); + } + + /** + * Retrieve grid row url + * + * @return string + */ + public function getRowUrl($item) + { + return $this->getUrl('*/sales_transactions/view', array('_current' => true, 'txn_id' => $item->getId())); + } + + /** + * Retrieve tab label + * + * @return string + */ + public function getTabLabel() + { + return Mage::helper('sales')->__('Transactions'); + } + + /** + * Retrieve tab title + * + * @return string + */ + public function getTabTitle() + { + return Mage::helper('sales')->__('Transactions'); + } + + /** + * Check whether can show tab + * + * @return bool + */ + public function canShowTab() + { + return true; + } + + /** + * Check whether tab is hidden + * + * @return bool + */ + public function isHidden() + { + return !Mage::getSingleton('admin/session')->isAllowed('sales/transactions/fetch'); + } +} diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tabs.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tabs.php index 9b8f848839..8153a940b9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -49,7 +49,7 @@ public function getOrder() if (Mage::registry('order')) { return Mage::registry('order'); } - Mage::throwException(Mage::helper('sales')->__('Can\'t get order instance')); + Mage::throwException(Mage::helper('sales')->__('Cannot get the order instance.')); } public function __construct() @@ -60,46 +60,4 @@ public function __construct() $this->setTitle(Mage::helper('sales')->__('Order View')); } - protected function _beforeToHtml() - { -// $this->addTab('order_info', array( -// 'label' => Mage::helper('sales')->__('Information'), -// 'title' => Mage::helper('sales')->__('Order Information'), -// 'content' => $this->getLayout()->createBlock('adminhtml/sales_order_view_tab_info')->toHtml(), -// 'active' => true -// )); -// -// $this->addTab('order_invoices', array( -// 'label' => Mage::helper('catalogrule')->__('Invoices'), -// 'title' => Mage::helper('catalogrule')->__('Order Invoices'), -// 'content' => $this->getLayout()->createBlock('adminhtml/sales_order_view_tab_invoices')->toHtml(), -// )); -// -// $this->addTab('order_creditmemos', array( -// 'label' => Mage::helper('catalogrule')->__('Credit Memos'), -// 'title' => Mage::helper('catalogrule')->__('Order Credit Memos'), -// 'content' => $this->getLayout()->createBlock('adminhtml/sales_order_view_tab_creditmemos')->toHtml(), -// )); -// -// if (!$this->getOrder()->getIsVirtual()) { -// $this->addTab('order_shipments', array( -// 'label' => Mage::helper('catalogrule')->__('Shipments'), -// 'title' => Mage::helper('catalogrule')->__('Order Shipments'), -// 'content' => $this->getLayout()->createBlock('adminhtml/sales_order_view_tab_shipments')->toHtml(), -// )); -// } -// -// /*$this->addTab('order_giftmessages', array( -// 'label' => Mage::helper('catalogrule')->__('Gift Messages'), -// 'title' => Mage::helper('catalogrule')->__('Order Gift Messages'), -// 'content' => 'Gift Messages', -// ));*/ -// -// $this->addTab('order_history', array( -// 'label' => Mage::helper('catalogrule')->__('Comments History'), -// 'title' => Mage::helper('catalogrule')->__('Order History'), -// 'content' => $this->getLayout()->createBlock('adminhtml/sales_order_view_tab_history')->toHtml(), -// )); - return parent::_beforeToHtml(); - } } diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Reorder/Renderer/Action.php b/app/code/core/Mage/Adminhtml/Block/Sales/Reorder/Renderer/Action.php index 44867711a7..9814512bb3 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Reorder/Renderer/Action.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Reorder/Renderer/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Shipment.php b/app/code/core/Mage/Adminhtml/Block/Sales/Shipment.php index 0cfd2386b4..8e1c3e42e7 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Shipment.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Shipment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Shipment/Grid.php b/app/code/core/Mage/Adminhtml/Block/Sales/Shipment/Grid.php index e27591f8fe..c5dbcc7998 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Shipment/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Shipment/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -40,18 +40,19 @@ public function __construct() $this->setDefaultDir('DESC'); } + /** + * Retrieve collection class + * + * @return string + */ + protected function _getCollectionClass() + { + return 'sales/order_shipment_grid_collection'; + } + protected function _prepareCollection() { - //TODO: add full name logic - $collection = Mage::getResourceModel('sales/order_shipment_collection') - ->addAttributeToSelect('increment_id') - ->addAttributeToSelect('created_at') - ->addAttributeToSelect('total_qty') - ->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left') - ->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left') - ->joinAttribute('order_increment_id', 'order/increment_id', 'order_id', null, 'left') - ->joinAttribute('order_created_at', 'order/created_at', 'order_id', null, 'left') - ; + $collection = Mage::getResourceModel($this->_getCollectionClass()); $this->setCollection($collection); return parent::_prepareCollection(); } @@ -61,7 +62,7 @@ protected function _prepareColumns() $this->addColumn('increment_id', array( 'header' => Mage::helper('sales')->__('Shipment #'), 'index' => 'increment_id', - 'type' => 'number', + 'type' => 'text', )); $this->addColumn('created_at', array( @@ -82,14 +83,9 @@ protected function _prepareColumns() 'type' => 'datetime', )); - $this->addColumn('shipping_firstname', array( - 'header' => Mage::helper('sales')->__('Ship to First name'), - 'index' => 'shipping_firstname', - )); - - $this->addColumn('shipping_lastname', array( - 'header' => Mage::helper('sales')->__('Ship to Last name'), - 'index' => 'shipping_lastname', + $this->addColumn('shipping_name', array( + 'header' => Mage::helper('sales')->__('Ship to Name'), + 'index' => 'shipping_name', )); $this->addColumn('total_qty', array( @@ -107,7 +103,7 @@ protected function _prepareColumns() 'actions' => array( array( 'caption' => Mage::helper('sales')->__('View'), - 'url' => array('base'=>'*/*/view'), + 'url' => array('base'=>'*/sales_shipment/view'), 'field' => 'shipment_id' ) ), @@ -116,12 +112,19 @@ protected function _prepareColumns() 'is_system' => true )); + $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV')); + $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel')); + return parent::_prepareColumns(); } public function getRowUrl($row) { - return $this->getUrl('*/*/view', + if (!Mage::getSingleton('admin/session')->isAllowed('sales/order/shipment')) { + return false; + } + + return $this->getUrl('*/sales_shipment/view', array( 'shipment_id'=> $row->getId(), ) @@ -132,10 +135,11 @@ protected function _prepareMassaction() { $this->setMassactionIdField('entity_id'); $this->getMassactionBlock()->setFormFieldName('shipment_ids'); + $this->getMassactionBlock()->setUseSelectAll(false); $this->getMassactionBlock()->addItem('pdfshipments_order', array( 'label'=> Mage::helper('sales')->__('PDF Packingslips'), - 'url' => $this->getUrl('*/*/pdfshipments'), + 'url' => $this->getUrl('*/sales_shipment/pdfshipments'), )); return $this; diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Totals.php b/app/code/core/Mage/Adminhtml/Block/Sales/Totals.php index d63c54bf8d..8b8373d49b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Totals.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Totals.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Transactions.php b/app/code/core/Mage/Adminhtml/Block/Sales/Transactions.php new file mode 100644 index 0000000000..99d33c84eb --- /dev/null +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Transactions.php @@ -0,0 +1,44 @@ + + */ +class Mage_Adminhtml_Block_Sales_Transactions extends Mage_Adminhtml_Block_Widget_Grid_Container +{ + public function __construct() + { + $this->_controller = 'sales_transactions'; + $this->_headerText = Mage::helper('sales')->__('Transactions'); + parent::__construct(); + $this->_removeButton('add'); + } + +} diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Child/Grid.php b/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Child/Grid.php new file mode 100644 index 0000000000..2d562c0940 --- /dev/null +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Child/Grid.php @@ -0,0 +1,86 @@ + + */ +class Mage_Adminhtml_Block_Sales_Transactions_Child_Grid extends Mage_Adminhtml_Block_Sales_Transactions_Grid +{ + /** + * Columns, that should be removed from grid + * + * @var array + */ + protected $_columnsToRemove = array('parent_id', 'parent_txn_id'); + + /** + * Disable pager and filter + * + */ + public function __construct() + { + parent::__construct(); + $this->setId('transactionChildGrid'); + $this->setDefaultSort('created_at'); + $this->setPagerVisibility(false); + $this->setFilterVisibility(false); + } + + /** + * Add filter by parent transaction ID + * + * @return Mage_Adminhtml_Block_Widget_Grid + */ + protected function _prepareCollection() + { + $collection = Mage::getResourceModel('sales/order_payment_transaction_collection'); + $collection->addParentIdFilter(Mage::registry('current_transaction')->getId()); + $this->setCollection($collection); + return parent::_prepareCollection(); + } + + /** + * Remove some columns and make other not sortable + * + */ + protected function _prepareColumns() + { + $result = parent::_prepareColumns(); + + foreach ($this->_columns as $key => $value) { + if (in_array($key, $this->_columnsToRemove)) { + unset($this->_columns[$key]); + } else { + $this->_columns[$key]->setData('sortable', false); + } + } + return $result; + } +} diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Detail.php b/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Detail.php new file mode 100644 index 0000000000..920bd94985 --- /dev/null +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Detail.php @@ -0,0 +1,115 @@ + + */ +class Mage_Adminhtml_Block_Sales_Transactions_Detail extends Mage_Adminhtml_Block_Widget_Container +{ + /** + * Transaction model + * + * @var Mage_Sales_Model_Order_Payment_Transaction + */ + protected $_txn; + + /** + * Add control buttons + * + */ + public function __construct() + { + parent::__construct(); + + $this->_txn = Mage::registry('current_transaction'); + + $backUrl = ($this->_txn->getOrderUrl()) ? $this->_txn->getOrderUrl() : $this->getUrl('*/*/'); + $this->_addButton('back', array( + 'label' => Mage::helper('sales')->__('Back'), + 'onclick' => "setLocation('{$backUrl}')", + 'class' => 'back' + )); + + if (Mage::getSingleton('admin/session')->isAllowed('sales/transactions/fetch') + && $this->_txn->getOrderPaymentObject()->getMethodInstance()->canFetchTransactionInfo()) { + $fetchUrl = $this->getUrl('*/*/fetch' , array('_current' => true)); + $this->_addButton('fetch', array( + 'label' => Mage::helper('sales')->__('Fetch'), + 'onclick' => "setLocation('{$fetchUrl}')", + 'class' => 'button' + )); + } + } + + /** + * Retrieve header text + * + * @return string + */ + public function getHeaderText() + { + return Mage::helper('sales')->__("Transaction # %s | %s", + $this->_txn->getTxnId(), + $this->formatDate($this->_txn->getCreatedAt(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true) + ); + } + + protected function _toHtml() + { + $this->setTxnIdHtml($this->escapeHtml($this->_txn->getTxnId())); + + $this->setParentTxnIdUrlHtml( + $this->escapeHtml($this->getUrl('*/sales_transactions/view', array('txn_id' => $this->_txn->getParentId()))) + ); + + $this->setParentTxnIdHtml( + $this->escapeHtml($this->_txn->getParentTxnId()) + ); + + $this->setOrderIncrementIdHtml($this->escapeHtml($this->_txn->getOrder()->getIncrementId())); + + $this->setTxnTypeHtml($this->escapeHtml($this->_txn->getTxnType())); + + $this->setOrderIdUrlHtml( + $this->escapeHtml($this->getUrl('*/sales_order/view', array('order_id' => $this->_txn->getOrderId()))) + ); + + $this->setIsClosedHtml( + ($this->_txn->getIsClosed()) ? Mage::helper('sales')->__('Yes') : Mage::helper('sales')->__('No') + ); + + $createdAt = (strtotime($this->_txn->getCreatedAt())) + ? $this->formatDate($this->_txn->getCreatedAt(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true) + : $this->__('N/A'); + $this->setCreatedAtHtml($this->escapeHtml($createdAt)); + + return parent::_toHtml(); + } +} diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Detail/Grid.php b/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Detail/Grid.php new file mode 100644 index 0000000000..a18292a2ee --- /dev/null +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Detail/Grid.php @@ -0,0 +1,100 @@ + + */ +class Mage_Adminhtml_Block_Sales_Transactions_Detail_Grid extends Mage_Adminhtml_Block_Widget_Grid +{ + /** + * Initialize default sorting and html ID + */ + protected function _construct() + { + $this->setId('transactionDetailsGrid'); + $this->setPagerVisibility(false); + $this->setFilterVisibility(false); + } + + /** + * Prepare collection for grid + * + * @return Mage_Adminhtml_Block_Widget_Grid + */ + protected function _prepareCollection() + { + $collection = new Varien_Data_Collection(); + foreach ($this->getTransactionAdditionalInfo() as $key => $value) { + $data = new Varien_Object(array('key' => $key, 'value' => $value)); + $collection->addItem($data); + } + + $this->setCollection($collection); + return parent::_prepareCollection(); + } + + /** + * Add columns to grid + * + * @return Mage_Adminhtml_Block_Widget_Grid + */ + protected function _prepareColumns() + { + $this->addColumn('key', array( + 'header' => Mage::helper('sales')->__('Key'), + 'index' => 'key', + 'sortable' => false, + 'type' => 'text', + 'width' => '50%' + )); + + $this->addColumn('value', array( + 'header' => Mage::helper('sales')->__('Value'), + 'index' => 'value', + 'sortable' => false, + 'type' => 'text' + )); + + return parent::_prepareColumns(); + } + + /** + * Retrieve Transaction addtitional info + * + * @return array + */ + public function getTransactionAdditionalInfo() + { + $info = Mage::registry('current_transaction')->getAdditionalInformation( + Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS + ); + return (is_array($info)) ? $info : array(); + } +} diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Grid.php b/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Grid.php new file mode 100644 index 0000000000..0408b20087 --- /dev/null +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Grid.php @@ -0,0 +1,159 @@ + + */ +class Mage_Adminhtml_Block_Sales_Transactions_Grid extends Mage_Adminhtml_Block_Widget_Grid +{ + /** + * Set grid params + * + */ + public function __construct() + { + parent::__construct(); + $this->setId('order_transactions'); + $this->setUseAjax(true); + $this->setDefaultSort('created_at'); + $this->setDefaultDir('DESC'); + $this->setSaveParametersInSession(true); + } + + /** + * Prepare collection for grid + * + * @return Mage_Adminhtml_Block_Widget_Grid + */ + protected function _prepareCollection() + { + $collection = ($this->getCollection()) + ? $this->getCollection() : Mage::getResourceModel('sales/order_payment_transaction_collection'); + $order = Mage::registry('current_order'); + if ($order) { + $collection->addOrderIdFilter($order->getId()); + } + $collection->addOrderInformation(array('increment_id')); + $collection->addPaymentInformation(array('method')); + $this->setCollection($collection); + return parent::_prepareCollection(); + } + + /** + * Add columns to grid + * + * @return Mage_Adminhtml_Block_Widget_Grid + */ + protected function _prepareColumns() + { + $this->addColumn('transaction_id', array( + 'header' => Mage::helper('sales')->__('ID #'), + 'index' => 'transaction_id', + 'type' => 'number' + )); + + $this->addColumn('increment_id', array( + 'header' => Mage::helper('sales')->__('Order ID'), + 'index' => 'increment_id', + 'type' => 'text' + )); + + $this->addColumn('txn_id', array( + 'header' => Mage::helper('sales')->__('Transaction ID'), + 'index' => 'txn_id', + 'type' => 'text' + )); + + $this->addColumn('parent_txn_id', array( + 'header' => Mage::helper('sales')->__('Parent Transaction ID'), + 'index' => 'parent_txn_id', + 'type' => 'text' + )); + + $this->addColumn('method', array( + 'header' => Mage::helper('sales')->__('Payment Method Name'), + 'index' => 'method', + 'type' => 'options', + 'options' => Mage::helper('payment')->getPaymentMethodList(true), + 'option_groups' => Mage::helper('payment')->getPaymentMethodList(true, true, true), + )); + + $this->addColumn('txn_type', array( + 'header' => Mage::helper('sales')->__('Transaction Type'), + 'index' => 'txn_type', + 'type' => 'options', + 'options' => Mage::getSingleton('sales/order_payment_transaction')->getTransactionTypes() + )); + + $this->addColumn('is_closed', array( + 'header' => Mage::helper('sales')->__('Is Closed'), + 'index' => 'is_closed', + 'width' => 1, + 'type' => 'options', + 'align' => 'center', + 'options' => array( + 1 => Mage::helper('sales')->__('Yes'), + 0 => Mage::helper('sales')->__('No'), + ) + )); + + $this->addColumn('created_at', array( + 'header' => Mage::helper('sales')->__('Created At'), + 'index' => 'created_at', + 'width' => 1, + 'type' => 'datetime', + 'align' => 'center', + 'default' => $this->__('N/A'), + 'html_decorators' => array('nobr') + )); + + return parent::_prepareColumns(); + } + + /** + * Retrieve grid url + * + * @return string + */ + public function getGridUrl() + { + return $this->getUrl('*/*/grid', array('_current' => true)); + } + + /** + * Retrieve row url + * + * @return string + */ + public function getRowUrl($item) + { + return $this->getUrl('*/*/view', array('txn_id' => $item->getId())); + } +} diff --git a/app/code/core/Mage/Adminhtml/Block/Sitemap.php b/app/code/core/Mage/Adminhtml/Block/Sitemap.php index 34a1dc6639..5488383e2b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sitemap.php +++ b/app/code/core/Mage/Adminhtml/Block/Sitemap.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sitemap/Edit.php b/app/code/core/Mage/Adminhtml/Block/Sitemap/Edit.php index 0c34116c80..57de3b2892 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sitemap/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Sitemap/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sitemap/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Sitemap/Edit/Form.php index 281dddc665..9d63b2cca4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sitemap/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Sitemap/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid.php b/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid.php index 37af607f72..e138809f33 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Action.php b/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Action.php index 85783ef5c9..84a1657c93 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Action.php +++ b/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Link.php b/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Link.php index f0a7142cda..68fb971892 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Link.php +++ b/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Link.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Time.php b/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Time.php index 555bac3b0a..d37c8c70a8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Time.php +++ b/app/code/core/Mage/Adminhtml/Block/Sitemap/Grid/Renderer/Time.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Store/Switcher.php b/app/code/core/Mage/Adminhtml/Block/Store/Switcher.php index 828f7d617f..50f1afc38a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Store/Switcher.php +++ b/app/code/core/Mage/Adminhtml/Block/Store/Switcher.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Account/Edit.php b/app/code/core/Mage/Adminhtml/Block/System/Account/Edit.php index 2402b7b596..8efa79fe5c 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Account/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Account/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Account/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/System/Account/Edit/Form.php index 0f897828ce..1166aac899 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Account/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Account/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Cache/Edit.php b/app/code/core/Mage/Adminhtml/Block/System/Cache/Edit.php index 73903fb39c..f66ccb4535 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Cache/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Cache/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -45,7 +45,7 @@ protected function _prepareLayout() $this->setChild('save_button', $this->getLayout()->createBlock('adminhtml/widget_button') ->setData(array( - 'label' => Mage::helper('adminhtml')->__('Save cache settings'), + 'label' => Mage::helper('adminhtml')->__('Save Cache Settings'), 'onclick' => 'configForm.submit()', 'class' => 'save', )) @@ -130,7 +130,7 @@ public function getCatalogData() array( 'name' => 'refresh_layered_navigation_now', 'action' => Mage::helper('adminhtml')->__('Refresh Now*'), - 'comment' => Mage::helper('adminhtml')->__('* - If indexing is in progress, it will be killed and new indexing process will start'), + 'comment' => Mage::helper('adminhtml')->__('* - If indexing is in progress, it will be killed and new indexing process will start.'), 'warning' => $warning, ) ), diff --git a/app/code/core/Mage/Adminhtml/Block/System/Cache/Form.php b/app/code/core/Mage/Adminhtml/Block/System/Cache/Form.php index b7121e3a63..092c30014d 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Cache/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Cache/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Dwstree.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Dwstree.php index 895407e7cc..ce8cb6bfc3 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Dwstree.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Dwstree.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Edit.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Edit.php index 0a09181cd4..5fbe3522ce 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -48,6 +48,7 @@ public function __construct() $this->_section = $sections->$sectionCode; $this->setTitle((string)$this->_section->label); + $this->setHeaderCss((string)$this->_section->header_css); } protected function _prepareLayout() diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php index e49c363680..49431ff867 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -40,12 +40,19 @@ class Mage_Adminhtml_Block_System_Config_Form extends Mage_Adminhtml_Block_Widge const SCOPE_STORES = 'stores'; /** - * Enter description here... + * Config data array * - * @var Mage_Adminhtml_Model_Config_Data + * @var array */ protected $_configData; + /** + * Adminhtml config data instance + * + * @var Mage_Adminhtml_Model_Config_Data + */ + protected $_configDataObject; + /** * Enter description here... * @@ -111,11 +118,12 @@ protected function _initObjects() { $this->_configRoot = Mage::getConfig()->getNode(null, $this->getScope(), $this->getScopeCode()); - $this->_configData = Mage::getModel('adminhtml/config_data') + $this->_configDataObject = Mage::getModel('adminhtml/config_data') ->setSection($this->getSectionCode()) ->setWebsite($this->getWebsiteCode()) - ->setStore($this->getStoreCode()) - ->load(); + ->setStore($this->getStoreCode()); + + $this->_configData = $this->_configDataObject->load(); $this->_configFields = Mage::getSingleton('adminhtml/config'); @@ -173,10 +181,14 @@ public function initForm() if (!empty($group->comment)) { $fieldsetConfig['comment'] = (string)$group->comment; } + if (!empty($group->expanded)) { + $fieldsetConfig['expanded'] = (bool)$group->expanded; + } $fieldset = $form->addFieldset( $section->getName() . '_' . $group->getName(), $fieldsetConfig) ->setRenderer($fieldsetRenderer); + $this->_prepareFieldOriginalData($fieldset, $group); $this->_addElementTypes($fieldset); if ($group->clone_fields) { @@ -229,6 +241,13 @@ protected function _getDependence() */ public function initFields($fieldset, $group, $section, $fieldPrefix='', $labelPrefix='') { + if (!$this->_configDataObject) { + $this->_initObjects(); + } + + // Extends for config data + $configDataAdditionalGroups = array(); + foreach ($group->fields as $elements) { $elements = (array)$elements; @@ -245,7 +264,22 @@ public function initFields($fieldset, $group, $section, $fieldPrefix='', $labelP if (!$this->_canShowField($e)) { continue; } - $path = $section->getName() . '/' . $group->getName() . '/' . $fieldPrefix . $e->getName(); + + /** + * Look for custom defined field path + */ + $path = (string)$e->config_path; + if (empty($path)) { + $path = $section->getName() . '/' . $group->getName() . '/' . $fieldPrefix . $e->getName(); + } elseif (strrpos($path, '/') > 0) { + // Extend config data with new section group + $groupPath = substr($path, 0, strrpos($path, '/')); + if (!isset($configDataAdditionalGroups[$groupPath])) { + $this->_configData = $this->_configDataObject->extendConfig($groupPath, false, $this->_configData); + $configDataAdditionalGroups[$groupPath] = true; + } + } + $id = $section->getName() . '_' . $group->getName() . '_' . $fieldPrefix . $e->getName(); if (isset($this->_configData[$path])) { @@ -268,7 +302,6 @@ public function initFields($fieldset, $group, $section, $fieldPrefix='', $labelP $fieldType = (string)$e->frontend_type ? (string)$e->frontend_type : 'text'; $name = 'groups['.$group->getName().'][fields]['.$fieldPrefix.$e->getName().'][value]'; $label = Mage::helper($helperName)->__($labelPrefix).' '.Mage::helper($helperName)->__((string)$e->label); - $comment = (string)$e->comment ? Mage::helper($helperName)->__((string)$e->comment) : ''; $hint = (string)$e->hint ? Mage::helper($helperName)->__((string)$e->hint) : ''; if ($e->backend_model) { @@ -276,10 +309,17 @@ public function initFields($fieldset, $group, $section, $fieldPrefix='', $labelP if (!$model instanceof Mage_Core_Model_Config_Data) { Mage::throwException('Invalid config field backend model: '.(string)$e->backend_model); } - $model->setPath($path)->setValue($data)->afterLoad(); + $model->setPath($path) + ->setValue($data) + ->setWebsite($this->getWebsiteCode()) + ->setStore($this->getStoreCode()) + ->afterLoad(); $data = $model->getValue(); } + $comment = $this->_prepareFieldComment($e, $helperName, $data); + $tooltip = $this->_prepareFieldTooltip($e, $helperName); + if ($e->depends) { foreach ($e->depends->children() as $dependent) { $dependentId = $section->getName() . '_' . $group->getName() . '_' . $fieldPrefix . $dependent->getName(); @@ -295,6 +335,7 @@ public function initFields($fieldset, $group, $section, $fieldPrefix='', $labelP 'name' => $name, 'label' => $label, 'comment' => $comment, + 'tooltip' => $tooltip, 'hint' => $hint, 'value' => $data, 'inherit' => $inherit, @@ -306,6 +347,7 @@ public function initFields($fieldset, $group, $section, $fieldPrefix='', $labelP 'can_use_default_value' => $this->canUseDefaultValue((int)$e->show_in_default), 'can_use_website_value' => $this->canUseWebsiteValue((int)$e->show_in_website), )); + $this->_prepareFieldOriginalData($field, $e); if (isset($e->validate)) { $field->addClass($e->validate); @@ -349,6 +391,66 @@ public function initFields($fieldset, $group, $section, $fieldPrefix='', $labelP return $this; } + /** + * Set "original_data" array to the element, composed from nodes with scalar values + * + * @param Varien_Data_Form_Element_Abstract $field + * @param Varien_Simplexml_Element $xmlElement + */ + protected function _prepareFieldOriginalData($field, $xmlElement) + { + $originalData = array(); + foreach ($xmlElement as $key => $value) { + if (!$value->hasChildren()) { + $originalData[$key] = (string)$value; + } + } + $field->setOriginalData($originalData); + } + + /** + * Support models "getCommentText" method for field note generation + * + * @param Mage_Core_Model_Config_Element $element + * @param string $helper + * @return string + */ + protected function _prepareFieldComment($element, $helper, $currentValue) + { + $comment = ''; + if ($element->comment) { + $commentInfo = $element->comment->asArray(); + if (is_array($commentInfo)) { + if (isset($commentInfo['model'])) { + $model = Mage::getModel($commentInfo['model']); + if (method_exists($model, 'getCommentText')) { + $comment = $model->getCommentText($element, $currentValue); + } + } + } else { + $comment = Mage::helper($helper)->__($commentInfo); + } + } + return $comment; + } + + /** + * Prepare additional comment for field like tooltip + * + * @param Mage_Core_Model_Config_Element $element + * @param string $helper + * @return string + */ + protected function _prepareFieldTooltip($element, $helper) + { + if ($element->tooltip) { + return Mage::helper($helper)->__((string)$element->tooltip); + } elseif ($element->tooltip_block) { + return $this->getLayout()->createBlock((string)$element->tooltip_block)->toHtml(); + } + return ''; + } + /** * Append dependence block at then end of form block * @@ -415,6 +517,11 @@ public function canUseWebsiteValue($field) */ protected function _canShowField($field) { + $ifModuleEnabled = trim((string)$field->if_module_enabled); + if ($ifModuleEnabled && !Mage::helper('Core')->isModuleEnabled($ifModuleEnabled)) { + return false; + } + switch ($this->getScope()) { case self::SCOPE_DEFAULT: return (int)$field->show_in_default; diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field.php index 59b580fc55..55237ee50e 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -58,7 +58,9 @@ public function render(Varien_Data_Form_Element_Abstract $element) { $id = $element->getHtmlId(); - $html = ''; + $useContainerId = $element->getData('use_container_id'); + $html = '' + . ''; //$isDefault = !$this->getRequest()->getParam('website') && !$this->getRequest()->getParam('store'); $isMultiple = $element->getExtType()==='multiple'; @@ -71,11 +73,11 @@ public function render(Varien_Data_Form_Element_Abstract $element) $addInheritCheckbox = false; if ($element->getCanUseWebsiteValue()) { $addInheritCheckbox = true; - $checkboxLabel = Mage::helper('adminhtml')->__('Use website'); + $checkboxLabel = Mage::helper('adminhtml')->__('Use Website'); } elseif ($element->getCanUseDefaultValue()) { $addInheritCheckbox = true; - $checkboxLabel = Mage::helper('adminhtml')->__('Use default'); + $checkboxLabel = Mage::helper('adminhtml')->__('Use Default'); } if ($addInheritCheckbox) { diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Array/Abstract.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Array/Abstract.php index f6bf680307..baac69ec1a 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Array/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Array/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -54,17 +54,26 @@ abstract class Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract exte */ protected $_addButtonLabel; + /** + * Rows cache + * + * @var array|null + */ private $_arrayRowsCache; + /** + * Indication whether block is prepared to render or no + * + * @var bool + */ + protected $_isPreparedToRender = false; + /** * Check if columns are defined, set template * */ public function __construct() { - if (empty($this->_columns)) { - throw new Exception('At least one column must be defined.'); - } if (!$this->_addButtonLabel) { $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add'); } @@ -108,6 +117,16 @@ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) return $html; } + /** + * Prepare existing row data object + * + * @param Varien_Object + */ + protected function _prepareArrayRow(Varien_Object $row) + { + // override in descendants + } + /** * Obtain existing data from form element * @@ -130,6 +149,7 @@ public function getArrayRows() } $row['_id'] = $rowId; $result[$rowId] = new Varien_Object($row); + $this->_prepareArrayRow($result[$rowId]); } } $this->_arrayRowsCache = $result; @@ -160,4 +180,29 @@ protected function _renderCellTemplate($columnName) (isset($column['class']) ? $column['class'] : 'input-text') . '"'. (isset($column['style']) ? ' style="'.$column['style'] . '"' : '') . '/>'; } + + /** + * Prepare to render + */ + protected function _prepareToRender() + { + // Override in descendants to add columns, change add button label etc + } + + /** + * Render block HTML + * + * @return string + */ + protected function _toHtml() + { + if (!$this->_isPreparedToRender) { + $this->_prepareToRender(); + $this->_isPreparedToRender = true; + } + if (empty($this->_columns)) { + throw new Exception('At least one column must be defined.'); + } + return parent::_toHtml(); + } } diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Datetime.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Datetime.php index b1e8c8380c..2bc7176312 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Datetime.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Datetime.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Export.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Export.php index faa319f2ea..f8408420a3 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Export.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Export.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Heading.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Heading.php new file mode 100644 index 0000000000..69cc98ce5b --- /dev/null +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Heading.php @@ -0,0 +1,49 @@ + + */ +class Mage_Adminhtml_Block_System_Config_Form_Field_Heading + extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface +{ + /** + * Render element html + * + * @param Varien_Data_Form_Element_Abstract $element + * @return string + */ + public function render(Varien_Data_Form_Element_Abstract $element) + { + $useContainerId = $element->getData('use_container_id'); + return sprintf('

    %s

    ', + $element->getHtmlId(), $element->getLabel() + ); + } +} diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Image.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Image.php index c873e33199..70d2f055d5 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Image.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Image.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Import.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Import.php index 8166906496..2b929f52b9 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Import.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Import.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Notification.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Notification.php index 094f456aff..d48bd710f0 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Notification.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Notification.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Regexceptions.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Regexceptions.php index 541dbab779..c382abda69 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Regexceptions.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Regexceptions.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -36,7 +36,7 @@ class Mage_Adminhtml_Block_System_Config_Form_Field_Regexceptions extends Mage_A public function __construct() { $this->addColumn('regexp', array( - 'label' => Mage::helper('adminhtml')->__('Matched expression'), + 'label' => Mage::helper('adminhtml')->__('Matched Expression'), 'style' => 'width:120px', )); $this->addColumn('value', array( diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Select/Allowspecific.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Select/Allowspecific.php index 37592ac562..20e87e12d7 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Select/Allowspecific.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Select/Allowspecific.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Select/Flatcatalog.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Select/Flatcatalog.php index 3de66025ac..64535f9ba4 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Select/Flatcatalog.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Select/Flatcatalog.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Select/Flatproduct.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Select/Flatproduct.php index 58381b74a1..36b9995eaf 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Select/Flatproduct.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Select/Flatproduct.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset.php index d0c814fca9..87edddb169 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -30,7 +30,7 @@ * * @category Mage * @package Mage_Adminhtml - * @author Magento Core Team + * @author Magento Core Team */ class Mage_Adminhtml_Block_System_Config_Form_Fieldset extends Mage_Adminhtml_Block_Abstract @@ -57,7 +57,7 @@ public function render(Varien_Data_Form_Element_Abstract $element) } /** - * Enter description here... + * Return header html for fieldset * * @param Varien_Data_Form_Element_Abstract $element * @return string @@ -68,7 +68,7 @@ protected function _getHeaderHtml($element) $html = '
    '.$element->getLegend().'
    '; $html.= ''; - $html.= '
    '; + $html.= '
    '; $html.= ''.$element->getLegend().''; if ($element->getComment()) { @@ -85,19 +85,114 @@ protected function _getHeaderHtml($element) } /** - * Enter description here... + * Return full css class name for form fieldset + * + * @return string + */ + protected function _getFieldsetCss() + { + $configCss = (string)$this->getGroup()->fieldset_css; + return 'config collapseable'.($configCss ? ' ' . $configCss : ''); + } + + /** + * Return footer html for fieldset + * Add extra tooltip comments to elements * * @param Varien_Data_Form_Element_Abstract $element * @return string */ protected function _getFooterHtml($element) { - $html = '
    ' . Mage::helper('adminhtml/js')->getScript("Fieldset.applyCollapse('{$element->getHtmlId()}')"); + $tooltipsExist = false; + $html = ''; + foreach ($element->getSortedElements() as $field) { + if ($field->getTooltip()) { + $tooltipsExist = true; + $html .= sprintf('', + $field->getId(), $field->getTooltip() + ); + } + } + $html .= '
    ' . $this->_getExtraJs($element, $tooltipsExist); return $html; } + /** + * Return js code for fieldset: + * - observe fieldset rows; + * - apply collapse; + * + * @param Varien_Data_Form_Element_Abstract $element + * @param bool $tooltipsExist Init tooltips observer or not + * @return string + */ + protected function _getExtraJs($element, $tooltipsExist = false) + { + $id = $element->getHtmlId(); + $js = "Fieldset.applyCollapse('{$id}');"; + if ($tooltipsExist) { + $js.= "$$('#{$id} table')[0].addClassName('system-tooltip-wrap'); + $$('#{$id} table tbody tr').each(function(tr) { + Event.observe(tr, 'mouseover', function (event) { + var relatedTarget = $(event.relatedTarget || event.fromElement); + if(relatedTarget && (relatedTarget == this || relatedTarget.descendantOf(this))) { + return; + } + showTooltip(event); + }); + Event.observe(tr, 'mouseout', function (event) { + var relatedTarget = $(event.relatedTarget || event.toElement); + if(relatedTarget && (relatedTarget == this || relatedTarget.childOf(this))) { + return; + } + hideTooltip(event); + }); + }); + $$('#{$id} table')[0].select('input','select').each(function(field) { + Event.observe(field, 'focus', function (event) { + showTooltip(event); + }); + Event.observe(field, 'blur', function (event) { + hideTooltip(event); + }); + }); + function showTooltip(event) { + var tableHeight = Event.findElement(event, 'table').getStyle('height'); + var tr = Event.findElement(event, 'tr'); + var id = tr.id + '_comment'; + $$('div.system-tooltip-box').invoke('hide'); + if ($(id)) { + $(id).show().setStyle({height : tableHeight}); + if(document.viewport.getWidth() < 1200) { + $(id).addClassName('system-tooltip-small').setStyle({height : 'auto'}); + } else { + $(id).removeClassName('system-tooltip-small'); + } + } + }; + function hideTooltip(event) { + var tr = Event.findElement(event, 'tr'); + var id = tr.id + '_comment'; + if ($(id)) { + setTimeout(function() { $(id).hide(); }, 1); + } + };"; + } + return Mage::helper('adminhtml/js')->getScript($js); + } + + /** + * Collapsed or expanded fieldset when page loaded? + * + * @param Varien_Data_Form_Element_Abstract $element + * @return bool + */ protected function _getCollapseState($element) { + if ($element->getExpanded() !== null) { + return 1; + } $extra = Mage::getSingleton('admin/session')->getUser()->getExtra(); if (isset($extra['configState'][$element->getId()])) { return $extra['configState'][$element->getId()]; diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php index ddc3e1b0a5..d72a0ddd07 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset/Order/Statuses.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset/Order/Statuses.php index 779d8bb995..8b0576be4a 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset/Order/Statuses.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset/Order/Statuses.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Switcher.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Switcher.php index 602eb25b69..5caa800885 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Switcher.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Switcher.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Tabs.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Tabs.php index a02245c4ce..8b639f03eb 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui.php index d0d64cddb8..e9c6b54050 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit.php index 93c242d818..4f76afe6ed 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -43,10 +43,10 @@ public function __construct() $this->_updateButton('save', 'label', Mage::helper('adminhtml')->__('Save Profile')); $this->_updateButton('delete', 'label', Mage::helper('adminhtml')->__('Delete Profile')); $this->_addButton('savecontinue', array( - 'label' => Mage::helper('adminhtml')->__('Save and Continue Editing'), + 'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'), 'onclick' => "$('edit_form').action += 'continue/true/'; editForm.submit();", 'class' => 'save', - ), -1); + ), -100); } diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Form.php index b5f97d4eb0..c85a592531 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Upload.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Upload.php index 822db7875f..5b395602c1 100755 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Upload.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Upload.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/View.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/View.php index 0b8dc38128..7e76aabf62 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/View.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/View.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php index 4ff21e2aca..90bb272768 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tabs.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tabs.php index c97be4125a..e69b134a82 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Grid.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Grid.php index 902b1932d4..3e58e71481 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -114,21 +114,6 @@ protected function _prepareColumns() ) )); -// $this->addColumn('action', array( -// 'header' =>Mage::helper('adminhtml')->__('Action'), -// 'width' =>'60px', -// 'sortable' =>false, -// 'filter' => false, -// 'type' => 'action', -// 'actions' => array( -// array( -// 'url' => $this->getUrl('*/*/run').'id/$profile_id', -// 'caption' => Mage::helper('adminhtml')->__('Run in popup'), -// 'target' => '_blank', -// ), -// ) -// )); - return parent::_prepareColumns(); } diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile.php index d9661381cc..71f8d92e38 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit.php index b953744965..7d74886e78 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -43,10 +43,10 @@ public function __construct() $this->_updateButton('save', 'label', Mage::helper('adminhtml')->__('Save Profile')); $this->_updateButton('delete', 'label', Mage::helper('adminhtml')->__('Delete Profile')); $this->_addButton('savecontinue', array( - 'label' => Mage::helper('adminhtml')->__('Save and Continue Editing'), + 'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'), 'onclick' => "$('edit_form').action += 'continue/true/'; editForm.submit();", 'class' => 'save', - ), -1); + ), -100); } diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Filter/Action.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Filter/Action.php index 1d63e3ee57..7b02f062f6 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Filter/Action.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Filter/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Form.php index 29f4d0b920..797564f9a5 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Renderer/Action.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Renderer/Action.php index b293b7cb5e..7a7b79b3d8 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Renderer/Action.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Renderer/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tab/Edit.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tab/Edit.php index 8957345c21..4214db7450 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tab/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tab/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tab/History.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tab/History.php index a554fb3b02..dbd8d460a2 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tab/History.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tab/History.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -67,12 +67,12 @@ protected function _prepareColumns() )); $this->addColumn('firstname', array( - 'header' => Mage::helper('adminhtml')->__('Firstname'), + 'header' => Mage::helper('adminhtml')->__('First Name'), 'index' => 'firstname', )); $this->addColumn('lastname', array( - 'header' => Mage::helper('adminhtml')->__('Lastname'), + 'header' => Mage::helper('adminhtml')->__('Last Name'), 'index' => 'lastname', )); diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tab/Run.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tab/Run.php index 306d5ab121..0c25ff3fe7 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tab/Run.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tab/Run.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -58,7 +58,7 @@ public function getRunButtonHtml() */ $html .= $this->getLayout()->createBlock('adminhtml/widget_button')->setType('button') - ->setClass('save')->setLabel($this->__('Run Profile In Popup')) + ->setClass('save')->setLabel($this->__('Run Profile in Popup')) ->setOnClick('runProfile(true)') ->toHtml(); diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tabs.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tabs.php index 90d7b4acf1..3f17fa5fa8 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Grid.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Grid.php index 46b377d6ed..9697672c85 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -90,21 +90,6 @@ protected function _prepareColumns() ) )); -// $this->addColumn('action', array( -// 'header' =>Mage::helper('adminhtml')->__('Action'), -// 'width' =>'60px', -// 'sortable' =>false, -// 'filter' => false, -// 'type' => 'action', -// 'actions' => array( -// array( -// 'url' => $this->getUrl('*/*/run').'id/$profile_id', -// 'caption' => Mage::helper('adminhtml')->__('Run in popup'), -// 'target' => '_blank', -// ), -// ) -// )); - return parent::_prepareColumns(); } diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Run.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Run.php index d7908d73c5..faaa5a8c2a 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Run.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Run.php @@ -56,7 +56,7 @@ protected function _toHtml() li { margin-left:0; border:1px solid #ccc; margin:2px; padding:2px 2px 2px 2px; font:normal 12px sans-serif; } img { margin-right:5px; } - '.($profile->getId() ? $this->htmlEscape($profile->getName()) : $this->__('No profile')).' + '.($profile->getId() ? $this->htmlEscape($profile->getName()) : $this->__('No Profile')).' '; echo '
      '; echo '
    • '; @@ -66,7 +66,7 @@ protected function _toHtml() echo '
    • '; echo '
    • '; echo ''; - echo $this->__("Warning: Please don't close window during importing/exporting data"); + echo $this->__("Warning: Please do not close the window during importing/exporting data"); } else { echo ''; echo $this->__("No profile loaded..."); @@ -111,7 +111,7 @@ protected function _toHtml() if($profile->getEntityType() == 'product' && $profile->getDirection() == 'import') { echo '
    • '; } diff --git a/app/code/core/Mage/Adminhtml/Block/System/Currency.php b/app/code/core/Mage/Adminhtml/Block/System/Currency.php index 210584b631..1db06c443f 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Currency.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Currency.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Form.php index 58d2b33794..bc35895a2c 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Tab/Main.php b/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Tab/Main.php index de868984c2..e0d24614bd 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Tab/Main.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Tab/Main.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Tab/Rates.php b/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Tab/Rates.php index 183c95b17a..aeab43ffa2 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Tab/Rates.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Tab/Rates.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Tabs.php b/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Tabs.php index 20680abb34..4ef182f759 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Currency/Edit/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Currency/Rate/Matrix.php b/app/code/core/Mage/Adminhtml/Block/System/Currency/Rate/Matrix.php index d2bd3779ba..7247d80ff3 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Currency/Rate/Matrix.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Currency/Rate/Matrix.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Currency/Rate/Services.php b/app/code/core/Mage/Adminhtml/Block/System/Currency/Rate/Services.php index 547d61dbf3..d714c2057c 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Currency/Rate/Services.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Currency/Rate/Services.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Design.php b/app/code/core/Mage/Adminhtml/Block/System/Design.php index d5365b4d7d..84350cd8ef 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Design.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Design.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Design/Edit.php b/app/code/core/Mage/Adminhtml/Block/System/Design/Edit.php index 3370daa17c..f7d811487c 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Design/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Design/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Design/Edit/Tab/General.php b/app/code/core/Mage/Adminhtml/Block/System/Design/Edit/Tab/General.php index 50d8154e07..8e35004dbe 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Design/Edit/Tab/General.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Design/Edit/Tab/General.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Block_System_Design_Edit_Tab_General extends Mage_Adminhtml_Block_Widget_Form diff --git a/app/code/core/Mage/Adminhtml/Block/System/Design/Edit/Tabs.php b/app/code/core/Mage/Adminhtml/Block/System/Design/Edit/Tabs.php index 4547dbd6ed..9ea3fda3c1 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Design/Edit/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Design/Edit/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Design/Grid.php b/app/code/core/Mage/Adminhtml/Block/System/Design/Grid.php index 5fdc99dd42..86dbf1f22b 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Design/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Design/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -47,7 +47,7 @@ public function __construct() /** * Prepare grid data collection - * + * * @return Mage_Adminhtml_Block_System_Design_Grid */ protected function _prepareCollection() diff --git a/app/code/core/Mage/Adminhtml/Block/System/Email/Template.php b/app/code/core/Mage/Adminhtml/Block/System/Email/Template.php index ef4a7a1795..b1ae6d4899 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Email/Template.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Email/Template.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Edit.php b/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Edit.php index 837509021f..77c8a12cd5 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Edit/Form.php index f57f9ef033..edbda7fbe3 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -184,10 +184,6 @@ public function getVariables() if ($template->getId() && $templateVariables = $template->getVariablesOptionArray(true)) { $variables[] = $templateVariables; } -// array_unshift($variables, array( -// 'value' => '', -// 'label' => Mage::helper('adminhtml')->__('-- Please Select --') -// )); return $variables; } } diff --git a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid.php b/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid.php index f4d2441394..38038cd371 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Filter/Type.php b/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Filter/Type.php index d80c2b3432..97d6189e65 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Filter/Type.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Filter/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Action.php b/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Action.php index 37a692159f..404ebeb783 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Action.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Sender.php b/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Sender.php index 9dfa63c3f2..3331da336d 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Sender.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Sender.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Type.php b/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Type.php index 19fd969f80..7050f2323e 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Type.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Renderer/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Preview.php b/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Preview.php index 8ed8f2e6c6..a124a4bfed 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Preview.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Email/Template/Preview.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Delete.php b/app/code/core/Mage/Adminhtml/Block/System/Store/Delete.php index 82ffa0c558..da023c357c 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Store/Delete.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Store/Delete.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Form.php b/app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Form.php index 8c79bdd864..aad699ae72 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -53,7 +53,7 @@ protected function _prepareForm() $form->setHtmlIdPrefix('store_'); - $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('core')->__('Backup options'), 'class' => 'fieldset-wide')); + $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('core')->__('Backup Options'), 'class' => 'fieldset-wide')); $fieldset->addField('item_id', 'hidden', array( 'name' => 'item_id', diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Group.php b/app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Group.php index d3593e6b96..a164dbe306 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Group.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Group.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Website.php b/app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Website.php index 0ccf656749..f2d670b4ea 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Website.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Store/Delete/Website.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php b/app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php index 158d391d2d..c4209e1f9c 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form.php index 59d1551053..c613896fdb 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -102,7 +102,7 @@ protected function _prepareForm() $fieldset->addField('website_sort_order', 'text', array( 'name' => 'website[sort_order]', - 'label' => Mage::helper('core')->__('Sort order'), + 'label' => Mage::helper('core')->__('Sort Order'), 'value' => $websiteModel->getSortOrder(), 'required' => false, 'disabled' => $websiteModel->isReadOnly(), @@ -124,7 +124,7 @@ protected function _prepareForm() if (!$websiteModel->getIsDefault() && $websiteModel->getStoresCount()) { $fieldset->addField('is_default', 'checkbox', array( 'name' => 'website[is_default]', - 'label' => Mage::helper('core')->__('Set as default'), + 'label' => Mage::helper('core')->__('Set as Default'), 'value' => 1, 'disabled' => $websiteModel->isReadOnly(), )); @@ -299,7 +299,7 @@ protected function _prepareForm() $fieldset->addField('store_sort_order', 'text', array( 'name' => 'store[sort_order]', - 'label' => Mage::helper('core')->__('Sort order'), + 'label' => Mage::helper('core')->__('Sort Order'), 'value' => $storeModel->getSortOrder(), 'required' => false, 'disabled' => $storeModel->isReadOnly(), diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Grid.php b/app/code/core/Mage/Adminhtml/Block/System/Store/Grid.php index 8469e03473..fb70effad1 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Store/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Store/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Group.php b/app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Group.php index 1714733a35..dc9bf69abc 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Group.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Group.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Store.php b/app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Store.php index b172cd4a08..9827c94297 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Store.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Store.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Website.php b/app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Website.php index 1e5f4ada25..ad57b7cc4c 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Website.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Website.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Store.php b/app/code/core/Mage/Adminhtml/Block/System/Store/Store.php index e80c13e931..083730a4ef 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Store/Store.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Store/Store.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Variable.php b/app/code/core/Mage/Adminhtml/Block/System/Variable.php index fd53c34dd9..773527561b 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Variable.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Variable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Variable/Edit.php b/app/code/core/Mage/Adminhtml/Block/System/Variable/Edit.php index d2b85d3037..beab426d17 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Variable/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Variable/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Variable/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/System/Variable/Edit/Form.php index 392a3224be..fa3626a6d3 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Variable/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Variable/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Variable/Grid.php b/app/code/core/Mage/Adminhtml/Block/System/Variable/Grid.php index f588bd3610..da32640daf 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Variable/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Variable/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tag.php b/app/code/core/Mage/Adminhtml/Block/Tag.php index 138f253dd3..d5ad72f0ed 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Assigned/Grid.php b/app/code/core/Mage/Adminhtml/Block/Tag/Assigned/Grid.php index b12c8ef602..1811ec4af7 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Assigned/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Assigned/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -170,7 +170,7 @@ protected function _prepareColumns() if ($store->getId()) { $this->addColumn('custom_name', array( - 'header'=> Mage::helper('catalog')->__('Name In %s', $store->getName()), + 'header'=> Mage::helper('catalog')->__('Name in %s', $store->getName()), 'index' => 'custom_name', )); } diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Customer.php b/app/code/core/Mage/Adminhtml/Block/Tag/Customer.php index 780df52b91..3177baa19c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Customer.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Customer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Customer/Grid.php b/app/code/core/Mage/Adminhtml/Block/Tag/Customer/Grid.php index a848b32afe..971bfff36e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Customer/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Customer/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Edit.php b/app/code/core/Mage/Adminhtml/Block/Tag/Edit.php index 153788c5be..7369189627 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -50,7 +50,7 @@ public function __construct() $this->_updateButton('delete', 'label', Mage::helper('tag')->__('Delete Tag')); $this->addButton('save_and_edit_button', array( - 'label' => Mage::helper('tag')->__('Save And Continue Edit'), + 'label' => Mage::helper('tag')->__('Save and Continue Edit'), 'onclick' => "saveAndContinueEdit('" . $this->getSaveAndContinueUrl() . "')", 'class' => 'save' ), 1); diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Edit/Accordion.php b/app/code/core/Mage/Adminhtml/Block/Tag/Edit/Accordion.php index ae5d367e49..e1a287bca9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Edit/Accordion.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Edit/Accordion.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Edit/Assigned.php b/app/code/core/Mage/Adminhtml/Block/Tag/Edit/Assigned.php index cd6da7841c..57a525688e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Edit/Assigned.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Edit/Assigned.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Tag/Edit/Form.php index 58ee290c2c..f00e45abc1 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Grid/All.php b/app/code/core/Mage/Adminhtml/Block/Tag/Grid/All.php index cd965f273f..9d0766cfcb 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Grid/All.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Grid/All.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Grid/Customers.php b/app/code/core/Mage/Adminhtml/Block/Tag/Grid/Customers.php index 9be138d905..ab52e61582 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Grid/Customers.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Grid/Customers.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Grid/Pending.php b/app/code/core/Mage/Adminhtml/Block/Tag/Grid/Pending.php index 0f7284dfe1..8335e622c0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Grid/Pending.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Grid/Pending.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -67,14 +67,6 @@ protected function _prepareColumns() 'index' => 'name', )); - $this->addColumn('total_used', array( - 'header' => Mage::helper('tag')->__('Uses'), - 'width' => '140px', - 'align' => 'right', - 'index' => 'uses', - 'type' => 'number', - )); - $this->addColumn('products', array( 'header' => Mage::helper('tag')->__('Products'), 'width' => '140px', @@ -91,13 +83,6 @@ protected function _prepareColumns() 'type' => 'number', )); - $this->addColumn('popularity', array( - 'header' => Mage::helper('tag')->__('Popularity'), - 'width' => '140px', - 'align' => 'right', - 'index' => 'popularity', - 'type' => 'number', - )); // Collection for stores filters if (!$collection = Mage::registry('stores_select_collection')) { $collection = Mage::app()->getStore()->getResourceCollection() @@ -107,7 +92,7 @@ protected function _prepareColumns() if (!Mage::app()->isSingleStoreMode()) { $this->addColumn('visible_in', array( - 'header' => Mage::helper('tag')->__('Visible In'), + 'header' => Mage::helper('tag')->__('Store View'), 'type' => 'store', 'index' => 'stores', 'sortable' => false, diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Grid/Products.php b/app/code/core/Mage/Adminhtml/Block/Tag/Grid/Products.php index d2c82209f6..d23df93082 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Grid/Products.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Grid/Products.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Pending.php b/app/code/core/Mage/Adminhtml/Block/Tag/Pending.php index 95c75d13e5..6744703a66 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Pending.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Pending.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Product.php b/app/code/core/Mage/Adminhtml/Block/Tag/Product.php index 5d25688020..8afe53726b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Product.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Product/Grid.php b/app/code/core/Mage/Adminhtml/Block/Tag/Product/Grid.php index 36bbbe525f..2f1f17a947 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Product/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Product/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Store/Switcher.php b/app/code/core/Mage/Adminhtml/Block/Tag/Store/Switcher.php index 8ff55653e5..a173d62147 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Store/Switcher.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Store/Switcher.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Tag.php b/app/code/core/Mage/Adminhtml/Block/Tag/Tag.php index 35a1d9f87c..72c2823a50 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Tag.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Tag.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Tag/Edit.php b/app/code/core/Mage/Adminhtml/Block/Tag/Tag/Edit.php index 87dd1a1b65..c146c50e88 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Tag/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Tag/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Tag/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Tag/Tag/Edit/Form.php index 500dfc1491..57e7dfc86e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Tag/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Tag/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Tag/Grid.php b/app/code/core/Mage/Adminhtml/Block/Tag/Tag/Grid.php index b881b1f2fc..9fe7725ef7 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Tag/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Tag/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -74,14 +74,6 @@ protected function _prepareColumns() 'index' => 'name', )); - $this->addColumn('total_used', array( - 'header' => Mage::helper('tag')->__('Uses'), - 'width' => 140, - 'align' => 'right', - 'index' => 'uses', - 'type' => 'number', - )); - $this->addColumn('products', array( 'header' => Mage::helper('tag')->__('Products'), 'width' => 140, @@ -98,14 +90,6 @@ protected function _prepareColumns() 'type' => 'number', )); - $this->addColumn('popularity', array( - 'header' => Mage::helper('tag')->__('Popularity'), - 'width' => 140, - 'align' => 'right', - 'index' => 'popularity', - 'type' => 'number', - )); - $this->addColumn('status', array( 'header' => Mage::helper('tag')->__('Status'), 'width' => 90, @@ -116,7 +100,7 @@ protected function _prepareColumns() if (!Mage::app()->isSingleStoreMode()) { $this->addColumn('visible_in', array( - 'header' => Mage::helper('tag')->__('Visible In'), + 'header' => Mage::helper('tag')->__('Store View'), 'type' => 'store', 'skipAllStoresLabel' => true, 'index' => 'stores', diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Class.php b/app/code/core/Mage/Adminhtml/Block/Tax/Class.php index 1aa160c0c4..eb104aa123 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Class.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Class.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Class/Edit.php b/app/code/core/Mage/Adminhtml/Block/Tax/Class/Edit.php index a66713d435..ba16a6fd34 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Class/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Class/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Class/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Tax/Class/Edit/Form.php index 96f6e090a1..3352e93b8d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Class/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Class/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Class/Grid.php b/app/code/core/Mage/Adminhtml/Block/Tax/Class/Grid.php index 154d7bdf71..a3093fda80 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Class/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Class/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Form.php b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Form.php index 8629746f12..2d1b19b5a2 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -102,7 +102,6 @@ protected function _prepareForm() array( 'name' => 'tax_country_id', 'label' => Mage::helper('tax')->__('Country'), - 'title' => Mage::helper('tax')->__('Please select Country'), 'required' => true, 'values' => $countries ) @@ -112,7 +111,6 @@ protected function _prepareForm() array( 'name' => 'tax_region_id', 'label' => Mage::helper('tax')->__('State'), - 'title' => Mage::helper('tax')->__('Please select State'), 'values' => $regions ) ); @@ -122,7 +120,6 @@ protected function _prepareForm() array( 'name' => 'tax_county_id', 'label' => Mage::helper('tax')->__('County'), - 'title' => Mage::helper('tax')->__('Please select County'), 'values' => array( array( 'label' => '*', @@ -136,7 +133,7 @@ protected function _prepareForm() $fieldset->addField('zip_is_range', 'select', array( 'name' => 'zip_is_range', - 'label' => Mage::helper('tax')->__('Zip/Post Is Range'), + 'label' => Mage::helper('tax')->__('Zip/Post is Range'), 'options' => array( '0' => Mage::helper('tax')->__('No'), '1' => Mage::helper('tax')->__('Yes'), @@ -158,18 +155,20 @@ protected function _prepareForm() $fieldset->addField('zip_from', 'text', array( 'name' => 'zip_from', - 'label' => Mage::helper('tax')->__('Range from'), + 'label' => Mage::helper('tax')->__('Range From'), 'value' => $rateObject->getZipFrom(), - 'required' => true + 'required' => true, + 'class' => 'validate-digits' ) ); $fieldset->addField('zip_to', 'text', array( 'name' => 'zip_to', - 'label' => Mage::helper('tax')->__('Range to'), + 'label' => Mage::helper('tax')->__('Range To'), 'value' => $rateObject->getZipTo(), - 'required' => true + 'required' => true, + 'class' => 'validate-digits' ) ); @@ -182,11 +181,11 @@ protected function _prepareForm() $fieldset->addField('rate', 'text', array( 'name' => "rate", - 'label' => Mage::helper('tax')->__('Rate'), - 'title' => Mage::helper('tax')->__('Rate'), + 'label' => Mage::helper('tax')->__('Rate Percent'), + 'title' => Mage::helper('tax')->__('Rate Percent'), 'value' => number_format($value, 4), 'required' => true, - 'class' => 'validate-not-negative-number required-entry' + 'class' => 'validate-not-negative-number' ) ); diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid.php b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid.php index 1748e88724..51792d734d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Block_Tax_Rate_Grid extends Mage_Adminhtml_Block_Widget_Grid diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Country.php b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Country.php index 519aa8e96a..e915a383a0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Country.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Country.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Data.php b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Data.php index 84f0e7c3c3..7092bf8bb4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Data.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/ImportExport.php b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/ImportExport.php index 8e67675a5e..b76ce6842f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/ImportExport.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/ImportExport.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Title.php b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Title.php index fba526bc67..9b344b0906 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Title.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Title.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Title/Fieldset.php b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Title/Fieldset.php index d9eb4b6920..029a355230 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Title/Fieldset.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Title/Fieldset.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Add.php b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Add.php index 9de4054888..941a5c8b5d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Add.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Add.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Save.php b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Save.php index a37c0ec7f3..72725a7fe1 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Save.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Save.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rule.php b/app/code/core/Mage/Adminhtml/Block/Tax/Rule.php index bab9ebfc8d..b6245bed16 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Rule.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Rule.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rule/Edit.php b/app/code/core/Mage/Adminhtml/Block/Tax/Rule/Edit.php index 8e6bb3a31a..0f17e38d58 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Rule/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Rule/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -49,7 +49,7 @@ public function __construct() $this->_updateButton('delete', 'label', Mage::helper('tax')->__('Delete Rule')); $this->_addButton('save_and_continue', array( - 'label' => Mage::helper('tax')->__('Save And Continue Edit'), + 'label' => Mage::helper('tax')->__('Save and Continue Edit'), 'onclick' => 'saveAndContinueEdit()', 'class' => 'save' ), 10); diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rule/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Tax/Rule/Edit/Form.php index eb42064167..9cf23bba7d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Rule/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Rule/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rule/Grid.php b/app/code/core/Mage/Adminhtml/Block/Tax/Rule/Grid.php index f5849169f9..7882fd13fb 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Rule/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Rule/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Block_Tax_Rule_Grid extends Mage_Adminhtml_Block_Widget_Grid diff --git a/app/code/core/Mage/Adminhtml/Block/Template.php b/app/code/core/Mage/Adminhtml/Block/Template.php index 0bf0f4a4f7..27a9e09af8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Template.php +++ b/app/code/core/Mage/Adminhtml/Block/Template.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Text/List.php b/app/code/core/Mage/Adminhtml/Block/Text/List.php index 74005920b7..f9af0dbf79 100644 --- a/app/code/core/Mage/Adminhtml/Block/Text/List.php +++ b/app/code/core/Mage/Adminhtml/Block/Text/List.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite.php b/app/code/core/Mage/Adminhtml/Block/Urlrewrite.php index 7cd3a2f5bd..80ea7effb8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Urlrewrite.php +++ b/app/code/core/Mage/Adminhtml/Block/Urlrewrite.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Category/Tree.php b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Category/Tree.php index 5a03819460..683708dd4e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Category/Tree.php +++ b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Category/Tree.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit.php b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit.php index dbc7f34048..df3bf4ef2a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit.php +++ b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -106,7 +106,7 @@ protected function _prepareLayout() $this->setChild('categories_tree', $this->getLayout()->createBlock('adminhtml/urlrewrite_category_tree')); $this->setChild('skip_categories', $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array( - 'label' => Mage::helper('adminhtml')->__('Skip category selection'), + 'label' => Mage::helper('adminhtml')->__('Skip Category Selection'), 'onclick' => 'window.location = \'' . Mage::helper('adminhtml')->getUrl('*/*/*', array( 'product' => $this->getProductId() )) . '\'', diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php index 2178f38b98..9baa99480d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Grid.php b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Grid.php index fd499904af..304b8438ac 100644 --- a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Link.php b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Link.php index 953210b428..d197132d00 100644 --- a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Link.php +++ b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Link.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Product/Grid.php b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Product/Grid.php index f20c952cf9..dd7a87969d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Product/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Product/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Selector.php b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Selector.php index a4c9552322..6447680f76 100644 --- a/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Selector.php +++ b/app/code/core/Mage/Adminhtml/Block/Urlrewrite/Selector.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget.php b/app/code/core/Mage/Adminhtml/Block/Widget.php index 52eee3bd98..e2c6e00688 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Accordion.php b/app/code/core/Mage/Adminhtml/Block/Widget/Accordion.php index b719843a90..05ec179f27 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Accordion.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Accordion.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Accordion/Item.php b/app/code/core/Mage/Adminhtml/Block/Widget/Accordion/Item.php index c95033952f..85aab31439 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Accordion/Item.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Accordion/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Breadcrumbs.php b/app/code/core/Mage/Adminhtml/Block/Widget/Breadcrumbs.php index bfed144b1f..7c025bf8e8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Breadcrumbs.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Breadcrumbs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Button.php b/app/code/core/Mage/Adminhtml/Block/Widget/Button.php index ef325dc2fc..2382f694db 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Button.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Button.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Container.php b/app/code/core/Mage/Adminhtml/Block/Widget/Container.php index 15b5182160..26f61bfea5 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Container.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Container.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Form.php b/app/code/core/Mage/Adminhtml/Block/Widget/Form.php index fd086925bd..82cdb6e615 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Form.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php b/app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php index e9fe613865..bb0af66bbf 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Element.php b/app/code/core/Mage/Adminhtml/Block/Widget/Form/Element.php index d07c60b272..6c9fcfb285 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Element.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Form/Element.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Element/Dependence.php b/app/code/core/Mage/Adminhtml/Block/Widget/Form/Element/Dependence.php index ad204beaae..17e27380e9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Element/Dependence.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Form/Element/Dependence.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -50,6 +50,13 @@ class Mage_Adminhtml_Block_Widget_Form_Element_Dependence extends Mage_Adminhtml */ protected $_depends = array(); + /** + * Additional configuration options for the dependencies javascript controller + * + * @var array + */ + protected $_configOptions = array(); + /** * Add name => id mapping * @@ -82,6 +89,18 @@ public function addFieldDependence($fieldName, $fieldNameFrom, $refValues) return $this; } + /** + * Add misc configuration options to the javascript dependencies controller + * + * @param array $options + * @return Mage_Adminhtml_Block_Widget_Form_Element_Dependence + */ + public function addConfigOptions(array $options) + { + $this->_configOptions = array_merge($this->_configOptions, $options); + return $this; + } + /** * HTML output getter * @return string @@ -92,7 +111,9 @@ protected function _toHtml() return ''; } return ''; + . $this->_getDependsJson() + . ($this->_configOptions ? ', ' . Mage::helper('core')->jsonEncode($this->_configOptions) : '') + . '); '; } /** diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Element/Gallery.php b/app/code/core/Mage/Adminhtml/Block/Widget/Form/Element/Gallery.php index 6483af8418..78d424092f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Element/Gallery.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Form/Element/Gallery.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Renderer/Element.php b/app/code/core/Mage/Adminhtml/Block/Widget/Form/Renderer/Element.php index ab688b1e41..bd609d6a2f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Renderer/Element.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Form/Renderer/Element.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Renderer/Fieldset.php b/app/code/core/Mage/Adminhtml/Block/Widget/Form/Renderer/Fieldset.php index 7fa3b1a0a1..4492507ef6 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Renderer/Fieldset.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Form/Renderer/Fieldset.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Renderer/Fieldset/Element.php b/app/code/core/Mage/Adminhtml/Block/Widget/Form/Renderer/Fieldset/Element.php index 557f0799e4..b0d5d39c09 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Form/Renderer/Fieldset/Element.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Form/Renderer/Fieldset/Element.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php index e879e992e6..98824b0b23 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -303,7 +303,7 @@ public function addColumn($columnId, $column) $this->_columns[$columnId] = $column; }*/ else { - throw new Exception(Mage::helper('adminhtml')->__('Wrong column format')); + throw new Exception(Mage::helper('adminhtml')->__('Wrong column format.')); } $this->_columns[$columnId]->setId($columnId); diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Block.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Block.php index dbaab3c1d3..72eb80064f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Block.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Block.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column.php index 608c65617d..463837cd56 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Abstract.php index 774f9d748c..09624d3fda 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Checkbox.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Checkbox.php index bb717d1c49..68b4606c34 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Checkbox.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Checkbox.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Country.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Country.php index 54c4fda2fc..330dfff894 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Country.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Country.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -34,7 +34,7 @@ class Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Country extends Mage_Adminh protected function _getOptions() { $options = Mage::getResourceModel('directory/country_collection')->load()->toOptionArray(false); - array_unshift($options, array('value'=>'', 'label'=>Mage::helper('cms')->__('All countries'))); + array_unshift($options, array('value'=>'', 'label'=>Mage::helper('cms')->__('All Countries'))); return $options; } } diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Date.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Date.php index 139d09a8ec..05ca5dc4ec 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Date.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Date.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -74,6 +74,29 @@ public function getHtml() align : "Bl", singleClick : true }); + + $("'.$htmlId.'_to_trig").observe("click", showCalendar); + $("'.$htmlId.'_from_trig").observe("click", showCalendar); + + function showCalendar(event){ + var element = event.element(event); + var offset = $(element).viewportOffset(); + var scrollOffset = $(element).cumulativeScrollOffset(); + var dimensionsButton = $(element).getDimensions(); + var index = $("widget-chooser").getStyle("zIndex"); + + $$("div.calendar").each(function(item){ + if ($(item).visible()) { + var dimensionsCalendar = $(item).getDimensions(); + + $(item).setStyle({ + "zIndex" : index + 1, + "left" : offset[0] + scrollOffset[0] - dimensionsCalendar.width + dimensionsButton.width + "px", + "top" : offset[1] + scrollOffset[1] + dimensionsButton.height + "px" + }); + }; + }); + }; '; return $html; } diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Datetime.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Datetime.php index 64beceb08d..8a63e383ab 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Datetime.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Datetime.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Interface.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Interface.php index 683d775032..076a789b1f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Interface.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Massaction.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Massaction.php index 71bfe8c115..6229a25e42 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Massaction.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Massaction.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Price.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Price.php index 409f8150b6..9f58900309 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Price.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Radio.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Radio.php index 98041a0fa3..4d138eb228 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Radio.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Radio.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Range.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Range.php index 4fac9eae36..d33c785122 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Range.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Range.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Select.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Select.php index 36dae00f53..54282b0dc0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Select.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Select.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -35,9 +35,17 @@ class Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Select extends Mage_Adminht { protected function _getOptions() { + $emptyOption = array('value' => null, 'label' => ''); + + $optionGroups = $this->getColumn()->getOptionGroups(); + if ($optionGroups) { + array_unshift($optionGroups, $emptyOption); + return $optionGroups; + } + $colOptions = $this->getColumn()->getOptions(); - if ( !empty($colOptions) && is_array($colOptions) ) { - $options = array(array('value' => null, 'label' => '')); + if (!empty($colOptions) && is_array($colOptions) ) { + $options = array($emptyOption); foreach ($colOptions as $value => $label) { $options[] = array('value' => $value, 'label' => $label); } @@ -46,13 +54,33 @@ protected function _getOptions() return array(); } + /** + * Render an option with selected value + * + * @param array $option + * @param string $value + * @return string + */ + protected function _renderOption($option, $value) + { + $selected = (($option['value'] == $value && (!is_null($value))) ? ' selected="selected"' : '' ); + return ''; + } + public function getHtml() { $html = ''; return $html; diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Store.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Store.php index 3064b60715..81733b65b7 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Store.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Store.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Text.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Text.php index 68426d4a4f..9551c885e4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Text.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Text.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Theme.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Theme.php index e01e962d82..24969060a4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Theme.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Theme.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Abstract.php index 73fe5ed14d..c5bfdc0c1f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php index 599e2c645c..669796d299 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -151,7 +151,7 @@ protected function _transformActionData(&$action, &$actionCaption, Varien_Object break; case 'popup': - $action['onclick'] = 'popWin(this.href, \'windth=800,height=700,resizable=1,scrollbars=1\');return false;'; + $action['onclick'] = 'popWin(this.href, \'_blank\', \'width=800,height=700,resizable=1,scrollbars=1\');return false;'; break; } diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Checkbox.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Checkbox.php index ef44f0935d..1fb3282d2c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Checkbox.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Checkbox.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Concat.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Concat.php index 870938aca9..471c01dc1d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Concat.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Concat.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Country.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Country.php index 9968cbd729..4eab53f2d9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Country.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Country.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Currency.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Currency.php index 9632353b20..175334ccb0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Currency.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Currency.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Date.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Date.php index d5fb134015..81607370ef 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Date.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Date.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php index 161483e849..0a4db0f9a4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Input.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Input.php index 7f892a89c2..004e4d834c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Input.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Input.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Interface.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Interface.php index 85cdbf2b84..e6f063c1bc 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Interface.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Ip.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Ip.php index 0b369e3f0a..51774ae382 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Ip.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Ip.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Longtext.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Longtext.php index 16fc88f3a4..34c65fd092 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Longtext.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Longtext.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Massaction.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Massaction.php index 82be78aee8..c96025dc81 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Massaction.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Massaction.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Number.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Number.php index 047f0304ae..66dab14c73 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Number.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Number.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php index 99f01d33f0..43fcdf91d6 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Price.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Price.php index 3da38e5b62..9153923ad0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Price.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Radio.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Radio.php index 460859c485..71505c3bc6 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Radio.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Radio.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Select.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Select.php index a6d8aeafb2..e572f7443c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Select.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Select.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -43,7 +43,7 @@ class Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Select extends Mage_Admin */ public function render(Varien_Object $row) { - $html = 'getColumn()->getValidateClass() . '>'; $value = $row->getData($this->getColumn()->getIndex()); foreach ($this->getColumn()->getOptions() as $val => $label){ $selected = ( ($val == $value && (!is_null($value))) ? ' selected="selected"' : '' ); diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Store.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Store.php index 9159efe01f..df006f180b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Store.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Store.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -35,6 +35,7 @@ class Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Store extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract { protected $_skipAllStoresLabel = false; + protected $_skipEmptyStoresLabel = false; /** * Retrieve System Store model @@ -58,6 +59,18 @@ protected function _getShowAllStoresLabelFlag() : $this->_skipAllStoresLabel; } + /** + * Retrieve 'show empty stores label' flag + * + * @return bool + */ + protected function _getShowEmptyStoresLabelFlag() + { + return $this->getColumn()->getData('skipEmptyStoresLabel') + ? $this->getColumn()->getData('skipEmptyStoresLabel') + : $this->_skipEmptyStoresLabel; + } + /** * Render row store views * @@ -68,6 +81,7 @@ public function render(Varien_Object $row) { $out = ''; $skipAllStoresLabel = $this->_getShowAllStoresLabelFlag(); + $skipEmptyStoresLabel = $this->_getShowEmptyStoresLabelFlag(); $origStores = $row->getData($this->getColumn()->getIndex()); if (is_null($origStores) && $row->getStoreName()) { @@ -79,11 +93,17 @@ public function render(Varien_Object $row) return $out; } + if (empty($origStores)&& !$skipEmptyStoresLabel) { + return ''; + } if (!is_array($origStores)) { $origStores = array($origStores); } - if (in_array(0, $origStores) && !$skipAllStoresLabel) { + if (empty($origStores)) { + return ''; + } + elseif (in_array(0, $origStores) && count($origStores) == 1 && !$skipAllStoresLabel) { return Mage::helper('adminhtml')->__('All Store Views'); } diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Text.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Text.php index 4dba178894..82aeb13c62 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Text.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Text.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Theme.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Theme.php index 500c20ec05..f61157384a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Theme.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Theme.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Wrapline.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Wrapline.php index 6aea650b02..e49ce9820e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Wrapline.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Wrapline.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php index c6466c0ae3..0e85d04508 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction.php index 29eb48ad15..f40d65b60a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php index 31159a230c..762e3f827f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -44,7 +44,7 @@ public function __construct() { parent::__construct(); $this->setTemplate('widget/grid/massaction.phtml'); - $this->setErrorText(Mage::helper('catalog')->jsQuoteEscape(Mage::helper('catalog')->__('Please select items'))); + $this->setErrorText(Mage::helper('catalog')->jsQuoteEscape(Mage::helper('catalog')->__('Please select items.'))); } /** @@ -225,12 +225,17 @@ public function getJavaScript() var {$this->getJsObjectName()} = new varienGridMassaction('{$this->getHtmlId()}', {$this->getGridJsObjectName()}, '{$this->getSelectedJson()}', '{$this->getFormFieldNameInternal()}', '{$this->getFormFieldName()}'); {$this->getJsObjectName()}.setItems({$this->getItemsJson()}); {$this->getJsObjectName()}.setGridIds('{$this->getGridIdsJson()}'); - ". ($this->getUseAjax() ? "{$this->getJsObjectName()}.setUseAjax(true);" : '') . + ". ($this->getUseAjax() ? "{$this->getJsObjectName()}.setUseAjax(true);" : '') . " + ". ($this->getUseSelectAll() ? "{$this->getJsObjectName()}.setUseSelectAll(true);" : '') . "{$this->getJsObjectName()}.errorText = '{$this->getErrorText()}';"; } public function getGridIdsJson() { + if (!$this->getUseSelectAll()) { + return ''; + } + $gridIds = $this->getParentBlock()->getCollection()->getAllIds(); if(!empty($gridIds)) { @@ -260,5 +265,27 @@ public function removeItem($itemId) return $this; } + + /** + * Retrieve select all functionality flag check + * + * @return boolean + */ + public function getUseSelectAll() + { + return $this->_getData('use_select_all') === null || $this->_getData('use_select_all'); + } + + /** + * Retrieve select all functionality flag check + * + * @param boolean $flag + * @return Mage_Adminhtml_Block_Widget_Grid_Massaction_Abstract + */ + public function setUseSelectAll($flag) + { + $this->setData('use_select_all', (bool) $flag); + return $this; + } } // Class Mage_Adminhtml_Block_Widget_Grid_Massaction_Abstract End diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item.php index 296c596aaf..d7ad849caa 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/Default.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/Default.php index b15176f1a9..11a2005557 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/Default.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/Interface.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/Interface.php index 9ecf29e06d..92cec34ed3 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/Interface.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item/Additional/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Serializer.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Serializer.php index 014f152cf0..e04aaeae6e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Serializer.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Serializer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Tab/Interface.php b/app/code/core/Mage/Adminhtml/Block/Widget/Tab/Interface.php index 35b4e224bf..42e32f4433 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Tab/Interface.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Tab/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php b/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php index ed7e007481..c319dd4d28 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -105,15 +105,11 @@ public function addTab($tabId, $tab) } if (!($this->_tabs[$tabId] instanceof Mage_Adminhtml_Block_Widget_Tab_Interface)) { - throw new Exception(Mage::helper('adminhtml')->__('Wrong tab configuration')); + throw new Exception(Mage::helper('adminhtml')->__('Wrong tab configuration.')); } -// $this->_tabs[$tabId]->setTabId($tabId); -// -// if (is_null($this->_activeTab)) $this->_activeTab = $tabId; -// return $this; } else { - throw new Exception(Mage::helper('adminhtml')->__('Wrong tab configuration')); + throw new Exception(Mage::helper('adminhtml')->__('Wrong tab configuration.')); } if (is_null($this->_tabs[$tabId]->getUrl())) { diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Tree.php b/app/code/core/Mage/Adminhtml/Block/Widget/Tree.php index b78445fc9e..f3e38c7747 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Tree.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Tree.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/View/Container.php b/app/code/core/Mage/Adminhtml/Block/Widget/View/Container.php index a092f3b1d8..e02a5bc65f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/View/Container.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/View/Container.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Controller/Action.php b/app/code/core/Mage/Adminhtml/Controller/Action.php index c64dacad77..6383749c79 100644 --- a/app/code/core/Mage/Adminhtml/Controller/Action.php +++ b/app/code/core/Mage/Adminhtml/Controller/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Controller/Sales/Creditmemo.php b/app/code/core/Mage/Adminhtml/Controller/Sales/Creditmemo.php index 19ca059191..db702b3bd0 100644 --- a/app/code/core/Mage/Adminhtml/Controller/Sales/Creditmemo.php +++ b/app/code/core/Mage/Adminhtml/Controller/Sales/Creditmemo.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -84,7 +84,7 @@ public function emailAction() if ($creditmemoId = $this->getRequest()->getParam('creditmemo_id')) { if ($creditmemo = Mage::getModel('sales/order_creditmemo')->load($creditmemoId)) { $creditmemo->sendEmail(); - $this->_getSession()->addSuccess(Mage::helper('sales')->__('Message was successfully sent')); + $this->_getSession()->addSuccess(Mage::helper('sales')->__('The message was sent.')); $this->_redirect('*/sales_order_creditmemo/view', array( 'creditmemo_id' => $creditmemoId )); diff --git a/app/code/core/Mage/Adminhtml/Controller/Sales/Invoice.php b/app/code/core/Mage/Adminhtml/Controller/Sales/Invoice.php index d735933e81..92d1e6e7f1 100644 --- a/app/code/core/Mage/Adminhtml/Controller/Sales/Invoice.php +++ b/app/code/core/Mage/Adminhtml/Controller/Sales/Invoice.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -97,7 +97,7 @@ public function emailAction() if ($invoiceId = $this->getRequest()->getParam('invoice_id')) { if ($invoice = Mage::getModel('sales/order_invoice')->load($invoiceId)) { $invoice->sendEmail(); - $this->_getSession()->addSuccess(Mage::helper('sales')->__('Message was successfully sent')); + $this->_getSession()->addSuccess(Mage::helper('sales')->__('The message has been sent.')); $this->_redirect('*/sales_invoice/view', array( 'order_id' => $invoice->getOrder()->getId(), 'invoice_id'=> $invoiceId, diff --git a/app/code/core/Mage/Adminhtml/Controller/Sales/Shipment.php b/app/code/core/Mage/Adminhtml/Controller/Sales/Shipment.php index ca76843fe9..bcb76e2c3c 100644 --- a/app/code/core/Mage/Adminhtml/Controller/Sales/Shipment.php +++ b/app/code/core/Mage/Adminhtml/Controller/Sales/Shipment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Exception.php b/app/code/core/Mage/Adminhtml/Exception.php index c076a528e5..edcada9ee5 100644 --- a/app/code/core/Mage/Adminhtml/Exception.php +++ b/app/code/core/Mage/Adminhtml/Exception.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Helper/Catalog.php b/app/code/core/Mage/Adminhtml/Helper/Catalog.php index e41e9de032..a626cdb940 100644 --- a/app/code/core/Mage/Adminhtml/Helper/Catalog.php +++ b/app/code/core/Mage/Adminhtml/Helper/Catalog.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Edit/Action/Attribute.php b/app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Edit/Action/Attribute.php index ff0329d97d..a28c26436d 100644 --- a/app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Edit/Action/Attribute.php +++ b/app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Edit/Action/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Helper/Dashboard/Abstract.php b/app/code/core/Mage/Adminhtml/Helper/Dashboard/Abstract.php index 73e39f9774..0f7f9d8e76 100644 --- a/app/code/core/Mage/Adminhtml/Helper/Dashboard/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Helper/Dashboard/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Helper/Dashboard/Data.php b/app/code/core/Mage/Adminhtml/Helper/Dashboard/Data.php index 6720937087..dd8d83993a 100644 --- a/app/code/core/Mage/Adminhtml/Helper/Dashboard/Data.php +++ b/app/code/core/Mage/Adminhtml/Helper/Dashboard/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -69,8 +69,8 @@ public function countStores() public function getDatePeriods() { return array( - '24h'=>$this->__('Last 24 hours'), - '7d'=>$this->__('Last 7 days'), + '24h'=>$this->__('Last 24 Hours'), + '7d'=>$this->__('Last 7 Days'), '1m'=>$this->__('Current Month'), '1y'=>$this->__('YTD'), '2y'=>$this->__('2YTD') diff --git a/app/code/core/Mage/Adminhtml/Helper/Dashboard/Order.php b/app/code/core/Mage/Adminhtml/Helper/Dashboard/Order.php index ae3ce97318..c5ecea16a6 100644 --- a/app/code/core/Mage/Adminhtml/Helper/Dashboard/Order.php +++ b/app/code/core/Mage/Adminhtml/Helper/Dashboard/Order.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,15 +42,21 @@ protected function _initCollection() ->prepareSummary($this->getParam('period'), 0, 0, $isFilter); if ($this->getParam('store')) { - $this->_collection->addAttributeToFilter('store_id', $this->getParam('store')); + $this->_collection->addFieldToFilter('store_id', $this->getParam('store')); } else if ($this->getParam('website')){ $storeIds = Mage::app()->getWebsite($this->getParam('website'))->getStoreIds(); - $this->_collection->addAttributeToFilter('store_id', array('in' => implode(',', $storeIds))); + $this->_collection->addFieldToFilter('store_id', array('in' => implode(',', $storeIds))); } else if ($this->getParam('group')){ $storeIds = Mage::app()->getGroup($this->getParam('group'))->getStoreIds(); - $this->_collection->addAttributeToFilter('store_id', array('in' => implode(',', $storeIds))); + $this->_collection->addFieldToFilter('store_id', array('in' => implode(',', $storeIds))); + } elseif (!$this->_collection->isLive()) { + $this->_collection->addFieldToFilter('store_id', + array('eq' => Mage::app()->getStore(Mage_Core_Model_Store::ADMIN_CODE)->getId()) + ); } + + $this->_collection->load(); } diff --git a/app/code/core/Mage/Adminhtml/Helper/Data.php b/app/code/core/Mage/Adminhtml/Helper/Data.php index 771d52c2a4..43d64fac24 100644 --- a/app/code/core/Mage/Adminhtml/Helper/Data.php +++ b/app/code/core/Mage/Adminhtml/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Helper/Js.php b/app/code/core/Mage/Adminhtml/Helper/Js.php index cd87ba6c46..40989f67b4 100644 --- a/app/code/core/Mage/Adminhtml/Helper/Js.php +++ b/app/code/core/Mage/Adminhtml/Helper/Js.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Helper/Media/Js.php b/app/code/core/Mage/Adminhtml/Helper/Media/Js.php index 728eeb02cd..39e1dbf736 100644 --- a/app/code/core/Mage/Adminhtml/Helper/Media/Js.php +++ b/app/code/core/Mage/Adminhtml/Helper/Media/Js.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Helper/Rss.php b/app/code/core/Mage/Adminhtml/Helper/Rss.php index f0ff523fa5..e29a6f8959 100644 --- a/app/code/core/Mage/Adminhtml/Helper/Rss.php +++ b/app/code/core/Mage/Adminhtml/Helper/Rss.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Helper/Sales.php b/app/code/core/Mage/Adminhtml/Helper/Sales.php index 8cd356d1df..b1d7dc63f1 100644 --- a/app/code/core/Mage/Adminhtml/Helper/Sales.php +++ b/app/code/core/Mage/Adminhtml/Helper/Sales.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -84,4 +84,30 @@ public function displayPrices($dataObject, $basePrice, $price, $strong = false, return $res; } + /** + * Filter collection by removing not available product types + * + * @param Mage_Core_Model_Mysql4_Collection_Abstract $collection + * @return Mage_Core_Model_Mysql4_Collection_Abstract + */ + public function applySalableProductTypesFilter($collection) + { + $productTypes = Mage::getConfig()->getNode('adminhtml/sales/order/create/available_product_types')->asArray(); + $productTypes = array_keys($productTypes); + foreach($collection->getItems() as $key => $item) { + if ($item instanceof Mage_Catalog_Model_Product) { + $type = $item->getTypeId(); + } else if ($item instanceof Mage_Sales_Model_Order_Item) { + $type = $item->getProductType(); + } else if ($item instanceof Mage_Sales_Model_Quote_Item) { + $type = $item->getProductType(); + } else { + $type = ''; + } + if (!in_array($type, $productTypes)) { + $collection->removeItemByKey($key); + } + } + return $collection; + } } diff --git a/app/code/core/Mage/Adminhtml/Model/Config.php b/app/code/core/Mage/Adminhtml/Model/Config.php index 2e174854ff..9a3ebc1a38 100644 --- a/app/code/core/Mage/Adminhtml/Model/Config.php +++ b/app/code/core/Mage/Adminhtml/Model/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -216,7 +216,7 @@ public function getSystemConfigNodeLabel($sectionName, $groupName = null, $field $fieldNode = $this->_sections->xpath($path); } else { - Mage::throwException(Mage::helper('adminhtml')->__('Group node name should be specified with field node name.')); + Mage::throwException(Mage::helper('adminhtml')->__('The group node name must be specified with field node name.')); } } $moduleName = $this->getAttributeModule($sectionNode, $groupNode, $fieldNode); diff --git a/app/code/core/Mage/Adminhtml/Model/Config/Data.php b/app/code/core/Mage/Adminhtml/Model/Config/Data.php index bfb2c0e617..da7aa83bab 100644 --- a/app/code/core/Mage/Adminhtml/Model/Config/Data.php +++ b/app/code/core/Mage/Adminhtml/Model/Config/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -66,6 +66,9 @@ public function save() $saveTransaction = Mage::getModel('core/resource_transaction'); /* @var $saveTransaction Mage_Core_Model_Resource_Transaction */ + // Extends for old config data + $oldConfigAdditionalGroups = array(); + foreach ($groups as $group => $groupData) { /** @@ -90,6 +93,13 @@ public function save() } } } + // set value for group field entry by fieldname + // use extra memory + $fieldsetData = array(); + foreach ($groupData['fields'] as $field => $fieldData) { + $fieldsetData[$field] = (is_array($fieldData) && isset($fieldData['value'])) + ? $fieldData['value'] : null; + } foreach ($groupData['fields'] as $field => $fieldData) { @@ -124,6 +134,7 @@ public function save() ->setScope($scope) ->setScopeId($scopeId) ->setFieldConfig($fieldConfig) + ->setFieldsetData($fieldsetData) ; if (!isset($fieldData['value'])) { @@ -134,7 +145,24 @@ public function save() $fieldData['value'] = join(',', $fieldData['value']); }*/ - $path = $section.'/'.$group.'/'.$field; + $path = $section.'/'.$group.'/'.$field; + + /** + * Look for custom defined field path + */ + if (is_object($fieldConfig)) { + $configPath = (string)$fieldConfig->config_path; + if (!empty($configPath) && strrpos($configPath, '/') > 0) { + // Extend old data with specified section group + $groupPath = substr($configPath, 0, strrpos($configPath, '/')); + if (!isset($oldConfigAdditionalGroups[$groupPath])) { + $oldConfig = $this->extendConfig($groupPath, true, $oldConfig); + $oldConfigAdditionalGroups[$groupPath] = true; + } + $path = $configPath; + } + } + $inherit = !empty($fieldData['inherit']); $dataObject->setPath($path) @@ -180,6 +208,23 @@ public function load() return $this->_getConfig(false); } + /** + * Extend config data with additional config data by specified path + * + * @param string $path Config path prefix + * @param bool $full Simple config structure or not + * @param array $oldConfig Config data to extend + * @return array + */ + public function extendConfig($path, $full = true, $oldConfig = array()) + { + $extended = $this->_getPathConfig($path, $full); + if (is_array($oldConfig) && !empty($oldConfig)) { + return $oldConfig + $extended; + } + return $extended; + } + /** * Validate isset required parametrs * @@ -188,15 +233,12 @@ protected function _validate() { if (is_null($this->getSection())) { $this->setSection(''); -// Mage::throwException(Mage::helper('adminhtml')->__('Invalid section value')); } if (is_null($this->getWebsite())) { $this->setWebsite(''); -// Mage::throwException(Mage::helper('adminhtml')->__('Invalid website value')); } if (is_null($this->getStore())) { $this->setStore(''); -// Mage::throwException(Mage::helper('adminhtml')->__('Invalid store value')); } } @@ -221,15 +263,28 @@ protected function _getScope() } /** - * Get config data where key = path + * Return formatted config data for current section * + * @param bool $full Simple config structure or not * @return array */ protected function _getConfig($full = true) + { + return $this->_getPathConfig($this->getSection(), $full); + } + + /** + * Return formatted config data for specified path prefix + * + * @param string $path Config path prefix + * @param bool $full Simple config structure or not + * @return array + */ + protected function _getPathConfig($path, $full = true) { $configDataCollection = Mage::getModel('core/config_data') ->getCollection() - ->addScopeFilter($this->getScope(), $this->getScopeId(), $this->getSection()); + ->addScopeFilter($this->getScope(), $this->getScopeId(), $path); $config = array(); foreach ($configDataCollection as $data) { diff --git a/app/code/core/Mage/Adminhtml/Model/Customer/Renderer/Region.php b/app/code/core/Mage/Adminhtml/Model/Customer/Renderer/Region.php index f1e8cff19e..54c10adede 100644 --- a/app/code/core/Mage/Adminhtml/Model/Customer/Renderer/Region.php +++ b/app/code/core/Mage/Adminhtml/Model/Customer/Renderer/Region.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/Email/Template.php b/app/code/core/Mage/Adminhtml/Model/Email/Template.php index c5f346bfc6..a423ed28c3 100644 --- a/app/code/core/Mage/Adminhtml/Model/Email/Template.php +++ b/app/code/core/Mage/Adminhtml/Model/Email/Template.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/Extension.php b/app/code/core/Mage/Adminhtml/Model/Extension.php index 2457479281..3be8f4943f 100644 --- a/app/code/core/Mage/Adminhtml/Model/Extension.php +++ b/app/code/core/Mage/Adminhtml/Model/Extension.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -143,7 +143,7 @@ protected function _setDependencies($pfm) case 'subpackage': if ($type==='conflicts') { - Mage::throwException(Mage::helper('adminhtml')->__("Subpackage can't be conflicting")); + Mage::throwException(Mage::helper('adminhtml')->__("Subpackage cannot be conflicting.")); } $pfm->addSubpackageDepWithChannel( $type, $name, $channel, $min, $max, $recommended, $exclude); diff --git a/app/code/core/Mage/Adminhtml/Model/Giftmessage/Save.php b/app/code/core/Mage/Adminhtml/Model/Giftmessage/Save.php index 6e630910a7..b873c05619 100644 --- a/app/code/core/Mage/Adminhtml/Model/Giftmessage/Save.php +++ b/app/code/core/Mage/Adminhtml/Model/Giftmessage/Save.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/Newsletter/Renderer/Text.php b/app/code/core/Mage/Adminhtml/Model/Newsletter/Renderer/Text.php index f34b647a2f..770f1c34cd 100644 --- a/app/code/core/Mage/Adminhtml/Model/Newsletter/Renderer/Text.php +++ b/app/code/core/Mage/Adminhtml/Model/Newsletter/Renderer/Text.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/Observer.php b/app/code/core/Mage/Adminhtml/Model/Observer.php index 89329fad42..48bdd5c0c7 100644 --- a/app/code/core/Mage/Adminhtml/Model/Observer.php +++ b/app/code/core/Mage/Adminhtml/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/Report/Item.php b/app/code/core/Mage/Adminhtml/Model/Report/Item.php index 06dc035fcc..098bac4fbc 100644 --- a/app/code/core/Mage/Adminhtml/Model/Report/Item.php +++ b/app/code/core/Mage/Adminhtml/Model/Report/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Model_Report_Item extends Varien_Object diff --git a/app/code/core/Mage/Adminhtml/Model/Sales/Order.php b/app/code/core/Mage/Adminhtml/Model/Sales/Order.php index 37f9789f92..85ded57baf 100644 --- a/app/code/core/Mage/Adminhtml/Model/Sales/Order.php +++ b/app/code/core/Mage/Adminhtml/Model/Sales/Order.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -51,7 +51,7 @@ public function checkRelation(Mage_Sales_Model_Order $order) $customer = Mage::getModel('customer/customer')->load($order->getCustomerId()); if (!$customer->getId()) { $this->_getSession()->addNotice( - Mage::helper('adminhtml')->__(' The customer doesn\'t exist in the system anymore') + Mage::helper('adminhtml')->__(' The customer does not exist in the system anymore.') ); } @@ -71,7 +71,7 @@ public function checkRelation(Mage_Sales_Model_Order $order) foreach ($order->getAllItems() as $item) { if (!$productCollection->getItemById($item->getProductId())) { $this->_getSession()->addError( - Mage::helper('adminhtml')->__('The item %s (SKU %s) doesn\'t exist in the catalog anymore', + Mage::helper('adminhtml')->__('The item %s (SKU %s) does not exist in the catalog anymore.', $item->getName(), $item->getSku() )); @@ -80,7 +80,7 @@ public function checkRelation(Mage_Sales_Model_Order $order) } if ($hasBadItems) { $this->_getSession()->addError( - Mage::helper('adminhtml')->__('Some of the ordered items don\'t exist in the catalog anymore and will be removed if you try to edit the order.') + Mage::helper('adminhtml')->__('Some of the ordered items do not exist in the catalog anymore and will be removed if you try to edit the order.') ); } return $this; diff --git a/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php b/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php index 05a8be3332..7553eab9a2 100644 --- a/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php +++ b/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -584,7 +584,7 @@ public function addProduct($product, $qty=1) ->setStoreId($this->getSession()->getStoreId()) ->load($product); if (!$product->getId()) { - Mage::throwException(Mage::helper('adminhtml')->__('Failed to add a product to cart by id "%s"', $productId)); + Mage::throwException(Mage::helper('adminhtml')->__('Failed to add a product to cart by id "%s".', $productId)); } } @@ -722,7 +722,7 @@ protected function _parseOptions(Mage_Sales_Model_Quote_Item $item, $additionalO try { list($label,$value) = explode(':', $_additionalOption, 2); } catch (Exception $e) { - Mage::throwException(Mage::helper('adminhtml')->__('One of options row has error')); + Mage::throwException(Mage::helper('adminhtml')->__('There is an error in one of the option rows.')); } $label = trim($label); $value = trim($value); @@ -1035,6 +1035,21 @@ public function importPostData($data) return $this; } + /** + * Check whether we need to create new customer (for another website) during order creation + * + * @param Mage_Core_Model_Store $store + * @return boolean + */ + protected function _customerIsInStore($store) + { + $customer = $this->getSession()->getCustomer(); + if ($customer->getWebsiteId() == $store->getWebsiteId()) { + return true; + } + return $customer->isInStore($store); + } + /** * Prepare quote customer */ @@ -1053,7 +1068,7 @@ public function _prepareCustomer() $customer->addData($this->_getData('account')); if ($customer->getId()) { - if (!$customer->isInStore($store)) { + if (!$this->_customerIsInStore($store)) { $customer->setId(null) ->setStore($store) ->setDefaultBilling(null) @@ -1204,34 +1219,34 @@ protected function _validate() { $customerId = $this->getSession()->getCustomerId(); if (is_null($customerId)) { - Mage::throwException(Mage::helper('adminhtml')->__('Please select a customer')); + Mage::throwException(Mage::helper('adminhtml')->__('Please select a customer.')); } if (!$this->getSession()->getStore()->getId()) { - Mage::throwException(Mage::helper('adminhtml')->__('Please select a store')); + Mage::throwException(Mage::helper('adminhtml')->__('Please select a store.')); } $items = $this->getQuote()->getAllItems(); $errors = array(); if (count($items) == 0) { - $errors[] = Mage::helper('adminhtml')->__('You need to specify order items'); + $errors[] = Mage::helper('adminhtml')->__('You need to specify order items.'); } if (!$this->getQuote()->isVirtual()) { if (!$this->getQuote()->getShippingAddress()->getShippingMethod()) { - $errors[] = Mage::helper('adminhtml')->__('Shipping method must be specified'); + $errors[] = Mage::helper('adminhtml')->__('Shipping method must be specified.'); } } if (!$this->getQuote()->getPayment()->getMethod()) { - $errors[] = Mage::helper('adminhtml')->__('Payment method must be specified'); + $errors[] = Mage::helper('adminhtml')->__('Payment method must be specified.'); } else { $method = $this->getQuote()->getPayment()->getMethodInstance(); if (!$method) { - $errors[] = Mage::helper('adminhtml')->__('Payment method instance is not available'); + $errors[] = Mage::helper('adminhtml')->__('Payment method instance is not available.'); } else { if (!$method->isAvailable($this->getQuote())) { - $errors[] = Mage::helper('adminhtml')->__('Payment method is not available'); + $errors[] = Mage::helper('adminhtml')->__('Payment method is not available.'); } else { try { $method->validate(); @@ -1268,14 +1283,6 @@ protected function _getNewCustomerEmail($customer) return $email; } - - - - - - - - /** * Create customer model and assign it to quote * @deprecated after 1.4.0.0. diff --git a/app/code/core/Mage/Adminhtml/Model/Sales/Order/Random.php b/app/code/core/Mage/Adminhtml/Model/Sales/Order/Random.php index a0123e2645..9af2cfa7c6 100644 --- a/app/code/core/Mage/Adminhtml/Model/Sales/Order/Random.php +++ b/app/code/core/Mage/Adminhtml/Model/Sales/Order/Random.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/Search/Catalog.php b/app/code/core/Mage/Adminhtml/Model/Search/Catalog.php index 6c56f7348f..cc71fa9fe7 100644 --- a/app/code/core/Mage/Adminhtml/Model/Search/Catalog.php +++ b/app/code/core/Mage/Adminhtml/Model/Search/Catalog.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/Search/Customer.php b/app/code/core/Mage/Adminhtml/Model/Search/Customer.php index 3b407c38c9..713ae26ba1 100644 --- a/app/code/core/Mage/Adminhtml/Model/Search/Customer.php +++ b/app/code/core/Mage/Adminhtml/Model/Search/Customer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/Search/Order.php b/app/code/core/Mage/Adminhtml/Model/Search/Order.php index efa838dd60..ae86c3f8db 100644 --- a/app/code/core/Mage/Adminhtml/Model/Search/Order.php +++ b/app/code/core/Mage/Adminhtml/Model/Search/Order.php @@ -20,12 +20,11 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Model_Search_Order extends Varien_Object { - public function load() { $arr = array(); @@ -68,12 +67,12 @@ public function load() foreach ($collection as $order) { $arr[] = array( - 'id' => 'order/1/'.$order->getId(), - 'type' => 'Order', - 'name' => Mage::helper('adminhtml')->__('Order #%s', $order->getIncrementId()), - 'description' => $order->getBillingFirstname().' '.$order->getBillingLastname(), - 'form_panel_title' => Mage::helper('adminhtml')->__('Order #%s (%s)', $order->getIncrementId(), $order->getBillingFirstname().' '.$order->getBillingLastname()), - 'url' => Mage::helper('adminhtml')->getUrl('*/sales_order/view', array('order_id'=>$order->getId())), + 'id' => 'order/1/'.$order->getId(), + 'type' => 'Order', + 'name' => Mage::helper('adminhtml')->__('Order #%s', $order->getIncrementId()), + 'description' => $order->getBillingFirstname().' '.$order->getBillingLastname(), + 'form_panel_title' => Mage::helper('adminhtml')->__('Order #%s (%s)', $order->getIncrementId(), $order->getBillingFirstname().' '.$order->getBillingLastname()), + 'url' => Mage::helper('adminhtml')->getUrl('*/sales_order/view', array('order_id'=>$order->getId())), ); } @@ -81,6 +80,4 @@ public function load() return $this; } - } - diff --git a/app/code/core/Mage/Adminhtml/Model/Session.php b/app/code/core/Mage/Adminhtml/Model/Session.php index b2c39bbf10..09129530dd 100644 --- a/app/code/core/Mage/Adminhtml/Model/Session.php +++ b/app/code/core/Mage/Adminhtml/Model/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/Session/Quote.php b/app/code/core/Mage/Adminhtml/Model/Session/Quote.php index 6d86975c96..fadedbd686 100644 --- a/app/code/core/Mage/Adminhtml/Model/Session/Quote.php +++ b/app/code/core/Mage/Adminhtml/Model/Session/Quote.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Custom.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Custom.php index 9c82ff85fb..d2bc15e9c6 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Custom.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Custom.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Usecustom.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Usecustom.php index 095d7f2722..cf278b9a77 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Usecustom.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Usecustom.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -41,7 +41,7 @@ protected function _beforeSave() if ($value == 1) { $customUrl = $this->getData('groups/url/fields/custom/value'); if (empty($customUrl)) { - Mage::throwException(Mage::helper('adminhtml')->__('Please specify admin custom URL')); + Mage::throwException(Mage::helper('adminhtml')->__('Please specify the admin custom URL.')); } } diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Usesecretkey.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Usesecretkey.php index b926c149b5..2b15711959 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Usesecretkey.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Usesecretkey.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Baseurl.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Baseurl.php index 355f9935d7..5f3bb8d1a9 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Baseurl.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Baseurl.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -52,26 +52,11 @@ protected function _beforeSave() } /** - * Clean compiled JS/CSS when updating base url configuration settings + * Clean compiled JS/CSS when updating url configuration settings */ protected function _afterSave() { - $unsecureUrl = $this->getData('groups/unsecure/fields/base_url/value'); - $secureUrl = $this->getData('groups/secure/fields/base_url/value'); - - $oldUnsecureUrl = Mage::getConfig()->getNode( - Mage_Core_Model_Url::XML_PATH_UNSECURE_URL, - $this->getScope(), - $this->getScopeId() - ); - - $oldSecureUrl = Mage::getConfig()->getNode( - Mage_Core_Model_Url::XML_PATH_SECURE_URL, - $this->getScope(), - $this->getScopeId() - ); - - if ($unsecureUrl != $oldUnsecureUrl || $secureUrl != $oldSecureUrl) { + if ($this->isValueChanged()) { Mage::getModel('core/design_package')->cleanMergedJsCss(); } } diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Cache.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Cache.php index 5ef31c65b3..ed5d6a300c 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Cache.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Cache.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Catalog/Inventory/Managestock.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Catalog/Inventory/Managestock.php index 914dc42afd..09345c2452 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Catalog/Inventory/Managestock.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Catalog/Inventory/Managestock.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Catalog/Search/Type.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Catalog/Search/Type.php index d797e58480..3e299b5a01 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Catalog/Search/Type.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Catalog/Search/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Category.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Category.php index 5baac0a1c7..457b840809 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Category.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Category.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Abstract.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Abstract.php index 62d6c1a456..9750dde041 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Allow.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Allow.php index 70418b95ac..41d0987702 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Allow.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Allow.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -47,12 +47,12 @@ protected function _afterSave() $exceptions = array(); foreach ($this->_getAllowedCurrencies() as $currencyCode) { if (!in_array($currencyCode, $this->_getInstalledCurrencies())) { - $exceptions[] = Mage::helper('adminhtml')->__('Selected allow currency "%s" is not available in installed currencies', Mage::app()->getLocale()->currency($currencyCode)->getName()); + $exceptions[] = Mage::helper('adminhtml')->__('Selected allowed currency "%s" is not available in installed currencies.', Mage::app()->getLocale()->currency($currencyCode)->getName()); } } if (!in_array($this->_getCurrencyDefault(), $this->_getAllowedCurrencies())) { - $exceptions[] = Mage::helper('adminhtml')->__('Default display currency "%s" is not available in allowed currencies', Mage::app()->getLocale()->currency($this->_getCurrencyDefault())->getName()); + $exceptions[] = Mage::helper('adminhtml')->__('Default display currency "%s" is not available in allowed currencies.', Mage::app()->getLocale()->currency($this->_getCurrencyDefault())->getName()); } if ($exceptions) { diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Base.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Base.php index bfd2aa4d10..d9111d64fe 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Base.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Base.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -44,7 +44,7 @@ class Mage_Adminhtml_Model_System_Config_Backend_Currency_Base extends Mage_Admi protected function _afterSave() { if (!in_array($this->getValue(), $this->_getInstalledCurrencies())) { - Mage::throwException(Mage::helper('adminhtml')->__('Selected base currency is not available in installed currencies')); + Mage::throwException(Mage::helper('adminhtml')->__('Selected base currency is not available in installed currencies.')); } return $this; diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Cron.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Cron.php index 372dbcbc80..4332e6c570 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Cron.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Cron.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -67,7 +67,7 @@ protected function _afterSave() ->setPath(self::CRON_STRING_PATH) ->save(); } catch (Exception $e) { - throw new Exception(Mage::helper('cron')->__('Unable to save Cron expression')); + throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.')); } } diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Default.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Default.php index c6bc405b17..b8e5864039 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Default.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -45,11 +45,11 @@ class Mage_Adminhtml_Model_System_Config_Backend_Currency_Default extends Mage_A protected function _afterSave() { if (!in_array($this->getValue(), $this->_getInstalledCurrencies())) { - Mage::throwException(Mage::helper('adminhtml')->__('Selected default display currency is not available in installed currencies')); + Mage::throwException(Mage::helper('adminhtml')->__('Selected default display currency is not available in installed currencies.')); } if (!in_array($this->getValue(), $this->_getAllowedCurrencies())) { - Mage::throwException(Mage::helper('adminhtml')->__('Selected default display currency is not available in allowed currencies')); + Mage::throwException(Mage::helper('adminhtml')->__('Selected default display currency is not available in allowed currencies.')); } return $this; diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Datashare.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Datashare.php index 0da4e28e4f..4f05df64aa 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Datashare.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Datashare.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Design/Package.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Design/Package.php index eec106c178..0bae94290a 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Design/Package.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Design/Package.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Email/Address.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Email/Address.php index 2695e1c793..2f76a4f6ba 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Email/Address.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Email/Address.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -38,7 +38,7 @@ protected function _beforeSave() { $value = $this->getValue(); if (!Zend_Validate::is($value, 'EmailAddress')) { - Mage::throwException(Mage::helper('adminhtml')->__('Invalid email address "%s"', $value)); + Mage::throwException(Mage::helper('adminhtml')->__('Invalid email address "%s".', $value)); } return $this; } diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Email/Sender.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Email/Sender.php index 1c4f1360ae..afa622fd7d 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Email/Sender.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Email/Sender.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Encrypted.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Encrypted.php index 9e9255eec9..6e9248cabb 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Encrypted.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Encrypted.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Image.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Image.php index 0a9b4ccead..8eb4c4b42f 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Image.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Image.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -53,7 +53,7 @@ protected function _beforeSave() /* @var $fieldConfig Varien_Simplexml_Element */ if (empty($fieldConfig->upload_dir)) { - Mage::throwException(Mage::helper('catalog')->__('Base directory to upload image file is not specified')); + Mage::throwException(Mage::helper('catalog')->__('The base directory to upload image file is not specified.')); } $uploadDir = (string)$fieldConfig->upload_dir; diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Image/Pdf.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Image/Pdf.php index 4e27c0b1a2..afeabdb090 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Image/Pdf.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Image/Pdf.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Layer/Children.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Layer/Children.php index 5995cd2325..1f08b163c3 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Layer/Children.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Layer/Children.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Locale.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Locale.php index 44cfd5f2ce..6bb22e5bca 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Locale.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Locale.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -76,7 +76,7 @@ protected function _afterSave() break; } - $exceptions[] = Mage::helper('adminhtml')->__('Currency "%s" is used as %s in %s', + $exceptions[] = Mage::helper('adminhtml')->__('Currency "%s" is used as %s in %s.', $currencyName, $fieldName, $scopeName diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Log/Cron.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Log/Cron.php index e82e0fc628..472b491fd4 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Log/Cron.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Log/Cron.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -82,7 +82,7 @@ protected function _afterSave() ->save(); } catch (Exception $e) { - Mage::throwException(Mage::helper('adminhtml')->__('Unable to save Cron expression')); + Mage::throwException(Mage::helper('adminhtml')->__('Unable to save the cron expression.')); } } } diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Price/Scope.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Price/Scope.php index de5087d852..1141932566 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Price/Scope.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Price/Scope.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Product/Alert/Cron.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Product/Alert/Cron.php index ffd4ff7cf3..9449b040e7 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Product/Alert/Cron.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Product/Alert/Cron.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -75,7 +75,7 @@ protected function _afterSave() ->setPath(self::CRON_MODEL_PATH) ->save(); } catch (Exception $e) { - throw new Exception(Mage::helper('cron')->__('Unable to save Cron expression')); + throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.')); } } } diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Seo/Product.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Seo/Product.php index d8641626f5..6c4efcc8f1 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Seo/Product.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Seo/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized.php index b570a4c2e7..8a015313e9 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized/Array.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized/Array.php index 7e68bbd000..2fae4abf3e 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized/Array.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized/Array.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Shipping/Tablerate.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Shipping/Tablerate.php index dc2d3cace2..a11e716e8f 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Shipping/Tablerate.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Shipping/Tablerate.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Sitemap.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Sitemap.php index e32a31d217..66c702da4e 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Sitemap.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Sitemap.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -32,9 +32,9 @@ protected function _beforeSave() { $value = $this->getValue(); if ($value < 0 || $value > 1) { - throw new Exception(Mage::helper('sitemap')->__('Priority must be between 0 and 1')); + throw new Exception(Mage::helper('sitemap')->__('The priority must be between 0 and 1.')); } elseif (($value == 0) && !($value === '0' || $value === '0.0')) { - throw new Exception(Mage::helper('sitemap')->__('Priority must be between 0 and 1')); + throw new Exception(Mage::helper('sitemap')->__('The priority must be between 0 and 1.')); } return $this; } diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Sitemap/Cron.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Sitemap/Cron.php index b114ce12ea..4386580964 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Sitemap/Cron.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Sitemap/Cron.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -73,7 +73,7 @@ protected function _afterSave() ->setPath(self::CRON_MODEL_PATH) ->save(); } catch (Exception $e) { - throw new Exception(Mage::helper('cron')->__('Unable to save Cron expression')); + throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.')); } } diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Store.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Store.php index f623fd4f9b..ab1447cb92 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Store.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Store.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Clone/Media/Image.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Clone/Media/Image.php index 122b4dfdaf..d436e22a02 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Clone/Media/Image.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Clone/Media/Image.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Admin/Page.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Admin/Page.php index 27a79196df..c5383ba06b 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Admin/Page.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Admin/Page.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -64,7 +64,10 @@ protected function _createOptions(&$optionArray, $menuNode) } else { $children = array(); - $this->_createOptions($children, $menu['children']); + + if(isset($menu['children'])) { + $this->_createOptions($optionArray, $menu['children']); + } $optionArray[] = array( 'label' => str_repeat($nonEscapableNbspChar, ($menu['level'] * 4)) . $menu['label'], diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Allregion.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Allregion.php index f6454d2977..59a39d08de 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Allregion.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Allregion.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/GridPerPage.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/GridPerPage.php index 5ca80b7c3f..4919dc6e4d 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/GridPerPage.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/GridPerPage.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/ListMode.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/ListMode.php index b59a2e9a83..a75c79f75a 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/ListMode.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/ListMode.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -31,8 +31,8 @@ public function toOptionArray() { return array( //array('value'=>'', 'label'=>''), - array('value'=>'grid', 'label'=>Mage::helper('adminhtml')->__('Grid only')), - array('value'=>'list', 'label'=>Mage::helper('adminhtml')->__('List only')), + array('value'=>'grid', 'label'=>Mage::helper('adminhtml')->__('Grid Only')), + array('value'=>'list', 'label'=>Mage::helper('adminhtml')->__('List Only')), array('value'=>'grid-list', 'label'=>Mage::helper('adminhtml')->__('Grid (default) / List')), array('value'=>'list-grid', 'label'=>Mage::helper('adminhtml')->__('List (default) / Grid')), ); diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/ListPerPage.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/ListPerPage.php index 3657eab4bb..dd8d7e92cd 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/ListPerPage.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/ListPerPage.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/ListSort.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/ListSort.php index 1ac3e16f1c..e873951350 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/ListSort.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/ListSort.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/Search/Type.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/Search/Type.php index a88190fd31..a976508342 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/Search/Type.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/Search/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/TimeFormat.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/TimeFormat.php index e8ef8beb21..a158b53ae9 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/TimeFormat.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Catalog/TimeFormat.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Category.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Category.php index 9e2f97e291..93f42d4ff5 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Category.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Category.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -47,7 +47,7 @@ public function toOptionArray($addEmpty = true) if ($addEmpty) { $options[] = array( - 'label' => Mage::helper('adminhtml')->__('-- Please select a category --'), + 'label' => Mage::helper('adminhtml')->__('-- Please Select a Category --'), 'value' => '' ); } diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Checktype.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Checktype.php index e3b27215b9..cf4a208126 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Checktype.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Checktype.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -48,7 +48,7 @@ public function toOptionArray() ), array( 'value' => Mage_Sendfriend_Helper_Data::CHECK_COOKIE, - 'label' => Mage::helper('adminhtml')->__('Cookie (Unsafe)') + 'label' => Mage::helper('adminhtml')->__('Cookie (unsafe)') ), ); } diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Cms/Page.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Cms/Page.php index ab3ed94788..12463e53ec 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Cms/Page.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Cms/Page.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Model_System_Config_Source_Cms_Page @@ -32,7 +32,7 @@ public function toOptionArray() { if (!$this->_options) { $this->_options = Mage::getResourceModel('cms/page_collection') - ->load()->toOptionArray(); + ->load()->toOptionIdArray(); } return $this->_options; } diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Cms/Wysiwyg/Enabled.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Cms/Wysiwyg/Enabled.php index 43e8463f7c..d721ec3d02 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Cms/Wysiwyg/Enabled.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Cms/Wysiwyg/Enabled.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Country.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Country.php index efab44a6cf..4bed5f5f4b 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Country.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Country.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Country/Full.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Country/Full.php index bb50873720..905d59f468 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Country/Full.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Country/Full.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Cron/Frequency.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Cron/Frequency.php index 33d617514f..bab3d48ce7 100755 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Cron/Frequency.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Cron/Frequency.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Currency.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Currency.php index e7bae47de9..aba31805ba 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Currency.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Currency.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Currency/Service.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Currency/Service.php index 36f13392e4..a55748a610 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Currency/Service.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Currency/Service.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Customer/Group.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Customer/Group.php index 07cec88d21..78e04dc559 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Customer/Group.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Customer/Group.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Date/Short.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Date/Short.php index 9d504357b8..dac27c23b0 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Date/Short.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Date/Short.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Design/Package.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Design/Package.php index afe89991bf..0ea6a8beb3 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Design/Package.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Design/Package.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Model_System_Config_Source_Package diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Design/Robots.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Design/Robots.php index e6a2c9be8e..360ce1665d 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Design/Robots.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Design/Robots.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Dev/Dbautoup.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Dev/Dbautoup.php index 4797b927e9..55054287ac 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Dev/Dbautoup.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Dev/Dbautoup.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Model_System_Config_Source_Dev_Dbautoup @@ -30,7 +30,7 @@ public function toOptionArray() $hlp = Mage::helper('adminhtml'); return array( array('value'=>Mage_Core_Model_Resource::AUTO_UPDATE_ALWAYS, 'label'=>$hlp->__('Always (during development)')), - array('value'=>Mage_Core_Model_Resource::AUTO_UPDATE_ONCE, 'label'=>$hlp->__('Only once (version upgrade)')), + array('value'=>Mage_Core_Model_Resource::AUTO_UPDATE_ONCE, 'label'=>$hlp->__('Only Once (version upgrade)')), array('value'=>Mage_Core_Model_Resource::AUTO_UPDATE_NEVER, 'label'=>$hlp->__('Never (production)')), ); } diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Email/Identity.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Email/Identity.php index 8c0d0ca563..f757dcdee4 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Email/Identity.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Email/Identity.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Email/Method.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Email/Method.php index 0f48834cbe..9654512b2d 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Email/Method.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Email/Method.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -43,7 +43,7 @@ public function toOptionArray() ), array( 'value' => 'copy', - 'label' => Mage::helper('adminhtml')->__('Separate email') + 'label' => Mage::helper('adminhtml')->__('Separate Email') ), ); return $options; diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Email/Smtpauth.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Email/Smtpauth.php index 7131870e33..21ba6d9e62 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Email/Smtpauth.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Email/Smtpauth.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Email/Template.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Email/Template.php index b896eded9d..59e4ccd5dd 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Email/Template.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Email/Template.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Enabledisable.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Enabledisable.php index 21529186e5..831ae15819 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Enabledisable.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Enabledisable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Frequency.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Frequency.php index f27abd6c86..0dac2c45aa 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Frequency.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Frequency.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Language.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Language.php index c11d7ba28d..29d9168b19 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Language.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Language.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale.php index eb52cd9006..9af0ec4230 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Country.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Country.php index a12a1d45a1..adb436285d 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Country.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Country.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Currency.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Currency.php index 2ef5fe321e..ff34ea3740 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Currency.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Currency.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Currency/All.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Currency/All.php index 1036c855bf..040cfe5d46 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Currency/All.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Currency/All.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Timezone.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Timezone.php index f8233d41ca..a57dd61956 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Timezone.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Timezone.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Weekdays.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Weekdays.php index 6aea7b139d..421d811bc4 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Weekdays.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Weekdays.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Nooptreq.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Nooptreq.php index e0c58381e1..0d57541760 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Nooptreq.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Nooptreq.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Model_System_Config_Source_Nooptreq diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Notification/Frequency.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Notification/Frequency.php index e6879bbbfc..97657b37c4 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Notification/Frequency.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Notification/Frequency.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Order/Status.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Order/Status.php index 0847986144..37303baebe 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Order/Status.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Order/Status.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Order/Status/New.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Order/Status/New.php index 61d0d5ec37..d00f01e4e5 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Order/Status/New.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Order/Status/New.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Order/Status/Newprocessing.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Order/Status/Newprocessing.php index d182cc1636..394c50fa7b 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Order/Status/Newprocessing.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Order/Status/Newprocessing.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Order/Status/Processing.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Order/Status/Processing.php index 0e0e2a3582..a3bbf5cfdb 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Order/Status/Processing.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Order/Status/Processing.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Payment/Allmethods.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Payment/Allmethods.php index a1ab5567f1..033631f636 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Payment/Allmethods.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Payment/Allmethods.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Payment/Allowedmethods.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Payment/Allowedmethods.php index 53c85b1aa0..ca7185ee92 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Payment/Allowedmethods.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Payment/Allowedmethods.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Payment/Allspecificcountries.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Payment/Allspecificcountries.php index 5da8827a9c..b749b3a672 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Payment/Allspecificcountries.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Payment/Allspecificcountries.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Payment/Cctype.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Payment/Cctype.php index d7a10e1ed0..9c295de96b 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Payment/Cctype.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Payment/Cctype.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Price/Scope.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Price/Scope.php index 51a53b24c2..5d1b16e7d5 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Price/Scope.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Price/Scope.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Product/Options/Price.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Product/Options/Price.php index 0178844202..f081327147 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Product/Options/Price.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Product/Options/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Product/Options/Type.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Product/Options/Type.php index 5f495ed188..c6f94a72bc 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Product/Options/Type.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Product/Options/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Product/Thumbnail.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Product/Thumbnail.php index 4e4eb8eef4..6459946e58 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Product/Thumbnail.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Product/Thumbnail.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Reports/Scope.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Reports/Scope.php index 94bfdd2ea0..f778f9347f 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Reports/Scope.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Reports/Scope.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Allmethods.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Allmethods.php index 4a8e03f8c5..d3eeab2599 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Allmethods.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Allmethods.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Allowedmethods.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Allowedmethods.php index 64c1941cf2..54f559912f 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Allowedmethods.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Allowedmethods.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Allspecificcountries.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Allspecificcountries.php index 9eadcff0fe..a7a2c9c155 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Allspecificcountries.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Allspecificcountries.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Flatrate.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Flatrate.php index 091c340cf0..18fbc54cdb 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Flatrate.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Flatrate.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Tablerate.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Tablerate.php index 42ee09eeb3..fa5ec62fd1 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Tablerate.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Tablerate.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Taxclass.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Taxclass.php index a6d2834732..8d10cd83f4 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Taxclass.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Shipping/Taxclass.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Model_System_Config_Source_Shipping_Taxclass diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Store.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Store.php index 723ba6588b..bd98e0b8cf 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Store.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Store.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Tax/Apply/On.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Tax/Apply/On.php index adad3f4412..28910d7527 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Tax/Apply/On.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Tax/Apply/On.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Model_System_Config_Source_Tax_Apply_On diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Tax/Basedon.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Tax/Basedon.php index dfe9fe6f4f..d4f420efdf 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Tax/Basedon.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Tax/Basedon.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Model_System_Config_Source_Tax_Basedon @@ -28,9 +28,9 @@ class Mage_Adminhtml_Model_System_Config_Source_Tax_Basedon public function toOptionArray() { return array( - array('value'=>'shipping', 'label'=>Mage::helper('adminhtml')->__('Shipping address')), - array('value'=>'billing', 'label'=>Mage::helper('adminhtml')->__('Billing address')), - array('value'=>'origin', 'label'=>Mage::helper('adminhtml')->__("Shipping origin")), + array('value'=>'shipping', 'label'=>Mage::helper('adminhtml')->__('Shipping Address')), + array('value'=>'billing', 'label'=>Mage::helper('adminhtml')->__('Billing Address')), + array('value'=>'origin', 'label'=>Mage::helper('adminhtml')->__("Shipping Origin")), ); } diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Tax/Catalog.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Tax/Catalog.php index be2971c929..83fe1f51a7 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Tax/Catalog.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Tax/Catalog.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Model_System_Config_Source_Tax_Catalog diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Watermark/Position.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Watermark/Position.php index ae283373d2..417128b2e2 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Watermark/Position.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Watermark/Position.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Web/Protocol.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Web/Protocol.php index 8acdd5fff2..92d95a08eb 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Web/Protocol.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Web/Protocol.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Model_System_Config_Source_Web_Protocol diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Website.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Website.php index f9272ceda2..9420133ebf 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Website.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Website.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Yesno.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Yesno.php index 5852ab7c26..2b9f357a97 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Yesno.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Yesno.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Yesnocustom.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Yesnocustom.php index 80fbd8e8ea..459422db2b 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Yesnocustom.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Yesnocustom.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Store.php b/app/code/core/Mage/Adminhtml/Model/System/Store.php index 5f4969efe4..c64782a842 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Store.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Store.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/Model/Url.php b/app/code/core/Mage/Adminhtml/Model/Url.php index 3943a0417e..ee821f8eba 100644 --- a/app/code/core/Mage/Adminhtml/Model/Url.php +++ b/app/code/core/Mage/Adminhtml/Model/Url.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Model_Url extends Mage_Core_Model_Url diff --git a/app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php b/app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php index ff5bbc6db5..543912982b 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -80,8 +80,8 @@ public function editRoleAction() $breadCrumbTitle = $this->__('Edit Role'); $this->_title($this->__('Edit Role')); } else { - $breadCrumb = $this->__('Add new Role'); - $breadCrumbTitle = $this->__('Add new Role'); + $breadCrumb = $this->__('Add New Role'); + $breadCrumbTitle = $this->__('Add New Role'); $this->_title($this->__('New Role')); } $this->_addBreadcrumb($breadCrumb, $breadCrumbTitle); @@ -108,9 +108,9 @@ public function deleteAction() try { Mage::getModel("api/roles")->load($rid)->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Role successfully deleted.')); + Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The role has been deleted.')); } catch (Exception $e) { - Mage::getSingleton('adminhtml/session')->addError($this->__('Error while deleting this role. Please try again later.')); + Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while deleting this role.')); } $this->_redirect("*/*/"); @@ -162,9 +162,9 @@ public function saveRoleAction() } $rid = $role->getId(); - Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Role successfully saved.')); + Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The role has been saved.')); } catch (Exception $e) { - Mage::getSingleton('adminhtml/session')->addError($this->__('Error while saving this role. Please try again later.')); + Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while saving this role.')); } //$this->getResponse()->setRedirect($this->getUrl("*/*/editrole/rid/$rid")); diff --git a/app/code/core/Mage/Adminhtml/controllers/Api/UserController.php b/app/code/core/Mage/Adminhtml/controllers/Api/UserController.php index 3ee7ad4233..fd5ad041b0 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Api/UserController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Api/UserController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Api_UserController extends Mage_Adminhtml_Controller_Action @@ -65,7 +65,7 @@ public function editAction() if ($id) { $model->load($id); if (! $model->getId()) { - Mage::getSingleton('adminhtml/session')->addError($this->__('This user no longer exists')); + Mage::getSingleton('adminhtml/session')->addError($this->__('This user no longer exists.')); $this->_redirect('*/*/'); return; } @@ -96,7 +96,7 @@ public function saveAction() $id = $this->getRequest()->getPost('user_id', false); $model = Mage::getModel('api/user')->load($id); if (!$model->getId() && $id) { - Mage::getSingleton('adminhtml/session')->addError($this->__('This User no longer exists')); + Mage::getSingleton('adminhtml/session')->addError($this->__('This user no longer exists.')); $this->_redirect('*/*/'); return; } @@ -118,7 +118,7 @@ public function saveAction() $model->setRoleIds( $rs )->setRoleUserId( $model->getUserId() )->saveRelations(); } } - Mage::getSingleton('adminhtml/session')->addSuccess($this->__('User was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The user has been saved.')); Mage::getSingleton('adminhtml/session')->setUserData(false); $this->_redirect('*/*/edit', array('user_id' => $model->getUserId())); return; @@ -139,7 +139,7 @@ public function deleteAction() try { $model = Mage::getModel('api/user')->load($id); $model->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess($this->__('User was successfully deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The user has been deleted.')); $this->_redirect('*/*/'); return; } @@ -149,7 +149,7 @@ public function deleteAction() return; } } - Mage::getSingleton('adminhtml/session')->addError($this->__('Unable to find a user to delete')); + Mage::getSingleton('adminhtml/session')->addError($this->__('Unable to find a user to delete.')); $this->_redirect('*/*/'); } diff --git a/app/code/core/Mage/Adminhtml/controllers/CacheController.php b/app/code/core/Mage/Adminhtml/controllers/CacheController.php index 764761af9a..98769b5ff6 100644 --- a/app/code/core/Mage/Adminhtml/controllers/CacheController.php +++ b/app/code/core/Mage/Adminhtml/controllers/CacheController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -54,7 +54,7 @@ public function indexAction() public function flushAllAction() { Mage::app()->getCacheInstance()->flush(); - $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("Cache storage was flushed successfully.")); + $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("The cache storage has been flushed.")); $this->_redirect('*/*'); } @@ -64,7 +64,7 @@ public function flushAllAction() public function flushSystemAction() { Mage::app()->cleanCache(); - $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("Magento cache storage was flushed successfully .")); + $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("The Magento cache storage has been flushed.")); $this->_redirect('*/*'); } @@ -141,13 +141,13 @@ public function cleanMediaAction() Mage::getModel('core/design_package')->cleanMergedJsCss(); Mage::dispatchEvent('clean_media_cache_after'); $this->_getSession()->addSuccess( - Mage::helper('adminhtml')->__('JavaScript/CSS cache was cleaned successfully.') + Mage::helper('adminhtml')->__('The JavaScript/CSS cache has been cleaned.') ); } catch (Exception $e) { $this->_getSession()->addException( $e, - Mage::helper('adminhtml')->__('Error while cleared JavaScript/CSS cache. Please try again later.') + Mage::helper('adminhtml')->__('An error occurred while clearing the JavaScript/CSS cache.') ); } catch (Mage_Core_Exception $e) { @@ -165,7 +165,7 @@ public function cleanImagesAction() Mage::getModel('catalog/product_image')->clearCache(); Mage::dispatchEvent('clean_catalog_images_cache_after'); $this->_getSession()->addSuccess( - Mage::helper('adminhtml')->__('Image cache was cleaned successfully.') + Mage::helper('adminhtml')->__('The image cache was cleaned.') ); } catch (Mage_Core_Exception $e) { @@ -174,7 +174,7 @@ public function cleanImagesAction() catch (Exception $e) { $this->_getSession()->addException( $e, - Mage::helper('adminhtml')->__('Error while cleared Image cache. Please try again later.') + Mage::helper('adminhtml')->__('An error occurred while clearing the image cache.') ); } $this->_redirect('*/*'); diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Category/WidgetController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/Category/WidgetController.php index 951a9cfe7f..05f1b2caf8 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Catalog/Category/WidgetController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/Category/WidgetController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php index 1d31886fc1..767c885268 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -177,12 +177,13 @@ public function editAction() ->setLastEditedCategory($category->getId()); // $this->_initLayoutMessages('adminhtml/session'); $this->loadLayout(); - $this->getResponse()->setBody( - $this->getLayout()->getMessagesBlock()->getGroupedHtml() - . $this->getLayout()->getBlock('category.edit')->getFormHtml() - . $this->getLayout()->getBlock('category.tree') - ->getBreadcrumbsJavascript($breadcrumbsPath, 'editingCategoryBreadcrumbs') - ); + $this->getResponse()->setBody(Zend_Json::encode(array( + 'messages' => $this->getLayout()->getMessagesBlock()->getGroupedHtml(), + 'content' => + $this->getLayout()->getBlock('category.edit')->getFormHtml() + . $this->getLayout()->getBlock('category.tree') + ->getBreadcrumbsJavascript($breadcrumbsPath, 'editingCategoryBreadcrumbs') + ))); return; } @@ -194,6 +195,12 @@ public function editAction() $this->_addBreadcrumb(Mage::helper('catalog')->__('Manage Catalog Categories'), Mage::helper('catalog')->__('Manage Categories') ); + + $block = $this->getLayout()->getBlock('catalog.wysiwyg.js'); + if ($block) { + $block->setStoreId($storeId); + } + $this->renderLayout(); } @@ -204,9 +211,15 @@ public function editAction() public function wysiwygAction() { $elementId = $this->getRequest()->getParam('element_id', md5(microtime())); + $storeId = $this->getRequest()->getParam('store_id', 0); + $storeMediaUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); + $content = $this->getLayout()->createBlock('adminhtml/catalog_helper_form_wysiwyg_content', '', array( - 'editor_element_id' => $elementId + 'editor_element_id' => $elementId, + 'store_id' => $storeId, + 'store_media_url' => $storeMediaUrl, )); + $this->getResponse()->setBody($content->toHtml()); } @@ -277,6 +290,15 @@ public function saveAction() } } + /** + * Create Permanent Redirect for old URL key + */ + if ($category->getId() && isset($data['general']['url_key_create_redirect'])) + // && $category->getOrigData('url_key') != $category->getData('url_key') + { + $category->setData('save_rewrites_history', (bool)$data['general']['url_key_create_redirect']); + } + $category->setAttributeSetId($category->getDefaultAttributeSetId()); if (isset($data['category_products']) && @@ -293,7 +315,7 @@ public function saveAction() try { $category->save(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalog')->__('Category saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalog')->__('The category has been saved.')); $refreshTree = 'true'; } catch (Exception $e){ @@ -354,7 +376,7 @@ public function deleteAction() Mage::getSingleton('admin/session')->setDeletedPath($category->getPath()); $category->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalog')->__('Category deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalog')->__('The category has been deleted.')); } catch (Mage_Core_Exception $e){ Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); @@ -362,7 +384,7 @@ public function deleteAction() return; } catch (Exception $e){ - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Category delete error')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('An error occurred while trying to delete the category.')); $this->getResponse()->setRedirect($this->getUrl('*/*/edit', array('_current'=>true))); return; } diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/Action/AttributeController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/Action/AttributeController.php index 29cfa30fea..614b3023b3 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/Action/AttributeController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/Action/AttributeController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -142,12 +142,12 @@ public function saveAction() )); $this->_getSession()->addNotice( - $this->__('Please refresh "Catalog Url Rewrites" and "Product Attributes" in System -> Index Management', $this->getUrl('adminhtml/process/list')) + $this->__('Please refresh "Catalog URL Rewrites" and "Product Attributes" in System -> Index Management', $this->getUrl('adminhtml/process/list')) ); } $this->_getSession()->addSuccess( - $this->__('Total of %d record(s) were successfully updated', + $this->__('Total of %d record(s) were updated', count($this->_getHelper()->getProductIds())) ); } @@ -155,7 +155,7 @@ public function saveAction() $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, $this->__('There was an error while updating product(s) attributes')); + $this->_getSession()->addException($e, $this->__('An error occurred while updating the product(s) attributes.')); } $this->_redirect('*/catalog_product/', array('store'=>$this->_getHelper()->getSelectedStoreId())); diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php index 1a289f350e..9ca06779f8 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -90,7 +90,7 @@ public function editAction() // entity type check if ($model->getEntityTypeId() != $this->_entityTypeId) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('You cannot edit this attribute')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('This attribute cannot be edited.')); $this->_redirect('*/*/'); return; } @@ -158,7 +158,7 @@ public function saveAction() // entity type check if ($model->getEntityTypeId() != $this->_entityTypeId) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('You cannot update this attribute')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('This attribute cannot be updated.')); Mage::getSingleton('adminhtml/session')->setAttributeData($data); $this->_redirect('*/*/'); return; @@ -216,7 +216,7 @@ public function saveAction() try { $model->save(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalog')->__('Product attribute was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalog')->__('The product attribute has been saved.')); /** * Clear translation cache because attribute labels are stored in translation @@ -253,14 +253,14 @@ public function deleteAction() // entity type check $model->load($id); if ($model->getEntityTypeId() != $this->_entityTypeId) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('You cannot delete this attribute')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('This attribute cannot be deleted.')); $this->_redirect('*/*/'); return; } try { $model->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalog')->__('Product attribute was successfully deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalog')->__('The product attribute has been deleted.')); $this->_redirect('*/*/'); return; } @@ -270,7 +270,7 @@ public function deleteAction() return; } } - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Unable to find an attribute to delete')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Unable to find an attribute to delete.')); $this->_redirect('*/*/'); } diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/DatafeedsController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/DatafeedsController.php index b06d472097..543934aacc 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/DatafeedsController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/DatafeedsController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GalleryController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GalleryController.php index 9ff7b37e1c..8f4301edd7 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GalleryController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GalleryController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GroupController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GroupController.php index bf7e4bead2..5c20c575c8 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GroupController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GroupController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -37,12 +37,12 @@ public function saveAction() ->setAttributeSetId($this->getRequest()->getParam('attribute_set_id')); if( $model->itemExists() ) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Error while saving this group. Group with the same name already exists.')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('A group with the same name already exists.')); } else { try { $model->save(); } catch (Exception $e) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Error while saving this group. Please try again later.')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('An error occurred while saving this group.')); } } } diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/ReviewController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/ReviewController.php index 8b50d32a34..f7904dc58b 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/ReviewController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/ReviewController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -124,7 +124,7 @@ public function saveAction() $review = Mage::getModel('review/review')->load($reviewId); if (! $review->getId()) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Review was removed by another user or does not exists')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('The review was removed by another user or does not exist.')); } else { try { $review->addData($data)->save(); @@ -152,7 +152,7 @@ public function saveAction() $review->aggregate(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalog')->__('Review has been successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalog')->__('The review has been saved.')); } catch (Exception $e){ Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); } @@ -172,7 +172,7 @@ public function deleteAction() ->aggregate() ->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalog')->__('Review successfully deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalog')->__('The review has been deleted')); if( $this->getRequest()->getParam('ret') == 'pending' ) { $this->getResponse()->setRedirect($this->getUrl('*/*/pending')); } else { @@ -190,7 +190,7 @@ public function massDeleteAction() { $reviewsIds = $this->getRequest()->getParam('reviews'); if(!is_array($reviewsIds)) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select review(s)')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select review(s).')); } else { try { foreach ($reviewsIds as $reviewId) { @@ -198,7 +198,7 @@ public function massDeleteAction() $model->delete(); } Mage::getSingleton('adminhtml/session')->addSuccess( - Mage::helper('adminhtml')->__('Total of %d record(s) were successfully deleted', count($reviewsIds)) + Mage::helper('adminhtml')->__('Total of %d record(s) have been deleted.', count($reviewsIds)) ); } catch (Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); @@ -212,7 +212,7 @@ public function massUpdateStatusAction() { $reviewsIds = $this->getRequest()->getParam('reviews'); if(!is_array($reviewsIds)) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select review(s)')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select review(s).')); } else { $session = Mage::getSingleton('adminhtml/session'); /* @var $session Mage_Adminhtml_Model_Session */ @@ -225,14 +225,14 @@ public function massUpdateStatusAction() ->aggregate(); } $session->addSuccess( - Mage::helper('adminhtml')->__('Total of %d record(s) were successfully updated', count($reviewsIds)) + Mage::helper('adminhtml')->__('Total of %d record(s) have been updated.', count($reviewsIds)) ); } catch (Mage_Core_Exception $e) { $session->addException($e->getMessage()); } catch (Exception $e) { - $session->addError(Mage::helper('adminhtml')->__('Error while updating selected review(s). Please try again later.')); + $session->addError(Mage::helper('adminhtml')->__('An error occurred while updating the selected review(s).')); } } @@ -243,7 +243,7 @@ public function massVisibleInAction() { $reviewsIds = $this->getRequest()->getParam('reviews'); if(!is_array($reviewsIds)) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select review(s)')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select review(s).')); } else { $session = Mage::getSingleton('adminhtml/session'); /* @var $session Mage_Adminhtml_Model_Session */ @@ -255,14 +255,14 @@ public function massVisibleInAction() $model->save(); } $session->addSuccess( - Mage::helper('adminhtml')->__('Total of %d record(s) were successfully updated', count($reviewsIds)) + Mage::helper('adminhtml')->__('Total of %d record(s) have been updated.', count($reviewsIds)) ); } catch (Mage_Core_Exception $e) { $session->addException($e->getMessage()); } catch (Exception $e) { - $session->addError(Mage::helper('adminhtml')->__('Error while updating selected review(s). Please try again later.')); + $session->addError(Mage::helper('adminhtml')->__('An error occurred while updating the selected review(s).')); } } @@ -292,7 +292,7 @@ public function jsonProductInfoAction() $response->setError(0); } else { $response->setError(1); - $response->setMessage(Mage::helper('catalog')->__('Unable to get product id.')); + $response->setMessage(Mage::helper('catalog')->__('Unable to get the product ID.')); } $this->getResponse()->setBody($response->toJSON()); } @@ -328,7 +328,7 @@ public function postAction() $review->aggregate(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalog')->__('Review was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalog')->__('The review has been saved.')); if( $this->getRequest()->getParam('ret') == 'pending' ) { $this->getResponse()->setRedirect($this->getUrl('*/*/pending')); } else { diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/SetController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/SetController.php index 909ec2171d..20726a6210 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/SetController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/SetController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -117,7 +117,7 @@ public function saveAction() $model->load($attributeSetId); } if (!$model->getId()) { - Mage::throwException(Mage::helper('catalog')->__('Attribute Set no longer exists.')); + Mage::throwException(Mage::helper('catalog')->__('This attribute set no longer exists.')); } $data = Mage::helper('core')->jsonDecode($this->getRequest()->getPost('data')); $model->organizeData($data); @@ -129,12 +129,12 @@ public function saveAction() $model->initFromSkeleton($this->getRequest()->getParam('skeleton_set')); } $model->save(); - $this->_getSession()->addSuccess(Mage::helper('catalog')->__('Attribute Set successfully saved.')); + $this->_getSession()->addSuccess(Mage::helper('catalog')->__('The attribute set has been saved.')); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); $hasError = true; } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('catalog')->__('Error while saving Attribute Set.')); + $this->_getSession()->addException($e, Mage::helper('catalog')->__('An error occurred while saving the attribute set.')); $hasError = true; } @@ -183,10 +183,10 @@ public function deleteAction() ->setId($setId) ->delete(); - $this->_getSession()->addSuccess($this->__('Attribute set was successfully removed.')); + $this->_getSession()->addSuccess($this->__('The attribute set has been removed.')); $this->getResponse()->setRedirect($this->getUrl('*/*/')); } catch (Exception $e) { - $this->_getSession()->addError($this->__('Error while deleting this set.')); + $this->_getSession()->addError($this->__('An error occurred while deleting this set.')); $this->_redirectReferer(); } } diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/WidgetController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/WidgetController.php index 629d58c0f1..468f929503 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/WidgetController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/WidgetController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php index e57c9df8fa..e89b950a1e 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -199,6 +199,12 @@ public function newAction() } $this->getLayout()->getBlock('head')->setCanLoadExtJs(true); + + $block = $this->getLayout()->getBlock('catalog.wysiwyg.js'); + if ($block) { + $block->setStoreId($product->getStoreId()); + } + $this->renderLayout(); } @@ -211,12 +217,12 @@ public function editAction() $product = $this->_initProduct(); if ($productId && !$product->getId()) { - $this->_getSession()->addError(Mage::helper('catalog')->__('This Product no longer exists')); + $this->_getSession()->addError(Mage::helper('catalog')->__('This product no longer exists.')); $this->_redirect('*/*/'); return; } - $this->_title(sprintf('#%s', $product->getName() ? $product->getName() : $product->getSku())); + $this->_title($product->getName()); Mage::dispatchEvent('catalog_product_edit_action', array('product' => $product)); @@ -243,6 +249,11 @@ public function editAction() $this->getLayout()->getBlock('head')->setCanLoadExtJs(true); + $block = $this->getLayout()->getBlock('catalog.wysiwyg.js'); + if ($block) { + $block->setStoreId($product->getStoreId()); + } + $this->renderLayout(); } @@ -253,8 +264,13 @@ public function editAction() public function wysiwygAction() { $elementId = $this->getRequest()->getParam('element_id', md5(microtime())); + $storeId = $this->getRequest()->getParam('store_id', 0); + $storeMediaUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); + $content = $this->getLayout()->createBlock('adminhtml/catalog_helper_form_wysiwyg_content', '', array( - 'editor_element_id' => $elementId + 'editor_element_id' => $elementId, + 'store_id' => $storeId, + 'store_media_url' => $storeMediaUrl, )); $this->getResponse()->setBody($content->toHtml()); } @@ -475,9 +491,21 @@ public function validateAction() if ($productId = $this->getRequest()->getParam('id')) { $product->load($productId); } - $product - ->addData($productData) - ->validate(); + $product->addData($productData); + $product->validate(); + /** + * @todo implement full validation process with errors returning which are ignoring now + */ +// if (is_array($errors = $product->validate())) { +// foreach ($errors as $code => $error) { +// if ($error === true) { +// Mage::throwException(Mage::helper('catalog')->__('Attribute "%s" is invalid.', $product->getResource()->getAttribute($code)->getFrontend()->getLabel())); +// } +// else { +// Mage::throwException($error); +// } +// } +// } } catch (Mage_Eav_Model_Entity_Attribute_Exception $e) { $response->setError(true); @@ -532,6 +560,15 @@ protected function _initProductSave() $product->setWebsiteIds(array(Mage::app()->getStore(true)->getWebsite()->getId())); } + /** + * Create Permanent Redirect for old URL key + */ + if ($product->getId() && isset($productData['url_key_create_redirect'])) + // && $product->getOrigData('url_key') != $product->getData('url_key') + { + $product->setData('save_rewrites_history', (bool)$productData['url_key_create_redirect']); + } + /** * Check "Use Default Value" checkboxes values */ @@ -638,7 +675,7 @@ public function saveAction() ->save(); } } - $this->_getSession()->addSuccess($this->__('Product was successfully saved.')); + $this->_getSession()->addSuccess($this->__('The product has been saved.')); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()) @@ -679,7 +716,7 @@ public function duplicateAction() $product = Mage::getModel('catalog/product')->load($productId); try { $newProduct = $product->duplicate(); - $this->_getSession()->addSuccess($this->__('Product duplicated')); + $this->_getSession()->addSuccess($this->__('The product has been duplicated.')); $this->_redirect('*/*/edit', array('_current'=>true, 'id'=>$newProduct->getId())); } catch (Exception $e) { @@ -712,7 +749,7 @@ public function deleteAction() $sku = $product->getSku(); try { $product->delete(); - $this->_getSession()->addSuccess($this->__('Product deleted')); + $this->_getSession()->addSuccess($this->__('The product has been deleted.')); } catch (Exception $e) { $this->_getSession()->addError($e->getMessage()); @@ -766,10 +803,10 @@ public function addCustomersToAlertQueueAction() ->setParamValues($this->getRequest()->getParams()) ->addCustomersToAlertQueue()) { - $collection->addMessage(Mage::getModel('core/message')->success($this->__('Customers for alert %s was successfuly added to queue', Mage::getSingleton('customeralert/config')->getTitleByType($key)))); + $collection->addMessage(Mage::getModel('core/message')->success($this->__('Customers for alert %s were successfuly added to queue', Mage::getSingleton('customeralert/config')->getTitleByType($key)))); } } catch (Exception $e) { - $collection->addMessage(Mage::getModel('core/message')->error($this->__('Error while adding customers for %s alert. Message: %s',Mage::getSingleton('customeralert/config')->getTitleByType($key),$e->getMessage()))); + $collection->addMessage(Mage::getModel('core/message')->error($this->__('An error occurred while adding customers for the %s alert. Message: %s',Mage::getSingleton('customeralert/config')->getTitleByType($key),$e->getMessage()))); continue; } } @@ -779,7 +816,7 @@ public function addCustomersToAlertQueueAction() public function addAttributeAction() { - $this->_getSession()->addNotice(Mage::helper('catalog')->__('Please click on Close Window button if it won\'t be closed automatically')); + $this->_getSession()->addNotice(Mage::helper('catalog')->__('Please click on the Close Window button if it is not closed automatically.')); $this->loadLayout('popup'); $this->_initProduct(); $this->_addContent( @@ -790,7 +827,7 @@ public function addAttributeAction() public function createdAction() { - $this->_getSession()->addNotice(Mage::helper('catalog')->__('Please click on Close Window button if it won\'t be closed automatically')); + $this->_getSession()->addNotice(Mage::helper('catalog')->__('Please click on the Close Window button if it is not closed automatically.')); $this->loadLayout('popup'); $this->_addContent( $this->getLayout()->createBlock('adminhtml/catalog_product_created') @@ -802,7 +839,7 @@ public function massDeleteAction() { $productIds = $this->getRequest()->getParam('product'); if (!is_array($productIds)) { - $this->_getSession()->addError($this->__('Please select product(s)')); + $this->_getSession()->addError($this->__('Please select product(s).')); } else { try { @@ -812,7 +849,7 @@ public function massDeleteAction() $product->delete(); } $this->_getSession()->addSuccess( - $this->__('Total of %d record(s) were successfully deleted', count($productIds)) + $this->__('Total of %d record(s) have been deleted.', count($productIds)) ); } catch (Exception $e) { $this->_getSession()->addError($e->getMessage()); @@ -836,14 +873,14 @@ public function massStatusAction() ->updateAttributes($productIds, array('status' => $status), $storeId); $this->_getSession()->addSuccess( - $this->__('Total of %d record(s) were successfully updated', count($productIds)) + $this->__('Total of %d record(s) have been updated.', count($productIds)) ); } catch (Mage_Core_Model_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, $this->__('There was an error while updating product(s) status')); + $this->_getSession()->addException($e, $this->__('An error occurred while updating the product(s) status.')); } $this->_redirect('*/*/', array('store'=> $storeId)); @@ -887,6 +924,7 @@ public function quickCreateAction() foreach ($product->getTypeInstance()->getEditableAttributes() as $attribute) { if ($attribute->getIsUnique() + || $attribute->getAttributeCode() == 'url_key' || $attribute->getFrontend()->getInputType() == 'gallery' || $attribute->getFrontend()->getInputType() == 'media_image' || !$attribute->getIsVisible()) { @@ -943,10 +981,22 @@ public function quickCreateAction() } try { + /** + * @todo implement full validation process with errors returning which are ignoring now + */ +// if (is_array($errors = $product->validate())) { +// $strErrors = array(); +// foreach($errors as $code=>$error) { +// $codeLabel = $product->getResource()->getAttribute($code)->getFrontend()->getLabel(); +// $strErrors[] = ($error === true)? Mage::helper('catalog')->__('Value for "%s" is invalid.', $codeLabel) : Mage::helper('catalog')->__('Value for "%s" is invalid: %s', $codeLabel, $error); +// } +// Mage::throwException('data_invalid', implode("\n", $strErrors)); +// } + $product->validate(); $product->save(); $result['product_id'] = $product->getId(); - $this->_getSession()->addSuccess(Mage::helper('catalog')->__('Product was successfully created.')); + $this->_getSession()->addSuccess(Mage::helper('catalog')->__('The product has been created.')); $this->_initLayoutMessages('adminhtml/session'); $result['messages'] = $this->getLayout()->getMessagesBlock()->getGroupedHtml(); } catch (Mage_Core_Exception $e) { @@ -960,7 +1010,7 @@ public function quickCreateAction() } catch (Exception $e) { Mage::logException($e); $result['error'] = array( - 'message' => $this->__('Product saving error. ') . $e->getMessage() + 'message' => $this->__('An error occurred while saving the product. ') . $e->getMessage() ); } diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/SearchController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/SearchController.php index af44197499..82c4bf5eba 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Catalog/SearchController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/SearchController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -61,7 +61,7 @@ public function editAction() if ($id) { $model->load($id); if (! $model->getId()) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('This search no longer exists')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('This search no longer exists.')); $this->_redirect('*/*'); return; } @@ -113,7 +113,7 @@ public function saveAction() $model->loadByQueryText($queryText); if ($model->getId() && $model->getId() != $queryId) { Mage::throwException( - Mage::helper('catalog')->__('Search Term with such search query already exist.') + Mage::helper('catalog')->__('Search Term with such search query already exists.') ); } else if (!$model->getId() && $queryId) { $model->load($queryId); @@ -130,7 +130,7 @@ public function saveAction() $hasError = true; } catch (Exception $e) { $this->_getSession()->addException($e, - Mage::helper('catalog')->__('Error while saving search query. Please try again later.') + Mage::helper('catalog')->__('An error occurred while saving the search query.') ); $hasError = true; } @@ -151,7 +151,7 @@ public function deleteAction() $model = Mage::getModel('catalogsearch/query'); $model->setId($id); $model->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalog')->__('Search was successfully deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalog')->__('The search was deleted.')); $this->_redirect('*/*/'); return; } @@ -161,7 +161,7 @@ public function deleteAction() return; } } - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Unable to find a search term to delete')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Unable to find a search term to delete.')); $this->_redirect('*/*/'); } @@ -169,7 +169,7 @@ public function massDeleteAction() { $searchIds = $this->getRequest()->getParam('search'); if(!is_array($searchIds)) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select catalog searches')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select catalog searches.')); } else { try { foreach ($searchIds as $searchId) { @@ -178,7 +178,7 @@ public function massDeleteAction() } Mage::getSingleton('adminhtml/session')->addSuccess( Mage::helper('adminhtml')->__( - 'Total of %d record(s) were successfully deleted', count($searchIds) + 'Total of %d record(s) were deleted', count($searchIds) ) ); } catch (Exception $e) { diff --git a/app/code/core/Mage/Adminhtml/controllers/CatalogController.php b/app/code/core/Mage/Adminhtml/controllers/CatalogController.php index b5a067cc5b..c4aa92df8f 100644 --- a/app/code/core/Mage/Adminhtml/controllers/CatalogController.php +++ b/app/code/core/Mage/Adminhtml/controllers/CatalogController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/Checkout/AgreementController.php b/app/code/core/Mage/Adminhtml/controllers/Checkout/AgreementController.php index 925bcb7549..3b2a442ba7 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Checkout/AgreementController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Checkout/AgreementController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -58,7 +58,7 @@ public function editAction() if ($id) { $agreementModel->load($id); if (!$agreementModel->getId()) { - Mage::getSingleton('adminhtml/session')->addError($hlp->__('This condition no longer exists')); + Mage::getSingleton('adminhtml/session')->addError($hlp->__('This condition no longer exists.')); $this->_redirect('*/*/'); return; } @@ -88,7 +88,7 @@ public function saveAction() try { $model->save(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('checkout')->__('Condition was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('checkout')->__('The condition has been saved.')); $this->_redirect('*/*/'); return; @@ -97,7 +97,7 @@ public function saveAction() Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); } catch (Exception $e) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('checkout')->__('Error while saving this condition. Please try again later.')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('checkout')->__('An error occurred while saving this condition.')); } Mage::getSingleton('adminhtml/session')->setAgreementData($postData); @@ -111,7 +111,7 @@ public function deleteAction() $model = Mage::getSingleton('checkout/agreement') ->load($id); if (!$model->getId()) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('checkout')->__('This condition no longer exists')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('checkout')->__('This condition no longer exists.')); $this->_redirect('*/*/'); return; } @@ -119,7 +119,7 @@ public function deleteAction() try { $model->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('checkout')->__('Condition was successfully deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('checkout')->__('The condition has been deleted')); $this->_redirect('*/*/'); return; @@ -128,7 +128,7 @@ public function deleteAction() Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); } catch (Exception $e) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('checkout')->__('Error while deleting this condition. Please try again later.')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('checkout')->__('An error occurred while deleting this condition.')); } $this->_redirectReferer(); diff --git a/app/code/core/Mage/Adminhtml/controllers/Cms/Block/WidgetController.php b/app/code/core/Mage/Adminhtml/controllers/Cms/Block/WidgetController.php index 067872e60b..5ffe7b350d 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Cms/Block/WidgetController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Cms/Block/WidgetController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/Cms/BlockController.php b/app/code/core/Mage/Adminhtml/controllers/Cms/BlockController.php index ccf36c596b..8dcc11a0c5 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Cms/BlockController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Cms/BlockController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -85,7 +85,7 @@ public function editAction() if ($id) { $model->load($id); if (! $model->getId()) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cms')->__('This block no longer exists')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cms')->__('This block no longer exists.')); $this->_redirect('*/*/'); return; } @@ -119,7 +119,7 @@ public function saveAction() $id = $this->getRequest()->getParam('block_id'); $model = Mage::getModel('cms/block')->load($id); if (!$model->getId() && $id) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cms')->__('This Block no longer exists')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cms')->__('This block no longer exists.')); $this->_redirect('*/*/'); return; } @@ -133,7 +133,7 @@ public function saveAction() // save the data $model->save(); // display success message - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('cms')->__('Block was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('cms')->__('The block has been saved.')); // clear previously saved data from session Mage::getSingleton('adminhtml/session')->setFormData(false); @@ -174,7 +174,7 @@ public function deleteAction() $title = $model->getTitle(); $model->delete(); // display success message - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('cms')->__('Block was successfully deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('cms')->__('The block has been deleted.')); // go to grid $this->_redirect('*/*/'); return; @@ -188,7 +188,7 @@ public function deleteAction() } } // display error message - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cms')->__('Unable to find a block to delete')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cms')->__('Unable to find a block to delete.')); // go to grid $this->_redirect('*/*/'); } diff --git a/app/code/core/Mage/Adminhtml/controllers/Cms/Page/WidgetController.php b/app/code/core/Mage/Adminhtml/controllers/Cms/Page/WidgetController.php index 8bfd315572..30c83e319b 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Cms/Page/WidgetController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Cms/Page/WidgetController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/Cms/PageController.php b/app/code/core/Mage/Adminhtml/controllers/Cms/PageController.php index 8faadfa848..54b334d0dd 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Cms/PageController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Cms/PageController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -90,7 +90,7 @@ public function editAction() if ($id) { $model->load($id); if (! $model->getId()) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cms')->__('This page no longer exists')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cms')->__('This page no longer exists.')); $this->_redirect('*/*/'); return; } @@ -127,12 +127,6 @@ public function saveAction() if ($id = $this->getRequest()->getParam('page_id')) { $model->load($id); -// if ($id != $model->getId()) { -// Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cms')->__('The page you are trying to save no longer exists')); -// Mage::getSingleton('adminhtml/session')->setFormData($data); -// $this->_redirect('*/*/edit', array('page_id' => $this->getRequest()->getParam('page_id'))); -// return; -// } } $model->setData($data); @@ -145,7 +139,7 @@ public function saveAction() $model->save(); // display success message - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('cms')->__('Page was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('cms')->__('The page has been saved.')); // clear previously saved data from session Mage::getSingleton('adminhtml/session')->setFormData(false); // check if 'Save and Continue' @@ -161,15 +155,7 @@ public function saveAction() $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('cms')->__('Error while saving Page. Please try again later.')); -// $this->_getSession()->setFormData($data); -// // display error message -// Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); -// // save data in session -// Mage::getSingleton('adminhtml/session')->setFormData($data); -// // redirect to edit form -// $this->_redirect('*/*/edit', array('page_id' => $this->getRequest()->getParam('page_id'))); -// return; + $this->_getSession()->addException($e, Mage::helper('cms')->__('An error occurred while saving the page.')); } $this->_getSession()->setFormData($data); @@ -194,7 +180,7 @@ public function deleteAction() $title = $model->getTitle(); $model->delete(); // display success message - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('cms')->__('Page was successfully deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('cms')->__('The page has been deleted.')); // go to grid Mage::dispatchEvent('adminhtml_cmspage_on_delete', array('title' => $title, 'status' => 'success')); $this->_redirect('*/*/'); @@ -210,7 +196,7 @@ public function deleteAction() } } // display error message - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cms')->__('Unable to find a page to delete')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cms')->__('Unable to find a page to delete.')); // go to grid $this->_redirect('*/*/'); } diff --git a/app/code/core/Mage/Adminhtml/controllers/Cms/Wysiwyg/ImagesController.php b/app/code/core/Mage/Adminhtml/controllers/Cms/Wysiwyg/ImagesController.php index 7e7e33cc0f..989c6b5293 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Cms/Wysiwyg/ImagesController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Cms/Wysiwyg/ImagesController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -47,14 +47,19 @@ protected function _initAction() public function indexAction() { + $storeId = (int) $this->getRequest()->getParam('store'); + try { Mage::helper('cms/wysiwyg_images')->getCurrentPath(); } catch (Exception $e) { $this->_getSession()->addError($e->getMessage()); } - $this->_initAction() - ->loadLayout('overlay_popup') - ->renderLayout(); + $this->_initAction()->loadLayout('overlay_popup'); + $block = $this->getLayout()->getBlock('wysiwyg_images.js'); + if ($block) { + $block->setStoreId($storeId); + } + $this->renderLayout(); } public function treeJsonAction() @@ -145,9 +150,15 @@ public function uploadAction() public function onInsertAction() { $helper = Mage::helper('cms/wysiwyg_images'); + $storeId = $this->getRequest()->getParam('store'); + $filename = $this->getRequest()->getParam('filename'); $filename = $helper->idDecode($filename); $asIs = $this->getRequest()->getParam('as_is'); + + Mage::helper('catalog')->setStoreId($storeId); + $helper->setStoreId($storeId); + $image = $helper->getImageHtmlDeclaration($filename, $asIs); $this->getResponse()->setBody($image); } diff --git a/app/code/core/Mage/Adminhtml/controllers/Cms/WysiwygController.php b/app/code/core/Mage/Adminhtml/controllers/Cms/WysiwygController.php index 7c108f9ab7..8a6f5c2b3d 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Cms/WysiwygController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Cms/WysiwygController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -49,6 +49,10 @@ public function directiveAction() $image->open($url); $image->display(); } catch (Exception $e) { + $image = Varien_Image_Adapter::factory('GD2'); + $image->open(Mage::getSingleton('cms/wysiwyg_config')->getSkinImagePlaceholderUrl()); + $image->display(); + /* $image = imagecreate(100, 100); $bkgrColor = imagecolorallocate($image,10,10,10); imagefill($image,0,0,$bkgrColor); @@ -57,6 +61,7 @@ public function directiveAction() header('Content-type: image/png'); imagepng($image); imagedestroy($image); + */ } } } diff --git a/app/code/core/Mage/Adminhtml/controllers/Customer/ConfigController.php b/app/code/core/Mage/Adminhtml/controllers/Customer/ConfigController.php index 5aaa846c45..81849d4cb2 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Customer/ConfigController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Customer/ConfigController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/Customer/GroupController.php b/app/code/core/Mage/Adminhtml/controllers/Customer/GroupController.php index 5779680e5d..9bfbc49b83 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Customer/GroupController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Customer/GroupController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -110,7 +110,7 @@ public function saveAction() $customerGroup->setCode($this->getRequest()->getParam('code')) ->setTaxClassId($taxClass) ->save(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('customer')->__('Customer Group was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('customer')->__('The customer group has been saved.')); $this->getResponse()->setRedirect($this->getUrl('*/customer_group')); return; } catch (Exception $e) { @@ -135,7 +135,7 @@ public function deleteAction() try { $customerGroup->load($id); $customerGroup->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('customer')->__('Customer Group was successfully deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('customer')->__('The customer group has been deleted.')); $this->getResponse()->setRedirect($this->getUrl('*/customer_group')); return; } catch (Exception $e) { diff --git a/app/code/core/Mage/Adminhtml/controllers/Customer/OnlineController.php b/app/code/core/Mage/Adminhtml/controllers/Customer/OnlineController.php index 06919f12c2..bf1a8378e9 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Customer/OnlineController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Customer/OnlineController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Customer_OnlineController extends Mage_Adminhtml_Controller_Action diff --git a/app/code/core/Mage/Adminhtml/controllers/CustomerController.php b/app/code/core/Mage/Adminhtml/controllers/CustomerController.php index ffe35e571b..1f2e04202d 100644 --- a/app/code/core/Mage/Adminhtml/controllers/CustomerController.php +++ b/app/code/core/Mage/Adminhtml/controllers/CustomerController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -142,7 +142,7 @@ public function deleteAction() try { $customer->load($customer->getId()); $customer->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Customer was deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('The customer has been deleted.')); } catch (Exception $e){ Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); @@ -244,7 +244,7 @@ public function saveAction() $customer->sendPasswordReminderEmail(); } - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Customer was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('The customer has been saved.')); Mage::dispatchEvent('adminhtml_customer_save_after', array('customer' => $customer, 'request' => $this->getRequest()) ); @@ -382,8 +382,10 @@ public function cartAction() ->setWebsite(Mage::app()->getWebsite($websiteId)) ->loadByCustomer(Mage::registry('current_customer')); $item = $quote->getItemById($deleteItemId); - $quote->removeItem($deleteItemId); - $quote->save(); + if ($item->getId()) { + $quote->removeItem($deleteItemId); + $quote->collectTotals()->save(); + } } $this->getResponse()->setBody( @@ -495,7 +497,7 @@ public function massSubscribeAction() { $customersIds = $this->getRequest()->getParam('customer'); if(!is_array($customersIds)) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select customer(s)')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select customer(s).')); } else { try { @@ -506,7 +508,7 @@ public function massSubscribeAction() } Mage::getSingleton('adminhtml/session')->addSuccess( Mage::helper('adminhtml')->__( - 'Total of %d record(s) were successfully updated', count($customersIds) + 'Total of %d record(s) were updated.', count($customersIds) ) ); } catch (Exception $e) { @@ -520,7 +522,7 @@ public function massUnsubscribeAction() { $customersIds = $this->getRequest()->getParam('customer'); if(!is_array($customersIds)) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select customer(s)')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select customer(s).')); } else { try { foreach ($customersIds as $customerId) { @@ -530,7 +532,7 @@ public function massUnsubscribeAction() } Mage::getSingleton('adminhtml/session')->addSuccess( Mage::helper('adminhtml')->__( - 'Total of %d record(s) were successfully updated', count($customersIds) + 'Total of %d record(s) were updated.', count($customersIds) ) ); } catch (Exception $e) { @@ -545,7 +547,7 @@ public function massDeleteAction() { $customersIds = $this->getRequest()->getParam('customer'); if(!is_array($customersIds)) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select customer(s)')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select customer(s).')); } else { try { $customer = Mage::getModel('customer/customer'); @@ -556,7 +558,7 @@ public function massDeleteAction() } Mage::getSingleton('adminhtml/session')->addSuccess( Mage::helper('adminhtml')->__( - 'Total of %d record(s) were successfully deleted', count($customersIds) + 'Total of %d record(s) were deleted.', count($customersIds) ) ); } catch (Exception $e) { @@ -571,7 +573,7 @@ public function massAssignGroupAction() { $customersIds = $this->getRequest()->getParam('customer'); if(!is_array($customersIds)) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select customer(s)')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select customer(s).')); } else { try { foreach ($customersIds as $customerId) { @@ -581,7 +583,7 @@ public function massAssignGroupAction() } Mage::getSingleton('adminhtml/session')->addSuccess( Mage::helper('adminhtml')->__( - 'Total of %d record(s) were successfully updated', count($customersIds) + 'Total of %d record(s) were updated.', count($customersIds) ) ); } catch (Exception $e) { diff --git a/app/code/core/Mage/Adminhtml/controllers/DashboardController.php b/app/code/core/Mage/Adminhtml/controllers/DashboardController.php index d211de0f91..722ffb03d0 100644 --- a/app/code/core/Mage/Adminhtml/controllers/DashboardController.php +++ b/app/code/core/Mage/Adminhtml/controllers/DashboardController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/IndexController.php b/app/code/core/Mage/Adminhtml/controllers/IndexController.php index 799a825f9c..0ee8cdeea3 100644 --- a/app/code/core/Mage/Adminhtml/controllers/IndexController.php +++ b/app/code/core/Mage/Adminhtml/controllers/IndexController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -73,7 +73,7 @@ public function logoutAction() { $auth = Mage::getSingleton('admin/session')->unsetAll(); Mage::getSingleton('adminhtml/session')->unsetAll(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('You successfully logged out.')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('You have logged out.')); $this->_redirect('*'); } @@ -86,13 +86,13 @@ public function globalSearchAction() $items[] = array( 'id'=>'error', 'type'=>'Error', - 'name'=>Mage::helper('adminhtml')->__('Access Deny'), - 'description'=>Mage::helper('adminhtml')->__('You have not enought permissions to use this functionality.') + 'name'=>Mage::helper('adminhtml')->__('Access Denied'), + 'description'=>Mage::helper('adminhtml')->__('You have not enough permissions to use this functionality.') ); $totalCount = 1; } else { if (empty($searchModules)) { - $items[] = array('id'=>'error', 'type'=>'Error', 'name'=>Mage::helper('adminhtml')->__('No search modules registered'), 'description'=>Mage::helper('adminhtml')->__('Please make sure that all global admin search modules are installed and activated.')); + $items[] = array('id'=>'error', 'type'=>'Error', 'name'=>Mage::helper('adminhtml')->__('No search modules were registered'), 'description'=>Mage::helper('adminhtml')->__('Please make sure that all global admin search modules are installed and activated.')); $totalCount = 1; } else { $start = $this->getRequest()->getParam('start', 1); @@ -193,10 +193,10 @@ public function forgotpasswordAction () break; } } else { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Can\'t find email address.')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Cannot find the email address.')); } } elseif (!empty($params)) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Email address is empty.')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('The email address is empty.')); } @@ -209,14 +209,6 @@ public function forgotpasswordAction () protected function _isAllowed() { - /*if ( $this->getRequest()->getActionName() == 'login' && ! Mage::getSingleton('admin/session')->isAllowed('admin') ) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('You have not enought permissions to login.')); - $request = Mage::app()->getRequest(); - - } else { - return Mage::getSingleton('admin/session')->isAllowed('admin'); - } - */ return true; } } diff --git a/app/code/core/Mage/Adminhtml/controllers/JsonController.php b/app/code/core/Mage/Adminhtml/controllers/JsonController.php index b9c363d38c..6d554ef19d 100644 --- a/app/code/core/Mage/Adminhtml/controllers/JsonController.php +++ b/app/code/core/Mage/Adminhtml/controllers/JsonController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/Media/EditorController.php b/app/code/core/Mage/Adminhtml/controllers/Media/EditorController.php index e3cd342d8d..1e3320626c 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Media/EditorController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Media/EditorController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/Media/UploaderController.php b/app/code/core/Mage/Adminhtml/controllers/Media/UploaderController.php index 88913bb48d..c0825ef8bc 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Media/UploaderController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Media/UploaderController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/Newsletter/ProblemController.php b/app/code/core/Mage/Adminhtml/controllers/Newsletter/ProblemController.php index 1041cb49e2..5ab3de07b9 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Newsletter/ProblemController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Newsletter/ProblemController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -74,7 +74,7 @@ public function gridAction() } Mage::getSingleton('adminhtml/session') - ->addSuccess(Mage::helper('newsletter')->__('Selected problem subscribers successfully unsubscribed')); + ->addSuccess(Mage::helper('newsletter')->__('Selected problem subscribers have been unsubscribed.')); } if($this->getRequest()->getParam('_delete')) { @@ -89,7 +89,7 @@ public function gridAction() } Mage::getSingleton('adminhtml/session') - ->addSuccess(Mage::helper('newsletter')->__('Selected problems successfully deleted')); + ->addSuccess(Mage::helper('newsletter')->__('Selected problems have been deleted.')); } $this->getLayout()->getMessagesBlock()->setMessages(Mage::getSingleton('adminhtml/session')->getMessages(true)); diff --git a/app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php b/app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php index 65077f9238..9943c22fa5 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/Newsletter/SubscriberController.php b/app/code/core/Mage/Adminhtml/controllers/Newsletter/SubscriberController.php index dec15cab4f..b93ffed5fd 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Newsletter/SubscriberController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Newsletter/SubscriberController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -118,7 +118,7 @@ public function massUnsubscribeAction() } Mage::getSingleton('adminhtml/session')->addSuccess( Mage::helper('adminhtml')->__( - 'Total of %d record(s) were successfully updated', count($subscribersIds) + 'Total of %d record(s) were updated', count($subscribersIds) ) ); } catch (Exception $e) { diff --git a/app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php b/app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php index 315704f007..b6f92abb05 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** @@ -160,7 +160,7 @@ public function saveAction () $this->getRequest()->getParams()); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('Error while saving this template. Please try again later.')); + $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('An error occurred while saving this template.')); $this->_getSession()->setData('newsletter_template_form_data', $this->getRequest()->getParams()); } $this->_forward('new'); @@ -182,7 +182,7 @@ public function deleteAction () $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('Error while deleting this template. Please try again later.')); + $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('An error occurred while deleting this template.')); } } $this->_redirect('*/*'); diff --git a/app/code/core/Mage/Adminhtml/controllers/NotificationController.php b/app/code/core/Mage/Adminhtml/controllers/NotificationController.php index b224d6c688..9a3fa5124b 100644 --- a/app/code/core/Mage/Adminhtml/controllers/NotificationController.php +++ b/app/code/core/Mage/Adminhtml/controllers/NotificationController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -53,7 +53,7 @@ public function markAsReadAction() ->load($id); if (!$model->getId()) { - $session->addError(Mage::helper('adminnotification')->__('Unable to proceed. Please, try again')); + $session->addError(Mage::helper('adminnotification')->__('Unable to proceed. Please, try again.')); $this->_redirect('*/*/'); return ; } @@ -61,13 +61,13 @@ public function markAsReadAction() try { $model->setIsRead(1) ->save(); - $session->addSuccess(Mage::helper('adminnotification')->__('Message was successfully marked as read')); + $session->addSuccess(Mage::helper('adminnotification')->__('The message has been marked as read.')); } catch (Mage_Core_Exception $e) { $session->addError($e->getMessage()); } catch (Exception $e) { - $session->addException($e, Mage::helper('adminnotification')->__('Error while marking as read. Please try again later.')); + $session->addException($e, Mage::helper('adminnotification')->__('An error occurred while marking notification as read.')); } $this->_redirectReferer(); @@ -81,7 +81,7 @@ public function massMarkAsReadAction() $session = Mage::getSingleton('adminhtml/session'); $ids = $this->getRequest()->getParam('notification'); if (!is_array($ids)) { - $session->addError(Mage::helper('adminnotification')->__('Please select messages')); + $session->addError(Mage::helper('adminnotification')->__('Please select messages.')); } else { try { @@ -94,13 +94,13 @@ public function massMarkAsReadAction() } } $this->_getSession()->addSuccess( - Mage::helper('adminnotification')->__('Total of %d record(s) were successfully marked as read', count($ids)) + Mage::helper('adminnotification')->__('Total of %d record(s) have been marked as read.', count($ids)) ); } catch (Mage_Core_Exception $e) { $session->addError($e->getMessage()); } catch (Exception $e) { - $session->addException($e, Mage::helper('adminnotification')->__('Error while marking as read. Please try again later.')); + $session->addException($e, Mage::helper('adminnotification')->__('An error occurred while marking the messages as read.')); } } $this->_redirect('*/*/'); @@ -114,7 +114,6 @@ public function removeAction() ->load($id); if (!$model->getId()) { - $session->addError(Mage::helper('adminnotification')->__('Unable to proceed. Please, try again')); $this->_redirect('*/*/'); return ; } @@ -122,13 +121,13 @@ public function removeAction() try { $model->setIsRemove(1) ->save(); - $session->addSuccess(Mage::helper('adminnotification')->__('Message was successfully removed')); + $session->addSuccess(Mage::helper('adminnotification')->__('The message has been removed.')); } catch (Mage_Core_Exception $e) { $session->addError($e->getMessage()); } catch (Exception $e) { - $session->addException($e, Mage::helper('adminnotification')->__('Error while removing. Please try again later.')); + $session->addException($e, Mage::helper('adminnotification')->__('An error occurred while removing the message.')); } $this->_redirectReferer(); @@ -142,7 +141,7 @@ public function massRemoveAction() $session = Mage::getSingleton('adminhtml/session'); $ids = $this->getRequest()->getParam('notification'); if (!is_array($ids)) { - $session->addError(Mage::helper('adminnotification')->__('Please select messages')); + $session->addError(Mage::helper('adminnotification')->__('Please select messages.')); } else { try { @@ -155,13 +154,13 @@ public function massRemoveAction() } } $this->_getSession()->addSuccess( - Mage::helper('adminnotification')->__('Total of %d record(s) were successfully removed', count($ids)) + Mage::helper('adminnotification')->__('Total of %d record(s) have been removed.', count($ids)) ); } catch (Mage_Core_Exception $e) { $session->addError($e->getMessage()); } catch (Exception $e) { - $session->addException($e, Mage::helper('adminnotification')->__('Error while marking. Please try again later.')); + $session->addException($e, Mage::helper('adminnotification')->__('An error occurred while removing messages.')); } } $this->_redirectReferer(); diff --git a/app/code/core/Mage/Adminhtml/controllers/Permissions/RoleController.php b/app/code/core/Mage/Adminhtml/controllers/Permissions/RoleController.php index a928e20c07..6854b00ad5 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Permissions/RoleController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Permissions/RoleController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -108,8 +108,8 @@ public function editRoleAction() $breadCrumb = $this->__('Edit Role'); $breadCrumbTitle = $this->__('Edit Role'); } else { - $breadCrumb = $this->__('Add new Role'); - $breadCrumbTitle = $this->__('Add new Role'); + $breadCrumb = $this->__('Add New Role'); + $breadCrumbTitle = $this->__('Add New Role'); } $this->_title($role->getId() ? $role->getRoleName() : $this->__('New Role')); @@ -139,7 +139,7 @@ public function deleteAction() $currentUser = Mage::getModel('admin/user')->setId(Mage::getSingleton('admin/session')->getUser()->getId()); if (in_array($rid, $currentUser->getRoles()) ) { - Mage::getSingleton('adminhtml/session')->addError($this->__('You can not delete self assigned roles.')); + Mage::getSingleton('adminhtml/session')->addError($this->__('Self-assigned roles cannot be deleted.')); $this->_redirect('*/*/editrole', array('rid' => $rid)); return; } @@ -147,9 +147,9 @@ public function deleteAction() try { $role = $this->_initRole()->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Role successfully deleted.')); + Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The role has been deleted.')); } catch (Exception $e) { - Mage::getSingleton('adminhtml/session')->addError($this->__('Error while deleting this role. Please try again later.')); + Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while deleting this role.')); } $this->_redirect("*/*/"); @@ -177,7 +177,7 @@ public function saveRoleAction() $role = $this->_initRole('role_id'); if (!$role->getId() && $rid) { - Mage::getSingleton('adminhtml/session')->addError($this->__('This Role no longer exists')); + Mage::getSingleton('adminhtml/session')->addError($this->__('This Role no longer exists.')); $this->_redirect('*/*/'); return; } @@ -203,11 +203,11 @@ public function saveRoleAction() } $rid = $role->getId(); - Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Role successfully saved.')); + Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The role has beensuccessfully saved.')); } catch (Mage_Core_Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); } catch (Exception $e) { - Mage::getSingleton('adminhtml/session')->addError($this->__('Error while saving this role. Please try again later.')); + Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while saving this role.')); } //$this->getResponse()->setRedirect($this->getUrl("*/*/editrole/rid/$rid")); diff --git a/app/code/core/Mage/Adminhtml/controllers/Permissions/UserController.php b/app/code/core/Mage/Adminhtml/controllers/Permissions/UserController.php index aa3561163d..e7fb105254 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Permissions/UserController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Permissions/UserController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Adminhtml_Permissions_UserController extends Mage_Adminhtml_Controller_Action @@ -65,7 +65,7 @@ public function editAction() if ($id) { $model->load($id); if (! $model->getId()) { - Mage::getSingleton('adminhtml/session')->addError($this->__('This user no longer exists')); + Mage::getSingleton('adminhtml/session')->addError($this->__('This user no longer exists.')); $this->_redirect('*/*/'); return; } @@ -97,7 +97,7 @@ public function saveAction() $id = $this->getRequest()->getParam('user_id'); $model = Mage::getModel('admin/user')->load($id); if (!$model->getId() && $id) { - Mage::getSingleton('adminhtml/session')->addError($this->__('This User no longer exists')); + Mage::getSingleton('adminhtml/session')->addError($this->__('This user no longer exists.')); $this->_redirect('*/*/'); return; } @@ -140,7 +140,7 @@ public function saveAction() $model->setRoleIds( $rs )->setRoleUserId( $model->getUserId() )->saveRelations(); } } - Mage::getSingleton('adminhtml/session')->addSuccess($this->__('User was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The user has been saved.')); Mage::getSingleton('adminhtml/session')->setUserData(false); $this->_redirect('*/*/edit', array('user_id' => $model->getUserId())); return; @@ -160,7 +160,7 @@ public function deleteAction() if ($id = $this->getRequest()->getParam('user_id')) { if ( $currentUser->getId() == $id ) { - Mage::getSingleton('adminhtml/session')->addError($this->__('You cannot delete account of yourself')); + Mage::getSingleton('adminhtml/session')->addError($this->__('You cannot delete your own account.')); $this->_redirect('*/*/edit', array('user_id' => $id)); return; } @@ -168,7 +168,7 @@ public function deleteAction() $model = Mage::getModel('admin/user'); $model->setId($id); $model->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess($this->__('User was successfully deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The user has been deleted.')); $this->_redirect('*/*/'); return; } @@ -178,7 +178,7 @@ public function deleteAction() return; } } - Mage::getSingleton('adminhtml/session')->addError($this->__('Unable to find a user to delete')); + Mage::getSingleton('adminhtml/session')->addError($this->__('Unable to find a user to delete.')); $this->_redirect('*/*/'); } diff --git a/app/code/core/Mage/Adminhtml/controllers/Poll/AnswerController.php b/app/code/core/Mage/Adminhtml/controllers/Poll/AnswerController.php index e85a444efa..e6e5e14c12 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Poll/AnswerController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Poll/AnswerController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -57,7 +57,7 @@ public function saveAction() ->setId($this->getRequest()->getParam('id')) ->save(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('poll')->__('Answer was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('poll')->__('The answer has been saved.')); $this->_redirect('*/poll/edit', array('id' => $this->getRequest()->getParam('poll_id'), 'tab' => 'answers_section')); return; } catch (Exception $e) { @@ -83,7 +83,7 @@ public function jsonSaveAction() $data = Zend_Json_Decoder::decode($post['data']); try { if( trim($data['answer_title']) == '' ) { - throw new Exception(Mage::helper('poll')->__('Invalid Answer')); + throw new Exception(Mage::helper('poll')->__('Invalid Answer.')); } $model = Mage::getModel('poll/poll_answer'); $model->setData($data) @@ -112,7 +112,7 @@ public function jsonDeleteAction() } } else { $response->setError(1); - $response->setMessage(Mage::helper('poll')->__('Unable to find answer to delete.')); + $response->setMessage(Mage::helper('poll')->__('Unable to find an answer to delete.')); } $this->getResponse()->setBody( $response->toJson() ); } diff --git a/app/code/core/Mage/Adminhtml/controllers/PollController.php b/app/code/core/Mage/Adminhtml/controllers/PollController.php index d163ae4aa5..d327b18e79 100644 --- a/app/code/core/Mage/Adminhtml/controllers/PollController.php +++ b/app/code/core/Mage/Adminhtml/controllers/PollController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -69,7 +69,7 @@ public function editAction() $this->renderLayout(); } else { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('poll')->__('Poll not exists')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('poll')->__('The poll does not exist.')); $this->_redirect('*/*/'); } } @@ -81,7 +81,7 @@ public function deleteAction() $model = Mage::getModel('poll/poll'); $model->setId($id); $model->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Poll was successfully deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('The poll has been deleted.')); $this->_redirect('*/*/'); return; } @@ -91,13 +91,13 @@ public function deleteAction() return; } } - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Unable to find a poll to delete')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Unable to find a poll to delete.')); $this->_redirect('*/*/'); } public function saveAction() { - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Poll was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('The poll has been saved.')); Mage::getSingleton('adminhtml/session')->setPollData(false); $this->_redirect('*/*/'); } @@ -138,7 +138,7 @@ public function validateAction() $stores = $this->getRequest()->getParam('store_ids'); if (!is_array($stores) || count($stores) == 0) { - Mage::throwException(Mage::helper('adminhtml')->__('Please, select visible in stores to this poll first')); + Mage::throwException(Mage::helper('adminhtml')->__('Please, select "Visible in Stores" for this poll first.')); } if (is_array($stores)) { @@ -152,7 +152,7 @@ public function validateAction() $answers = $this->getRequest()->getParam('answer'); if( !is_array($answers) || sizeof($answers) == 0 ) { - Mage::throwException(Mage::helper('adminhtml')->__('Please, add a few answers to this poll first')); + Mage::throwException(Mage::helper('adminhtml')->__('Please, add some answers to this poll first.')); } if( is_array($answers) ) { diff --git a/app/code/core/Mage/Adminhtml/controllers/Promo/CatalogController.php b/app/code/core/Mage/Adminhtml/controllers/Promo/CatalogController.php index 66bde880f5..15b90708b3 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Promo/CatalogController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Promo/CatalogController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -40,7 +40,7 @@ public function indexAction() $this->_title($this->__('Promotions'))->_title($this->__('Catalog Price Rules')); if (Mage::app()->loadCache('catalog_rules_dirty')) { - Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('catalogrule')->__('There are rules that have been changed but not applied. Please, click Apply Rules in order to see immediate effect in catalog.')); + Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('catalogrule')->__('There are rules that have been changed but were not applied. Please, click Apply Rules in order to see immediate effect in the catalog.')); } $this->_initAction() @@ -63,7 +63,7 @@ public function editAction() if ($id) { $model->load($id); if (! $model->getRuleId()) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalogrule')->__('This rule no longer exists')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalogrule')->__('This rule no longer exists.')); $this->_redirect('*/*'); return; } @@ -103,7 +103,7 @@ public function saveAction() Mage::throwException(Mage::helper('catalogrule')->__('Wrong rule specified.')); } } - + $validateResult = $model->validateData(new Varien_Object($data)); if ($validateResult !== true) { foreach($validateResult as $errorMessage) { @@ -123,14 +123,14 @@ public function saveAction() } else { $autoApply = false; } - + $model->loadPost($data); Mage::getSingleton('adminhtml/session')->setPageData($model->getData()); $model->save(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalogrule')->__('Rule was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalogrule')->__('The rule has been saved.')); Mage::getSingleton('adminhtml/session')->setPageData(false); if ($autoApply) { $this->_forward('applyRules'); @@ -146,7 +146,7 @@ public function saveAction() } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addError(Mage::helper('catalogrule')->__('Error while saving rule data. Please review log and try again.')); + $this->_getSession()->addError(Mage::helper('catalogrule')->__('An error occurred while saving the rule data. Please review the log and try again.')); Mage::logException($e); Mage::getSingleton('adminhtml/session')->setPageData($data); $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('rule_id'))); @@ -164,19 +164,19 @@ public function deleteAction() $model->load($id); $model->delete(); Mage::app()->saveCache(1, 'catalog_rules_dirty'); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalogrule')->__('Rule was successfully deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('catalogrule')->__('The rule has been deleted.')); $this->_redirect('*/*/'); return; } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addError(Mage::helper('catalogrule')->__('Error while deleting rule. Please review log and try again.')); + $this->_getSession()->addError(Mage::helper('catalogrule')->__('An error occurred while deleting the rule. Please review the log and try again.')); Mage::logException($e); $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id'))); return; } } - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalogrule')->__('Unable to find a page to delete')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalogrule')->__('Unable to find a rule to delete.')); $this->_redirect('*/*/'); } @@ -256,11 +256,11 @@ public function applyRulesAction() Mage::getModel('catalogrule/rule')->applyAll(); Mage::app()->removeCache('catalog_rules_dirty'); Mage::getSingleton('adminhtml/session')->addSuccess( - Mage::helper('catalogrule')->__('Rules were successfully applied') + Mage::helper('catalogrule')->__('The rules have been applied.') ); } catch (Exception $e) { Mage::getSingleton('adminhtml/session')->addError( - Mage::helper('catalogrule')->__('Unable to apply rules') + Mage::helper('catalogrule')->__('Unable to apply rules.') ); throw $e; } diff --git a/app/code/core/Mage/Adminhtml/controllers/Promo/QuoteController.php b/app/code/core/Mage/Adminhtml/controllers/Promo/QuoteController.php index 95a53be802..eb503b2166 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Promo/QuoteController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Promo/QuoteController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -69,7 +69,7 @@ public function editAction() if ($id) { $model->load($id); if (! $model->getRuleId()) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('salesrule')->__('This rule no longer exists')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('salesrule')->__('This rule no longer exists.')); $this->_redirect('*/*'); return; } @@ -99,7 +99,7 @@ public function editAction() /** * Promo quote save action - * + * */ public function saveAction() { @@ -108,7 +108,7 @@ public function saveAction() $model = Mage::getModel('salesrule/rule'); Mage::dispatchEvent('adminhtml_controller_salesrule_prepare_save', array('request' => $this->getRequest())); $data = $this->getRequest()->getPost(); - + $data = $this->_filterDates($data, array('from_date', 'to_date')); $id = $this->getRequest()->getParam('rule_id'); if ($id) { @@ -117,9 +117,9 @@ public function saveAction() Mage::throwException(Mage::helper('salesrule')->__('Wrong rule specified.')); } } - + $session = Mage::getSingleton('adminhtml/session'); - + $validateResult = $model->validateData(new Varien_Object($data)); if ($validateResult !== true) { foreach($validateResult as $errorMessage) { @@ -129,7 +129,7 @@ public function saveAction() $this->_redirect('*/*/edit', array('id'=>$model->getId())); return; } - + if (isset($data['simple_action']) && $data['simple_action'] == 'by_percent' && isset($data['discount_amount'])) { $data['discount_amount'] = min(100,$data['discount_amount']); } @@ -145,7 +145,7 @@ public function saveAction() $session->setPageData($model->getData()); $model->save(); - $session->addSuccess(Mage::helper('salesrule')->__('Rule was successfully saved')); + $session->addSuccess(Mage::helper('salesrule')->__('The rule has been saved.')); $session->setPageData(false); if ($this->getRequest()->getParam('back')) { $this->_redirect('*/*/edit', array('id' => $model->getId())); @@ -156,7 +156,7 @@ public function saveAction() } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addError(Mage::helper('catalogrule')->__('Error while saving rule data. Please review log and try again.')); + $this->_getSession()->addError(Mage::helper('catalogrule')->__('An error occurred while saving the rule data. Please review the log and try again.')); Mage::logException($e); Mage::getSingleton('adminhtml/session')->setPageData($data); $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('rule_id'))); @@ -173,19 +173,19 @@ public function deleteAction() $model = Mage::getModel('salesrule/rule'); $model->load($id); $model->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('salesrule')->__('Rule was successfully deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('salesrule')->__('The rule has been deleted.')); $this->_redirect('*/*/'); return; } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addError(Mage::helper('catalogrule')->__('Error while deleting rule. Please review log and try again.')); + $this->_getSession()->addError(Mage::helper('catalogrule')->__('An error occurred while deleting the rule. Please review the log and try again.')); Mage::logException($e); $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id'))); return; } } - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('salesrule')->__('Unable to find a page to delete')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('salesrule')->__('Unable to find a rule to delete.')); $this->_redirect('*/*/'); } @@ -246,7 +246,18 @@ public function applyRulesAction() public function gridAction() { $this->_initRule()->loadLayout()->renderLayout(); + } + /** + * Chooser source action + */ + public function chooserAction() + { + $uniqId = $this->getRequest()->getParam('uniq_id'); + $chooserBlock = $this->getLayout()->createBlock('adminhtml/promo_widget_chooser', '', array( + 'id' => $uniqId + )); + $this->getResponse()->setBody($chooserBlock->toHtml()); } protected function _isAllowed() diff --git a/app/code/core/Mage/Adminhtml/controllers/Promo/WidgetController.php b/app/code/core/Mage/Adminhtml/controllers/Promo/WidgetController.php index 5f176c681e..2e32d96c57 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Promo/WidgetController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Promo/WidgetController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/PromoController.php b/app/code/core/Mage/Adminhtml/controllers/PromoController.php index 83de3cef08..79a8759bbf 100644 --- a/app/code/core/Mage/Adminhtml/controllers/PromoController.php +++ b/app/code/core/Mage/Adminhtml/controllers/PromoController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/RatingController.php b/app/code/core/Mage/Adminhtml/controllers/RatingController.php index 10accf8515..80db85766d 100644 --- a/app/code/core/Mage/Adminhtml/controllers/RatingController.php +++ b/app/code/core/Mage/Adminhtml/controllers/RatingController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -107,7 +107,7 @@ public function saveAction() } } - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Rating was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('The rating has been saved.')); Mage::getSingleton('adminhtml/session')->setRatingData(false); $this->_redirect('*/*/'); @@ -130,7 +130,7 @@ public function deleteAction() /* @var $model Mage_Rating_Model_Rating */ $model->setId($this->getRequest()->getParam('id')) ->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Rating was successfully deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('The rating has been deleted.')); $this->_redirect('*/*/'); } catch (Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); diff --git a/app/code/core/Mage/Adminhtml/controllers/Report/CustomerController.php b/app/code/core/Mage/Adminhtml/controllers/Report/CustomerController.php index bb8dd543c9..7ecf82f855 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Report/CustomerController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Report/CustomerController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -91,8 +91,8 @@ public function ordersAction() $this->_initAction() ->_setActiveMenu('report/customer/orders') - ->_addBreadcrumb(Mage::helper('reports')->__('Customers by number of orders'), - Mage::helper('reports')->__('Customers by number of orders')) + ->_addBreadcrumb(Mage::helper('reports')->__('Customers by Number of Orders'), + Mage::helper('reports')->__('Customers by Number of Orders')) ->_addContent($this->getLayout()->createBlock('adminhtml/report_customer_orders')) ->renderLayout(); } @@ -125,12 +125,12 @@ public function totalsAction() { $this->_title($this->__('Reports')) ->_title($this->__('Customers')) - ->_title($this->__('Customers By Orders Total')); + ->_title($this->__('Customers by Orders Total')); $this->_initAction() ->_setActiveMenu('report/customer/totals') - ->_addBreadcrumb(Mage::helper('reports')->__('Customers by orders total'), - Mage::helper('reports')->__('Customers by orders total')) + ->_addBreadcrumb(Mage::helper('reports')->__('Customers by Orders Total'), + Mage::helper('reports')->__('Customers by Orders Total')) ->_addContent($this->getLayout()->createBlock('adminhtml/report_customer_totals')) ->renderLayout(); } diff --git a/app/code/core/Mage/Adminhtml/controllers/Report/ProductController.php b/app/code/core/Mage/Adminhtml/controllers/Report/ProductController.php index 5000a162a9..ab7d970880 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Report/ProductController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Report/ProductController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -53,44 +53,31 @@ public function _initAction() /** * Bestsellers * + * @deprecated after 1.4.0.1 */ public function orderedAction() { - $this->_title($this->__('Reports')) - ->_title($this->__('Products')) - ->_title($this->__('Bestsellers')); - - $this->_initAction() - ->_setActiveMenu('report/product/ordered') - ->_addBreadcrumb(Mage::helper('reports')->__('Bestsellers'), Mage::helper('reports')->__('Bestsellers')) - ->_addContent($this->getLayout()->createBlock('adminhtml/report_product_ordered')) - ->renderLayout(); + return $this->_forward('bestsellers', 'report_sales'); } /** * Export products bestsellers report to CSV format * + * @deprecated after 1.4.0.1 */ public function exportOrderedCsvAction() { - $fileName = 'products_bestsellers.csv'; - $content = $this->getLayout()->createBlock('adminhtml/report_product_ordered_grid') - ->getCsv(); - - $this->_prepareDownloadResponse($fileName, $content); + return $this->_forward('exportBestsellersCsv', 'report_sales'); } /** * Export products bestsellers report to XML format * + * @deprecated after 1.4.0.1 */ public function exportOrderedExcelAction() { - $fileName = 'products_bestsellers.xml'; - $content = $this->getLayout()->createBlock('adminhtml/report_product_ordered_grid') - ->getExcel($fileName); - - $this->_prepareDownloadResponse($fileName, $content); + return $this->_forward('exportBestsellersExcel', 'report_sales'); } /** @@ -150,7 +137,7 @@ public function viewedAction() $this->_initAction() ->_setActiveMenu('report/product/viewed') - ->_addBreadcrumb(Mage::helper('reports')->__('Most viewed'), Mage::helper('reports')->__('Most viewed')) + ->_addBreadcrumb(Mage::helper('reports')->__('Most Viewed'), Mage::helper('reports')->__('Most Viewed')) ->_addContent($this->getLayout()->createBlock('adminhtml/report_product_viewed')) ->renderLayout(); } @@ -193,7 +180,7 @@ public function lowstockAction() $this->_initAction() ->_setActiveMenu('report/product/lowstock') - ->_addBreadcrumb(Mage::helper('reports')->__('Low stock'), Mage::helper('reports')->__('Low stock')) + ->_addBreadcrumb(Mage::helper('reports')->__('Low Stock'), Mage::helper('reports')->__('Low Stock')) ->_addContent($this->getLayout()->createBlock('adminhtml/report_product_lowstock')) ->renderLayout(); } @@ -279,9 +266,6 @@ public function exportDownloadsExcelAction() protected function _isAllowed() { switch ($this->getRequest()->getActionName()) { - case 'ordered': - return Mage::getSingleton('admin/session')->isAllowed('report/products/ordered'); - break; case 'viewed': return Mage::getSingleton('admin/session')->isAllowed('report/products/viewed'); break; diff --git a/app/code/core/Mage/Adminhtml/controllers/Report/ReviewController.php b/app/code/core/Mage/Adminhtml/controllers/Report/ReviewController.php index 1d16a3097b..bbd312a91e 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Report/ReviewController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Report/ReviewController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/Report/SalesController.php b/app/code/core/Mage/Adminhtml/controllers/Report/SalesController.php index a99a0846dc..2a0e432f86 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Report/SalesController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Report/SalesController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -33,11 +33,20 @@ */ class Mage_Adminhtml_Report_SalesController extends Mage_Adminhtml_Controller_Action { + /** + * Admin session model + * + * @var null|Mage_Admin_Model_Session + */ + protected $_adminSession = null; + public function _initAction() { $act = $this->getRequest()->getActionName(); - if(!$act) + if(!$act) { $act = 'default'; + } + $this->loadLayout() ->_addBreadcrumb(Mage::helper('reports')->__('Reports'), Mage::helper('reports')->__('Reports')) ->_addBreadcrumb(Mage::helper('reports')->__('Sales'), Mage::helper('reports')->__('Sales')); @@ -92,33 +101,58 @@ public function salesAction() $this->renderLayout(); } + public function bestsellersAction() + { + $this->_title($this->__('Reports'))->_title($this->__('Products'))->_title($this->__('Bestsellers')); + + $this->_showLastExecutionTime(Mage_Reports_Model_Flag::REPORT_BESTSELLERS_FLAG_CODE, 'bestsellers'); + + $this->_initAction() + ->_setActiveMenu('report/sales/bestsellers') + ->_addBreadcrumb(Mage::helper('adminhtml')->__('Products Bestsellers Report'), Mage::helper('adminhtml')->__('Products Bestsellers Report')); + + $gridBlock = $this->getLayout()->getBlock('report_sales_bestsellers.grid'); + $filterFormBlock = $this->getLayout()->getBlock('grid.filter.form'); + + $this->_initReportAction(array( + $gridBlock, + $filterFormBlock + )); + + $this->renderLayout(); + } + + /** + * Export bestsellers report grid to CSV format + */ + public function exportBestsellersCsvAction() + { + $fileName = 'bestsellers.csv'; + $grid = $this->getLayout()->createBlock('adminhtml/report_sales_bestsellers_grid'); + $this->_initReportAction($grid); + $this->_prepareDownloadResponse($fileName, $grid->getCsvFile()); + } + + /** + * Export bestsellers report grid to Excel XML format + */ + public function exportBestsellersExcelAction() + { + $fileName = 'bestsellers.xml'; + $grid = $this->getLayout()->createBlock('adminhtml/report_sales_bestsellers_grid'); + $this->_initReportAction($grid); + $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName)); + } + /** * Retrieve array of collection names by code specified in request * + * @deprecated after 1.4.0.1 * @return array */ protected function _getCollectionNames() { - $codes = $this->getRequest()->getParam('code'); - if (!$codes) { - throw new Exception(Mage::helper('adminhtml')->__('No report code specified')); - } - if(!is_array($codes)) { - $codes = array($codes); - } - $aliases = array( - 'sales' => 'sales/order', - 'tax' => 'tax/tax', - 'shipping' => 'sales/report_shipping', - 'invoiced' => 'sales/report_invoiced', - 'refunded' => 'sales/report_refunded', - 'coupons' => 'salesrule/rule' - ); - $out = array(); - foreach ($codes as $code) { - $out[] = $aliases[$code]; - } - return $out; + return array(); } protected function _showLastExecutionTime($flagCode, $refreshCode) @@ -133,47 +167,30 @@ protected function _showLastExecutionTime($flagCode, $refreshCode) $refreshStatsLink = $this->getUrl('*/*/refreshstatistics'); $directRefreshLink = $this->getUrl('*/*/refreshRecent', array('code' => $refreshCode)); - Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('adminhtml')->__('Last updated: %s. To refresh last day\'s statistics, click here', $updatedAt, $refreshStatsLink, $directRefreshLink)); + Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('adminhtml')->__('Last updated: %s. To refresh last day\'s statistics, click here.', $updatedAt, $refreshStatsLink, $directRefreshLink)); return $this; } + /** + * Refresh statistics for last 25 hours + * + * @deprecated after 1.4.0.1 + * @return Mage_Adminhtml_Report_SalesController + */ public function refreshRecentAction() { - try { - $collectionsNames = $this->_getCollectionNames(); - $currentDate = Mage::app()->getLocale()->date(); - $date = $currentDate->subHour(25); - foreach ($collectionsNames as $collectionName) { - Mage::getResourceModel($collectionName)->aggregate($date); - } - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Recent statistics was successfully updated')); - } catch (Mage_Core_Exception $e) { - Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); - } catch (Exception $e) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Unable to refresh recent statistics')); - Mage::logException($e); - } - - $this->_redirectReferer('*/*/sales'); - return $this; + return $this->_forward('refreshRecent', 'report_statistics'); } + /** + * Refresh statistics for all period + * + * @deprecated after 1.4.0.1 + * @return Mage_Adminhtml_Report_SalesController + */ public function refreshLifetimeAction() { - try { - $collectionsNames = $this->_getCollectionNames(); - foreach ($collectionsNames as $collectionName) { - Mage::getResourceModel($collectionName)->aggregate(); - } - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Lifetime statistics was successfully updated')); - } catch (Mage_Core_Exception $e) { - Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); - } catch (Exception $e) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Unable to refresh lifetime statistics')); - Mage::logException($e); - } - $this->_redirectReferer('*/*/sales'); - return $this; + return $this->_forward('refreshLifetime', 'report_statistics'); } /** @@ -374,7 +391,7 @@ public function couponsAction() { $this->_title($this->__('Reports'))->_title($this->__('Sales'))->_title($this->__('Coupons')); - $this->_showLastExecutionTime(Mage_Reports_Model_Flag::REPORT_COUPNS_FLAG_CODE, 'coupons'); + $this->_showLastExecutionTime(Mage_Reports_Model_Flag::REPORT_COUPONS_FLAG_CODE, 'coupons'); $this->_initAction() ->_setActiveMenu('report/sales/coupons') @@ -413,43 +430,57 @@ public function exportCouponsExcelAction() $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName)); } + /** + * @deprecated after 1.4.0.1 + */ public function refreshStatisticsAction() { - $this->_title($this->__('Reports'))->_title($this->__('Sales'))->_title($this->__('Refresh Statistics')); - - $this->_initAction() - ->_setActiveMenu('report/sales/refreshstatistics') - ->_addBreadcrumb(Mage::helper('adminhtml')->__('Refresh Statistics'), Mage::helper('adminhtml')->__('Refresh Statistics')) - ->renderLayout(); + return $this->_forward('index', 'report_statistics'); } protected function _isAllowed() { switch ($this->getRequest()->getActionName()) { case 'sales': - return Mage::getSingleton('admin/session')->isAllowed('report/salesroot/sales'); + return $this->_getSession()->isAllowed('report/salesroot/sales'); break; case 'tax': - return Mage::getSingleton('admin/session')->isAllowed('report/salesroot/tax'); + return $this->_getSession()->isAllowed('report/salesroot/tax'); break; case 'shipping': - return Mage::getSingleton('admin/session')->isAllowed('report/salesroot/shipping'); + return $this->_getSession()->isAllowed('report/salesroot/shipping'); break; case 'invoiced': - return Mage::getSingleton('admin/session')->isAllowed('report/salesroot/invoiced'); + return $this->_getSession()->isAllowed('report/salesroot/invoiced'); break; case 'refunded': - return Mage::getSingleton('admin/session')->isAllowed('report/salesroot/refunded'); + return $this->_getSession()->isAllowed('report/salesroot/refunded'); break; case 'coupons': - return Mage::getSingleton('admin/session')->isAllowed('report/salesroot/coupons'); + return $this->_getSession()->isAllowed('report/salesroot/coupons'); break; case 'shipping': - return Mage::getSingleton('admin/session')->isAllowed('report/salesroot/shipping'); + return $this->_getSession()->isAllowed('report/salesroot/shipping'); + break; + case 'bestsellers': + return $this->_getSession()->isAllowed('report/products/ordered'); break; default: - return Mage::getSingleton('admin/session')->isAllowed('report/salesroot'); + return $this->_getSession()->isAllowed('report/salesroot'); break; } } + + /** + * Retrieve admin session model + * + * @return Mage_Admin_Model_Session + */ + protected function _getSession() + { + if (is_null($this->_adminSession)) { + $this->_adminSession = Mage::getSingleton('admin/session'); + } + return $this->_adminSession; + } } diff --git a/app/code/core/Mage/Adminhtml/controllers/Report/ShopcartController.php b/app/code/core/Mage/Adminhtml/controllers/Report/ShopcartController.php index 263aaabba0..be80c84b64 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Report/ShopcartController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Report/ShopcartController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -124,7 +124,7 @@ public function abandonedAction() $this->_initAction() ->_setActiveMenu('report/shopcart/abandoned') - ->_addBreadcrumb(Mage::helper('reports')->__('Abandoned carts'), Mage::helper('reports')->__('Abandoned carts')) + ->_addBreadcrumb(Mage::helper('reports')->__('Abandoned Carts'), Mage::helper('reports')->__('Abandoned Carts')) ->_addContent($this->getLayout()->createBlock('adminhtml/report_shopcart_abandoned')) ->renderLayout(); } diff --git a/app/code/core/Mage/Adminhtml/controllers/Report/StatisticsController.php b/app/code/core/Mage/Adminhtml/controllers/Report/StatisticsController.php new file mode 100644 index 0000000000..8d78d43ad4 --- /dev/null +++ b/app/code/core/Mage/Adminhtml/controllers/Report/StatisticsController.php @@ -0,0 +1,204 @@ + + */ +class Mage_Adminhtml_Report_StatisticsController extends Mage_Adminhtml_Controller_Action +{ + /** + * Admin session model + * + * @var null|Mage_Admin_Model_Session + */ + protected $_adminSession = null; + + public function _initAction() + { + $act = $this->getRequest()->getActionName(); + if(!$act) { + $act = 'default'; + } + + $this->loadLayout() + ->_addBreadcrumb(Mage::helper('reports')->__('Reports'), Mage::helper('reports')->__('Reports')) + ->_addBreadcrumb(Mage::helper('reports')->__('Statistics'), Mage::helper('reports')->__('Statistics')); + return $this; + } + + public function _initReportAction($blocks) + { + if (!is_array($blocks)) { + $blocks = array($blocks); + } + + $requestData = Mage::helper('adminhtml')->prepareFilterString($this->getRequest()->getParam('filter')); + $requestData = $this->_filterDates($requestData, array('from', 'to')); + $requestData['store_ids'] = $this->getRequest()->getParam('store_ids'); + $params = new Varien_Object(); + + foreach ($requestData as $key => $value) { + if (!empty($value)) { + $params->setData($key, $value); + } + } + + foreach ($blocks as $block) { + if ($block) { + $block->setPeriodType($params->getData('period_type')); + $block->setFilterData($params); + } + } + + return $this; + } + + /** + * Retrieve array of collection names by code specified in request + * + * @return array + * @deprecated after 1.4.0.1 + */ + protected function _getCollectionNames() + { + $codes = $this->getRequest()->getParam('code'); + if (!$codes) { + throw new Exception(Mage::helper('adminhtml')->__('No report code specified.')); + } + + if(!is_array($codes) && strpos($codes, ',') === false) { + $codes = array($codes); + } elseif (!is_array($codes)) { + $codes = explode(',', $codes); + } + + $aliases = array( + 'sales' => 'sales/report_order', + 'tax' => 'tax/report_tax', + 'shipping' => 'sales/report_shipping', + 'invoiced' => 'sales/report_invoiced', + 'refunded' => 'sales/report_refunded', + 'coupons' => 'salesrule/report_rule', + 'bestsellers' => 'sales/report_bestsellers', + ); + $out = array(); + foreach ($codes as $code) { + $out[] = $aliases[$code]; + } + return $out; + } + + /** + * Refresh statistics for last 25 hours + * + * @return Mage_Adminhtml_Report_SalesController + */ + public function refreshRecentAction() + { + try { + $collectionsNames = $this->_getCollectionNames(); + $currentDate = Mage::app()->getLocale()->date(); + $date = $currentDate->subHour(25); + foreach ($collectionsNames as $collectionName) { + Mage::getResourceModel($collectionName)->aggregate($date); + } + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Recent statistics have been updated.')); + } catch (Mage_Core_Exception $e) { + Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); + } catch (Exception $e) { + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Unable to refresh recent statistics.')); + Mage::logException($e); + } + + if($this->_getSession()->isFirstPageAfterLogin()) { + $this->_redirect('*/*'); + } else { + $this->_redirectReferer('*/*'); + } + return $this; + } + + /** + * Refresh statistics for all period + * + * @return Mage_Adminhtml_Report_SalesController + */ + public function refreshLifetimeAction() + { + try { + $collectionsNames = $this->_getCollectionNames(); + foreach ($collectionsNames as $collectionName) { + Mage::getResourceModel($collectionName)->aggregate(); + } + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Lifetime statistics have been updated.')); + } catch (Mage_Core_Exception $e) { + Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); + } catch (Exception $e) { + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Unable to refresh lifetime statistics.')); + Mage::logException($e); + } + + if($this->_getSession()->isFirstPageAfterLogin()) { + $this->_redirect('*/*'); + } else { + $this->_redirectReferer('*/*'); + } + + return $this; + } + + public function indexAction() + { + $this->_title($this->__('Reports'))->_title($this->__('Sales'))->_title($this->__('Refresh Statistics')); + + $this->_initAction() + ->_setActiveMenu('report/statistics/refreshstatistics') + ->_addBreadcrumb(Mage::helper('adminhtml')->__('Refresh Statistics'), Mage::helper('adminhtml')->__('Refresh Statistics')) + ->renderLayout(); + } + + protected function _isAllowed() + { + return $this->_getSession()->isAllowed('report/statistics'); + } + + /** + * Retrieve admin session model + * + * @return Mage_Admin_Model_Session + */ + protected function _getSession() + { + if (is_null($this->_adminSession)) { + $this->_adminSession = Mage::getSingleton('admin/session'); + } + return $this->_adminSession; + } +} diff --git a/app/code/core/Mage/Adminhtml/controllers/Report/TagController.php b/app/code/core/Mage/Adminhtml/controllers/Report/TagController.php index e426c2cf00..c43fceccee 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Report/TagController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Report/TagController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -159,11 +159,18 @@ public function exportPopularExcelAction() public function customerDetailAction() { + $detailBlock = $this->getLayout()->createBlock('adminhtml/report_tag_customer_detail'); + + $this->_title($this->__('Reports')) + ->_title($this->__('Tags')) + ->_title($this->__('Customers')) + ->_title($detailBlock->getHeaderText()); + $this->_initAction() ->_setActiveMenu('report/tag/customerDetail') ->_addBreadcrumb(Mage::helper('reports')->__('Customers Report'), Mage::helper('reports')->__('Customers Report')) ->_addBreadcrumb(Mage::helper('reports')->__('Customer Tags'), Mage::helper('reports')->__('Customer Tags')) - ->_addContent($this->getLayout()->createBlock('adminhtml/report_tag_customer_detail')) + ->_addContent($detailBlock) ->renderLayout(); } @@ -193,11 +200,18 @@ public function exportCustomerDetailExcelAction() public function productDetailAction() { + $detailBlock = $this->getLayout()->createBlock('adminhtml/report_tag_product_detail'); + + $this->_title($this->__('Reports')) + ->_title($this->__('Tags')) + ->_title($this->__('Products')) + ->_title($detailBlock->getHeaderText()); + $this->_initAction() ->_setActiveMenu('report/tag/productDetail') ->_addBreadcrumb(Mage::helper('reports')->__('Products Report'), Mage::helper('reports')->__('Products Report')) ->_addBreadcrumb(Mage::helper('reports')->__('Product Tags'), Mage::helper('reports')->__('Product Tags')) - ->_addContent($this->getLayout()->createBlock('adminhtml/report_tag_product_detail')) + ->_addContent($detailBlock) ->renderLayout(); } @@ -227,11 +241,18 @@ public function exportProductDetailExcelAction() public function tagDetailAction() { + $detailBlock = $this->getLayout()->createBlock('adminhtml/report_tag_popular_detail'); + + $this->_title($this->__('Reports')) + ->_title($this->__('Tags')) + ->_title($this->__('Popular')) + ->_title($detailBlock->getHeaderText()); + $this->_initAction() ->_setActiveMenu('report/tag/tagDetail') ->_addBreadcrumb(Mage::helper('reports')->__('Popular Tags'), Mage::helper('reports')->__('Popular Tags')) ->_addBreadcrumb(Mage::helper('reports')->__('Tag Detail'), Mage::helper('reports')->__('Tag Detail')) - ->_addContent($this->getLayout()->createBlock('adminhtml/report_tag_popular_detail')) + ->_addContent($detailBlock) ->renderLayout(); } diff --git a/app/code/core/Mage/Adminhtml/controllers/ReportController.php b/app/code/core/Mage/Adminhtml/controllers/ReportController.php index 4caa55cca9..d5f66072af 100644 --- a/app/code/core/Mage/Adminhtml/controllers/ReportController.php +++ b/app/code/core/Mage/Adminhtml/controllers/ReportController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/Rss/CatalogController.php b/app/code/core/Mage/Adminhtml/controllers/Rss/CatalogController.php index 22849a136d..d451d92c70 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Rss/CatalogController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Rss/CatalogController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/Rss/OrderController.php b/app/code/core/Mage/Adminhtml/controllers/Rss/OrderController.php index 421b2adecd..f72cf3bdab 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Rss/OrderController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Rss/OrderController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Billing/AgreementController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Billing/AgreementController.php new file mode 100644 index 0000000000..bdc3b10636 --- /dev/null +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Billing/AgreementController.php @@ -0,0 +1,219 @@ + + */ +class Mage_Adminhtml_Sales_Billing_AgreementController extends Mage_Adminhtml_Controller_Action +{ + /** + * Billing agreements + * + */ + public function indexAction() + { + $this->_title($this->__('Sales')) + ->_title($this->__('Billing Agreements')); + + $this->loadLayout() + ->_setActiveMenu('sales/billing_agreement') + ->renderLayout(); + } + + /** + * Ajax action for billing agreements + * + */ + public function gridAction() + { + $this->loadLayout(false) + ->renderLayout(); + } + + /** + * View billing agreement action + * + */ + public function viewAction() + { + $agreementModel = $this->_initBillingAgreement(); + + if ($agreementModel) { + $this->_title($this->__('Sales')) + ->_title($this->__('Billing Agreements')) + ->_title(sprintf("#%s", $agreementModel->getReferenceId())); + + Mage::register('current_billing_agreement', $agreementModel); + $this->loadLayout() + ->_setActiveMenu('sales/billing_agreement') + ->renderLayout(); + return; + } + + $this->_redirect('*/*/'); + return; + } + + /** + * Related orders ajax action + * + */ + public function ordersGridAction() + { + $this->loadLayout(false) + ->renderLayout(); + } + + /** + * Cutomer billing agreements ajax action + * + */ + public function customerGridAction() + { + $this->_initCustomer(); + $this->loadLayout(false) + ->renderLayout(); + } + + /** + * Cancel billing agreement action + * + */ + public function cancelAction() + { + $agreementModel = $this->_initBillingAgreement(); + + if ($agreementModel && $agreementModel->canCancel()) { + try { + $agreementModel->cancel(); + $this->_getSession()->addSuccess($this->__('The billing agreement has been canceled.')); + $this->_redirect('*/*/view', array('_current' => true)); + return; + } catch (Mage_Core_Exception $e) { + $this->_getSession()->addError($e->getMessage()); + } catch (Exception $e) { + $this->_getSession()->addError($this->__('Failed to cancel the billing agreement.')); + Mage::logException($e); + } + $this->_redirect('*/*/view', array('_current' => true)); + } + return $this->_redirect('*/*/'); + } + + /** + * Delete billing agreement action + */ + public function deleteAction() + { + $agreementModel = $this->_initBillingAgreement(); + + if ($agreementModel) { + try { + $agreementModel->delete(); + $this->_getSession()->addSuccess($this->__('The billing agreement has been deleted.')); + $this->_redirect('*/*/'); + return; + } catch (Mage_Core_Exception $e) { + $this->_getSession()->addError($e->getMessage()); + } catch (Exception $e) { + $this->_getSession()->addError($this->__('Failed to delete the billing agreement.')); + Mage::logException($e); + } + $this->_redirect('*/*/view', array('_current' => true)); + } + $this->_redirect('*/*/'); + } + + /** + * Initialize billing agreement by ID specified in request + * + * @return Mage_Sales_Model_Billing_Agreement | false + */ + protected function _initBillingAgreement() + { + $agreementId = $this->getRequest()->getParam('agreement'); + $agreementModel = Mage::getModel('sales/billing_agreement')->load($agreementId); + + if (!$agreementModel->getId()) { + $this->_getSession()->addError($this->__('Wrong billing agreement ID specified.')); + return false; + } + return $agreementModel; + } + + /** + * Initialize customer by ID specified in request + * + * @return Mage_Adminhtml_Sales_Billing_AgreementController + */ + protected function _initCustomer() + { + $customerId = (int) $this->getRequest()->getParam('id'); + $customer = Mage::getModel('customer/customer'); + + if ($customerId) { + $customer->load($customerId); + } + + Mage::register('current_customer', $customer); + return $this; + } + + /** + * Retrieve adminhtml session + * + * @return Mage_Adminhtml_Model_Session + */ + protected function _getSession() + { + return Mage::getSingleton('adminhtml/session'); + } + + /** + * Check currently called action by permissions for current user + * + * @return bool + */ + protected function _isAllowed() + { + switch ($this->getRequest()->getActionName()) { + case 'index': + case 'grid' : + case 'view' : + return Mage::getSingleton('admin/session')->isAllowed('sales/billing_agreement/actions/view'); + break; + case 'cancel': + case 'delete': + return Mage::getSingleton('admin/session')->isAllowed('sales/billing_agreement/actions/manage'); + break; + default: + return Mage::getSingleton('admin/session')->isAllowed('sales/billing_agreement'); + break; + } + } +} diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/CreditmemoController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/CreditmemoController.php index 796f1424ca..62c240c5a6 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Sales/CreditmemoController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/CreditmemoController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -31,7 +31,25 @@ */ class Mage_Adminhtml_Sales_CreditmemoController extends Mage_Adminhtml_Controller_Sales_Creditmemo { + /** + * Export credit memo grid to CSV format + */ + public function exportCsvAction() + { + $fileName = 'creditmemos.csv'; + $grid = $this->getLayout()->createBlock('adminhtml/sales_creditmemo_grid'); + $this->_prepareDownloadResponse($fileName, $grid->getCsvFile()); + } + /** + * Export credit memo grid to Excel XML format + */ + public function exportExcelAction() + { + $fileName = 'creditmemos.xml'; + $grid = $this->getLayout()->createBlock('adminhtml/sales_creditmemo_grid'); + $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName)); + } /** * Index page @@ -42,3 +60,4 @@ public function indexAction() { parent::indexAction(); } } + diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/InvoiceController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/InvoiceController.php index 439bd1bc54..fbcd480775 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Sales/InvoiceController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/InvoiceController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -31,5 +31,23 @@ */ class Mage_Adminhtml_Sales_InvoiceController extends Mage_Adminhtml_Controller_Sales_Invoice { + /** + * Export invoice grid to CSV format + */ + public function exportCsvAction() + { + $fileName = 'invoices.csv'; + $grid = $this->getLayout()->createBlock('adminhtml/sales_invoice_grid'); + $this->_prepareDownloadResponse($fileName, $grid->getCsvFile()); + } + /** + * Export invoice grid to Excel XML format + */ + public function exportExcelAction() + { + $fileName = 'invoices.xml'; + $grid = $this->getLayout()->createBlock('adminhtml/sales_invoice_grid'); + $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName)); + } } diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreateController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreateController.php index 7917c3cbcd..fbb7cd0a92 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreateController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreateController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -252,7 +252,7 @@ protected function _processData() if ($this->_getQuote()->getCouponCode() !== $data['coupon']['code']) { $this->_getSession()->addError($this->__('"%s" coupon code is not valid.', $data['coupon']['code'])); } else { - $this->_getSession()->addSuccess($this->__('Coupon code accepted.')); + $this->_getSession()->addSuccess($this->__('The coupon code has been accepted.')); } } @@ -314,7 +314,6 @@ public function loadBlockAction() } catch (Exception $e){ $this->_reloadQuote(); -// $this->_getSession()->addException($e, $this->__('Processing data problem')); $this->_getSession()->addException($e, $e->getMessage()); } @@ -386,7 +385,7 @@ public function saveAction() ->createOrder(); $this->_getSession()->clear(); - Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Order has been successfully created')); + Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The order has been created.')); $this->_redirect('*/sales_order/view', array('order_id' => $order->getId())); } catch (Mage_Core_Exception $e){ diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php index c07bc76da2..b296887489 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -33,25 +33,32 @@ */ class Mage_Adminhtml_Sales_Order_CreditmemoController extends Mage_Adminhtml_Controller_Sales_Creditmemo { + /** + * Get requested items qtys and return to stock flags + */ protected function _getItemData() { $data = $this->getRequest()->getParam('creditmemo'); if (isset($data['items'])) { $qtys = $data['items']; - } - else { + } else { $qtys = array(); } return $qtys; } + /** + * Check if creditmeno can be created for order + * @param Mage_Sales_Model_Order $order + * @return bool + */ protected function _canCreditmemo($order) { /** * Check order existing */ if (!$order->getId()) { - $this->_getSession()->addError($this->__('Order not longer exist')); + $this->_getSession()->addError($this->__('The order no longer exists.')); return false; } @@ -59,12 +66,30 @@ protected function _canCreditmemo($order) * Check creditmemo create availability */ if (!$order->canCreditmemo()) { - $this->_getSession()->addError($this->__('Can not do credit memo for order')); + $this->_getSession()->addError($this->__('Cannot create credit memo for the order.')); return false; } return true; } + /** + * Initialize requested invoice instance + * @param unknown_type $order + */ + protected function _initInvoice($order) + { + $invoiceId = $this->getRequest()->getParam('invoice_id'); + if ($invoiceId) { + $invoice = Mage::getModel('sales/order_invoice') + ->load($invoiceId) + ->setOrder($order); + if ($invoice->getId()) { + return $invoice; + } + } + return false; + } + /** * Initialize creditmemo model instance * @@ -75,149 +100,69 @@ protected function _initCreditmemo($update = false) $this->_title($this->__('Sales'))->_title($this->__('Credit Memos')); $creditmemo = false; - if ($creditmemoId = $this->getRequest()->getParam('creditmemo_id')) { + $creditmemoId = $this->getRequest()->getParam('creditmemo_id'); + $orderId = $this->getRequest()->getParam('order_id'); + if ($creditmemoId) { $creditmemo = Mage::getModel('sales/order_creditmemo')->load($creditmemoId); - } - elseif ($orderId = $this->getRequest()->getParam('order_id')) { + } elseif ($orderId) { $data = $this->getRequest()->getParam('creditmemo'); $order = Mage::getModel('sales/order')->load($orderId); - $invoiceId = $this->getRequest()->getParam('invoice_id'); - $invoice= null; + $invoice = $this->_initInvoice($order); if (!$this->_canCreditmemo($order)) { return false; } - if ($invoiceId) { - $invoice = Mage::getModel('sales/order_invoice') - ->load($invoiceId) - ->setOrder($order); - } - - $convertor = Mage::getModel('sales/convert_order'); - $creditmemo = $convertor->toCreditmemo($order) - ->setInvoice($invoice); - $savedData = $this->_getItemData(); - if ($invoice && $invoice->getId()) { - foreach ($invoice->getAllItems() as $invoiceItem) { - $orderItem = $invoiceItem->getOrderItem(); - - if (!$orderItem->isDummy() && !$orderItem->getQtyToRefund()) { - continue; - } - - if (!$update && $orderItem->isDummy() && !empty($savedData) && !$this->_needToAddDummy($orderItem, $savedData)) { - continue; - } - - $item = $convertor->itemToCreditmemoItem($orderItem); - if (isset($savedData[$orderItem->getId()]['qty'])) { - $qty = $savedData[$orderItem->getId()]['qty']; - } - else { - if ($orderItem->isDummy()) { - if ($orderItem->getParentItem() && isset($savedData[$orderItem->getParentItem()->getId()]['qty'])) { - $parentItemNewQty = $savedData[$orderItem->getParentItem()->getId()]['qty']; - $parentItemOrigQty = $orderItem->getParentItem()->getQtyOrdered(); - $itemOrigQty = $orderItem->getQtyOrdered()/$parentItemOrigQty; - $qty = $itemOrigQty*$parentItemNewQty; - if (isset($savedData[$orderItem->getParentItem()->getId()]['back_to_stock'])) { - $savedData[$orderItem->getId()]['back_to_stock'] = 1; - } - } else { - $qty = 1; - } - } else { - $qty = min($orderItem->getQtyToRefund(), $invoiceItem->getQty()); - } - } - - $item->setQty($qty); - - $children = $orderItem->getChildrenItems(); - if (!empty($children)) { - $item->setBackToStock(false); - } else { - $item->setBackToStock(isset($savedData[$orderItem->getId()]['back_to_stock'])); - } - - $creditmemo->addItem($item); + $qtys = array(); + $backToStock = array(); + foreach ($savedData as $orderItemId =>$itemData) { + if (isset($itemData['qty'])) { + $qtys[$orderItemId] = $itemData['qty']; } - } else { - foreach ($order->getAllItems() as $orderItem) { - - if (!$orderItem->isDummy() && !$orderItem->getQtyToRefund()) { - continue; - } - - if (!$update && $orderItem->isDummy() && !empty($savedData) && !$this->_needToAddDummy($orderItem, $savedData)) { - continue; - } - - $item = $convertor->itemToCreditmemoItem($orderItem); - if (isset($savedData[$orderItem->getId()]['qty'])) { - $qty = $savedData[$orderItem->getId()]['qty']; - } - else { - if ($orderItem->isDummy()) { - if ($orderItem->getParentItem() && isset($savedData[$orderItem->getParentItem()->getId()]['qty'])) { - $parentItemNewQty = $savedData[$orderItem->getParentItem()->getId()]['qty']; - $parentItemOrigQty = $orderItem->getParentItem()->getQtyOrdered(); - $itemOrigQty = $orderItem->getQtyOrdered()/$parentItemOrigQty; - $qty = $itemOrigQty*$parentItemNewQty; - if (isset($savedData[$orderItem->getParentItem()->getId()]['back_to_stock'])) { - $savedData[$orderItem->getId()]['back_to_stock'] = 1; - } - } else { - $qty = 1; - } - } else { - $qty = $orderItem->getQtyToRefund(); - } - } - - $item->setQty($qty); - - $children = $orderItem->getChildrenItems(); - if (!empty($children)) { - $item->setBackToStock(false); - } else { - $item->setBackToStock(isset($savedData[$orderItem->getId()]['back_to_stock'])); - } - - $creditmemo->addItem($item); + if (isset($itemData['back_to_stock'])) { + $backToStock[$orderItemId] = true; } } + $data['qtys'] = $qtys; - if (isset($data['shipping_amount'])) { - $creditmemo->setBaseShippingAmount((float)$data['shipping_amount']); - } elseif ($invoice) { - $baseAllowedAmount = $order->getBaseShippingAmount()-$order->getBaseShippingRefunded(); - $creditmemo->setBaseShippingAmount(min($baseAllowedAmount, $invoice->getBaseShippingAmount())); + $service = Mage::getModel('sales/service_order', $order); + if ($invoice) { + $creditmemo = $service->prepareInvoiceCreditmemo($invoice, $data); + } else { + $creditmemo = $service->prepareCreditmemo($data); } - if (isset($data['adjustment_positive'])) { - $creditmemo->setAdjustmentPositive($data['adjustment_positive']); - } - if (isset($data['adjustment_negative'])) { - $creditmemo->setAdjustmentNegative($data['adjustment_negative']); + /** + * Process back to stock flags + */ + foreach ($creditmemo->getAllItems() as $creditmemoItem) { + $orderItem = $creditmemoItem->getOrderItem(); + $parentId = $orderItem->getParentItemId(); + if (isset($backToStock[$orderItem->getId()])) { + $creditmemoItem->setBackToStock(true); + } elseif ($orderItem->getParentItem() && isset($backToStock[$parentId]) && $backToStock[$parentId]) { + $creditmemoItem->setBackToStock(true); + } elseif (empty($savedData)) { + $creditmemoItem->setBackToStock(Mage::helper('cataloginventory')->isAutoReturnEnabled()); + } else { + $creditmemoItem->setBackToStock(false); + } } - - $creditmemo->collectTotals(); } - $args = array( - 'creditmemo' => $creditmemo, - 'request' => $this->getRequest(), - ); + $args = array('creditmemo' => $creditmemo, 'request' => $this->getRequest()); Mage::dispatchEvent('adminhtml_sales_order_creditmemo_register_before', $args); Mage::register('current_creditmemo', $creditmemo); return $creditmemo; } + /** + * Save creditmemo and related order, invoice in one transaction + * @param Mage_Sales_Model_Order_Creditmemo $creditmemo + */ protected function _saveCreditmemo($creditmemo) { $transactionSave = Mage::getModel('core/resource_transaction') @@ -236,7 +181,8 @@ protected function _saveCreditmemo($creditmemo) */ public function viewAction() { - if ($creditmemo = $this->_initCreditmemo()) { + $creditmemo = $this->_initCreditmemo(); + if ($creditmemo) { if ($creditmemo->getInvoice()) { $this->_title($this->__("View Memo for #%s", $creditmemo->getInvoice()->getIncrementId())); } else { @@ -248,8 +194,7 @@ public function viewAction() ->updateBackButtonUrl($this->getRequest()->getParam('come_from')); $this->_setActiveMenu('sales/order') ->renderLayout(); - } - else { + } else { $this->_forward('noRoute'); } } @@ -277,15 +222,14 @@ public function newAction() $this->_title($this->__("New Memo")); } - $commentText = Mage::getSingleton('adminhtml/session')->getCommentText(true); - - $creditmemo->addData(array('commentText'=>$commentText)); + if ($comment = Mage::getSingleton('adminhtml/session')->getCommentText(true)) { + $creditmemo->setCommentText($comment); + } $this->loadLayout() ->_setActiveMenu('sales/order') ->renderLayout(); - } - else { + } else { $this->_forward('noRoute'); } } @@ -299,18 +243,16 @@ public function updateQtyAction() $creditmemo = $this->_initCreditmemo(true); $this->loadLayout(); $response = $this->getLayout()->getBlock('order_items')->toHtml(); - } - catch (Mage_Core_Exception $e) { + } catch (Mage_Core_Exception $e) { $response = array( 'error' => true, 'message' => $e->getMessage() ); $response = Mage::helper('core')->jsonEncode($response); - } - catch (Exception $e) { + } catch (Exception $e) { $response = array( 'error' => true, - 'message' => $this->__('Can not update item qty') + 'message' => $this->__('Cannot update the item\'s quantity.') ); $response = Mage::helper('core')->jsonEncode($response); } @@ -324,16 +266,19 @@ public function updateQtyAction() public function saveAction() { $data = $this->getRequest()->getPost('creditmemo'); + if (!empty($data['comment_text'])) { + Mage::getSingleton('adminhtml/session')->setCommentText($data['comment_text']); + } + try { - if ($creditmemo = $this->_initCreditmemo()) { + $creditmemo = $this->_initCreditmemo(); + if ($creditmemo) { if (($creditmemo->getGrandTotal() <=0) && (!$creditmemo->getAllowZeroGrandTotal())) { Mage::throwException( - $this->__('Credit Memo total must be positive.') + $this->__('Credit memo\'s total must be positive.') ); } - Mage::getSingleton('adminhtml/session')->setCommentText($data['comment_text']); - $comment = ''; if (!empty($data['comment_text'])) { $creditmemo->addComment($data['comment_text'], isset($data['comment_customer_notify'])); @@ -357,22 +302,19 @@ public function saveAction() $creditmemo->getOrder()->setCustomerNoteNotify(!empty($data['send_email'])); $this->_saveCreditmemo($creditmemo); $creditmemo->sendEmail(!empty($data['send_email']), $comment); - $this->_getSession()->addSuccess($this->__('Credit Memo was successfully created')); + $this->_getSession()->addSuccess($this->__('The credit memo has been created.')); Mage::getSingleton('adminhtml/session')->getCommentText(true); $this->_redirect('*/sales_order/view', array('order_id' => $creditmemo->getOrderId())); return; - } - else { + } else { $this->_forward('noRoute'); return; } - } - catch (Mage_Core_Exception $e) { + } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); - } - catch (Exception $e) { + } catch (Exception $e) { Mage::logException($e); - $this->_getSession()->addError($this->__('Cannot save Credit Memo.')); + $this->_getSession()->addError($this->__('Cannot save the cedit memo.')); } $this->_redirect('*/*/new', array('_current' => true)); } @@ -386,17 +328,14 @@ public function cancelAction() try { $creditmemo->cancel(); $this->_saveCreditmemo($creditmemo); - $this->_getSession()->addSuccess($this->__('Credit Memo was successfully canceled.')); - } - catch (Mage_Core_Exception $e) { + $this->_getSession()->addSuccess($this->__('The credit memo has been canceled.')); + } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); - } - catch (Exception $e) { - $this->_getSession()->addError($this->__('Credit Memo cancel error.')); + } catch (Exception $e) { + $this->_getSession()->addError($this->__('Unable to cancel the credit memo.')); } $this->_redirect('*/*/view', array('creditmemo_id'=>$creditmemo->getId())); - } - else { + } else { $this->_forward('noRoute'); } } @@ -410,21 +349,21 @@ public function voidAction() try { $creditmemo->void(); $this->_saveCreditmemo($creditmemo); - $this->_getSession()->addSuccess($this->__('Credit Memo was successfully voided')); - } - catch (Mage_Core_Exception $e) { + $this->_getSession()->addSuccess($this->__('The credit memo has been voided.')); + } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); - } - catch (Exception $e) { - $this->_getSession()->addError($this->__('Credit Memo void error')); + } catch (Exception $e) { + $this->_getSession()->addError($this->__('Unable to void the credit memo.')); } $this->_redirect('*/*/view', array('creditmemo_id'=>$creditmemo->getId())); - } - else { + } else { $this->_forward('noRoute'); } } + /** + * Add comment to creditmemo history + */ public function addCommentAction() { try { @@ -434,27 +373,26 @@ public function addCommentAction() ); $data = $this->getRequest()->getPost('comment'); if (empty($data['comment'])) { - Mage::throwException($this->__('Comment text field can not be empty.')); + Mage::throwException($this->__('The Comment Text field cannot be empty.')); } $creditmemo = $this->_initCreditmemo(); $creditmemo->addComment($data['comment'], isset($data['is_customer_notified'])); + $creditmemo->_hasDataChanges = true; $creditmemo->save(); $creditmemo->sendUpdateEmail(!empty($data['is_customer_notified']), $data['comment']); $this->loadLayout(); $response = $this->getLayout()->getBlock('creditmemo_comments')->toHtml(); - } - catch (Mage_Core_Exception $e) { + } catch (Mage_Core_Exception $e) { $response = array( 'error' => true, 'message' => $e->getMessage() ); $response = Mage::helper('core')->jsonEncode($response); - } - catch (Exception $e) { + } catch (Exception $e) { $response = array( 'error' => true, - 'message' => $this->__('Can not add new comment.') + 'message' => $this->__('Cannot add new comment.') ); $response = Mage::helper('core')->jsonEncode($response); } @@ -466,6 +404,7 @@ public function addCommentAction() * for eaxample we don't need create dummy parent if all * children are not in process * + * @deprecated after 1.4, Mage_Sales_Model_Service_Order used * @param Mage_Sales_Model_Order_Item $item * @param array $qtys * @return bool diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/EditController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/EditController.php index c1ee81f6eb..189769665b 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/EditController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/EditController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php index b22465e792..54cdce157c 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -33,17 +33,15 @@ */ class Mage_Adminhtml_Sales_Order_InvoiceController extends Mage_Adminhtml_Controller_Sales_Invoice { + /** + * Get requested items qty's from request + */ protected function _getItemQtys() { $data = $this->getRequest()->getParam('invoice'); if (isset($data['items'])) { $qtys = $data['items']; - //$this->_getSession()->setInvoiceItemQtys($qtys); - } - /*elseif ($this->_getSession()->getInvoiceItemQtys()) { - $qtys = $this->_getSession()->getInvoiceItemQtys(); - }*/ - else { + } else { $qtys = array(); } return $qtys; @@ -60,68 +58,31 @@ protected function _initInvoice($update = false) $invoice = false; $itemsToInvoice = 0; - - if ($invoiceId = $this->getRequest()->getParam('invoice_id')) { + $invoiceId = $this->getRequest()->getParam('invoice_id'); + $orderId = $this->getRequest()->getParam('order_id'); + if ($invoiceId) { $invoice = Mage::getModel('sales/order_invoice')->load($invoiceId); - } - elseif ($orderId = $this->getRequest()->getParam('order_id')) { - $order = Mage::getModel('sales/order')->load($orderId); + } elseif ($orderId) { + $order = Mage::getModel('sales/order')->load($orderId); /** * Check order existing */ if (!$order->getId()) { - $this->_getSession()->addError($this->__('Order not longer exist')); + $this->_getSession()->addError($this->__('The order no longer exists.')); return false; } /** * Check invoice create availability */ if (!$order->canInvoice()) { - $this->_getSession()->addError($this->__('Order does not allow to create an invoice.')); + $this->_getSession()->addError($this->__('The order does not allow creating an invoice.')); return false; } - - $convertor = Mage::getModel('sales/convert_order'); - $invoice = $convertor->toInvoice($order); - $savedQtys = $this->_getItemQtys(); - /* @var $orderItem Mage_Sales_Model_Order_Item */ - foreach ($order->getAllItems() as $orderItem) { - - if (!$orderItem->isDummy() && !$orderItem->getQtyToInvoice() && $orderItem->getLockedDoInvoice()) { - continue; - } - - if ($order->getForcedDoShipmentWithInvoice() && $orderItem->getLockedDoShip()) { - continue; - } - - if (!$update && $orderItem->isDummy() && !empty($savedQtys) && !$this->_needToAddDummy($orderItem, $savedQtys)) { - continue; - } - $item = $convertor->itemToInvoiceItem($orderItem); - - if (isset($savedQtys[$orderItem->getId()])) { - $qty = $savedQtys[$orderItem->getId()]; - } - else { - if ($orderItem->isDummy()) { - $qty = 1; - } else { - $qty = $orderItem->getQtyToInvoice(); - } - } - $itemsToInvoice += floatval($qty); - $item->setQty($qty); - $invoice->addItem($item); + $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice($savedQtys); + if (!$invoice->getTotalQty()) { + Mage::throwException($this->__('Cannot create an invoice without products.')); } - - if ($itemsToInvoice <= 0){ - Mage::throwException($this->__('Invoice without products could not be created.')); - return false; - } - - $invoice->collectTotals(); } Mage::register('current_invoice', $invoice); @@ -153,69 +114,19 @@ protected function _saveInvoice($invoice) */ protected function _prepareShipment($invoice) { - $convertor = Mage::getModel('sales/convert_order'); - /* @var $convertor Mage_Sales_Model_Convert_Order */ - $shipment = $convertor->toShipment($invoice->getOrder()); - $savedQtys = $this->_getItemQtys(); - $skipedParent = array(); - - foreach ($invoice->getOrder()->getAllItems() as $item) { - /* - * if this is child and its parent was skipped - * bc of something we need to skip child also - */ - if ($item->getParentItem() && isset($skipedParent[$item->getParentItem()->getId()])){ - continue; - } - - if (isset($savedQtys[$item->getId()])) { - $qty = min($savedQtys[$item->getId()], $item->getQtyToShip()); - } else { - $qty = $item->getQtyToShip(); - } - - if (!$item->isDummy(true) && !$item->getQtyToShip() && $item->getLockedDoShip()) { - continue; - } - - /** - * if this is a dummy item and we don't need it. we skip it. - * also if this item is parent we need to mark that we skipped - * it so children will be also skipped - */ - if ($item->isDummy(true) && !$this->_needToAddDummyForShipment($item, $savedQtys)) { - if ($item->getChildrenItems()) { - $skipedParent[$item->getId()] = 1; - } - continue; - } - - if ($item->getIsVirtual()) { - continue; - } - - $shipItem = $convertor->itemToShipmentItem($item); - - if ($item->isDummy(true)) { - $qty = 1; - } - - $shipItem->setQty($qty); - $shipment->addItem($shipItem); - } - - if (!count($shipment->getAllItems())) { - // no need to create empty shipment + $shipment = Mage::getModel('sales/service_order', $invoice->getOrder())->prepareShipment($savedQtys); + if (!$shipment->getTotalQty()) { return false; } - $shipment->register(); - if ($tracks = $this->getRequest()->getPost('tracking')) { + $shipment->register(); + $tracks = $this->getRequest()->getPost('tracking'); + if ($tracks) { foreach ($tracks as $data) { $track = Mage::getModel('sales/order_shipment_track') - ->addData($data); + ->addData($data); $shipment->addTrack($track); } } @@ -227,7 +138,8 @@ protected function _prepareShipment($invoice) */ public function viewAction() { - if ($invoice = $this->_initInvoice()) { + $invoice = $this->_initInvoice(); + if ($invoice) { $this->_title(sprintf("#%s", $invoice->getIncrementId())); $this->loadLayout() @@ -258,14 +170,18 @@ public function startAction() */ public function newAction() { - if ($invoice = $this->_initInvoice()) { + $invoice = $this->_initInvoice(); + if ($invoice) { $this->_title($this->__('New Invoice')); + + if ($comment = Mage::getSingleton('adminhtml/session')->getCommentText(true)) { + $invoice->setCommentText($comment); + } + $this->loadLayout() ->_setActiveMenu('sales/order') ->renderLayout(); - } - else { - // $this->_forward('noRoute'); + } else { $this->_redirect('*/sales_order/view', array('order_id'=>$this->getRequest()->getParam('order_id'))); } } @@ -279,18 +195,16 @@ public function updateQtyAction() $invoice = $this->_initInvoice(true); $this->loadLayout(); $response = $this->getLayout()->getBlock('order_items')->toHtml(); - } - catch (Mage_Core_Exception $e) { + } catch (Mage_Core_Exception $e) { $response = array( 'error' => true, 'message' => $e->getMessage() ); $response = Mage::helper('core')->jsonEncode($response); - } - catch (Exception $e) { + } catch (Exception $e) { $response = array( 'error' => true, - 'message' => $this->__('Can not update item qty') + 'message' => $this->__('Cannot update item quantity.') ); $response = Mage::helper('core')->jsonEncode($response); } @@ -305,8 +219,14 @@ public function saveAction() { $data = $this->getRequest()->getPost('invoice'); $orderId = $this->getRequest()->getParam('order_id'); + + if (!empty($data['comment_text'])) { + Mage::getSingleton('adminhtml/session')->setCommentText($data['comment_text']); + } + try { - if ($invoice = $this->_initInvoice()) { + $invoice = $this->_initInvoice(); + if ($invoice) { if (!empty($data['capture_case'])) { $invoice->setRequestedCaptureCase($data['capture_case']); @@ -339,10 +259,9 @@ public function saveAction() $transactionSave->save(); if (!empty($data['do_shipment'])) { - $this->_getSession()->addSuccess($this->__('Invoice and shipment have been successfully created.')); - } - else { - $this->_getSession()->addSuccess($this->__('Invoice has been successfully created.')); + $this->_getSession()->addSuccess($this->__('The invoice and shipment have been created.')); + } else { + $this->_getSession()->addSuccess($this->__('The invoice has been created.')); } // send invoice/shipment emails @@ -354,28 +273,26 @@ public function saveAction() $invoice->sendEmail(!empty($data['send_email']), $comment); } catch (Exception $e) { Mage::logException($e); - $this->_getSession()->addError($this->__('Unable to send invoice email.')); + $this->_getSession()->addError($this->__('Unable to send the invoice email.')); } if ($shipment) { try { $shipment->sendEmail(!empty($data['send_email'])); } catch (Exception $e) { Mage::logException($e); - $this->_getSession()->addError($this->__('Unable to send shipment email.')); + $this->_getSession()->addError($this->__('Unable to send the shipment email.')); } } + Mage::getSingleton('adminhtml/session')->getCommentText(true); $this->_redirect('*/sales_order/view', array('order_id' => $orderId)); - } - else { + } else { $this->_redirect('*/*/new', array('order_id' => $orderId)); } return; - } - catch (Mage_Core_Exception $e) { + } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); - } - catch (Exception $e) { - $this->_getSession()->addError($this->__('Failed to save invoice.')); + } catch (Exception $e) { + $this->_getSession()->addError($this->__('Unable to save the invoice.')); Mage::logException($e); } $this->_redirect('*/*/new', array('order_id' => $orderId)); @@ -391,17 +308,14 @@ public function captureAction() try { $invoice->capture(); $this->_saveInvoice($invoice); - $this->_getSession()->addSuccess($this->__('Invoice was successfully captured')); - } - catch (Mage_Core_Exception $e) { + $this->_getSession()->addSuccess($this->__('The invoice has been captured.')); + } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); - } - catch (Exception $e) { - $this->_getSession()->addError($this->__('Invoice capture error')); + } catch (Exception $e) { + $this->_getSession()->addError($this->__('Invoice capturing error.')); } $this->_redirect('*/*/view', array('invoice_id'=>$invoice->getId())); - } - else { + } else { $this->_forward('noRoute'); } } @@ -415,17 +329,14 @@ public function cancelAction() try { $invoice->cancel(); $this->_saveInvoice($invoice); - $this->_getSession()->addSuccess($this->__('Invoice was successfully canceled.')); - } - catch (Mage_Core_Exception $e) { + $this->_getSession()->addSuccess($this->__('The invoice has been canceled.')); + } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); - } - catch (Exception $e) { - $this->_getSession()->addError($this->__('Invoice cancel error.')); + } catch (Exception $e) { + $this->_getSession()->addError($this->__('Invoice canceling error.')); } $this->_redirect('*/*/view', array('invoice_id'=>$invoice->getId())); - } - else { + } else { $this->_forward('noRoute'); } } @@ -439,17 +350,14 @@ public function voidAction() try { $invoice->void(); $this->_saveInvoice($invoice); - $this->_getSession()->addSuccess($this->__('Invoice was successfully voided')); - } - catch (Mage_Core_Exception $e) { + $this->_getSession()->addSuccess($this->__('The invoice has been voided.')); + } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); - } - catch (Exception $e) { - $this->_getSession()->addError($this->__('Invoice void error')); + } catch (Exception $e) { + $this->_getSession()->addError($this->__('Invoice voiding error.')); } $this->_redirect('*/*/view', array('invoice_id'=>$invoice->getId())); - } - else { + } else { $this->_forward('noRoute'); } } @@ -460,38 +368,45 @@ public function addCommentAction() $this->getRequest()->setParam('invoice_id', $this->getRequest()->getParam('id')); $data = $this->getRequest()->getPost('comment'); if (empty($data['comment'])) { - Mage::throwException($this->__('Comment text field can not be empty.')); + Mage::throwException($this->__('The Comment Text field cannot be empty.')); } $invoice = $this->_initInvoice(); $invoice->addComment($data['comment'], isset($data['is_customer_notified'])); $invoice->sendUpdateEmail(!empty($data['is_customer_notified']), $data['comment']); + $invoice->_hasDataChanges = true; $invoice->save(); $this->loadLayout(); $response = $this->getLayout()->getBlock('invoice_comments')->toHtml(); - } - catch (Mage_Core_Exception $e) { + } catch (Mage_Core_Exception $e) { $response = array( 'error' => true, 'message' => $e->getMessage() ); $response = Mage::helper('core')->jsonEncode($response); - } - catch (Exception $e) { + } catch (Exception $e) { $response = array( 'error' => true, - 'message' => $this->__('Can not add new comment.') + 'message' => $this->__('Cannot add new comment.') ); $response = Mage::helper('core')->jsonEncode($response); } $this->getResponse()->setBody($response); } + + + + + + + /** * Decides if we need to create dummy invoice item or not * for eaxample we don't need create dummy parent if all * children are not in process * + * @deprecated after 1.4, Mage_Sales_Model_Service_Order used * @param Mage_Sales_Model_Order_Item $item * @param array $qtys * @return bool @@ -517,6 +432,7 @@ protected function _needToAddDummy($item, $qtys) { * for eaxample we don't need create dummy parent if all * children are not in process * + * @deprecated after 1.4, Mage_Sales_Model_Service_Order used * @param Mage_Sales_Model_Order_Item $item * @param array $qtys * @return bool diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php index d5b8662751..a20cab036f 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -33,13 +33,15 @@ */ class Mage_Adminhtml_Sales_Order_ShipmentController extends Mage_Adminhtml_Controller_Sales_Shipment { + /** + * Initialize shipment items QTY + */ protected function _getItemQtys() { $data = $this->getRequest()->getParam('shipment'); if (isset($data['items'])) { $qtys = $data['items']; - } - else { + } else { $qtys = array(); } return $qtys; @@ -55,69 +57,42 @@ protected function _initShipment() $this->_title($this->__('Sales'))->_title($this->__('Shipments')); $shipment = false; - if ($shipmentId = $this->getRequest()->getParam('shipment_id')) { + $shipmentId = $this->getRequest()->getParam('shipment_id'); + $orderId = $this->getRequest()->getParam('order_id'); + if ($shipmentId) { $shipment = Mage::getModel('sales/order_shipment')->load($shipmentId); - } - elseif ($orderId = $this->getRequest()->getParam('order_id')) { + } elseif ($orderId) { $order = Mage::getModel('sales/order')->load($orderId); /** * Check order existing */ if (!$order->getId()) { - $this->_getSession()->addError($this->__('Order not longer exist.')); + $this->_getSession()->addError($this->__('The order no longer exists.')); return false; } /** * Check shipment is available to create separate from invoice */ if ($order->getForcedDoShipmentWithInvoice()) { - $this->_getSession()->addError($this->__('Can not do shipment for order separate from invoice.')); + $this->_getSession()->addError($this->__('Cannot do shipment for the order separately from invoice.')); return false; } /** * Check shipment create availability */ if (!$order->canShip()) { - $this->_getSession()->addError($this->__('Can not do shipment for order.')); + $this->_getSession()->addError($this->__('Cannot do shipment for the order.')); return false; } - - $convertor = Mage::getModel('sales/convert_order'); - $shipment = $convertor->toShipment($order); $savedQtys = $this->_getItemQtys(); - foreach ($order->getAllItems() as $orderItem) { - if (!$orderItem->isDummy(true) && !$orderItem->getQtyToShip()) { - continue; - } - if ($orderItem->isDummy(true) && !$this->_needToAddDummy($orderItem, $savedQtys)) { - continue; - } - if ($orderItem->getIsVirtual()) { - continue; - } - $item = $convertor->itemToShipmentItem($orderItem); - if (isset($savedQtys[$orderItem->getId()])) { - if ($savedQtys[$orderItem->getId()] > 0) { - $qty = $savedQtys[$orderItem->getId()]; - } else { - continue; - } - } - else { - if ($orderItem->isDummy(true)) { - $qty = 1; - } else { - $qty = $orderItem->getQtyToShip(); - } - } - $item->setQty($qty); - $shipment->addItem($item); - } - if ($tracks = $this->getRequest()->getPost('tracking')) { + $shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($savedQtys); + + $tracks = $this->getRequest()->getPost('tracking'); + if ($tracks) { foreach ($tracks as $data) { $track = Mage::getModel('sales/order_shipment_track') - ->addData($data); + ->addData($data); $shipment->addTrack($track); } } @@ -127,6 +102,10 @@ protected function _initShipment() return $shipment; } + /** + * Save shipment and order in one transaction + * @param Mage_Sales_Model_Order_Shipment $shipment + */ protected function _saveShipment($shipment) { $shipment->getOrder()->setIsInProcess(true); @@ -176,11 +155,14 @@ public function newAction() if ($shipment = $this->_initShipment()) { $this->_title($this->__('New Shipment')); + if ($comment = Mage::getSingleton('adminhtml/session')->getCommentText(true)) { + $shipment->setCommentText($comment); + } + $this->loadLayout() ->_setActiveMenu('sales/order') ->renderLayout(); - } - else { + } else { $this->_redirect('*/sales_order/view', array('order_id'=>$this->getRequest()->getParam('order_id'))); } } @@ -192,6 +174,9 @@ public function newAction() public function saveAction() { $data = $this->getRequest()->getPost('shipment'); + if (!empty($data['comment_text'])) { + Mage::getSingleton('adminhtml/session')->setCommentText($data['comment_text']); + } try { if ($shipment = $this->_initShipment()) { @@ -212,24 +197,25 @@ public function saveAction() $shipment->getOrder()->setCustomerNoteNotify(!empty($data['send_email'])); $this->_saveShipment($shipment); $shipment->sendEmail(!empty($data['send_email']), $comment); - $this->_getSession()->addSuccess($this->__('Shipment was successfully created.')); + $this->_getSession()->addSuccess($this->__('The shipment has been created.')); + Mage::getSingleton('adminhtml/session')->getCommentText(true); $this->_redirect('*/sales_order/view', array('order_id' => $shipment->getOrderId())); return; - } - else { + } else { $this->_forward('noRoute'); return; } - } - catch (Mage_Core_Exception $e) { + } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); - } - catch (Exception $e) { - $this->_getSession()->addError($this->__('Can not save shipment.')); + } catch (Exception $e) { + $this->_getSession()->addError($this->__('Cannot save shipment.')); } $this->_redirect('*/*/new', array('order_id' => $this->getRequest()->getParam('order_id'))); } + /** + * Send email with shipment data to customer + */ public function emailAction() { try { @@ -237,14 +223,12 @@ public function emailAction() $shipment->sendEmail(true) ->setEmailSent(true) ->save(); - $this->_getSession()->addSuccess($this->__('Shipment was successfully sent.')); + $this->_getSession()->addSuccess($this->__('The shipment has been sent.')); } - } - catch (Mage_Core_Exception $e) { + } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); - } - catch (Exception $e) { - $this->_getSession()->addError($this->__('Can not send shipment information.')); + } catch (Exception $e) { + $this->_getSession()->addError($this->__('Cannot send shipment information.')); } $this->_redirect('*/*/view', array( 'shipment_id' => $this->getRequest()->getParam('shipment_id') @@ -261,10 +245,10 @@ public function addTrackAction() $number = $this->getRequest()->getPost('number'); $title = $this->getRequest()->getPost('title'); if (empty($carrier)) { - Mage::throwException($this->__('You need specify carrier.')); + Mage::throwException($this->__('The carrier needs to be specified.')); } if (empty($number)) { - Mage::throwException($this->__('Tracking number can not be empty.')); + Mage::throwException($this->__('Tracking number cannot be empty.')); } if ($shipment = $this->_initShipment()) { $track = Mage::getModel('sales/order_shipment_track') @@ -276,24 +260,21 @@ public function addTrackAction() $this->loadLayout(); $response = $this->getLayout()->getBlock('shipment_tracking')->toHtml(); - } - else { + } else { $response = array( 'error' => true, - 'message' => $this->__('Can not initialize shipment for adding tracking number.'), + 'message' => $this->__('Cannot initialize shipment for adding tracking number.'), ); } - } - catch (Mage_Core_Exception $e) { + } catch (Mage_Core_Exception $e) { $response = array( 'error' => true, 'message' => $e->getMessage(), ); - } - catch (Exception $e) { + } catch (Exception $e) { $response = array( 'error' => true, - 'message' => $this->__('Can not add tracking number.'), + 'message' => $this->__('Cannot add tracking number.'), ); } if (is_array($response)) { @@ -302,6 +283,9 @@ public function addTrackAction() $this->getResponse()->setBody($response); } + /** + * Remove tracking number from shipment + */ public function removeTrackAction() { $trackId = $this->getRequest()->getParam('track_id'); @@ -314,25 +298,22 @@ public function removeTrackAction() $this->loadLayout(); $response = $this->getLayout()->getBlock('shipment_tracking')->toHtml(); - } - else { + } else { $response = array( 'error' => true, - 'message' => $this->__('Can not initialize shipment for delete tracking number.'), + 'message' => $this->__('Cannot initialize shipment for delete tracking number.'), ); } - } - catch (Exception $e) { + } catch (Exception $e) { $response = array( 'error' => true, - 'message' => $this->__('Can not delete tracking number.'), + 'message' => $this->__('Cannot delete tracking number.'), ); } - } - else { + } else { $response = array( 'error' => true, - 'message' => $this->__('Can not load track with retrieving identifier.'), + 'message' => $this->__('Cannot load track with retrieving identifier.'), ); } if (is_array($response)) { @@ -341,6 +322,9 @@ public function removeTrackAction() $this->getResponse()->setBody($response); } + /** + * View shipment tracking information + */ public function viewTrackAction() { $trackId = $this->getRequest()->getParam('track_id'); @@ -349,18 +333,16 @@ public function viewTrackAction() if ($track->getId()) { try { $response = $track->getNumberDetail(); - } - catch (Exception $e) { + } catch (Exception $e) { $response = array( 'error' => true, - 'message' => $this->__('Can not retrieve tracking number detail.'), + 'message' => $this->__('Cannot retrieve tracking number detail.'), ); } - } - else { + } else { $response = array( 'error' => true, - 'message' => $this->__('Can not load track with retrieving identifier.'), + 'message' => $this->__('Cannot load track with retrieving identifier.'), ); } @@ -374,8 +356,7 @@ public function viewTrackAction() $block->setTrackingInfo($response); $this->getResponse()->setBody($block->toHtml()); - } - else { + } else { if (is_array($response)) { $response = Mage::helper('core')->jsonEncode($response); } @@ -384,6 +365,9 @@ public function viewTrackAction() } } + /** + * Add comment to shipment history + */ public function addCommentAction() { try { @@ -393,38 +377,40 @@ public function addCommentAction() ); $data = $this->getRequest()->getPost('comment'); if (empty($data['comment'])) { - Mage::throwException($this->__('Comment text field can not be empty.')); + Mage::throwException($this->__('Comment text field cannot be empty.')); } $shipment = $this->_initShipment(); $shipment->addComment($data['comment'], isset($data['is_customer_notified'])); $shipment->sendUpdateEmail(!empty($data['is_customer_notified']), $data['comment']); + $shipment->_hasDataChanges = true; $shipment->save(); $this->loadLayout(); $response = $this->getLayout()->getBlock('shipment_comments')->toHtml(); - } - catch (Mage_Core_Exception $e) { + } catch (Mage_Core_Exception $e) { $response = array( 'error' => true, 'message' => $e->getMessage() ); $response = Mage::helper('core')->jsonEncode($response); - } - catch (Exception $e) { + } catch (Exception $e) { $response = array( 'error' => true, - 'message' => $this->__('Can not add new comment.') + 'message' => $this->__('Cannot add new comment.') ); $response = Mage::helper('core')->jsonEncode($response); } $this->getResponse()->setBody($response); } + + /** * Decides if we need to create dummy shipment item or not * for eaxample we don't need create dummy parent if all * children are not in process * + * @deprecated after 1.4, Mage_Sales_Model_Service_Order used * @param Mage_Sales_Model_Order_Item $item * @param array $qtys * @return bool diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/View/GiftmessageController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/View/GiftmessageController.php index fb92971e03..be29ef58b7 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/View/GiftmessageController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/View/GiftmessageController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -52,7 +52,7 @@ public function saveAction() } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addError(Mage::helper('giftmessage')->__('Error while saving gift message')); + $this->_getSession()->addError(Mage::helper('giftmessage')->__('An error occurred while saving the gift message.')); } if($this->getRequest()->getParam('type')=='order_item') { @@ -61,7 +61,7 @@ public function saveAction() ); } else { $this->getResponse()->setBody( - Mage::helper('giftmessage')->__('Gift message has been successfully saved') + Mage::helper('giftmessage')->__('The gift message has been saved.') ); } } diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php index 25c85e1504..5fed284738 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -92,7 +92,6 @@ public function indexAction() $this->_title($this->__('Sales'))->_title($this->__('Orders')); $this->_initAction() - ->_addContent($this->getLayout()->createBlock('adminhtml/sales_order')) ->renderLayout(); } @@ -101,10 +100,8 @@ public function indexAction() */ public function gridAction() { - $this->loadLayout(); - $this->getResponse()->setBody( - $this->getLayout()->createBlock('adminhtml/sales_order_grid')->toHtml() - ); + $this->loadLayout(false); + $this->renderLayout(); } /** @@ -118,7 +115,7 @@ public function viewAction() $this->_initAction(); $this->_title(sprintf("#%s", $order->getRealOrderId())); - + $this->renderLayout(); } } @@ -131,11 +128,11 @@ public function emailAction() if ($order = $this->_initOrder()) { try { $order->sendNewOrderEmail(); - $this->_getSession()->addSuccess($this->__('Order email has been successfully sent.')); + $this->_getSession()->addSuccess($this->__('The order email has been sent.')); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addError($this->__('Failed to send order email.')); + $this->_getSession()->addError($this->__('Failed to send the order email.')); Mage::logException($e); } } @@ -151,14 +148,14 @@ public function cancelAction() $order->cancel() ->save(); $this->_getSession()->addSuccess( - $this->__('Order was successfully cancelled.') + $this->__('The order has been cancelled.') ); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addError($this->__('Order was not cancelled.')); + $this->_getSession()->addError($this->__('The order has not been cancelled.')); Mage::logException($e); } $this->_redirect('*/sales_order/view', array('order_id' => $order->getId())); @@ -175,14 +172,14 @@ public function holdAction() $order->hold() ->save(); $this->_getSession()->addSuccess( - $this->__('Order was successfully put on hold.') + $this->__('The order has been put on hold.') ); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addError($this->__('Order was not put on hold.')); + $this->_getSession()->addError($this->__('The order was not put on hold.')); } $this->_redirect('*/sales_order/view', array('order_id' => $order->getId())); } @@ -198,19 +195,59 @@ public function unholdAction() $order->unhold() ->save(); $this->_getSession()->addSuccess( - $this->__('Order was successfully released from holding status.') + $this->__('The order has been released from holding status.') ); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addError($this->__('Order was not unholded.')); + $this->_getSession()->addError($this->__('The order was not unheld.')); } $this->_redirect('*/sales_order/view', array('order_id' => $order->getId())); } } + /** + * Manage payment state + * + * Either denies or approves a payment that is in "review" state + */ + public function reviewPaymentAction() + { + try { + if (!$order = $this->_initOrder()) { + return; + } + $action = $this->getRequest()->getParam('action', ''); + switch ($action) { + case 'accept': + $order->getPayment()->accept(); + $message = $this->__('The payment has been accepted.'); + break; + case 'deny': + $order->getPayment()->deny(); + $message = $this->__('The payment has been denied.'); + break; + case 'update': + $order->getPayment() + ->registerPaymentReviewAction(Mage_Sales_Model_Order_Payment::REVIEW_ACTION_UPDATE, true); + $message = $this->__('Payment update has been made.'); + break; + default: + throw new Exception(sprintf('Action "%s" is not supported.', $action)); + } + $order->save(); + $this->_getSession()->addSuccess($message); + } catch (Mage_Core_Exception $e) { + $this->_getSession()->addError($e->getMessage()); + } catch (Exception $e) { + $this->_getSession()->addError($this->__('Failed to update the payment.')); + Mage::logException($e); + } + $this->_redirect('*/sales_order/view', array('order_id' => $order->getId())); + } + /** * Add order comment action */ @@ -221,7 +258,12 @@ public function addCommentAction() $response = false; $data = $this->getRequest()->getPost('history'); $notify = isset($data['is_customer_notified']) ? $data['is_customer_notified'] : false; - $order->addStatusToHistory($data['status'], $data['comment'], $notify); + $visible = isset($data['is_visible_on_front']) ? $data['is_visible_on_front'] : false; + + $order->addStatusHistoryComment($data['comment'], $data['status']) + ->setIsVisibleOnFront($visible) + ->setIsCustomerNotified($notify); + $comment = trim(strip_tags($data['comment'])); $order->save(); @@ -239,7 +281,7 @@ public function addCommentAction() catch (Exception $e) { $response = array( 'error' => true, - 'message' => $this->__('Can not add order history.') + 'message' => $this->__('Cannot add order history.') ); } if (is_array($response)) { @@ -313,13 +355,13 @@ public function massCancelAction() } if ($countNonCancelOrder) { if ($countCancelOrder) { - $this->_getSession()->addError($this->__('%s order(s) can not be canceled', $countNonCancelOrder)); + $this->_getSession()->addError($this->__('%s order(s) cannot be canceled', $countNonCancelOrder)); } else { - $this->_getSession()->addError($this->__('Order(s) can not be canceled')); + $this->_getSession()->addError($this->__('The order(s) cannot be canceled')); } } if ($countCancelOrder) { - $this->_getSession()->addSuccess($this->__('%s order(s) successfully canceled', $countCancelOrder)); + $this->_getSession()->addSuccess($this->__('%s order(s) have been canceled.', $countCancelOrder)); } $this->_redirect('*/*/'); } @@ -344,13 +386,13 @@ public function massHoldAction() } if ($countNonHoldOrder) { if ($countHoldOrder) { - $this->_getSession()->addError($this->__('%s order(s) not put on hold', $countNonHoldOrder)); + $this->_getSession()->addError($this->__('%s order(s) were not put on hold.', $countNonHoldOrder)); } else { - $this->_getSession()->addError($this->__('No order(s) put on hold')); + $this->_getSession()->addError($this->__('No order(s) were put on hold.')); } } if ($countHoldOrder) { - $this->_getSession()->addSuccess($this->__('%s order(s) successfully put on hold', $countHoldOrder)); + $this->_getSession()->addSuccess($this->__('%s order(s) have been put on hold.', $countHoldOrder)); } $this->_redirect('*/*/'); @@ -377,13 +419,13 @@ public function massUnholdAction() } if ($countNonUnholdOrder) { if ($countUnholdOrder) { - $this->_getSession()->addError($this->__('%s order(s) not released from holding status', $countNonUnholdOrder)); + $this->_getSession()->addError($this->__('%s order(s) were not released from holding status.', $countNonUnholdOrder)); } else { - $this->_getSession()->addError($this->__('No order(s) released from holding status')); + $this->_getSession()->addError($this->__('No order(s) were released from holding status.')); } } if ($countUnholdOrder) { - $this->_getSession()->addSuccess($this->__('%s order(s) successfully released from holding status', $countUnholdOrder)); + $this->_getSession()->addSuccess($this->__('%s order(s) have been released from holding status.', $countUnholdOrder)); } $this->_redirect('*/*/'); } @@ -410,10 +452,7 @@ public function pdfinvoicesAction(){ $flag = false; if (!empty($orderIds)) { foreach ($orderIds as $orderId) { - $order = Mage::getModel('sales/order')->load($orderId); - $invoices = Mage::getResourceModel('sales/order_invoice_collection') - ->addAttributeToSelect('*') ->setOrderFilter($orderId) ->load(); if ($invoices->getSize() > 0) { @@ -429,7 +468,7 @@ public function pdfinvoicesAction(){ if ($flag) { return $this->_prepareDownloadResponse('invoice'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s').'.pdf', $pdf->render(), 'application/pdf'); } else { - $this->_getSession()->addError($this->__('There are no printable documents related to selected orders')); + $this->_getSession()->addError($this->__('There are no printable documents related to selected orders.')); $this->_redirect('*/*/'); } @@ -443,9 +482,7 @@ public function pdfshipmentsAction(){ $flag = false; if (!empty($orderIds)) { foreach ($orderIds as $orderId) { - $order = Mage::getModel('sales/order')->load($orderId); $shipments = Mage::getResourceModel('sales/order_shipment_collection') - ->addAttributeToSelect('*') ->setOrderFilter($orderId) ->load(); if ($shipments->getSize()) { @@ -461,7 +498,7 @@ public function pdfshipmentsAction(){ if ($flag) { return $this->_prepareDownloadResponse('packingslip'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s').'.pdf', $pdf->render(), 'application/pdf'); } else { - $this->_getSession()->addError($this->__('There are no printable documents related to selected orders')); + $this->_getSession()->addError($this->__('There are no printable documents related to selected orders.')); $this->_redirect('*/*/'); } } @@ -473,10 +510,7 @@ public function pdfcreditmemosAction(){ $flag = false; if (!empty($orderIds)) { foreach ($orderIds as $orderId) { - $order = Mage::getModel('sales/order')->load($orderId); - $creditmemos = Mage::getResourceModel('sales/order_creditmemo_collection') - ->addAttributeToSelect('*') ->setOrderFilter($orderId) ->load(); if ($creditmemos->getSize()) { @@ -492,7 +526,7 @@ public function pdfcreditmemosAction(){ if ($flag) { return $this->_prepareDownloadResponse('creditmemo'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s').'.pdf', $pdf->render(), 'application/pdf'); } else { - $this->_getSession()->addError($this->__('There are no printable documents related to selected orders')); + $this->_getSession()->addError($this->__('There are no printable documents related to selected orders.')); $this->_redirect('*/*/'); } } @@ -504,10 +538,7 @@ public function pdfdocsAction(){ $flag = false; if (!empty($orderIds)) { foreach ($orderIds as $orderId) { - $order = Mage::getModel('sales/order')->load($orderId); - $invoices = Mage::getResourceModel('sales/order_invoice_collection') - ->addAttributeToSelect('*') ->setOrderFilter($orderId) ->load(); if ($invoices->getSize()){ @@ -521,7 +552,6 @@ public function pdfdocsAction(){ } $shipments = Mage::getResourceModel('sales/order_shipment_collection') - ->addAttributeToSelect('*') ->setOrderFilter($orderId) ->load(); if ($shipments->getSize()){ @@ -535,7 +565,6 @@ public function pdfdocsAction(){ } $creditmemos = Mage::getResourceModel('sales/order_creditmemo_collection') - ->addAttributeToSelect('*') ->setOrderFilter($orderId) ->load(); if ($creditmemos->getSize()) { @@ -551,7 +580,7 @@ public function pdfdocsAction(){ if ($flag) { return $this->_prepareDownloadResponse('docs'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s').'.pdf', $pdf->render(), 'application/pdf'); } else { - $this->_getSession()->addError($this->__('There are no printable documents related to selected orders')); + $this->_getSession()->addError($this->__('There are no printable documents related to selected orders.')); $this->_redirect('*/*/'); } } @@ -571,7 +600,7 @@ public function voidPaymentAction() new Varien_Object() // workaround for backwards compatibility ); $order->save(); - $this->_getSession()->addSuccess($this->__('Payment has been voided successfully.')); + $this->_getSession()->addSuccess($this->__('The payment has been voided.')); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { @@ -588,4 +617,35 @@ protected function _isAllowed() } return Mage::getSingleton('admin/session')->isAllowed('sales/order'); } + + /** + * Export order grid to CSV format + */ + public function exportCsvAction() + { + $fileName = 'orders.csv'; + $grid = $this->getLayout()->createBlock('adminhtml/sales_order_grid'); + $this->_prepareDownloadResponse($fileName, $grid->getCsvFile()); + } + + /** + * Export order grid to Excel XML format + */ + public function exportExcelAction() + { + $fileName = 'orders.xml'; + $grid = $this->getLayout()->createBlock('adminhtml/sales_order_grid'); + $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName)); + } + + /** + * Order transactions grid ajax action + * + */ + public function transactionsAction() + { + $this->_initOrder(); + $this->loadLayout(false); + $this->renderLayout(); + } } diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Recurring/ProfileController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Recurring/ProfileController.php new file mode 100644 index 0000000000..5482571fc4 --- /dev/null +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Recurring/ProfileController.php @@ -0,0 +1,176 @@ +_title(Mage::helper('sales')->__('Sales'))->_title(Mage::helper('sales')->__('Recurring Profiles')) + ->loadLayout() + ->_setActiveMenu('sales/recurring_profile') + ->renderLayout(); + return $this; + } + + /** + * View recurring profile detales + */ + public function viewAction() + { + try { + $this->_title(Mage::helper('sales')->__('Sales'))->_title(Mage::helper('sales')->__('Recurring Profiles')); + $profile = $this->_initProfile(); + $this->loadLayout() + ->_setActiveMenu('sales/recurring_profile') + ->_title(Mage::helper('sales')->__('Profile #%s', $profile->getReferenceId())) + ->renderLayout() + ; + return; + } catch (Mage_Core_Exception $e) { + $this->_getSession()->addError($e->getMessage()); + } catch (Exception $e) { + Mage::logException($e); + } + $this->_redirect('*/*/'); + } + + /** + * Profiles ajax grid + */ + public function gridAction() + { + try { + $this->loadLayout()->renderLayout(); + return; + } catch (Mage_Core_Exception $e) { + $this->_getSession()->addError($e->getMessage()); + } catch (Exception $e) { + Mage::logException($e); + } + $this->_redirect('*/*/'); + } + + /** + * Profile orders ajax grid + */ + public function ordersAction() + { + try { + $this->_initProfile(); + $this->loadLayout()->renderLayout(); + } catch (Exception $e) { + Mage::logException($e); + $this->norouteAction(); + } + } + + /** + * Profile state updater action + */ + public function updateStateAction() + { + $profile = null; + try { + $profile = $this->_initProfile(); + + switch ($this->getRequest()->getParam('action')) { + case 'cancel': + $profile->cancel(); + break; + case 'suspend': + $profile->suspend(); + break; + case 'activate': + $profile->activate(); + break; + } + $this->_getSession()->addSuccess(Mage::helper('sales')->__('The profile state has been updated.')); + } catch (Mage_Core_Exception $e) { + $this->_getSession()->addError($e->getMessage()); + } catch (Exception $e) { + $this->_getSession()->addError(Mage::helper('sales')->__('Failed to update the profile.')); + Mage::logException($e); + } + if ($profile) { + $this->_redirect('*/*/view', array('profile' => $profile->getId())); + } else { + $this->_redirect('*/*/'); + } + } + + /** + * Profile information updater action + */ + public function updateProfileAction() + { + $profile = null; + try { + $profile = $this->_initProfile(); + $profile->fetchUpdate(); + if ($profile->hasDataChanges()) { + $profile->save(); + $this->_getSession()->addSuccess($this->__('The profile has been updated.')); + } else { + $this->_getSession()->addNotice($this->__('The profile has no changes.')); + } + } catch (Mage_Core_Exception $e) { + $this->_getSession()->addError($e->getMessage()); + } catch (Exception $e) { + $this->_getSession()->addError($this->__('Failed to update the profile.')); + Mage::logException($e); + } + if ($profile) { + $this->_redirect('*/*/view', array('profile' => $profile->getId())); + } else { + $this->_redirect('*/*/'); + } + } + + /** + * Load/set profile + * + * @return Mage_Sales_Model_Recurring_Profile + */ + protected function _initProfile() + { + $profile = Mage::getModel('sales/recurring_profile')->load($this->getRequest()->getParam('profile')); + if (!$profile->getId()) { + Mage::throwException($this->__('Specified profile does not exist.')); + } + Mage::register('current_recurring_profile', $profile); + return $profile; + } +} diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/ShipmentController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/ShipmentController.php index 818fcad9f6..d363dcf57b 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Sales/ShipmentController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/ShipmentController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -31,5 +31,23 @@ */ class Mage_Adminhtml_Sales_ShipmentController extends Mage_Adminhtml_Controller_Sales_Shipment { + /** + * Export shipment grid to CSV format + */ + public function exportCsvAction() + { + $fileName = 'shipments.csv'; + $grid = $this->getLayout()->createBlock('adminhtml/sales_shipment_grid'); + $this->_prepareDownloadResponse($fileName, $grid->getCsvFile()); + } + /** + * Export shipment grid to Excel XML format + */ + public function exportExcelAction() + { + $fileName = 'shipments.xml'; + $grid = $this->getLayout()->createBlock('adminhtml/sales_shipment_grid'); + $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName)); + } } diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/TransactionsController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/TransactionsController.php new file mode 100644 index 0000000000..62671b617b --- /dev/null +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/TransactionsController.php @@ -0,0 +1,140 @@ + + */ +class Mage_Adminhtml_Sales_TransactionsController extends Mage_Adminhtml_Controller_Action +{ + /** + * Initialize payment transaction model + * + * @return Mage_Sales_Model_Order_Payment_Transaction | bool + */ + protected function _initTransaction() + { + $txn = Mage::getModel('sales/order_payment_transaction')->load( + $this->getRequest()->getParam('txn_id') + ); + + if (!$txn->getId()) { + $this->_getSession()->addError($this->__('Wrong transaction ID specified.')); + $this->_redirect('*/*/'); + $this->setFlag('', self::FLAG_NO_DISPATCH, true); + return false; + } + $orderId = $this->getRequest()->getParam('order_id'); + if ($orderId) { + $txn->setOrderUrl( + $this->getUrl('*/sales_order/view', array('order_id' => $orderId)) + ); + } + + Mage::register('current_transaction', $txn); + return $txn; + } + + public function indexAction() + { + $this->_title($this->__('Sales')) + ->_title($this->__('Transactions')); + + $this->loadLayout() + ->_setActiveMenu('sales/transactions') + ->renderLayout(); + } + + /** + * Ajax grid action + */ + public function gridAction() + { + $this->loadLayout(false); + $this->renderLayout(); + } + + /** + * View Transaction Details action + */ + public function viewAction() + { + $txn = $this->_initTransaction(); + if (!$txn) { + return; + } + $this->_title($this->__('Sales')) + ->_title($this->__('Transactions')) + ->_title(sprintf("#%s", $txn->getTxnId())); + + $this->loadLayout() + ->_setActiveMenu('sales/transactions') + ->renderLayout(); + } + + /** + * Fetch transaction details action + */ + public function fetchAction() + { + $txn = $this->_initTransaction(); + if (!$txn) { + return; + } + try { + $txn->getOrderPaymentObject() + ->setOrder($txn->getOrder()) + ->importTransactionInfo($txn); + $txn->save(); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml') + ->__('The transaction details have been updated.')); + } catch (Mage_Core_Exception $e) { + Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); + } catch (Exception $e) { + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml') + ->__('Unable to update transaction details.')); + Mage::logException($e); + } + $this->_redirect('*/sales_transactions/view', array('_current' => true)); + } + + /** + * Check currently called action by permissions for current user + * + */ + protected function _isAllowed() + { + switch ($this->getRequest()->getActionName()) { + case 'fetch': + return Mage::getSingleton('admin/session')->isAllowed('sales/transactions/fetch'); + break; + default: + return Mage::getSingleton('admin/session')->isAllowed('sales/transactions'); + break; + } + } +} diff --git a/app/code/core/Mage/Adminhtml/controllers/SalesController.php b/app/code/core/Mage/Adminhtml/controllers/SalesController.php index c2fde89164..481564d744 100644 --- a/app/code/core/Mage/Adminhtml/controllers/SalesController.php +++ b/app/code/core/Mage/Adminhtml/controllers/SalesController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/SitemapController.php b/app/code/core/Mage/Adminhtml/controllers/SitemapController.php index e81c562a65..a05df895de 100644 --- a/app/code/core/Mage/Adminhtml/controllers/SitemapController.php +++ b/app/code/core/Mage/Adminhtml/controllers/SitemapController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -85,7 +85,7 @@ public function editAction() if ($id) { $model->load($id); if (! $model->getId()) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sitemap')->__('This sitemap no longer exists')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sitemap')->__('This sitemap no longer exists.')); $this->_redirect('*/*/'); return; } @@ -135,7 +135,7 @@ public function saveAction() // save the data $model->save(); // display success message - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sitemap')->__('Sitemap was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sitemap')->__('The sitemap has been saved.')); // clear previously saved data from session Mage::getSingleton('adminhtml/session')->setFormData(false); @@ -188,7 +188,7 @@ public function deleteAction() } $model->delete(); // display success message - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sitemap')->__('Sitemap was successfully deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sitemap')->__('The sitemap has been deleted.')); // go to grid $this->_redirect('*/*/'); return; @@ -202,7 +202,7 @@ public function deleteAction() } } // display error message - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sitemap')->__('Unable to find a sitemap to delete')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sitemap')->__('Unable to find a sitemap to delete.')); // go to grid $this->_redirect('*/*/'); } @@ -222,17 +222,17 @@ public function generateAction() try { $sitemap->generateXml(); - $this->_getSession()->addSuccess(Mage::helper('sitemap')->__('Sitemap "%s" has been successfully generated', $sitemap->getSitemapFilename())); + $this->_getSession()->addSuccess(Mage::helper('sitemap')->__('The sitemap "%s" has been generated.', $sitemap->getSitemapFilename())); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('sitemap')->__('Unable to generate a sitemap')); + $this->_getSession()->addException($e, Mage::helper('sitemap')->__('Unable to generate the sitemap.')); } } else { - $this->_getSession()->addError(Mage::helper('sitemap')->__('Unable to find a sitemap to generate')); + $this->_getSession()->addError(Mage::helper('sitemap')->__('Unable to find a sitemap to generate.')); } // go to grid diff --git a/app/code/core/Mage/Adminhtml/controllers/SurveyController.php b/app/code/core/Mage/Adminhtml/controllers/SurveyController.php index 4d4147eb9c..6b72cca6f1 100644 --- a/app/code/core/Mage/Adminhtml/controllers/SurveyController.php +++ b/app/code/core/Mage/Adminhtml/controllers/SurveyController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/System/AccountController.php b/app/code/core/Mage/Adminhtml/controllers/System/AccountController.php index dfe92f54f2..8b69868c7d 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/AccountController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/AccountController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -78,13 +78,13 @@ public function saveAction() try { $user->save(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Account successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('The account has been saved.')); } catch (Mage_Core_Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); } catch (Exception $e) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Error while saving account. Please try again later')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('An error occurred while saving account.')); } $this->getResponse()->setRedirect($this->getUrl("*/*/")); } diff --git a/app/code/core/Mage/Adminhtml/controllers/System/BackupController.php b/app/code/core/Mage/Adminhtml/controllers/System/BackupController.php index 8c1d6d8714..551c45c3bf 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/BackupController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/BackupController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -79,10 +79,10 @@ public function createAction() Mage::register('backup_model', $backup); $backupDb->createBackup($backup); - $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__('Backup successfully created')); + $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__('The backup has been created.')); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('Error while create backup. Please try again later')); + $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('An error occurred while creating the backup.')); } $this->_redirect('*/*'); } @@ -126,7 +126,7 @@ public function deleteAction() Mage::register('backup_model', $backup); - $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__('Backup record was deleted')); + $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__('Backup record was deleted.')); } catch (Exception $e) { // Nothing diff --git a/app/code/core/Mage/Adminhtml/controllers/System/CacheController.php b/app/code/core/Mage/Adminhtml/controllers/System/CacheController.php index fdb0567252..5a9ade092a 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/CacheController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/CacheController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -109,10 +109,10 @@ public function saveAction() if ($this->getRequest()->getPost('jscss_action')) { if (Mage::getDesign()->cleanMergedJsCss()) { $this->_getSession()->addSuccess( - Mage::helper('adminhtml')->__('JavaScript/CSS cache has been cleared successfully.') + Mage::helper('adminhtml')->__('The JavaScript/CSS cache has been cleared.') ); } else { - $this->_getSession()->addError(Mage::helper('adminhtml')->__('Failed to clear JavaScript/CSS cache.')); + $this->_getSession()->addError(Mage::helper('adminhtml')->__('Failed to clear the JavaScript/CSS cache.')); } } @@ -126,14 +126,14 @@ public function saveAction() try { Mage::getSingleton('catalog/url')->refreshRewrites(); $this->_getSession()->addSuccess( - Mage::helper('adminhtml')->__('Catalog Rewrites were refreshed successfully') + Mage::helper('adminhtml')->__('The Catalog Rewrites were refreshed.') ); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('Error while refreshed Catalog Rewrites. Please try again later')); + $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('An error occurred while refreshing the Catalog Rewrites.')); } break; @@ -141,14 +141,14 @@ public function saveAction() try { Mage::getModel('catalog/product_image')->clearCache(); $this->_getSession()->addSuccess( - Mage::helper('adminhtml')->__('Image cache was cleared successfully') + Mage::helper('adminhtml')->__('The image cache was cleared.') ); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('Error while cleared Image cache. Please try again later')); + $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('An error occurred while clearing the image cache.')); } break; @@ -163,14 +163,14 @@ public function saveAction() $flag->setState(Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_QUEUED)->save(); Mage::getSingleton('catalogindex/indexer')->plainReindex(); $this->_getSession()->addSuccess( - Mage::helper('adminhtml')->__('Layered Navigation Indices were refreshed successfully') + Mage::helper('adminhtml')->__('Layered Navigation Indices were refreshed.') ); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('Error while refreshed Layered Navigation Indices. Please try again later')); + $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('An error occurred while refreshing the Layered Navigation indices.')); } break; @@ -181,20 +181,20 @@ public function saveAction() case Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_QUEUED: $flag->delete(); $this->_getSession()->addSuccess( - Mage::helper('adminhtml')->__('Layered Navigation indexing queue cancelled') + Mage::helper('adminhtml')->__('The Layered Navigation indexing queue has been canceled.') ); break; case Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_RUNNING: $kill = Mage::getModel('catalogindex/catalog_index_kill_flag')->loadSelf(); $kill->setFlagData($flag->getFlagData())->save(); $this->_getSession()->addSuccess( - Mage::helper('adminhtml')->__('Layered Navigation process queued to be killed') + Mage::helper('adminhtml')->__('The Layered Navigation process has been queued to be killed.') ); break; default: $flag->setState(Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_QUEUED)->save(); $this->_getSession()->addSuccess( - Mage::helper('adminhtml')->__('Layered Navigation indexing queued') + Mage::helper('adminhtml')->__('The Layered Navigation indexing has been queued.') ); break; } @@ -203,72 +203,72 @@ public function saveAction() $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('Error while refreshed Layered Navigation Indices. Please try again later')); + $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('An error occurred while refreshing the Layered Navigation indices.')); } break; case 'rebuild_search_index': try { Mage::getSingleton('catalogsearch/fulltext')->rebuildIndex(); - $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__('Search Index was rebuilt successfully')); + $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__('The search index has been rebuilt.')); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('Search Index rebuild error. Please try again later')); + $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('An error occurred while rebuilding the search index.')); } break; case 'rebuild_inventory_stock_status': try { Mage::getSingleton('cataloginventory/stock_status')->rebuild(); - $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__('CatalogInventory Stock Status was rebuilt successfully')); + $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__('The CatalogInventory Stock Status has been rebuilt.')); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('CatalogInventory Stock Status rebuild error. Please try again later')); + $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('An error occurred while rebuilding the CatalogInventory Stock Status.')); } break; case 'rebuild_catalog_index': try { Mage::getSingleton('catalog/index')->rebuild(); - $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__('Catalog Index was rebuilt successfully')); + $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__('The catalog index has been rebuilt.')); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('Catalog Index rebuild error. Please try again later')); + $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('An error occurred while rebuilding the catalog index.')); } break; case 'rebuild_flat_catalog_category': try { Mage::getResourceModel('catalog/category_flat')->rebuild(); - $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__('Flat Catalog Category was rebuilt successfully')); + $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__('The flat catalog category has been rebuilt.')); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('Flat Catalog Category rebuild error')); + $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('An error occurred while rebuilding the flat catalog category.')); } break; case 'rebuild_flat_catalog_product': try { Mage::getResourceModel('catalog/product_flat_indexer')->rebuild(); - $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__('Flat Catalog Product was rebuilt successfully')); + $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__('The Flat Catalog Product was rebuilt')); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('Flat Catalog Product rebuild error. Please try again later')); + $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('An error occurred while rebuilding the flat product catalog.')); } break; @@ -285,14 +285,14 @@ public function refreshCatalogRewritesAction() try { Mage::getSingleton('catalog/url')->refreshRewrites(); $this->_getSession()->addSuccess( - Mage::helper('adminhtml')->__('Catalog Rewrites was refreshed successfully') + Mage::helper('adminhtml')->__('The catalog rewrites have been refreshed.') ); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('Error while refreshed Catalog Rewrites. Please try again later')); + $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('An error occurred while refreshing the catalog rewrites.')); } $this->_redirect('*/*'); @@ -303,14 +303,14 @@ public function clearImagesCacheAction() try { Mage::getModel('catalog/product_image')->clearCache(); $this->_getSession()->addSuccess( - Mage::helper('adminhtml')->__('Image cache was cleared successfully') + Mage::helper('adminhtml')->__('The image cache was cleared.') ); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('Error while cleared Image cache. Please try again later')); + $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('An error occurred while clearing the image cache.')); } $this->_redirect('*/*'); @@ -321,14 +321,14 @@ public function refreshLayeredNavigationAction() try { Mage::getSingleton('catalogindex/indexer')->plainReindex(); $this->_getSession()->addSuccess( - Mage::helper('adminhtml')->__('Layered Navigation Indices was refreshed successfully') + Mage::helper('adminhtml')->__('The Layered Navigation indices were refreshed.') ); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('Error while refreshed Layered Navigation Indices. Please try again later')); + $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('An error occurred while refreshing the layered navigation indices.')); } $this->_redirect('*/*'); diff --git a/app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php b/app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php index 078295c86d..28e30a7b8d 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -57,7 +57,6 @@ public function editAction() $configFields = Mage::getSingleton('adminhtml/config'); - $sections = $configFields->getSections($current); $section = $sections->$current; $hasChildren = $configFields->hasChildren($section, $website, $store); @@ -69,7 +68,7 @@ public function editAction() $this->_setActiveMenu('system/config'); - $this->_addBreadcrumb(Mage::helper('adminhtml')->__('System'), Mage::helper('adminhtml')->__('System'), $this->getUrl('*/system')); + $this->_addBreadcrumb(Mage::helper('adminhtml')->__('System'), Mage::helper('adminhtml')->__('System'), $this->getUrl('*/system')); $this->getLayout()->getBlock('left') ->append($this->getLayout()->createBlock('adminhtml/system_config_tabs')->initTabs()); @@ -96,7 +95,6 @@ public function saveAction() $groups = $this->getRequest()->getPost('groups'); - if (isset($_FILES['groups']['name']) && is_array($_FILES['groups']['name'])) { /** * Carefully merge $_FILES and $_POST information @@ -134,12 +132,11 @@ public function saveAction() Mage::getConfig()->reinit(); Mage::app()->reinitStores(); - // website and store codes can be used in event implementation, so set them as well Mage::dispatchEvent("admin_system_config_changed_section_{$section}", array('website' => $website, 'store' => $store) ); - $session->addSuccess(Mage::helper('adminhtml')->__('Configuration successfully saved')); + $session->addSuccess(Mage::helper('adminhtml')->__('The configuration has been saved.')); } catch (Mage_Core_Exception $e) { foreach(explode("\n", $e->getMessage()) as $message) { @@ -147,7 +144,7 @@ public function saveAction() } } catch (Exception $e) { - $session->addException($e, Mage::helper('adminhtml')->__('Error while saving this configuration: '.$e->getMessage())); + $session->addException($e, Mage::helper('adminhtml')->__('An error occurred while saving this configuration:').' '.$e->getMessage()); } $this->_saveState($this->getRequest()->getPost('config_state')); diff --git a/app/code/core/Mage/Adminhtml/controllers/System/Convert/GuiController.php b/app/code/core/Mage/Adminhtml/controllers/System/Convert/GuiController.php index e85a454e16..3f7b96366e 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/Convert/GuiController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/Convert/GuiController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php b/app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php index 05d1724a54..dcb84c5e58 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php @@ -149,7 +149,7 @@ public function deleteAction() if ($profile->getId()) { try { $profile->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Profile was deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('The profile has been deleted.')); } catch (Exception $e){ Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); @@ -177,7 +177,7 @@ public function saveAction() try { $profile->save(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Profile was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('The profile has been saved.')); } catch (Exception $e){ Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); @@ -192,7 +192,7 @@ public function saveAction() } } else { - Mage::getSingleton('adminhtml/session')->addError($this->__('Invalid POST data (please check post_max_size and upload_max_filesize settings in you php.ini file)')); + Mage::getSingleton('adminhtml/session')->addError($this->__('Invalid POST data (please check post_max_size and upload_max_filesize settings in your php.ini file).')); $this->_redirect('*/*'); } } @@ -247,7 +247,7 @@ public function batchRunAction() foreach ($rowIds as $importId) { $batchImportModel->load($importId); if (!$batchImportModel->getId()) { - $errors[] = Mage::helper('dataflow')->__('Skip undefined row'); + $errors[] = Mage::helper('dataflow')->__('Skip undefined row.'); continue; } @@ -285,7 +285,7 @@ public function batchFinishAction() $result['error'] = $e->getMessage(); } catch (Exception $e) { - $result['error'] = Mage::helper('adminhtml')->__('Error while finished process. Please refresh cache'); + $result['error'] = Mage::helper('adminhtml')->__('An error occurred while finishing process. Please refresh the cache'); } $batchModel->delete(); $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result)); diff --git a/app/code/core/Mage/Adminhtml/controllers/System/CurrencyController.php b/app/code/core/Mage/Adminhtml/controllers/System/CurrencyController.php index 2b7153506e..12ed01acb6 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/CurrencyController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/CurrencyController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -80,9 +80,9 @@ public function fetchRatesAction() foreach ($errors as $error) { Mage::getSingleton('adminhtml/session')->addWarning($error); } - Mage::getSingleton('adminhtml/session')->addWarning(Mage::helper('adminhtml')->__('All possible rates were fetched, click on "Save" to apply')); + Mage::getSingleton('adminhtml/session')->addWarning(Mage::helper('adminhtml')->__('All possible rates were fetched, please click on "Save" to apply')); } else { - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('All rates were fetched, click on "Save" to apply')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('All rates were fetched, please click on "Save" to apply')); } Mage::getSingleton('adminhtml/session')->setRates($rates); @@ -109,7 +109,7 @@ public function saveRatesAction() } Mage::getModel('directory/currency')->saveRates($data); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('All valid rates successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('All valid rates have been saved.')); } catch (Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); } diff --git a/app/code/core/Mage/Adminhtml/controllers/System/DesignController.php b/app/code/core/Mage/Adminhtml/controllers/System/DesignController.php index c4e746b550..3dca58ecc8 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/DesignController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/DesignController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -89,7 +89,7 @@ public function saveAction() try { $design->save(); - Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Design change saved')); + Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The design change has been saved.')); } catch (Exception $e){ Mage::getSingleton('adminhtml/session') ->addError($e->getMessage()) @@ -111,13 +111,13 @@ public function deleteAction() $design->delete(); Mage::getSingleton('adminhtml/session') - ->addSuccess($this->__('Design change deleted')); + ->addSuccess($this->__('The design change has been deleted.')); } catch (Mage_Exception $e) { Mage::getSingleton('adminhtml/session') ->addError($e->getMessage()); } catch (Exception $e) { Mage::getSingleton('adminhtml/session') - ->addException($e, $this->__("Can't delete design change")); + ->addException($e, $this->__("Cannot delete the design change.")); } } $this->getResponse()->setRedirect($this->getUrl('*/*/')); diff --git a/app/code/core/Mage/Adminhtml/controllers/System/Email/TemplateController.php b/app/code/core/Mage/Adminhtml/controllers/System/Email/TemplateController.php index 25b3ef39cc..eaae2e75c7 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/Email/TemplateController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/Email/TemplateController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -96,7 +96,7 @@ public function saveAction() $template = $this->_initTemplate('id'); if (!$template->getId() && $id) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('This Email template no longer exists')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('This Email template no longer exists.')); $this->_redirect('*/*/'); return; } @@ -127,7 +127,7 @@ public function saveAction() $template->save(); Mage::getSingleton('adminhtml/session')->setFormData(false); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Email Template was successfully saved.')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('The email template has been saved.')); $this->_redirect('*/*'); } catch (Exception $e) { @@ -145,7 +145,7 @@ public function deleteAction() { try { $template->delete(); // display success message - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Email Template was successfully deleted.')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('The email template has been deleted.')); // go to grid $this->_redirect('*/*/'); return; @@ -154,7 +154,7 @@ public function deleteAction() { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addError(Mage::helper('adminhtml')->__('Error while deleting email template data. Please review log and try again.')); + $this->_getSession()->addError(Mage::helper('adminhtml')->__('An error occurred while deleting email template data. Please review log and try again.')); Mage::logException($e); // save data in session Mage::getSingleton('adminhtml/session')->setFormData($data); diff --git a/app/code/core/Mage/Adminhtml/controllers/System/StoreController.php b/app/code/core/Mage/Adminhtml/controllers/System/StoreController.php index b22356f461..5f896a9029 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/StoreController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/StoreController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -52,7 +52,8 @@ protected function _initAction() public function indexAction() { - $this->_title($this->__('System'))->_title($this->__('Stores')); + $this->_title($this->__('System')) + ->_title($this->__('Stores')); $this->_initAction() ->_addContent($this->getLayout()->createBlock('adminhtml/system_store_store')) @@ -113,14 +114,14 @@ public function editStoreAction() $itemId = $this->getRequest()->getParam('website_id', null); $model = Mage::getModel('core/website'); $title = Mage::helper('core')->__("Website"); - $notExists = Mage::helper('core')->__("Website doesn't exist"); - $codeBase = Mage::helper('core')->__('Before modifying the website code please make sure that it is not used in index.php'); + $notExists = Mage::helper('core')->__("The website does not exist."); + $codeBase = Mage::helper('core')->__('Before modifying the website code please make sure that it is not used in index.php.'); break; case 'group': $itemId = $this->getRequest()->getParam('group_id', null); $model = Mage::getModel('core/store_group'); $title = Mage::helper('core')->__("Store"); - $notExists = Mage::helper('core')->__("Store doesn't exist"); + $notExists = Mage::helper('core')->__("The store does not exist"); $codeBase = false; break; case 'store': @@ -128,7 +129,7 @@ public function editStoreAction() $model = Mage::getModel('core/store'); $title = Mage::helper('core')->__("Store View"); $notExists = Mage::helper('core')->__("Store view doesn't exist"); - $codeBase = Mage::helper('core')->__('Before modifying the store view code please make sure that it is not used in index.php'); + $codeBase = Mage::helper('core')->__('Before modifying the store view code please make sure that it is not used in index.php.'); break; } if (null !== $itemId) { @@ -181,7 +182,7 @@ public function saveAction() } $websiteModel->save(); - $session->addSuccess(Mage::helper('core')->__('Website was successfully saved')); + $session->addSuccess(Mage::helper('core')->__('The website has been saved.')); break; case 'group': @@ -198,7 +199,7 @@ public function saveAction() Mage::dispatchEvent('store_group_save', array('group' => $groupModel)); - $session->addSuccess(Mage::helper('core')->__('Store was successfully saved')); + $session->addSuccess(Mage::helper('core')->__('The store has been saved.')); break; case 'store': @@ -220,7 +221,7 @@ public function saveAction() Mage::dispatchEvent($eventName, array('store'=>$storeModel)); - $session->addSuccess(Mage::helper('core')->__('Store View was successfully saved')); + $session->addSuccess(Mage::helper('core')->__('The store view has been saved')); break; default: $this->_redirect('*/*/'); @@ -234,7 +235,7 @@ public function saveAction() $session->setPostData($postData); } catch (Exception $e) { - $session->addException($e, Mage::helper('core')->__('Error while saving. Please try again later.')); + $session->addException($e, Mage::helper('core')->__('An error occurred while saving. Please review the error log.')); $session->setPostData($postData); } $this->_redirectReferer(); @@ -245,15 +246,19 @@ public function saveAction() public function deleteWebsiteAction() { + $this->_title($this->__('System')) + ->_title($this->__('Stores')) + ->_title($this->__('Delete Website')); + $session = $this->_getSession(); $itemId = $this->getRequest()->getParam('item_id', null); if (!$model = Mage::getModel('core/website')->load($itemId)) { - $session->addError(Mage::helper('core')->__('Unable to proceed. Please, try again')); + $session->addError(Mage::helper('core')->__('Unable to proceed. Please, try again.')); $this->_redirect('*/*/'); return ; } if (!$model->isCanDelete()) { - $session->addError(Mage::helper('core')->__('This website cannot be deleted')); + $session->addError(Mage::helper('core')->__('This website cannot be deleted.')); $this->_redirect('*/*/editWebsite', array('website_id' => $itemId)); return ; } @@ -273,15 +278,19 @@ public function deleteWebsiteAction() public function deleteGroupAction() { + $this->_title($this->__('System')) + ->_title($this->__('Stores')) + ->_title($this->__('Delete Store')); + $session = $this->_getSession(); $itemId = $this->getRequest()->getParam('item_id', null); if (!$model = Mage::getModel('core/store_group')->load($itemId)) { - $session->addError(Mage::helper('core')->__('Unable to proceed. Please, try again')); + $session->addError(Mage::helper('core')->__('Unable to proceed. Please, try again.')); $this->_redirect('*/*/'); return ; } if (!$model->isCanDelete()) { - $session->addError(Mage::helper('core')->__('This store cannot be deleted')); + $session->addError(Mage::helper('core')->__('This store cannot be deleted.')); $this->_redirect('*/*/editGroup', array('group_id' => $itemId)); return ; } @@ -301,16 +310,19 @@ public function deleteGroupAction() public function deleteStoreAction() { + $this->_title($this->__('System')) + ->_title($this->__('Stores')) + ->_title($this->__('Delete Store View')); $session = $this->_getSession(); $itemId = $this->getRequest()->getParam('item_id', null); if (!$model = Mage::getModel('core/store')->load($itemId)) { - $session->addError(Mage::helper('core')->__('Unable to proceed. Please, try again')); + $session->addError(Mage::helper('core')->__('Unable to proceed. Please, try again.')); $this->_redirect('*/*/'); return ; } if (!$model->isCanDelete()) { - $session->addError(Mage::helper('core')->__('This store view cannot be deleted')); + $session->addError(Mage::helper('core')->__('This store view cannot be deleted.')); $this->_redirect('*/*/editStore', array('store_id' => $itemId)); return ; } @@ -347,7 +359,7 @@ public function deleteWebsitePostAction() try { $model->delete(); - $this->_getSession()->addSuccess(Mage::helper('core')->__('Website was successfully deleted.')); + $this->_getSession()->addSuccess(Mage::helper('core')->__('The website has been deleted.')); $this->_redirect('*/*/'); return ; } @@ -365,7 +377,7 @@ public function deleteGroupPostAction() $itemId = $this->getRequest()->getParam('item_id'); if (!$model = Mage::getModel('core/store_group')->load($itemId)) { - $this->_getSession()->addError(Mage::helper('core')->__('Unable to proceed. Please, try again')); + $this->_getSession()->addError(Mage::helper('core')->__('Unable to proceed. Please, try again.')); $this->_redirect('*/*/'); return ; } @@ -379,7 +391,7 @@ public function deleteGroupPostAction() try { $model->delete(); - $this->_getSession()->addSuccess(Mage::helper('core')->__('Store was successfully deleted.')); + $this->_getSession()->addSuccess(Mage::helper('core')->__('The store has been deleted.')); $this->_redirect('*/*/'); return ; } @@ -418,7 +430,7 @@ public function deleteStorePostAction() Mage::dispatchEvent('store_delete', array('store' => $model)); - $this->_getSession()->addSuccess(Mage::helper('core')->__('Store view was successfully deleted.')); + $this->_getSession()->addSuccess(Mage::helper('core')->__('The store view has been deleted.')); $this->_redirect('*/*/'); return ; } diff --git a/app/code/core/Mage/Adminhtml/controllers/System/VariableController.php b/app/code/core/Mage/Adminhtml/controllers/System/VariableController.php index 5a013354c6..499fbf2989 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/VariableController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/VariableController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -139,7 +139,7 @@ public function saveAction() try { $variable->save(); $this->_getSession()->addSuccess( - Mage::helper('adminhtml')->__('Custom Variable has been successfully saved.') + Mage::helper('adminhtml')->__('The custom variable has been saved.') ); if ($back) { $this->_redirect('*/*/edit', array('_current' => true, 'variable_id' => $variable->getId())); @@ -168,7 +168,7 @@ public function deleteAction() try { $variable->delete(); $this->_getSession()->addSuccess( - Mage::helper('adminhtml')->__('Custom Variable has been successfully deleted.') + Mage::helper('adminhtml')->__('The custom variable has been deleted.') ); } catch (Exception $e) { $this->_getSession()->addError($e->getMessage()); diff --git a/app/code/core/Mage/Adminhtml/controllers/SystemController.php b/app/code/core/Mage/Adminhtml/controllers/SystemController.php index f9bf5ffb5c..50af1d3935 100644 --- a/app/code/core/Mage/Adminhtml/controllers/SystemController.php +++ b/app/code/core/Mage/Adminhtml/controllers/SystemController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Adminhtml/controllers/TagController.php b/app/code/core/Mage/Adminhtml/controllers/TagController.php index 09ef665e18..e6be3381f1 100644 --- a/app/code/core/Mage/Adminhtml/controllers/TagController.php +++ b/app/code/core/Mage/Adminhtml/controllers/TagController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -52,19 +52,20 @@ protected function _initAction() protected function _initTag() { $model = Mage::getModel('tag/tag'); + $storeId = $this->getRequest()->getParam('store'); + $model->setStoreId($storeId); if (($id = $this->getRequest()->getParam('tag_id'))) { + $model->setAddBasePopularity(); $model->load($id); + $model->setStoreId($storeId); - if (! $model->getId()) { + if (!$model->getId()) { return false; } - - $model->setStoreId($this->getRequest()->getParam('store')); } Mage::register('current_tag', $model); - return $model; } @@ -128,12 +129,10 @@ public function editAction() } if (! ($model = $this->_initTag())) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Wrong Tag specified')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Wrong tag was specified.')); return $this->_redirect('*/*/index', array('store' => $this->getRequest()->getParam('store'))); } - $model->addSummary($this->getRequest()->getParam('store')); - // set entered data if was error when we do save $data = Mage::getSingleton('adminhtml/session')->getTagData(true); if (! empty($data)) { @@ -164,7 +163,7 @@ public function saveAction() $data['store'] = $postData['store_id']; if (!$model = $this->_initTag()) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Wrong Tag specified')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Wrong tag was specified.')); return $this->_redirect('*/*/index', array('store' => $data['store'])); } @@ -178,8 +177,8 @@ public function saveAction() try { $model->save(); - $model->aggregate(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Tag was successfully saved')); + + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('The tag has been saved.')); Mage::getSingleton('adminhtml/session')->setTagData(false); if (($continue = $this->getRequest()->getParam('continue'))) { @@ -211,12 +210,12 @@ public function deleteAction() if ($model && $model->getId()) { try { $model->delete(); - $session->addSuccess(Mage::helper('adminhtml')->__('Tag was successfully deleted')); + $session->addSuccess(Mage::helper('adminhtml')->__('The tag has been deleted.')); } catch (Exception $e) { $session->addError($e->getMessage()); } } else { - $session->addError(Mage::helper('adminhtml')->__('Unable to find a tag to delete')); + $session->addError(Mage::helper('adminhtml')->__('Unable to find a tag to delete.')); } $this->getResponse()->setRedirect($this->getUrl('*/tag/' . $this->getRequest()->getParam('ret', 'index'))); @@ -291,7 +290,7 @@ public function massDeleteAction() { $tagIds = $this->getRequest()->getParam('tag'); if(!is_array($tagIds)) { - Mage::getSingleton('adminhtml/session')->addError($this->__('Please select tag(s)')); + Mage::getSingleton('adminhtml/session')->addError($this->__('Please select tag(s).')); } else { try { foreach ($tagIds as $tagId) { @@ -299,7 +298,7 @@ public function massDeleteAction() $tag->delete(); } Mage::getSingleton('adminhtml/session')->addSuccess( - $this->__('Total of %d record(s) were successfully deleted', count($tagIds)) + $this->__('Total of %d record(s) have been deleted.', count($tagIds)) ); } catch (Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); @@ -319,7 +318,7 @@ public function massStatusAction() $storeId = (int)$this->getRequest()->getParam('store', 0); if(!is_array($tagIds)) { // No products selected - Mage::getSingleton('adminhtml/session')->addError($this->__('Please select tag(s)')); + Mage::getSingleton('adminhtml/session')->addError($this->__('Please select tag(s).')); } else { try { foreach ($tagIds as $tagId) { @@ -329,7 +328,7 @@ public function massStatusAction() $tag->save(); } Mage::getSingleton('adminhtml/session')->addSuccess( - $this->__('Total of %d record(s) were successfully updated', count($tagIds)) + $this->__('Total of %d record(s) have been updated.', count($tagIds)) ); } catch (Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); diff --git a/app/code/core/Mage/Adminhtml/controllers/Tax/Class/CustomerController.php b/app/code/core/Mage/Adminhtml/controllers/Tax/Class/CustomerController.php index bffcf5abe8..37fa8ccacb 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Tax/Class/CustomerController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Tax/Class/CustomerController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -134,7 +134,7 @@ public function deleteAction() try { $classModel->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('Tax class was successfully deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('The tax class has been deleted.')); $this->getResponse()->setRedirect($this->getUrl("*/*/")); return ; } @@ -142,7 +142,7 @@ public function deleteAction() Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); } catch (Exception $e) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('Error while deleting this class. Please try again later.')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('An error occurred while deleting this tax class.')); } $this->_redirectReferer(); diff --git a/app/code/core/Mage/Adminhtml/controllers/Tax/Class/ProductController.php b/app/code/core/Mage/Adminhtml/controllers/Tax/Class/ProductController.php index 2d65635e4c..93fbd86723 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Tax/Class/ProductController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Tax/Class/ProductController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -133,7 +133,7 @@ public function deleteAction() try { $classModel->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('Tax class was successfully deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('The tax class has been deleted.')); $this->getResponse()->setRedirect($this->getUrl("*/*/")); return; } @@ -141,7 +141,7 @@ public function deleteAction() Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); } catch (Exception $e) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('Error while deleting this class. Please try again later.')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('An error occurred while deleting this tax class.')); } $this->_redirectReferer(); diff --git a/app/code/core/Mage/Adminhtml/controllers/Tax/ClassController.php b/app/code/core/Mage/Adminhtml/controllers/Tax/ClassController.php index fc1d450340..226e44f8d2 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Tax/ClassController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Tax/ClassController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -49,7 +49,7 @@ public function saveAction() $classType = $model->getClassType(); $classUrl = '*/tax_class_' . strtolower($classType); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('Tax class was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('The tax class has been saved.')); $this->_redirect($classUrl); return ; @@ -60,7 +60,7 @@ public function saveAction() $this->_redirectReferer(); } catch (Exception $e) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('Error while saving this tax class. Please try again later.')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('An error occurred while saving this tax class.')); Mage::getSingleton('adminhtml/session')->setClassData($postData); $this->_redirectReferer(); } diff --git a/app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php b/app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php index c899f9d2b3..cd23e06e92 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -107,7 +107,7 @@ public function saveAction() try { $rateModel->save(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('Tax rate was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('The tax rate has been saved.')); $this->getResponse()->setRedirect($this->getUrl("*/*/")); return true; } @@ -117,7 +117,7 @@ public function saveAction() Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); } catch (Exception $e) { - //Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('Error while saving this rate. Please try again later.')); + //Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('An error occurred while saving this rate.')); Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); } @@ -170,7 +170,7 @@ public function deleteAction() try { $rateModel->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('Tax rate was successfully deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('The tax rate has been deleted.')); $this->getResponse()->setRedirect($this->getUrl("*/*/")); return true; } @@ -178,7 +178,7 @@ public function deleteAction() Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); } catch (Exception $e) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('Error while deleting this rate. Please try again later.')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('An error occurred while deleting this rate.')); } if ($referer = $this->getRequest()->getServer('HTTP_REFERER')) { $this->getResponse()->setRedirect($referer); @@ -187,7 +187,7 @@ public function deleteAction() $this->getResponse()->setRedirect($this->getUrl("*/*/")); } } else { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('Error while deleting this rate. Incorrect rate ID')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('An error occurred while deleting this rate. Incorrect rate ID.')); $this->getResponse()->setRedirect($this->getUrl('*/*/')); } } @@ -260,7 +260,7 @@ public function importPostAction() try { $this->_importRates(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('Tax rate was successfully imported')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('The tax rate has been imported.')); } catch (Mage_Core_Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); diff --git a/app/code/core/Mage/Adminhtml/controllers/Tax/RuleController.php b/app/code/core/Mage/Adminhtml/controllers/Tax/RuleController.php index ef1b8a73ad..605550b8ee 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Tax/RuleController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Tax/RuleController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -62,7 +62,7 @@ public function editAction() $ruleModel->load($taxRuleId); if (!$ruleModel->getId()) { Mage::getSingleton('adminhtml/session')->unsRuleData(); - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('This rule no longer exists')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('This rule no longer exists.')); $this->_redirect('*/*/'); return; } @@ -92,7 +92,7 @@ public function saveAction() try { $ruleModel->save(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('Tax rule was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('The tax rule has been saved.')); if ($this->getRequest()->getParam('back')) { $this->_redirect('*/*/edit', array('rule' => $ruleModel->getId())); @@ -106,7 +106,7 @@ public function saveAction() Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); } catch (Exception $e) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('Error while saving this tax rule. Please try again later.')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('An error occurred while saving this tax rule.')); } Mage::getSingleton('adminhtml/session')->setRuleData($postData); @@ -130,7 +130,7 @@ public function deleteAction() try { $ruleModel->delete(); - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('Tax rule was successfully deleted')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('The tax rule has been deleted.')); $this->_redirect('*/*/'); return; @@ -139,7 +139,7 @@ public function deleteAction() Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); } catch (Exception $e) { - Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('Error while deleting this tax rule. Please try again later.')); + Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('An error occurred while deleting this tax rule.')); } $this->_redirectReferer(); diff --git a/app/code/core/Mage/Adminhtml/controllers/UrlrewriteController.php b/app/code/core/Mage/Adminhtml/controllers/UrlrewriteController.php index 31cc531b36..32e5e1e28f 100644 --- a/app/code/core/Mage/Adminhtml/controllers/UrlrewriteController.php +++ b/app/code/core/Mage/Adminhtml/controllers/UrlrewriteController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -129,8 +129,8 @@ public function saveAction() ->setTargetPath($this->getRequest()->getParam('target_path')) ->setOptions($this->getRequest()->getParam('options')) ->setDescription($this->getRequest()->getParam('description')) - ->setRequestPath($this->getRequest()->getParam('request_path')) - ; + ->setRequestPath($this->getRequest()->getParam('request_path')); + if (!$model->getId()) { $model->setIsSystem(0); } @@ -149,14 +149,30 @@ public function saveAction() } if ($product || $category) { $catalogUrlModel = Mage::getSingleton('catalog/url'); - $model->setIdPath($catalogUrlModel->generatePath('id', $product, $category)); - $model->setTargetPath($catalogUrlModel->generatePath('target', $product, $category)); + $idPath = $catalogUrlModel->generatePath('id', $product, $category); + + // if redirect specified try to find friendly URL + $found = false; + if (in_array($model->getOptions(), array('R', 'RP'))) { + $rewrite = Mage::getResourceModel('catalog/url') + ->getRewriteByIdPath($idPath, $model->getStoreId()); + if($rewrite->getId() && $rewrite->getId() != $model->getId()) { + $model->setIdPath($idPath); + $model->setTargetPath($rewrite->getRequestPath()); + $found = true; + } + } + + if (!$found) { + $model->setIdPath($idPath); + $model->setTargetPath($catalogUrlModel->generatePath('target', $product, $category)); + } } // save and redirect $model->save(); Mage::getSingleton('adminhtml/session')->addSuccess( - Mage::helper('adminhtml')->__('URL Rewrite has been successfully saved') + Mage::helper('adminhtml')->__('The URL Rewrite has been saved.') ); $this->_redirect('*/*/'); return; @@ -184,7 +200,7 @@ public function deleteAction() try { Mage::registry('current_urlrewrite')->delete(); Mage::getSingleton('adminhtml/session')->addSuccess( - Mage::helper('adminhtml')->__('URL Rewrite has been successfully deleted') + Mage::helper('adminhtml')->__('The URL Rewrite has been deleted.') ); } catch (Exception $e) { diff --git a/app/code/core/Mage/Adminhtml/etc/adminhtml.xml b/app/code/core/Mage/Adminhtml/etc/adminhtml.xml index c7b5014423..c700705b51 100644 --- a/app/code/core/Mage/Adminhtml/etc/adminhtml.xml +++ b/app/code/core/Mage/Adminhtml/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Adminhtml/etc/config.xml b/app/code/core/Mage/Adminhtml/etc/config.xml index 3e470bf756..7361ea5ef6 100644 --- a/app/code/core/Mage/Adminhtml/etc/config.xml +++ b/app/code/core/Mage/Adminhtml/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Adminhtml - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -132,6 +132,9 @@ main.xml + + report.xml + catalog.xml diff --git a/app/code/core/Mage/Api/Controller/Action.php b/app/code/core/Mage/Api/Controller/Action.php index 15f5a0c36f..7779c1c8e4 100644 --- a/app/code/core/Mage/Api/Controller/Action.php +++ b/app/code/core/Mage/Api/Controller/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Exception.php b/app/code/core/Mage/Api/Exception.php index c248f3144e..fccafd8eea 100644 --- a/app/code/core/Mage/Api/Exception.php +++ b/app/code/core/Mage/Api/Exception.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Helper/Data.php b/app/code/core/Mage/Api/Helper/Data.php index b19c09db57..f9bef6047c 100644 --- a/app/code/core/Mage/Api/Helper/Data.php +++ b/app/code/core/Mage/Api/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Acl.php b/app/code/core/Mage/Api/Model/Acl.php index 27b2f62444..30973bc775 100644 --- a/app/code/core/Mage/Api/Model/Acl.php +++ b/app/code/core/Mage/Api/Model/Acl.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Acl/Assert/Ip.php b/app/code/core/Mage/Api/Model/Acl/Assert/Ip.php index 27a74a9660..11dbba3d0c 100644 --- a/app/code/core/Mage/Api/Model/Acl/Assert/Ip.php +++ b/app/code/core/Mage/Api/Model/Acl/Assert/Ip.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Acl/Assert/Time.php b/app/code/core/Mage/Api/Model/Acl/Assert/Time.php index e8b5479f63..7da109423f 100644 --- a/app/code/core/Mage/Api/Model/Acl/Assert/Time.php +++ b/app/code/core/Mage/Api/Model/Acl/Assert/Time.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Acl/Resource.php b/app/code/core/Mage/Api/Model/Acl/Resource.php index 9583b7d6c4..9b27684947 100644 --- a/app/code/core/Mage/Api/Model/Acl/Resource.php +++ b/app/code/core/Mage/Api/Model/Acl/Resource.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Acl/Role.php b/app/code/core/Mage/Api/Model/Acl/Role.php index 802c259622..e87eebd13a 100644 --- a/app/code/core/Mage/Api/Model/Acl/Role.php +++ b/app/code/core/Mage/Api/Model/Acl/Role.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Acl/Role/Generic.php b/app/code/core/Mage/Api/Model/Acl/Role/Generic.php index 7e42cf4521..1a94a402bc 100644 --- a/app/code/core/Mage/Api/Model/Acl/Role/Generic.php +++ b/app/code/core/Mage/Api/Model/Acl/Role/Generic.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Acl/Role/Group.php b/app/code/core/Mage/Api/Model/Acl/Role/Group.php index 4e309a011b..268f38465d 100644 --- a/app/code/core/Mage/Api/Model/Acl/Role/Group.php +++ b/app/code/core/Mage/Api/Model/Acl/Role/Group.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Acl/Role/Registry.php b/app/code/core/Mage/Api/Model/Acl/Role/Registry.php index 114ea6cbcc..e492fd600d 100644 --- a/app/code/core/Mage/Api/Model/Acl/Role/Registry.php +++ b/app/code/core/Mage/Api/Model/Acl/Role/Registry.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Acl/Role/User.php b/app/code/core/Mage/Api/Model/Acl/Role/User.php index 389024c311..b8376f4729 100644 --- a/app/code/core/Mage/Api/Model/Acl/Role/User.php +++ b/app/code/core/Mage/Api/Model/Acl/Role/User.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Config.php b/app/code/core/Mage/Api/Model/Config.php index 7951060491..06cd4fe8ec 100644 --- a/app/code/core/Mage/Api/Model/Config.php +++ b/app/code/core/Mage/Api/Model/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Mysql4/Acl.php b/app/code/core/Mage/Api/Model/Mysql4/Acl.php index 479442e93b..d4564cc9cf 100644 --- a/app/code/core/Mage/Api/Model/Mysql4/Acl.php +++ b/app/code/core/Mage/Api/Model/Mysql4/Acl.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Mysql4/Acl/Role.php b/app/code/core/Mage/Api/Model/Mysql4/Acl/Role.php index dacf5965b8..a0e410e605 100644 --- a/app/code/core/Mage/Api/Model/Mysql4/Acl/Role.php +++ b/app/code/core/Mage/Api/Model/Mysql4/Acl/Role.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Mysql4/Acl/Role/Collection.php b/app/code/core/Mage/Api/Model/Mysql4/Acl/Role/Collection.php index 3424955fe2..bc21a2e637 100644 --- a/app/code/core/Mage/Api/Model/Mysql4/Acl/Role/Collection.php +++ b/app/code/core/Mage/Api/Model/Mysql4/Acl/Role/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Mysql4/Permissions/Collection.php b/app/code/core/Mage/Api/Model/Mysql4/Permissions/Collection.php index b0f4e8ecb0..db7fbdbc3c 100644 --- a/app/code/core/Mage/Api/Model/Mysql4/Permissions/Collection.php +++ b/app/code/core/Mage/Api/Model/Mysql4/Permissions/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Mysql4/Role.php b/app/code/core/Mage/Api/Model/Mysql4/Role.php index 3b7cd7895f..f582cf1164 100644 --- a/app/code/core/Mage/Api/Model/Mysql4/Role.php +++ b/app/code/core/Mage/Api/Model/Mysql4/Role.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Mysql4/Role/Collection.php b/app/code/core/Mage/Api/Model/Mysql4/Role/Collection.php index 5ab7ca8293..3a608bc9a6 100644 --- a/app/code/core/Mage/Api/Model/Mysql4/Role/Collection.php +++ b/app/code/core/Mage/Api/Model/Mysql4/Role/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Mysql4/Roles.php b/app/code/core/Mage/Api/Model/Mysql4/Roles.php index 77e38ca527..9160d96b08 100644 --- a/app/code/core/Mage/Api/Model/Mysql4/Roles.php +++ b/app/code/core/Mage/Api/Model/Mysql4/Roles.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Mysql4/Roles/Collection.php b/app/code/core/Mage/Api/Model/Mysql4/Roles/Collection.php index d3cdc7e0f7..be1c5eec1c 100644 --- a/app/code/core/Mage/Api/Model/Mysql4/Roles/Collection.php +++ b/app/code/core/Mage/Api/Model/Mysql4/Roles/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Mysql4/Roles/User/Collection.php b/app/code/core/Mage/Api/Model/Mysql4/Roles/User/Collection.php index dfb4c60fc7..037577d735 100644 --- a/app/code/core/Mage/Api/Model/Mysql4/Roles/User/Collection.php +++ b/app/code/core/Mage/Api/Model/Mysql4/Roles/User/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Mysql4/Rules.php b/app/code/core/Mage/Api/Model/Mysql4/Rules.php index c02c7ada73..23d18cb5af 100644 --- a/app/code/core/Mage/Api/Model/Mysql4/Rules.php +++ b/app/code/core/Mage/Api/Model/Mysql4/Rules.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Mysql4/Rules/Collection.php b/app/code/core/Mage/Api/Model/Mysql4/Rules/Collection.php index 5fe4ab7259..022566219d 100644 --- a/app/code/core/Mage/Api/Model/Mysql4/Rules/Collection.php +++ b/app/code/core/Mage/Api/Model/Mysql4/Rules/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Mysql4/User.php b/app/code/core/Mage/Api/Model/Mysql4/User.php index 1165141cb8..6ef9445889 100644 --- a/app/code/core/Mage/Api/Model/Mysql4/User.php +++ b/app/code/core/Mage/Api/Model/Mysql4/User.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Mysql4/User/Collection.php b/app/code/core/Mage/Api/Model/Mysql4/User/Collection.php index f919a0561f..04485f85f2 100644 --- a/app/code/core/Mage/Api/Model/Mysql4/User/Collection.php +++ b/app/code/core/Mage/Api/Model/Mysql4/User/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Resource/Abstract.php b/app/code/core/Mage/Api/Model/Resource/Abstract.php index 4e7a82bdbf..208beda0ff 100644 --- a/app/code/core/Mage/Api/Model/Resource/Abstract.php +++ b/app/code/core/Mage/Api/Model/Resource/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Role.php b/app/code/core/Mage/Api/Model/Role.php index 6f2ea47692..a1b8b4bd7d 100644 --- a/app/code/core/Mage/Api/Model/Role.php +++ b/app/code/core/Mage/Api/Model/Role.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Roles.php b/app/code/core/Mage/Api/Model/Roles.php index 739c8585e0..4ce7adfa82 100644 --- a/app/code/core/Mage/Api/Model/Roles.php +++ b/app/code/core/Mage/Api/Model/Roles.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Rules.php b/app/code/core/Mage/Api/Model/Rules.php index cef0068751..79f8e1f1d8 100644 --- a/app/code/core/Mage/Api/Model/Rules.php +++ b/app/code/core/Mage/Api/Model/Rules.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Server.php b/app/code/core/Mage/Api/Model/Server.php index 05bb348670..bbf8a9a7df 100644 --- a/app/code/core/Mage/Api/Model/Server.php +++ b/app/code/core/Mage/Api/Model/Server.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -48,20 +48,20 @@ public function init(Mage_Api_Controller_Action $controller, $adapter='default', $adapterModel = Mage::getModel((string) $adapters[$adapter]->model); /* @var $adapterModel Mage_Api_Model_Server_Adapter_Interface */ if (!($adapterModel instanceof Mage_Api_Model_Server_Adapter_Interface)) { - Mage::throwException(Mage::helper('api')->__('Invalid webservice adapter specified')); + Mage::throwException(Mage::helper('api')->__('Invalid webservice adapter specified.')); } $this->_adapter = $adapterModel; $this->_adapter->setController($controller); if (!isset($handlers->$handler)) { - Mage::throwException(Mage::helper('api')->__('Invalid webservice handler specified')); + Mage::throwException(Mage::helper('api')->__('Invalid webservice handler specified.')); } $handlerClassName = Mage::getConfig()->getModelClassName((string) $handlers->$handler->model); $this->_adapter->setHandler($handlerClassName); } else { - Mage::throwException(Mage::helper('api')->__('Invalid webservice adapter specified')); + Mage::throwException(Mage::helper('api')->__('Invalid webservice adapter specified.')); } return $this; diff --git a/app/code/core/Mage/Api/Model/Server/Adapter/Interface.php b/app/code/core/Mage/Api/Model/Server/Adapter/Interface.php index 19a46202c8..0bcf1d5177 100644 --- a/app/code/core/Mage/Api/Model/Server/Adapter/Interface.php +++ b/app/code/core/Mage/Api/Model/Server/Adapter/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php b/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php index a513e84987..af6f2f7a8f 100644 --- a/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php +++ b/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -132,7 +132,6 @@ public function run() } else { $this->fault('0', 'Unable to load Soap extension on the server'); - } return $this; } diff --git a/app/code/core/Mage/Api/Model/Server/Adapter/Xmlrpc.php b/app/code/core/Mage/Api/Model/Server/Adapter/Xmlrpc.php index 3b861add80..e178838762 100644 --- a/app/code/core/Mage/Api/Model/Server/Adapter/Xmlrpc.php +++ b/app/code/core/Mage/Api/Model/Server/Adapter/Xmlrpc.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Server/Handler.php b/app/code/core/Mage/Api/Model/Server/Handler.php index 6aea0fb39e..201018f230 100644 --- a/app/code/core/Mage/Api/Model/Server/Handler.php +++ b/app/code/core/Mage/Api/Model/Server/Handler.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php b/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php index 3af45be2b6..ba1bc1c57c 100644 --- a/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php +++ b/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php b/app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php index 0073d80bd1..0504552b38 100644 --- a/app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php +++ b/app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Server/V2/Handler.php b/app/code/core/Mage/Api/Model/Server/V2/Handler.php index ce97dc09b4..d392c1e698 100644 --- a/app/code/core/Mage/Api/Model/Server/V2/Handler.php +++ b/app/code/core/Mage/Api/Model/Server/V2/Handler.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Session.php b/app/code/core/Mage/Api/Model/Session.php index 4dbc818473..f0673db29c 100644 --- a/app/code/core/Mage/Api/Model/Session.php +++ b/app/code/core/Mage/Api/Model/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -92,9 +92,9 @@ public function login($username, $apiKey) ->login($username, $apiKey); if ( $user->getId() && $user->getIsActive() != '1' ) { - Mage::throwException(Mage::helper('api')->__('Your Account has been deactivated.')); + Mage::throwException(Mage::helper('api')->__('Your account has been deactivated.')); } elseif (!Mage::getModel('api/user')->hasAssigned2Role($user->getId())) { - Mage::throwException(Mage::helper('api')->__('Access Denied.')); + Mage::throwException(Mage::helper('api')->__('Access denied.')); } else { if ($user->getId()) { $this->setUser($user); diff --git a/app/code/core/Mage/Api/Model/User.php b/app/code/core/Mage/Api/Model/User.php index 22b84a80f0..bf332a547b 100644 --- a/app/code/core/Mage/Api/Model/User.php +++ b/app/code/core/Mage/Api/Model/User.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Wsdl/Config.php b/app/code/core/Mage/Api/Model/Wsdl/Config.php index f0153dd5e8..cc3b3c7846 100644 --- a/app/code/core/Mage/Api/Model/Wsdl/Config.php +++ b/app/code/core/Mage/Api/Model/Wsdl/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php b/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php index 3623d76720..b4650ac993 100644 --- a/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php +++ b/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/Model/Wsdl/Config/Element.php b/app/code/core/Mage/Api/Model/Wsdl/Config/Element.php index f3365d9b01..3643eb75fa 100644 --- a/app/code/core/Mage/Api/Model/Wsdl/Config/Element.php +++ b/app/code/core/Mage/Api/Model/Wsdl/Config/Element.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/controllers/IndexController.php b/app/code/core/Mage/Api/controllers/IndexController.php index 4d5bb530da..f67be513e9 100644 --- a/app/code/core/Mage/Api/controllers/IndexController.php +++ b/app/code/core/Mage/Api/controllers/IndexController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/controllers/SoapController.php b/app/code/core/Mage/Api/controllers/SoapController.php index 60b7330646..75a7d0c2e2 100644 --- a/app/code/core/Mage/Api/controllers/SoapController.php +++ b/app/code/core/Mage/Api/controllers/SoapController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/controllers/V2/SoapController.php b/app/code/core/Mage/Api/controllers/V2/SoapController.php index 76db40213b..d7c99a6796 100644 --- a/app/code/core/Mage/Api/controllers/V2/SoapController.php +++ b/app/code/core/Mage/Api/controllers/V2/SoapController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/controllers/XmlrpcController.php b/app/code/core/Mage/Api/controllers/XmlrpcController.php index 97551f0d77..fbc9668a5e 100644 --- a/app/code/core/Mage/Api/controllers/XmlrpcController.php +++ b/app/code/core/Mage/Api/controllers/XmlrpcController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/etc/adminhtml.xml b/app/code/core/Mage/Api/etc/adminhtml.xml index b2bd959a7e..ce1b3e6f14 100644 --- a/app/code/core/Mage/Api/etc/adminhtml.xml +++ b/app/code/core/Mage/Api/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Api/etc/api.xml b/app/code/core/Mage/Api/etc/api.xml index 687e63cc71..30d691a43f 100644 --- a/app/code/core/Mage/Api/etc/api.xml +++ b/app/code/core/Mage/Api/etc/api.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Api/etc/config.xml b/app/code/core/Mage/Api/etc/config.xml index 04d50cb3ff..a8226412af 100644 --- a/app/code/core/Mage/Api/etc/config.xml +++ b/app/code/core/Mage/Api/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Api/etc/system.xml b/app/code/core/Mage/Api/etc/system.xml index 743a8f4f79..c85f89a123 100644 --- a/app/code/core/Mage/Api/etc/system.xml +++ b/app/code/core/Mage/Api/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -45,7 +45,7 @@ 1 - + text 1 1 diff --git a/app/code/core/Mage/Api/sql/api_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Api/sql/api_setup/mysql4-install-0.7.0.php index f0b61029b9..ced3b85fcd 100644 --- a/app/code/core/Mage/Api/sql/api_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Api/sql/api_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-0.7.0-0.7.1.php index f87bb66f78..978bf2bcfb 100644 --- a/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-0.8.0-0.8.1.php b/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-0.8.0-0.8.1.php index f57a0ff7c7..0d92d18acc 100644 --- a/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-0.8.0-0.8.1.php +++ b/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-0.8.0-0.8.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Api - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Backup/Exception.php b/app/code/core/Mage/Backup/Exception.php index 98cf7384bb..eeb6c26257 100644 --- a/app/code/core/Mage/Backup/Exception.php +++ b/app/code/core/Mage/Backup/Exception.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Backup - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Backup/Helper/Data.php b/app/code/core/Mage/Backup/Helper/Data.php index e6517716d2..6d00629cb1 100644 --- a/app/code/core/Mage/Backup/Helper/Data.php +++ b/app/code/core/Mage/Backup/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Backup - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Backup/Model/Backup.php b/app/code/core/Mage/Backup/Model/Backup.php index 0df96a54c0..0d2591e15a 100644 --- a/app/code/core/Mage/Backup/Model/Backup.php +++ b/app/code/core/Mage/Backup/Model/Backup.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Backup - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -134,7 +134,7 @@ public function getType() public function setFile(&$content) { if (!$this->hasData('time') || !$this->hasData('type') || !$this->hasData('path')) { - Mage::throwException(Mage::helper('backup')->__('Wrong order of creation for new backup')); + Mage::throwException(Mage::helper('backup')->__('Wrong order of creation for new backup.')); } $ioProxy = new Varien_Io_File(); @@ -169,12 +169,12 @@ public function &getFile() { if (!$this->exists()) { - Mage::throwException(Mage::helper('backup')->__("Backup file doesn't exist")); + Mage::throwException(Mage::helper('backup')->__("Backup file does not exist.")); } $fResource = @fopen($this->getPath() . DS . $this->getFileName(), "rb"); if (!$fResource) { - Mage::throwException(Mage::helper('backup')->__("Cannot read backup file")); + Mage::throwException(Mage::helper('backup')->__("Cannot read backup file.")); } $content = ''; @@ -187,7 +187,7 @@ public function &getFile() if ($compressed && !extension_loaded("zlib")) { fclose($fResource); - Mage::throwException(Mage::helper('backup')->__('File compressed with Zlib, but this extension is not installed on server')); + Mage::throwException(Mage::helper('backup')->__('The file was compressed with Zlib, but this extension is not installed on server.')); } if ($compressed) { @@ -209,7 +209,7 @@ public function &getFile() public function deleteFile() { if (!$this->exists()) { - Mage::throwException(Mage::helper('backup')->__("Backup file doesn't exist")); + Mage::throwException(Mage::helper('backup')->__("Backup file does not exist.")); } $ioProxy = new Varien_Io_File(); @@ -227,7 +227,7 @@ public function deleteFile() public function open($write = false) { if (is_null($this->getPath())) { - Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file path don\'t specify')); + Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file path was not specified.')); } $ioAdapter = new Varien_Io_File(); @@ -244,7 +244,7 @@ public function open($write = false) $ioAdapter->rm($filePath); } if (!$write && !$ioAdapter->fileExists($filePath)) { - Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file "%s" doesn\'t exist', $this->getFileName())); + Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file "%s" does not exist.', $this->getFileName())); } $mode = $write ? 'wb' . self::COMPRESS_RATE : 'rb'; @@ -253,7 +253,7 @@ public function open($write = false) $this->_handler = gzopen($filePath, $mode); } catch (Exception $e) { - Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file "%s" can\'t read or write', $this->getFileName())); + Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file "%s" cannot be read from or written to.', $this->getFileName())); } return $this; @@ -268,7 +268,7 @@ public function open($write = false) public function read($length) { if (is_null($this->_handler)) { - Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file handler don\'t specify')); + Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file handler was unspecified.')); } return gzread($this->_handler, $length); @@ -277,7 +277,7 @@ public function read($length) public function eof() { if (is_null($this->_handler)) { - Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file handler don\'t specify')); + Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file handler was unspecified.')); } return gzeof($this->_handler); @@ -292,14 +292,14 @@ public function eof() public function write($string) { if (is_null($this->_handler)) { - Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file handler don\'t specify')); + Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file handler was unspecified.')); } try { gzwrite($this->_handler, $string); } catch (Exception $e) { - Mage::exception('Mage_Backup', Mage::helper('backup')->__('Error write to Backup file "%s"', $this->getFileName())); + Mage::exception('Mage_Backup', Mage::helper('backup')->__('An error occurred while writing to the backup file "%s".', $this->getFileName())); } return $this; diff --git a/app/code/core/Mage/Backup/Model/Db.php b/app/code/core/Mage/Backup/Model/Db.php index 7f340a8f15..606127153f 100644 --- a/app/code/core/Mage/Backup/Model/Db.php +++ b/app/code/core/Mage/Backup/Model/Db.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Backup - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Backup/Model/Fs/Collection.php b/app/code/core/Mage/Backup/Model/Fs/Collection.php index d26f9a3e85..a7bc76bd12 100644 --- a/app/code/core/Mage/Backup/Model/Fs/Collection.php +++ b/app/code/core/Mage/Backup/Model/Fs/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Backup - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Backup/Model/Mysql4/Db.php b/app/code/core/Mage/Backup/Model/Mysql4/Db.php index 55efb1f8ca..14d762ad6f 100644 --- a/app/code/core/Mage/Backup/Model/Mysql4/Db.php +++ b/app/code/core/Mage/Backup/Model/Mysql4/Db.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Backup - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Backup/etc/adminhtml.xml b/app/code/core/Mage/Backup/etc/adminhtml.xml index 84ee7c5835..dfe811bea1 100644 --- a/app/code/core/Mage/Backup/etc/adminhtml.xml +++ b/app/code/core/Mage/Backup/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Backup - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Backup/etc/config.xml b/app/code/core/Mage/Backup/etc/config.xml index b644a092d7..c580fb70bb 100644 --- a/app/code/core/Mage/Backup/etc/config.xml +++ b/app/code/core/Mage/Backup/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Backup - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes.php b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes.php index 93b864e5ae..51dd16f62c 100644 --- a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes.php +++ b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Extend.php b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Extend.php index cfa209e94e..ca063b173e 100644 --- a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Extend.php +++ b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Extend.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -44,7 +44,7 @@ public function getElementHtml() $switchAttributeValue = $this->getProduct()->getData($switchAttributeCode); $html = ''; diff --git a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Special.php b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Special.php index 6e1a8de907..0a03580f97 100644 --- a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Special.php +++ b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Special.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php index 35b278eca0..ca0a54345e 100644 --- a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php +++ b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php index 99ed97751c..a08be2db34 100644 --- a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php +++ b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search.php b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search.php index d902637c15..a09ca92b36 100644 --- a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search.php +++ b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,7 +42,7 @@ protected function _construct() public function getHeaderText() { - return Mage::helper('bundle')->__('Please select products to add'); + return Mage::helper('bundle')->__('Please Select Products to Add'); } protected function _prepareLayout() diff --git a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/Grid.php b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/Grid.php index 28f8fff64e..63a3bd555e 100644 --- a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/Grid.php +++ b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -137,7 +137,7 @@ protected function _prepareColumns() $this->addColumn('qty', array( 'filter' => false, 'sortable' => false, - 'header' => Mage::helper('sales')->__('Qty To Add'), + 'header' => Mage::helper('sales')->__('Qty to Add'), 'name' => 'qty', 'inline_css'=> 'qty', 'align' => 'right', diff --git a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php index 2138182cbf..33e4cd4b9f 100644 --- a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php +++ b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tabs.php b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tabs.php index 9097df40e7..701b8c9cfe 100644 --- a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tabs.php +++ b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php b/app/code/core/Mage/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php index be1dcac470..eea3fd55e3 100644 --- a/app/code/core/Mage/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php +++ b/app/code/core/Mage/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Block/Adminhtml/Sales/Order/View/Items/Renderer.php b/app/code/core/Mage/Bundle/Block/Adminhtml/Sales/Order/View/Items/Renderer.php index 1c68c5563f..1b10c9aa8f 100644 --- a/app/code/core/Mage/Bundle/Block/Adminhtml/Sales/Order/View/Items/Renderer.php +++ b/app/code/core/Mage/Bundle/Block/Adminhtml/Sales/Order/View/Items/Renderer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Block/Catalog/Product/List/Partof.php b/app/code/core/Mage/Bundle/Block/Catalog/Product/List/Partof.php index 4930fa748d..3791881503 100644 --- a/app/code/core/Mage/Bundle/Block/Catalog/Product/List/Partof.php +++ b/app/code/core/Mage/Bundle/Block/Catalog/Product/List/Partof.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Block/Catalog/Product/Price.php b/app/code/core/Mage/Bundle/Block/Catalog/Product/Price.php index 1e62bca567..86e23b8c72 100644 --- a/app/code/core/Mage/Bundle/Block/Catalog/Product/Price.php +++ b/app/code/core/Mage/Bundle/Block/Catalog/Product/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Block/Catalog/Product/View.php b/app/code/core/Mage/Bundle/Block/Catalog/Product/View.php index 400854fda9..bc66af2035 100644 --- a/app/code/core/Mage/Bundle/Block/Catalog/Product/View.php +++ b/app/code/core/Mage/Bundle/Block/Catalog/Product/View.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle.php b/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle.php index b70d86a730..0782f3ab2b 100644 --- a/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle.php +++ b/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -134,7 +134,7 @@ public function addRenderer($type, $block) public function getOptionHtml($option) { if (!isset($this->_optionRenderers[$option->getType()])) { - return $this->__('There is no defined renderer for "%s" option type', $option->getType()); + return $this->__('There is no defined renderer for "%s" option type.', $option->getType()); } return $this->getLayout()->createBlock($this->_optionRenderers[$option->getType()]) ->setOption($option)->toHtml(); diff --git a/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php b/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php index ba5d3cdc30..03ade6607e 100644 --- a/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php +++ b/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Checkbox.php b/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Checkbox.php index 4745317bfa..9efd724f09 100644 --- a/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Checkbox.php +++ b/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Checkbox.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Multi.php b/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Multi.php index e74f794225..fa87910640 100644 --- a/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Multi.php +++ b/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Multi.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Radio.php b/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Radio.php index 549804a437..da729300ce 100644 --- a/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Radio.php +++ b/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Radio.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Select.php b/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Select.php index 7aa1a1e13a..f9e844185c 100644 --- a/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Select.php +++ b/app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Select.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Block/Checkout/Cart/Item/Renderer.php b/app/code/core/Mage/Bundle/Block/Checkout/Cart/Item/Renderer.php index 8d7b4b8cb8..0426c9b48f 100644 --- a/app/code/core/Mage/Bundle/Block/Checkout/Cart/Item/Renderer.php +++ b/app/code/core/Mage/Bundle/Block/Checkout/Cart/Item/Renderer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Block/Sales/Order/Items/Renderer.php b/app/code/core/Mage/Bundle/Block/Sales/Order/Items/Renderer.php index e63cea6cdd..514b229858 100644 --- a/app/code/core/Mage/Bundle/Block/Sales/Order/Items/Renderer.php +++ b/app/code/core/Mage/Bundle/Block/Sales/Order/Items/Renderer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Helper/Data.php b/app/code/core/Mage/Bundle/Helper/Data.php index c77fd7e2da..939dacfe9a 100644 --- a/app/code/core/Mage/Bundle/Helper/Data.php +++ b/app/code/core/Mage/Bundle/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Model/CatalogIndex/Data/Bundle.php b/app/code/core/Mage/Bundle/Model/CatalogIndex/Data/Bundle.php index ae8c2b1e45..1e4a4e3932 100644 --- a/app/code/core/Mage/Bundle/Model/CatalogIndex/Data/Bundle.php +++ b/app/code/core/Mage/Bundle/Model/CatalogIndex/Data/Bundle.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Model/Mysql4/Bundle.php b/app/code/core/Mage/Bundle/Model/Mysql4/Bundle.php index 2d2343b205..4a954c4c78 100644 --- a/app/code/core/Mage/Bundle/Model/Mysql4/Bundle.php +++ b/app/code/core/Mage/Bundle/Model/Mysql4/Bundle.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Model/Mysql4/Indexer/Price.php b/app/code/core/Mage/Bundle/Model/Mysql4/Indexer/Price.php index ba098363c2..caac5ec726 100644 --- a/app/code/core/Mage/Bundle/Model/Mysql4/Indexer/Price.php +++ b/app/code/core/Mage/Bundle/Model/Mysql4/Indexer/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,6 +42,7 @@ class Mage_Bundle_Model_Mysql4_Indexer_Price */ public function reindexAll() { + $this->useIdxTable(true); $this->_prepareBundlePrice(); return $this; @@ -67,62 +68,47 @@ public function reindexEntity($entityIds) */ protected function _getBundlePriceTable() { - return $this->getMainTable() . '_bundle'; + if ($this->useIdxTable()) { + return $this->getTable('bundle/price_indexer_idx'); + } + return $this->getTable('bundle/price_indexer_tmp'); } /** - * Prepare temporary price index table for fixed bundle products + * Retrieve table name for temporary bundle selection prices index * - * @return Mage_Bundle_Model_Mysql4_Indexer_Price + * @return string */ - protected function _prepareBundlePriceTable() + protected function _getBundleSelectionTable() { - $write = $this->_getWriteAdapter(); - $table = $this->_getBundlePriceTable(); - - $query = sprintf('DROP TABLE IF EXISTS %s', $write->quoteIdentifier($table)); - $write->query($query); - - $query = sprintf('CREATE TABLE %s (' - . ' `entity_id` INT(10) UNSIGNED NOT NULL,' - . ' `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL,' - . ' `website_id` SMALLINT(5) UNSIGNED NOT NULL,' - . ' `tax_class_id` SMALLINT(5) UNSIGNED DEFAULT \'0\',' - . ' `price_type` TINYINT(1) UNSIGNED NOT NULL,' - . ' `special_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `tier_percent` DECIMAL(12,4) DEFAULT NULL,' - . ' `orig_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `price` DECIMAL(12,4) DEFAULT NULL,' - . ' `min_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `max_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `tier_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `base_tier` DECIMAL(12,4) DEFAULT NULL,' - . ' PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`)' - . ') ENGINE=MYISAM DEFAULT CHARSET=utf8', - $write->quoteIdentifier($table)); - $write->query($query); - - return $this; + if ($this->useIdxTable()) { + return $this->getTable('bundle/selection_indexer_idx'); + } + return $this->getTable('bundle/selection_indexer_tmp'); } /** - * Retrieve table name for temporary bundle selection prices index + * Retrieve table name for temporary bundle option prices index * * @return string */ - protected function _getBundleSelectionTable() + protected function _getBundleOptionTable() { - return $this->getMainTable() . '_bndl_sel'; + if ($this->useIdxTable()) { + return $this->getTable('bundle/option_indexer_idx'); + } + return $this->getTable('bundle/option_indexer_tmp'); } /** - * Retrieve table name for temporary bundle option prices index + * Prepare temporary price index table for fixed bundle products * - * @return string + * @return Mage_Bundle_Model_Mysql4_Indexer_Price */ - protected function _getBundleOptionTable() + protected function _prepareBundlePriceTable() { - return $this->getMainTable() . '_bndl_opt'; + $this->_getWriteAdapter()->delete($this->_getBundlePriceTable()); + return $this; } /** @@ -132,27 +118,7 @@ protected function _getBundleOptionTable() */ protected function _prepareBundleSelectionTable() { - $write = $this->_getWriteAdapter(); - $table = $this->_getBundleSelectionTable(); - - $query = sprintf('DROP TABLE IF EXISTS %s', $write->quoteIdentifier($table)); - $write->query($query); - - $query = sprintf('CREATE TABLE %s (' - . ' `entity_id` INT(10) UNSIGNED NOT NULL,' - . ' `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL,' - . ' `website_id` SMALLINT(5) UNSIGNED NOT NULL,' - . ' `option_id` INT(10) UNSIGNED DEFAULT \'0\',' - . ' `selection_id` INT(10) UNSIGNED DEFAULT \'0\',' - . ' `group_type` TINYINT(1) UNSIGNED DEFAULT \'0\',' - . ' `is_required` TINYINT(1) UNSIGNED DEFAULT \'0\',' - . ' `price` DECIMAL(12,4) DEFAULT NULL,' - . ' `tier_price` DECIMAL(12,4) DEFAULT NULL,' - . ' PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`, `option_id`, `selection_id`)' - . ') ENGINE=MYISAM DEFAULT CHARSET=utf8', - $write->quoteIdentifier($table)); - $write->query($query); - + $this->_getWriteAdapter()->delete($this->_getBundleSelectionTable()); return $this; } @@ -163,27 +129,7 @@ protected function _prepareBundleSelectionTable() */ protected function _prepareBundleOptionTable() { - $write = $this->_getWriteAdapter(); - $table = $this->_getBundleOptionTable(); - - $query = sprintf('DROP TABLE IF EXISTS %s', $write->quoteIdentifier($table)); - $write->query($query); - - $query = sprintf('CREATE TABLE %s (' - . ' `entity_id` INT(10) UNSIGNED NOT NULL,' - . ' `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL,' - . ' `website_id` SMALLINT(5) UNSIGNED NOT NULL,' - . ' `option_id` INT(10) UNSIGNED DEFAULT \'0\',' - . ' `min_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `alt_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `max_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `tier_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `alt_tier_price` DECIMAL(12,4) DEFAULT NULL,' - . ' PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`, `option_id`)' - . ') ENGINE=MYISAM DEFAULT CHARSET=utf8', - $write->quoteIdentifier($table)); - $write->query($query); - + $this->_getWriteAdapter()->delete($this->_getBundleOptionTable()); return $this; } diff --git a/app/code/core/Mage/Bundle/Model/Mysql4/Indexer/Stock.php b/app/code/core/Mage/Bundle/Model/Mysql4/Indexer/Stock.php index e2dab72c3d..396cbc3c76 100644 --- a/app/code/core/Mage/Bundle/Model/Mysql4/Indexer/Stock.php +++ b/app/code/core/Mage/Bundle/Model/Mysql4/Indexer/Stock.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -41,6 +41,7 @@ class Mage_Bundle_Model_Mysql4_Indexer_Stock extends Mage_CatalogInventory_Model */ public function reindexAll() { + $this->useIdxTable(true); $this->_prepareIndexTable(); return $this; } diff --git a/app/code/core/Mage/Bundle/Model/Mysql4/Option.php b/app/code/core/Mage/Bundle/Model/Mysql4/Option.php index a879b61498..389475e805 100644 --- a/app/code/core/Mage/Bundle/Model/Mysql4/Option.php +++ b/app/code/core/Mage/Bundle/Model/Mysql4/Option.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Model/Mysql4/Option/Collection.php b/app/code/core/Mage/Bundle/Model/Mysql4/Option/Collection.php index 0c9a155bf6..66fd46f68c 100644 --- a/app/code/core/Mage/Bundle/Model/Mysql4/Option/Collection.php +++ b/app/code/core/Mage/Bundle/Model/Mysql4/Option/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Model/Mysql4/Price/Index.php b/app/code/core/Mage/Bundle/Model/Mysql4/Price/Index.php index 6df208a4ec..1065bae443 100644 --- a/app/code/core/Mage/Bundle/Model/Mysql4/Price/Index.php +++ b/app/code/core/Mage/Bundle/Model/Mysql4/Price/Index.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Model/Mysql4/Selection.php b/app/code/core/Mage/Bundle/Model/Mysql4/Selection.php index 2b38a8f7ef..b914b180a8 100644 --- a/app/code/core/Mage/Bundle/Model/Mysql4/Selection.php +++ b/app/code/core/Mage/Bundle/Model/Mysql4/Selection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Model/Mysql4/Selection/Collection.php b/app/code/core/Mage/Bundle/Model/Mysql4/Selection/Collection.php index 7548258ded..7c61379d8a 100644 --- a/app/code/core/Mage/Bundle/Model/Mysql4/Selection/Collection.php +++ b/app/code/core/Mage/Bundle/Model/Mysql4/Selection/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Model/Observer.php b/app/code/core/Mage/Bundle/Model/Observer.php index 6ccd3d501a..d463171bc9 100644 --- a/app/code/core/Mage/Bundle/Model/Observer.php +++ b/app/code/core/Mage/Bundle/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Model/Option.php b/app/code/core/Mage/Bundle/Model/Option.php index c9d1d5b362..b473b7f680 100644 --- a/app/code/core/Mage/Bundle/Model/Option.php +++ b/app/code/core/Mage/Bundle/Model/Option.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Model/Price/Index.php b/app/code/core/Mage/Bundle/Model/Price/Index.php index c1edb52d7d..1cdeb7bc42 100644 --- a/app/code/core/Mage/Bundle/Model/Price/Index.php +++ b/app/code/core/Mage/Bundle/Model/Price/Index.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Model/Product/Attribute/Source/Price/View.php b/app/code/core/Mage/Bundle/Model/Product/Attribute/Source/Price/View.php index 202a48649f..9cb5385ae6 100644 --- a/app/code/core/Mage/Bundle/Model/Product/Attribute/Source/Price/View.php +++ b/app/code/core/Mage/Bundle/Model/Product/Attribute/Source/Price/View.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -39,7 +39,7 @@ public function getAllOptions() if (is_null($this->_options)) { $this->_options = array( array( - 'label' => Mage::helper('bundle')->__('As low as'), + 'label' => Mage::helper('bundle')->__('As Low as'), 'value' => 1 ), array( diff --git a/app/code/core/Mage/Bundle/Model/Product/Price.php b/app/code/core/Mage/Bundle/Model/Product/Price.php index 28def09259..3bde7e9bfa 100644 --- a/app/code/core/Mage/Bundle/Model/Product/Price.php +++ b/app/code/core/Mage/Bundle/Model/Product/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -610,7 +610,7 @@ public static function calculateSpecialPrice($finalPrice, $specialPrice, $specia { if (!is_null($specialPrice) && $specialPrice != false) { if (Mage::app()->getLocale()->isStoreDateInInterval($store, $specialPriceFrom, $specialPriceTo)) { - $specialPrice = ($finalPrice * $specialPrice) / 100; + $specialPrice = Mage::app()->getStore()->roundPrice($finalPrice * $specialPrice / 100); $finalPrice = min($finalPrice, $specialPrice); } } diff --git a/app/code/core/Mage/Bundle/Model/Product/Type.php b/app/code/core/Mage/Bundle/Model/Product/Type.php index 328f2c5174..c9a80271e1 100644 --- a/app/code/core/Mage/Bundle/Model/Product/Type.php +++ b/app/code/core/Mage/Bundle/Model/Product/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -358,7 +358,9 @@ public function getOptionsCollection($product = null) */ public function getSelectionsCollection($optionIds, $product = null) { - if (!$this->getProduct($product)->hasData($this->_keySelectionsCollection)) { + $keyOptionIds = (is_array($optionIds) ? implode('_', $optionIds) : ''); + $key = $this->_keySelectionsCollection . $keyOptionIds; + if (!$this->getProduct($product)->hasData($key)) { $selectionsCollection = Mage::getResourceModel('bundle/selection_collection') ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes()) ->setFlag('require_stock_items', true) @@ -368,9 +370,9 @@ public function getSelectionsCollection($optionIds, $product = null) ->addFilterByRequiredOptions() ->setOptionIdsFilter($optionIds); - $this->getProduct($product)->setData($this->_keySelectionsCollection, $selectionsCollection); + $this->getProduct($product)->setData($key, $selectionsCollection); } - return $this->getProduct($product)->getData($this->_keySelectionsCollection); + return $this->getProduct($product)->getData($key); } /** @@ -491,7 +493,9 @@ public function prepareForCart(Varien_Object $buyRequest, $product = null) $_appendAllSelections = true; } - if ($options = $buyRequest->getBundleOption()) { + $options = array_filter($buyRequest->getBundleOption(), 'intval'); + + if ($options) { $qtys = $buyRequest->getBundleOptionQty(); foreach ($options as $_optionId => $_selections) { if (empty($_selections)) { @@ -510,7 +514,7 @@ public function prepareForCart(Varien_Object $buyRequest, $product = null) if (!$this->getProduct($product)->getSkipCheckRequiredOption()) { foreach ($optionsCollection->getItems() as $option) { if ($option->getRequired() && !isset($options[$option->getId()])) { - return Mage::helper('bundle')->__('Required options not selected.'); + return Mage::helper('bundle')->__('Required options are not selected.'); } } } @@ -519,12 +523,12 @@ public function prepareForCart(Varien_Object $buyRequest, $product = null) foreach ($options as $optionId => $selectionId) { if (!is_array($selectionId)) { if ($selectionId != '') { - $selectionIds[] = $selectionId; + $selectionIds[] = (int)$selectionId; } } else { foreach ($selectionId as $id) { if ($id != '') { - $selectionIds[] = $id; + $selectionIds[] = (int)$id; } } } @@ -544,7 +548,7 @@ public function prepareForCart(Varien_Object $buyRequest, $product = null) $moreSelections = false; } if ($_option->getRequired() && (!$_option->isMultiSelection() || ($_option->isMultiSelection() && !$moreSelections))) { - return Mage::helper('bundle')->__('Selected required options not available.'); + return Mage::helper('bundle')->__('Selected required options are not available.'); } } } @@ -622,7 +626,7 @@ public function prepareForCart(Varien_Object $buyRequest, $product = null) } if (!isset($_result[0])) { - return Mage::helper('checkout')->__('Can not add item to shopping cart'); + return Mage::helper('checkout')->__('Cannot add item to the shopping cart.'); } $result[] = $_result[0]->setParentProductId($product->getId()) @@ -657,7 +661,7 @@ public function prepareForCart(Varien_Object $buyRequest, $product = null) */ public function getSpecifyOptionMessage() { - return Mage::helper('bundle')->__('Please specify product option(s)'); + return Mage::helper('bundle')->__('Please specify product option(s).'); } /** @@ -864,11 +868,41 @@ public function checkProductBuyState($product = null) $selection = $productSelections->getItemById($selectionId); if (!$selection || !$selection->isSalable()) { Mage::throwException( - Mage::helper('bundle')->__('Selected required options not available.') + Mage::helper('bundle')->__('Selected required options are not available.') ); } } return $this; } + + /** + * Retrieve products divided into groups required to purchase + * At least one product in each group has to be purchased + * + * @param Mage_Catalog_Model_Product $product + * @return array + */ + public function getProductsToPurchaseByReqGroups($product = null) + { + $product = $this->getProduct($product); + $groups = array(); + $allProducts = array(); + $hasRequiredOptions = false; + foreach ($this->getOptions($product) as $option) { + $groupProducts = array(); + foreach ($this->getSelectionsCollection(array($option->getId()), $product) as $childProduct) { + $groupProducts[] = $childProduct; + $allProducts[] = $childProduct; + } + if ($option->getRequired()) { + $groups[] = $groupProducts; + $hasRequiredOptions = true; + } + } + if (!$hasRequiredOptions) { + $groups = array($allProducts); + } + return $groups; + } } diff --git a/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Abstract.php b/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Abstract.php index 6f7c63d740..e212789574 100644 --- a/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Abstract.php +++ b/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php b/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php index 5101decb93..2665dbb7a0 100644 --- a/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php +++ b/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php b/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php index ba051a4a8a..3d3c73defc 100644 --- a/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php +++ b/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php b/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php index 719f5521bd..811806f908 100644 --- a/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php +++ b/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Model/Selection.php b/app/code/core/Mage/Bundle/Model/Selection.php index 5da46e258c..c58a9a2b59 100644 --- a/app/code/core/Mage/Bundle/Model/Selection.php +++ b/app/code/core/Mage/Bundle/Model/Selection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Model/Source/Option/Selection/Price/Type.php b/app/code/core/Mage/Bundle/Model/Source/Option/Selection/Price/Type.php index 157dadffd4..ea1e88bd2d 100644 --- a/app/code/core/Mage/Bundle/Model/Source/Option/Selection/Price/Type.php +++ b/app/code/core/Mage/Bundle/Model/Source/Option/Selection/Price/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/Model/Source/Option/Type.php b/app/code/core/Mage/Bundle/Model/Source/Option/Type.php index 81a2cc69bb..6e798a343a 100644 --- a/app/code/core/Mage/Bundle/Model/Source/Option/Type.php +++ b/app/code/core/Mage/Bundle/Model/Source/Option/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/controllers/Product/EditController.php b/app/code/core/Mage/Bundle/controllers/Product/EditController.php index 081b0fd619..d2492d319e 100644 --- a/app/code/core/Mage/Bundle/controllers/Product/EditController.php +++ b/app/code/core/Mage/Bundle/controllers/Product/EditController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/controllers/SelectionController.php b/app/code/core/Mage/Bundle/controllers/SelectionController.php index b1e1d5a5dd..2d0470f81c 100644 --- a/app/code/core/Mage/Bundle/controllers/SelectionController.php +++ b/app/code/core/Mage/Bundle/controllers/SelectionController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/etc/config.xml b/app/code/core/Mage/Bundle/etc/config.xml index 619723b8f7..ecb5cbbbed 100644 --- a/app/code/core/Mage/Bundle/etc/config.xml +++ b/app/code/core/Mage/Bundle/etc/config.xml @@ -21,14 +21,14 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - 0.1.11 + 0.1.12 @@ -55,6 +55,24 @@ catalog_product_bundle_stock_index
      + + catalog_product_index_price_bundle_idx
      +
      + + catalog_product_index_price_bundle_tmp
      +
      + + catalog_product_index_price_bundle_sel_idx
      +
      + + catalog_product_index_price_bundle_sel_tmp
      +
      + + catalog_product_index_price_bundle_opt_idx
      +
      + + catalog_product_index_price_bundle_opt_tmp
      +
      diff --git a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-install-0.1.0.php b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-install-0.1.0.php index ec42bb3499..a5568c7406 100644 --- a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-install-0.1.0.php +++ b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-install-0.1.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.0-0.1.1.php b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.0-0.1.1.php index 1af54b1b3b..9e6cc923fb 100644 --- a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.0-0.1.1.php +++ b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.0-0.1.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.1-0.1.2.php b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.1-0.1.2.php index 5d59040571..83070fb835 100644 --- a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.1-0.1.2.php +++ b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.1-0.1.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.10-0.1.11.php b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.10-0.1.11.php index a2f87cf30e..215d9b0dcd 100644 --- a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.10-0.1.11.php +++ b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.10-0.1.11.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.11-0.1.12.php b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.11-0.1.12.php new file mode 100644 index 0000000000..d6335fa97d --- /dev/null +++ b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.11-0.1.12.php @@ -0,0 +1,126 @@ +startSetup(); +$installer->run(" +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_index_price')}_bundle`; + +CREATE TABLE `{$installer->getTable('bundle/price_indexer_idx')}` ( + `entity_id` INT(10) UNSIGNED NOT NULL, + `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL, + `website_id` SMALLINT(5) UNSIGNED NOT NULL, + `tax_class_id` SMALLINT(5) UNSIGNED DEFAULT '0', + `price_type` TINYINT(1) UNSIGNED NOT NULL, + `special_price` DECIMAL(12,4) DEFAULT NULL, + `tier_percent` DECIMAL(12,4) DEFAULT NULL, + `orig_price` DECIMAL(12,4) DEFAULT NULL, + `price` DECIMAL(12,4) DEFAULT NULL, + `min_price` DECIMAL(12,4) DEFAULT NULL, + `max_price` DECIMAL(12,4) DEFAULT NULL, + `tier_price` DECIMAL(12,4) DEFAULT NULL, + `base_tier` DECIMAL(12,4) DEFAULT NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('bundle/price_indexer_tmp')}` ( + `entity_id` INT(10) UNSIGNED NOT NULL, + `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL, + `website_id` SMALLINT(5) UNSIGNED NOT NULL, + `tax_class_id` SMALLINT(5) UNSIGNED DEFAULT '0', + `price_type` TINYINT(1) UNSIGNED NOT NULL, + `special_price` DECIMAL(12,4) DEFAULT NULL, + `tier_percent` DECIMAL(12,4) DEFAULT NULL, + `orig_price` DECIMAL(12,4) DEFAULT NULL, + `price` DECIMAL(12,4) DEFAULT NULL, + `min_price` DECIMAL(12,4) DEFAULT NULL, + `max_price` DECIMAL(12,4) DEFAULT NULL, + `tier_price` DECIMAL(12,4) DEFAULT NULL, + `base_tier` DECIMAL(12,4) DEFAULT NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_index_price')}_bndl_sel`; + +CREATE TABLE `{$installer->getTable('bundle/selection_indexer_idx')}` ( + `entity_id` INT(10) UNSIGNED NOT NULL, + `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL, + `website_id` SMALLINT(5) UNSIGNED NOT NULL, + `option_id` INT(10) UNSIGNED DEFAULT '0', + `selection_id` INT(10) UNSIGNED DEFAULT '0', + `group_type` TINYINT(1) UNSIGNED DEFAULT '0', + `is_required` TINYINT(1) UNSIGNED DEFAULT '0', + `price` DECIMAL(12,4) DEFAULT NULL, + `tier_price` DECIMAL(12,4) DEFAULT NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`, `option_id`, `selection_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('bundle/selection_indexer_tmp')}` ( + `entity_id` INT(10) UNSIGNED NOT NULL, + `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL, + `website_id` SMALLINT(5) UNSIGNED NOT NULL, + `option_id` INT(10) UNSIGNED DEFAULT '0', + `selection_id` INT(10) UNSIGNED DEFAULT '0', + `group_type` TINYINT(1) UNSIGNED DEFAULT '0', + `is_required` TINYINT(1) UNSIGNED DEFAULT '0', + `price` DECIMAL(12,4) DEFAULT NULL, + `tier_price` DECIMAL(12,4) DEFAULT NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`, `option_id`, `selection_id`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_index_price')}_bndl_opt`; + +CREATE TABLE `{$installer->getTable('bundle/option_indexer_idx')}` ( + `entity_id` INT(10) UNSIGNED NOT NULL, + `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL, + `website_id` SMALLINT(5) UNSIGNED NOT NULL, + `option_id` INT(10) UNSIGNED DEFAULT '0', + `min_price` DECIMAL(12,4) DEFAULT NULL, + `alt_price` DECIMAL(12,4) DEFAULT NULL, + `max_price` DECIMAL(12,4) DEFAULT NULL, + `tier_price` DECIMAL(12,4) DEFAULT NULL, + `alt_tier_price` DECIMAL(12,4) DEFAULT NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`, `option_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('bundle/option_indexer_tmp')}` ( + `entity_id` INT(10) UNSIGNED NOT NULL, + `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL, + `website_id` SMALLINT(5) UNSIGNED NOT NULL, + `option_id` INT(10) UNSIGNED DEFAULT '0', + `min_price` DECIMAL(12,4) DEFAULT NULL, + `alt_price` DECIMAL(12,4) DEFAULT NULL, + `max_price` DECIMAL(12,4) DEFAULT NULL, + `tier_price` DECIMAL(12,4) DEFAULT NULL, + `alt_tier_price` DECIMAL(12,4) DEFAULT NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`, `option_id`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8; + +"); +$installer->endSetup(); diff --git a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.2-0.1.3.php b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.2-0.1.3.php index 082ff33e3b..99810f01e3 100644 --- a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.2-0.1.3.php +++ b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.2-0.1.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.3-0.1.4.php b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.3-0.1.4.php index 378503f1e5..e0347b667a 100644 --- a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.3-0.1.4.php +++ b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.3-0.1.4.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.4-0.1.5.php b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.4-0.1.5.php index 4069ea5cce..2a616ae913 100644 --- a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.4-0.1.5.php +++ b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.4-0.1.5.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.5-0.1.6.php b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.5-0.1.6.php index 835734aad3..705737df58 100644 --- a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.5-0.1.6.php +++ b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.5-0.1.6.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.6-0.1.7.php b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.6-0.1.7.php index 258d4fd664..f7123bc10f 100644 --- a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.6-0.1.7.php +++ b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.6-0.1.7.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.7-0.1.8.php b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.7-0.1.8.php index 270e8d6716..134ec9260c 100644 --- a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.7-0.1.8.php +++ b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.7-0.1.8.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.8-0.1.9.php b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.8-0.1.9.php index 114492281f..af5e9b8053 100644 --- a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.8-0.1.9.php +++ b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.8-0.1.9.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.9-0.1.10.php b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.9-0.1.10.php index d9309d80a7..2ede6aaed8 100644 --- a/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.9-0.1.10.php +++ b/app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-0.1.9-0.1.10.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Bundle - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Breadcrumbs.php b/app/code/core/Mage/Catalog/Block/Breadcrumbs.php index dd174be465..400f11794d 100644 --- a/app/code/core/Mage/Catalog/Block/Breadcrumbs.php +++ b/app/code/core/Mage/Catalog/Block/Breadcrumbs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** diff --git a/app/code/core/Mage/Catalog/Block/Category/View.php b/app/code/core/Mage/Catalog/Block/Category/View.php index 8379330934..b2328962ed 100644 --- a/app/code/core/Mage/Catalog/Block/Category/View.php +++ b/app/code/core/Mage/Catalog/Block/Category/View.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Category/Widget/Link.php b/app/code/core/Mage/Catalog/Block/Category/Widget/Link.php index ffdc4c7a46..82bd2808f4 100644 --- a/app/code/core/Mage/Catalog/Block/Category/Widget/Link.php +++ b/app/code/core/Mage/Catalog/Block/Category/Widget/Link.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Layer/Filter/Abstract.php b/app/code/core/Mage/Catalog/Block/Layer/Filter/Abstract.php index 806a96d180..f81e082281 100644 --- a/app/code/core/Mage/Catalog/Block/Layer/Filter/Abstract.php +++ b/app/code/core/Mage/Catalog/Block/Layer/Filter/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -76,7 +76,7 @@ public function init() protected function _initFilter() { if (!$this->_filterModelName) { - Mage::throwException(Mage::helper('catalog')->__('Filter model name must be declared')); + Mage::throwException(Mage::helper('catalog')->__('Filter model name must be declared.')); } $this->_filter = Mage::getModel($this->_filterModelName) ->setLayer($this->getLayer()); diff --git a/app/code/core/Mage/Catalog/Block/Layer/Filter/Attribute.php b/app/code/core/Mage/Catalog/Block/Layer/Filter/Attribute.php index bf6981b515..56515f7c00 100644 --- a/app/code/core/Mage/Catalog/Block/Layer/Filter/Attribute.php +++ b/app/code/core/Mage/Catalog/Block/Layer/Filter/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Layer/Filter/Category.php b/app/code/core/Mage/Catalog/Block/Layer/Filter/Category.php index 22e706d99b..96b9026a81 100644 --- a/app/code/core/Mage/Catalog/Block/Layer/Filter/Category.php +++ b/app/code/core/Mage/Catalog/Block/Layer/Filter/Category.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Layer/Filter/Decimal.php b/app/code/core/Mage/Catalog/Block/Layer/Filter/Decimal.php index acf287f445..5771e57a6a 100644 --- a/app/code/core/Mage/Catalog/Block/Layer/Filter/Decimal.php +++ b/app/code/core/Mage/Catalog/Block/Layer/Filter/Decimal.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Layer/Filter/Price.php b/app/code/core/Mage/Catalog/Block/Layer/Filter/Price.php index 6c76b8b368..a066661c1e 100644 --- a/app/code/core/Mage/Catalog/Block/Layer/Filter/Price.php +++ b/app/code/core/Mage/Catalog/Block/Layer/Filter/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Layer/State.php b/app/code/core/Mage/Catalog/Block/Layer/State.php index cbc79bd1ea..6bcd04dcbe 100644 --- a/app/code/core/Mage/Catalog/Block/Layer/State.php +++ b/app/code/core/Mage/Catalog/Block/Layer/State.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Layer/View.php b/app/code/core/Mage/Catalog/Block/Layer/View.php index 2fa07550d8..c7d9a570fc 100644 --- a/app/code/core/Mage/Catalog/Block/Layer/View.php +++ b/app/code/core/Mage/Catalog/Block/Layer/View.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Navigation.php b/app/code/core/Mage/Catalog/Block/Navigation.php index 6b54fdb488..cc7925f1ba 100644 --- a/app/code/core/Mage/Catalog/Block/Navigation.php +++ b/app/code/core/Mage/Catalog/Block/Navigation.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -52,17 +52,21 @@ protected function _construct() } /** - * Retrieve Key for caching block content + * Get Key pieces for caching block content * - * @return string + * @return array */ - public function getCacheKey() + public function getCacheKeyInfo() { - return 'CATALOG_NAVIGATION_' . Mage::app()->getStore()->getId() - . '_' . Mage::getDesign()->getPackageName() - . '_' . Mage::getDesign()->getTheme('template') - . '_' . Mage::getSingleton('customer/session')->getCustomerGroupId() - . '_' . md5($this->getTemplate() . $this->getCurrenCategoryKey()); + return array( + 'CATALOG_NAVIGATION', + Mage::app()->getStore()->getId(), + Mage::getDesign()->getPackageName(), + Mage::getDesign()->getTheme('template'), + Mage::getSingleton('customer/session')->getCustomerGroupId(), + 'template' => $this->getTemplate(), + $this->getCurrenCategoryKey() + ); } public function getCurrenCategoryKey() @@ -171,76 +175,138 @@ protected function _getItemPosition($level) } /** - * Enter description here... + * Render category to html * * @param Mage_Catalog_Model_Category $category - * @param int $level - * @param boolean $last + * @param int Nesting level number + * @param boolean Whether ot not this item is last, affects list item class + * @param boolean Whether ot not this item is first, affects list item class + * @param boolean Whether ot not this item is outermost, affects list item class + * @param string Extra class of outermost list items + * @param string If specified wraps children list in div with this class + * @param boolean Whether ot not to add on* attributes to list item * @return string */ - public function drawItem($category, $level=0, $last=false) + protected function _renderCategoryMenuItemHtml($category, $level = 0, $isLast = false, $isFirst = false, + $isOutermost = false, $outermostItemClass = '', $childrenWrapClass = '', $noEventAttributes = false) { - $html = ''; if (!$category->getIsActive()) { - return $html; + return ''; } + $html = array(); + + // get all children if (Mage::helper('catalog/category_flat')->isEnabled()) { - $children = $category->getChildrenNodes(); + $children = (array)$category->getChildrenNodes(); $childrenCount = count($children); } else { $children = $category->getChildren(); $childrenCount = $children->count(); } - $hasChildren = $children && $childrenCount; - $html.= 'getIsActive()) { + $activeChildren[] = $child; + } } + $activeChildrenCount = count($activeChildren); + $hasActiveChildren = ($activeChildrenCount > 0); - $html.= ' class="level'.$level; - //$html.= ' nav-'.str_replace('/', '-', Mage::helper('catalog/category')->getCategoryUrlPath($category->getRequestPath())); - $html.= ' nav-' . $this->_getItemPosition($level); + // prepare list item html classes + $classes = array(); + $classes[] = 'level' . $level; + $classes[] = 'nav-' . $this->_getItemPosition($level); + $linkClass = ''; + if ($isOutermost && $outermostItemClass) { + $classes[] = $outermostItemClass; + $linkClass = ' class="'.$outermostItemClass.'"'; + } if ($this->isCategoryActive($category)) { - $html.= ' active'; + $classes[] = 'active'; } - if ($last) { - $html .= ' last'; + if ($isFirst) { + $classes[] = 'first'; } - if ($hasChildren) { - $cnt = 0; - foreach ($children as $child) { - if ($child->getIsActive()) { - $cnt++; - } - } - if ($cnt > 0) { - $html .= ' parent'; - } + if ($isLast) { + $classes[] = 'last'; + } + if ($hasActiveChildren) { + $classes[] = 'parent'; } - $html.= '">'."\n"; - $html.= ''.$this->htmlEscape($category->getName()).''."\n"; - if ($hasChildren){ + // prepare list item attributes + $attributes = array(); + if (count($classes) > 0) { + $attributes['class'] = implode(' ', $classes); + } + if ($hasActiveChildren && !$noEventAttributes) { + $attributes['onmouseover'] = 'toggleMenu(this,1)'; + $attributes['onmouseout'] = 'toggleMenu(this,0)'; + } - $j = 0; - $htmlChildren = ''; - foreach ($children as $child) { - if ($child->getIsActive()) { - $htmlChildren.= $this->drawItem($child, $level+1, ++$j >= $cnt); - } - } + // assemble list item with attributes + $htmlLi = ' $attrValue) { + $htmlLi .= ' ' . $attrName . '="' . str_replace('"', '\"', $attrValue) . '"'; + } + $htmlLi .= '>'; + $html[] = $htmlLi; - if (!empty($htmlChildren)) { - $html.= '
        '."\n" - .$htmlChildren - .'
      '; - } + $html[] = ''; + $html[] = '' . $this->escapeHtml($category->getName()) . ''; + $html[] = ''; + // render children + $htmlChildren = ''; + $j = 0; + foreach ($activeChildren as $child) { + $htmlChildren .= $this->_renderCategoryMenuItemHtml( + $child, + ($level + 1), + ($j == $activeChildrenCount - 1), + ($j == 0), + false, + $outermostItemClass, + $childrenWrapClass, + $noEventAttributes + ); + $j++; } - $html.= ''."\n"; + if (!empty($htmlChildren)) { + if ($childrenWrapClass) { + $html[] = '
      '; + } + $html[] = '
        '; + $html[] = $htmlChildren; + $html[] = '
      '; + if ($childrenWrapClass) { + $html[] = '
      '; + } + } + + $html[] = ''; + + $html = implode("\n", $html); return $html; } + /** + * Render category to html + * + * @deprecated deprecated after 1.4 + * @param Mage_Catalog_Model_Category $category + * @param int Nesting level number + * @param boolean Whether ot not this item is last, affects list item class + * @return string + */ + public function drawItem($category, $level = 0, $last = false) + { + return $this->_renderCategoryMenuItemHtml($category, $level, $last); + } + /** * Enter description here... * @@ -309,4 +375,46 @@ public function drawOpenCategoryItem($category) { return $html; } + /** + * Render categories menu in HTML + * + * @param int Level number for list item class to start from + * @param string Extra class of outermost list items + * @param string If specified wraps children list in div with this class + * @return string + */ + public function renderCategoriesMenuHtml($level = 0, $outermostItemClass = '', $childrenWrapClass = '') + { + $activeCategories = array(); + foreach ($this->getStoreCategories() as $child) { + if ($child->getIsActive()) { + $activeCategories[] = $child; + } + } + $activeCategoriesCount = count($activeCategories); + $hasActiveCategoriesCount = ($activeCategoriesCount > 0); + + if (!$hasActiveCategoriesCount) { + return ''; + } + + $html = ''; + $j = 0; + foreach ($activeCategories as $category) { + $html .= $this->_renderCategoryMenuItemHtml( + $category, + $level, + ($j == $activeCategoriesCount - 1), + ($j == 0), + true, + $outermostItemClass, + $childrenWrapClass, + true + ); + $j++; + } + + return $html; + } + } diff --git a/app/code/core/Mage/Catalog/Block/Product.php b/app/code/core/Mage/Catalog/Block/Product.php index 8b939f3099..9181180df2 100644 --- a/app/code/core/Mage/Catalog/Block/Product.php +++ b/app/code/core/Mage/Catalog/Block/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/Abstract.php b/app/code/core/Mage/Catalog/Block/Product/Abstract.php index ccb92ea3c1..2dc3eb5b6d 100644 --- a/app/code/core/Mage/Catalog/Block/Product/Abstract.php +++ b/app/code/core/Mage/Catalog/Block/Product/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -110,7 +110,7 @@ public function getAddToCompareUrl($product) public function getMinimalQty($product) { if ($stockItem = $product->getStockItem()) { - return $stockItem->getMinSaleQty()>0 ? $stockItem->getMinSaleQty()*1 : null; + return ($stockItem->getMinSaleQty() && $stockItem->getMinSaleQty() > 0 ? $stockItem->getMinSaleQty() * 1 : null); } return null; } diff --git a/app/code/core/Mage/Catalog/Block/Product/Compare/Abstract.php b/app/code/core/Mage/Catalog/Block/Product/Compare/Abstract.php index e1e78947ea..992e1694f4 100644 --- a/app/code/core/Mage/Catalog/Block/Product/Compare/Abstract.php +++ b/app/code/core/Mage/Catalog/Block/Product/Compare/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/Compare/List.php b/app/code/core/Mage/Catalog/Block/Product/Compare/List.php index 55b2bf226d..939e6652a0 100644 --- a/app/code/core/Mage/Catalog/Block/Product/Compare/List.php +++ b/app/code/core/Mage/Catalog/Block/Product/Compare/List.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -82,7 +82,7 @@ protected function _prepareLayout() { $headBlock = $this->getLayout()->getBlock('head'); if ($headBlock) { - $headBlock->setTitle(Mage::helper('catalog')->__('Compare Products List') . ' - ' . $headBlock->getDefaultTitle()); + $headBlock->setTitle(Mage::helper('catalog')->__('Products Comparison List') . ' - ' . $headBlock->getDefaultTitle()); } return parent::_prepareLayout(); } diff --git a/app/code/core/Mage/Catalog/Block/Product/Compare/Sidebar.php b/app/code/core/Mage/Catalog/Block/Product/Compare/Sidebar.php index 1adf6c7368..789e8a025d 100644 --- a/app/code/core/Mage/Catalog/Block/Product/Compare/Sidebar.php +++ b/app/code/core/Mage/Catalog/Block/Product/Compare/Sidebar.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/Gallery.php b/app/code/core/Mage/Catalog/Block/Product/Gallery.php index 02bf81eb72..e0ccc7b420 100644 --- a/app/code/core/Mage/Catalog/Block/Product/Gallery.php +++ b/app/code/core/Mage/Catalog/Block/Product/Gallery.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/List.php b/app/code/core/Mage/Catalog/Block/Product/List.php index 3617e82cf5..5cb7d8df3d 100644 --- a/app/code/core/Mage/Catalog/Block/Product/List.php +++ b/app/code/core/Mage/Catalog/Block/Product/List.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -136,6 +136,9 @@ protected function _beforeToHtml() if ($sort = $this->getSortBy()) { $toolbar->setDefaultOrder($sort); } + if ($dir = $this->getDefaultDirection()) { + $toolbar->setDefaultDirection($dir); + } if ($modes = $this->getModes()) { $toolbar->setModes($modes); } diff --git a/app/code/core/Mage/Catalog/Block/Product/List/Crosssell.php b/app/code/core/Mage/Catalog/Block/Product/List/Crosssell.php index 16ba4d4bf3..6b5afd450b 100644 --- a/app/code/core/Mage/Catalog/Block/Product/List/Crosssell.php +++ b/app/code/core/Mage/Catalog/Block/Product/List/Crosssell.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/List/Promotion.php b/app/code/core/Mage/Catalog/Block/Product/List/Promotion.php index 499865129f..621f01d751 100755 --- a/app/code/core/Mage/Catalog/Block/Product/List/Promotion.php +++ b/app/code/core/Mage/Catalog/Block/Product/List/Promotion.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Catalog_Block_Product_List_Promotion extends Mage_Catalog_Block_Product_List diff --git a/app/code/core/Mage/Catalog/Block/Product/List/Random.php b/app/code/core/Mage/Catalog/Block/Product/List/Random.php index 0901c77d1f..ac137a8af3 100644 --- a/app/code/core/Mage/Catalog/Block/Product/List/Random.php +++ b/app/code/core/Mage/Catalog/Block/Product/List/Random.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/List/Related.php b/app/code/core/Mage/Catalog/Block/Product/List/Related.php index e66961880e..bd6cf8283a 100644 --- a/app/code/core/Mage/Catalog/Block/Product/List/Related.php +++ b/app/code/core/Mage/Catalog/Block/Product/List/Related.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php b/app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php index bd59edbf10..6627d37bbc 100644 --- a/app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php +++ b/app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/List/Upsell.php b/app/code/core/Mage/Catalog/Block/Product/List/Upsell.php index 443349e989..725cdcf647 100644 --- a/app/code/core/Mage/Catalog/Block/Product/List/Upsell.php +++ b/app/code/core/Mage/Catalog/Block/Product/List/Upsell.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/New.php b/app/code/core/Mage/Catalog/Block/Product/New.php index 27d94b0f19..12c6edc090 100644 --- a/app/code/core/Mage/Catalog/Block/Product/New.php +++ b/app/code/core/Mage/Catalog/Block/Product/New.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -50,18 +50,21 @@ protected function _construct() } /** - * Retrieve Key for caching block content + * Get Key pieces for caching block content * - * @return string + * @return array */ - public function getCacheKey() + public function getCacheKeyInfo() { - return 'CATALOG_PRODUCT_NEW_' . Mage::app()->getStore()->getId() - . '_' . Mage::getDesign()->getPackageName() - . '_' . Mage::getDesign()->getTheme('template') - . '_' . Mage::getSingleton('customer/session')->getCustomerGroupId() - . '_' . md5($this->getTemplate()) - . '_' . $this->getProductsCount(); + return array( + 'CATALOG_PRODUCT_NEW', + Mage::app()->getStore()->getId(), + Mage::getDesign()->getPackageName(), + Mage::getDesign()->getTheme('template'), + Mage::getSingleton('customer/session')->getCustomerGroupId(), + 'template' => $this->getTemplate(), + $this->getProductsCount() + ); } /** diff --git a/app/code/core/Mage/Catalog/Block/Product/Price.php b/app/code/core/Mage/Catalog/Block/Product/Price.php index bd8f322ad8..8705c55257 100644 --- a/app/code/core/Mage/Catalog/Block/Product/Price.php +++ b/app/code/core/Mage/Catalog/Block/Product/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/Price/Template.php b/app/code/core/Mage/Catalog/Block/Product/Price/Template.php index 61028125cf..2769a8db4f 100644 --- a/app/code/core/Mage/Catalog/Block/Product/Price/Template.php +++ b/app/code/core/Mage/Catalog/Block/Product/Price/Template.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/Send.php b/app/code/core/Mage/Catalog/Block/Product/Send.php index 92f030dbeb..7ab6a6818d 100644 --- a/app/code/core/Mage/Catalog/Block/Product/Send.php +++ b/app/code/core/Mage/Catalog/Block/Product/Send.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/View.php b/app/code/core/Mage/Catalog/Block/Product/View.php index 572bd38341..25dcf923a0 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View.php +++ b/app/code/core/Mage/Catalog/Block/Product/View.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/View/Abstract.php b/app/code/core/Mage/Catalog/Block/Product/View/Abstract.php index a7341999a0..c4893f8835 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View/Abstract.php +++ b/app/code/core/Mage/Catalog/Block/Product/View/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/View/Additional.php b/app/code/core/Mage/Catalog/Block/Product/View/Additional.php index 7265802644..199822b00c 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View/Additional.php +++ b/app/code/core/Mage/Catalog/Block/Product/View/Additional.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -50,7 +50,7 @@ public function getChildHtmlList() foreach ($this->getSortedChildren() as $name) { $block = $this->getLayout()->getBlock($name); if (!$block) { - Mage::exception(Mage::helper('catalog')->__('Invalid block: %s', $name)); + Mage::exception(Mage::helper('catalog')->__('Invalid block: %s.', $name)); } $this->_list[] = $block->toHtml(); } diff --git a/app/code/core/Mage/Catalog/Block/Product/View/Attributes.php b/app/code/core/Mage/Catalog/Block/Product/View/Attributes.php index 7693ed6be4..3046359459 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View/Attributes.php +++ b/app/code/core/Mage/Catalog/Block/Product/View/Attributes.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -67,8 +67,6 @@ public function getAdditionalData(array $excludeAttr = array()) if (strlen($value) && $product->hasData($attribute->getAttributeCode())) { if ($attribute->getFrontendInput() == 'price') { $value = Mage::app()->getStore()->convertPrice($value,true); - } elseif (!$attribute->getIsHtmlAllowedOnFront()) { - $value = $this->htmlEscape($value); } $data[$attribute->getAttributeCode()] = array( 'label' => $attribute->getStoreLabel(), diff --git a/app/code/core/Mage/Catalog/Block/Product/View/Description.php b/app/code/core/Mage/Catalog/Block/Product/View/Description.php index 5c1a76ac8f..cb0b9acac4 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View/Description.php +++ b/app/code/core/Mage/Catalog/Block/Product/View/Description.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/View/Media.php b/app/code/core/Mage/Catalog/Block/Product/View/Media.php index 707894f344..55d98c6850 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View/Media.php +++ b/app/code/core/Mage/Catalog/Block/Product/View/Media.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/View/Options.php b/app/code/core/Mage/Catalog/Block/Product/View/Options.php index 3dc57dadb6..7491b26521 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View/Options.php +++ b/app/code/core/Mage/Catalog/Block/Product/View/Options.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/View/Options/Abstract.php b/app/code/core/Mage/Catalog/Block/Product/View/Options/Abstract.php index 08c6ae471a..5e9b34e1e3 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View/Options/Abstract.php +++ b/app/code/core/Mage/Catalog/Block/Product/View/Options/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Date.php b/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Date.php index f567819940..08a8112047 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Date.php +++ b/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Date.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Default.php b/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Default.php index 5dd43cd01e..283f22c1c3 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Default.php +++ b/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/File.php b/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/File.php index fd763d9b73..479cce6c68 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/File.php +++ b/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/File.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Select.php b/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Select.php index ff0cabf56f..382103a54b 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Select.php +++ b/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Select.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Text.php b/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Text.php index 25a7f7498b..36a54734f6 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Text.php +++ b/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Text.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/View/Price.php b/app/code/core/Mage/Catalog/Block/Product/View/Price.php index edd25b4b51..ae58b71f20 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View/Price.php +++ b/app/code/core/Mage/Catalog/Block/Product/View/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/View/Tabs.php b/app/code/core/Mage/Catalog/Block/Product/View/Tabs.php index 615d2f15d6..a86062d02d 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View/Tabs.php +++ b/app/code/core/Mage/Catalog/Block/Product/View/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/View/Type/Configurable.php b/app/code/core/Mage/Catalog/Block/Product/View/Type/Configurable.php index 8df8134306..18c467a3a5 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View/Type/Configurable.php +++ b/app/code/core/Mage/Catalog/Block/Product/View/Type/Configurable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/View/Type/Grouped.php b/app/code/core/Mage/Catalog/Block/Product/View/Type/Grouped.php index 07b10fb11f..7e8b182e9b 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View/Type/Grouped.php +++ b/app/code/core/Mage/Catalog/Block/Product/View/Type/Grouped.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/View/Type/Simple.php b/app/code/core/Mage/Catalog/Block/Product/View/Type/Simple.php index 7526e2b82d..5e1286df74 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View/Type/Simple.php +++ b/app/code/core/Mage/Catalog/Block/Product/View/Type/Simple.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/View/Type/Virtual.php b/app/code/core/Mage/Catalog/Block/Product/View/Type/Virtual.php index faef25a0d4..abd6243047 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View/Type/Virtual.php +++ b/app/code/core/Mage/Catalog/Block/Product/View/Type/Virtual.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/Widget/Link.php b/app/code/core/Mage/Catalog/Block/Product/Widget/Link.php index 52ec36d2be..5b0aac6e84 100644 --- a/app/code/core/Mage/Catalog/Block/Product/Widget/Link.php +++ b/app/code/core/Mage/Catalog/Block/Product/Widget/Link.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Product/Widget/New.php b/app/code/core/Mage/Catalog/Block/Product/Widget/New.php index dcc605e6c0..42ec65b011 100644 --- a/app/code/core/Mage/Catalog/Block/Product/Widget/New.php +++ b/app/code/core/Mage/Catalog/Block/Product/Widget/New.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Abstract.php b/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Abstract.php index 0bd423343c..7c19f09951 100644 --- a/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Abstract.php +++ b/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Category.php b/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Category.php index 1fa8725b47..07a8d5d52b 100644 --- a/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Category.php +++ b/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Category.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Product.php b/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Product.php index e3d0e723cb..4fafabdceb 100644 --- a/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Product.php +++ b/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Tree/Category.php b/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Tree/Category.php index 84acb72a21..de116a0c85 100644 --- a/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Tree/Category.php +++ b/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Tree/Category.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Tree/Pager.php b/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Tree/Pager.php index f803ee3da8..a8729ff35e 100644 --- a/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Tree/Pager.php +++ b/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Tree/Pager.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Block/Widget/Link.php b/app/code/core/Mage/Catalog/Block/Widget/Link.php index 679a6fef1c..7d5acd3552 100644 --- a/app/code/core/Mage/Catalog/Block/Widget/Link.php +++ b/app/code/core/Mage/Catalog/Block/Widget/Link.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Exception.php b/app/code/core/Mage/Catalog/Exception.php index 8870a9e8a8..1f0c660ccb 100644 --- a/app/code/core/Mage/Catalog/Exception.php +++ b/app/code/core/Mage/Catalog/Exception.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Helper/Category.php b/app/code/core/Mage/Catalog/Helper/Category.php index f28002605b..dd4d3b7f6f 100644 --- a/app/code/core/Mage/Catalog/Helper/Category.php +++ b/app/code/core/Mage/Catalog/Helper/Category.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Helper/Category/Flat.php b/app/code/core/Mage/Catalog/Helper/Category/Flat.php index 13850c6523..1f5fa72b77 100644 --- a/app/code/core/Mage/Catalog/Helper/Category/Flat.php +++ b/app/code/core/Mage/Catalog/Helper/Category/Flat.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Helper/Data.php b/app/code/core/Mage/Catalog/Helper/Data.php index e908766a43..d6534a4779 100644 --- a/app/code/core/Mage/Catalog/Helper/Data.php +++ b/app/code/core/Mage/Catalog/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -34,10 +34,14 @@ */ class Mage_Catalog_Helper_Data extends Mage_Core_Helper_Abstract { - const PRICE_SCOPE_GLOBAL = 0; - const PRICE_SCOPE_WEBSITE = 1; - const XML_PATH_PRICE_SCOPE = 'catalog/price/scope'; - + const PRICE_SCOPE_GLOBAL = 0; + const PRICE_SCOPE_WEBSITE = 1; + const XML_PATH_PRICE_SCOPE = 'catalog/price/scope'; + const XML_PATH_SEO_SAVE_HISTORY = 'catalog/seo/save_rewrites_history'; + const CONFIG_USE_STATIC_URLS = 'cms/wysiwyg/use_static_urls_in_catalog'; + const CONFIG_PARSE_URL_DIRECTIVES = 'catalog/frontend/parse_url_directives'; + const XML_PATH_CONTENT_TEMPLATE_FILTER = 'global/catalog/content/tempate_filter'; + /** * Breadcrumb Path cache * @@ -45,6 +49,24 @@ class Mage_Catalog_Helper_Data extends Mage_Core_Helper_Abstract */ protected $_categoryPath; + /** + * Currenty selected store ID if applicable + * + * @var int + */ + protected $_storeId = null; + + /** + * Set a specified store ID value + * + * @param int $store + */ + public function setStoreId($store) + { + $this->_storeId = $store; + return $this; + } + /** * Return current category path or get it from current category * and creating array of categories|product paths for breadcrumbs @@ -204,4 +226,46 @@ public function isPriceGlobal() { return $this->getPriceScope() == self::PRICE_SCOPE_GLOBAL; } + + /** + * Indicate whether to save URL Rewrite History or not (create redirects to old URLs) + * + * @param int $storeId Store View + * @return bool + */ + public function shouldSaveUrlRewritesHistory($storeId = null) + { + return Mage::getStoreConfigFlag(self::XML_PATH_SEO_SAVE_HISTORY, $storeId); + } + + /** + * Check if the store is configured to use static URLs for media + * + * @return bool + */ + public function isUsingStaticUrlsAllowed() + { + return Mage::getStoreConfigFlag(self::CONFIG_USE_STATIC_URLS, $this->_storeId); + } + + /** + * Check if the parsing of URL directives is allowed for the catalog + * + * @return bool + */ + public function isUrlDirectivesParsingAllowed() + { + return Mage::getStoreConfigFlag(self::CONFIG_PARSE_URL_DIRECTIVES, $this->_storeId); + } + + /** + * Retrieve template processor for catalog content + * + * @return Varien_Filter_Template + */ + public function getPageTemplateProcessor() + { + $model = (string)Mage::getConfig()->getNode(self::XML_PATH_CONTENT_TEMPLATE_FILTER); + return Mage::getModel($model); + } } diff --git a/app/code/core/Mage/Catalog/Helper/Image.php b/app/code/core/Mage/Catalog/Helper/Image.php index dab13ffee5..7ccc5201a9 100644 --- a/app/code/core/Mage/Catalog/Helper/Image.php +++ b/app/code/core/Mage/Catalog/Helper/Image.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Helper/Map.php b/app/code/core/Mage/Catalog/Helper/Map.php index 9953991a2c..4de183d80b 100644 --- a/app/code/core/Mage/Catalog/Helper/Map.php +++ b/app/code/core/Mage/Catalog/Helper/Map.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Helper/Output.php b/app/code/core/Mage/Catalog/Helper/Output.php index ea77353984..aba5f0142b 100644 --- a/app/code/core/Mage/Catalog/Helper/Output.php +++ b/app/code/core/Mage/Catalog/Helper/Output.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -33,11 +33,30 @@ class Mage_Catalog_Helper_Output extends Mage_Core_Helper_Abstract */ protected $_handlers; + /** + * Template processor instance + * + * @var Varien_Filter_Template + */ + protected $_templateProcessor = null; + + /** + * Constructor + */ public function __construct() { Mage::dispatchEvent('catalog_helper_output_construct', array('helper'=>$this)); } + protected function _getTemplateProcessor() + { + if (null === $this->_templateProcessor) { + $this->_templateProcessor = Mage::helper('catalog')->getPageTemplateProcessor(); + } + + return $this->_templateProcessor; + } + /** * Adding method handler * @@ -100,12 +119,18 @@ public function process($method, $result, $params) */ public function productAttribute($product, $attributeHtml, $attributeName) { - $attributes = $product->getAttributes(); - $attribute = (isset($attributes[$attributeName])) ? $attributes[$attributeName] : null; - - if ($attribute && ($attribute->getFrontendInput() != 'media_image') + $attribute = Mage::getSingleton('eav/config')->getAttribute('catalog_product', $attributeName); + if ($attribute && $attribute->getId() && ($attribute->getFrontendInput() != 'media_image') && (!$attribute->getIsHtmlAllowedOnFront() && !$attribute->getIsWysiwygEnabled())) { $attributeHtml = $this->htmlEscape($attributeHtml); + if ($attribute->getFrontendInput() == 'textarea') { + $attributeHtml = nl2br($attributeHtml); + } + } + if ($attribute->getIsHtmlAllowedOnFront() && $attribute->getIsWysiwygEnabled()) { + if (Mage::helper('catalog')->isUrlDirectivesParsingAllowed()) { + $attributeHtml = $this->_getTemplateProcessor()->filter($attributeHtml); + } } $attributeHtml = $this->process('productAttribute', $attributeHtml, array( 'product' => $product, @@ -130,6 +155,11 @@ public function categoryAttribute($category, $attributeHtml, $attributeName) && (!$attribute->getIsHtmlAllowedOnFront() && !$attribute->getIsWysiwygEnabled())) { $attributeHtml = $this->htmlEscape($attributeHtml); } + if ($attribute->getIsHtmlAllowedOnFront() && $attribute->getIsWysiwygEnabled()) { + if (Mage::helper('catalog')->isUrlDirectivesParsingAllowed()) { + $attributeHtml = $this->_getTemplateProcessor()->filter($attributeHtml); + } + } $attributeHtml = $this->process('categoryAttribute', $attributeHtml, array( 'category' => $category, 'attribute' => $attributeName diff --git a/app/code/core/Mage/Catalog/Helper/Product.php b/app/code/core/Mage/Catalog/Helper/Product.php index a41930c8bc..14a7512dbf 100644 --- a/app/code/core/Mage/Catalog/Helper/Product.php +++ b/app/code/core/Mage/Catalog/Helper/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Helper/Product/Compare.php b/app/code/core/Mage/Catalog/Helper/Product/Compare.php index d07402d9e8..53c18390c3 100644 --- a/app/code/core/Mage/Catalog/Helper/Product/Compare.php +++ b/app/code/core/Mage/Catalog/Helper/Product/Compare.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Helper/Product/Flat.php b/app/code/core/Mage/Catalog/Helper/Product/Flat.php index 85de26c6f5..5b6c33d814 100644 --- a/app/code/core/Mage/Catalog/Helper/Product/Flat.php +++ b/app/code/core/Mage/Catalog/Helper/Product/Flat.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Helper/Product/Options.php b/app/code/core/Mage/Catalog/Helper/Product/Options.php index f07100e0cd..bf8e24f639 100644 --- a/app/code/core/Mage/Catalog/Helper/Product/Options.php +++ b/app/code/core/Mage/Catalog/Helper/Product/Options.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Helper/Product/Url.php b/app/code/core/Mage/Catalog/Helper/Product/Url.php index 7bb20de1ea..eb11faf7df 100644 --- a/app/code/core/Mage/Catalog/Helper/Product/Url.php +++ b/app/code/core/Mage/Catalog/Helper/Product/Url.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Abstract.php b/app/code/core/Mage/Catalog/Model/Abstract.php index 16568ada9f..885daaebf4 100644 --- a/app/code/core/Mage/Catalog/Model/Abstract.php +++ b/app/code/core/Mage/Catalog/Model/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Api/Resource.php b/app/code/core/Mage/Catalog/Model/Api/Resource.php index eb3a990e60..102b0bb124 100644 --- a/app/code/core/Mage/Catalog/Model/Api/Resource.php +++ b/app/code/core/Mage/Catalog/Model/Api/Resource.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Category.php b/app/code/core/Mage/Catalog/Model/Category.php index 21f8fb3b31..153f4da64b 100644 --- a/app/code/core/Mage/Catalog/Model/Category.php +++ b/app/code/core/Mage/Catalog/Model/Category.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -192,7 +192,7 @@ public function move($parentId, $afterCategoryId) if (!$parent->getId()) { Mage::throwException( - Mage::helper('catalog')->__('Category move operation is not possible: new parent category not found.') + Mage::helper('catalog')->__('Category move operation is not possible: the new parent category was not found.') ); } diff --git a/app/code/core/Mage/Catalog/Model/Category/Api.php b/app/code/core/Mage/Catalog/Model/Category/Api.php index a7c66bf16b..6734aa4ec9 100644 --- a/app/code/core/Mage/Catalog/Model/Category/Api.php +++ b/app/code/core/Mage/Catalog/Model/Category/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -259,7 +259,7 @@ public function create($parentId, $categoryData, $store = null) if ($validate !== true) { foreach ($validate as $code => $error) { if ($error === true) { - Mage::throwException(Mage::helper('catalog')->__('Attribute "%s" is required', $code)); + Mage::throwException(Mage::helper('catalog')->__('Attribute "%s" is required.', $code)); } else { Mage::throwException($error); @@ -303,7 +303,7 @@ public function update($categoryId, $categoryData, $store = null) if ($validate !== true) { foreach ($validate as $code => $error) { if ($error === true) { - Mage::throwException(Mage::helper('catalog')->__('Attribute "%s" is required', $code)); + Mage::throwException(Mage::helper('catalog')->__('Attribute "%s" is required.', $code)); } else { Mage::throwException($error); @@ -429,9 +429,9 @@ public function assignedProducts($categoryId, $store = null) { $category = $this->_initCategory($categoryId); - $collection = $category->setStoreId($this->_getStoreId($store)) - ->getProductCollection() - ->setOrder('position', 'asc'); + $storeId = $this->_getStoreId($store); + $collection = $category->setStoreId($storeId)->getProductCollection(); + ($storeId == 0)? $collection->addOrder('position', 'asc') : $collection->setOrder('position', 'asc');; $result = array(); diff --git a/app/code/core/Mage/Catalog/Model/Category/Api/V2.php b/app/code/core/Mage/Catalog/Model/Category/Api/V2.php index 7b93b784df..8b844e74b1 100644 --- a/app/code/core/Mage/Catalog/Model/Category/Api/V2.php +++ b/app/code/core/Mage/Catalog/Model/Category/Api/V2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -100,7 +100,7 @@ public function create($parentId, $categoryData, $store = null) if ($validate !== true) { foreach ($validate as $code => $error) { if ($error === true) { - Mage::throwException(Mage::helper('catalog')->__('Attribute "%s" is required', $code)); + Mage::throwException(Mage::helper('catalog')->__('Attribute "%s" is required.', $code)); } else { Mage::throwException($error); @@ -145,7 +145,7 @@ public function update($categoryId, $categoryData, $store = null) if ($validate !== true) { foreach ($validate as $code => $error) { if ($error === true) { - Mage::throwException(Mage::helper('catalog')->__('Attribute "%s" is required', $code)); + Mage::throwException(Mage::helper('catalog')->__('Attribute "%s" is required.', $code)); } else { Mage::throwException($error); diff --git a/app/code/core/Mage/Catalog/Model/Category/Attribute/Api.php b/app/code/core/Mage/Catalog/Model/Category/Attribute/Api.php index d2d5345549..5b701bb84a 100644 --- a/app/code/core/Mage/Catalog/Model/Category/Attribute/Api.php +++ b/app/code/core/Mage/Catalog/Model/Category/Attribute/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Category/Attribute/Api/V2.php b/app/code/core/Mage/Catalog/Model/Category/Attribute/Api/V2.php index 3ed63b93c6..22287f9088 100644 --- a/app/code/core/Mage/Catalog/Model/Category/Attribute/Api/V2.php +++ b/app/code/core/Mage/Catalog/Model/Category/Attribute/Api/V2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Category/Attribute/Backend/Image.php b/app/code/core/Mage/Catalog/Model/Category/Attribute/Backend/Image.php index 7a98630d7b..aa8c60d366 100644 --- a/app/code/core/Mage/Catalog/Model/Category/Attribute/Backend/Image.php +++ b/app/code/core/Mage/Catalog/Model/Category/Attribute/Backend/Image.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Category/Attribute/Backend/Sortby.php b/app/code/core/Mage/Catalog/Model/Category/Attribute/Backend/Sortby.php index 3f9a5a9a99..7a8921fb46 100644 --- a/app/code/core/Mage/Catalog/Model/Category/Attribute/Backend/Sortby.php +++ b/app/code/core/Mage/Catalog/Model/Category/Attribute/Backend/Sortby.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -54,7 +54,7 @@ public function validate($object) $available = explode(',', $available); } if (!in_array($object->getData($attributeCode), $available)) { - Mage::throwException(Mage::helper('eav')->__('Default Product Listing Sort by not exists on Available Product Listing Sort by')); + Mage::throwException(Mage::helper('eav')->__('Default Product Listing Sort by not exists on Available Product Listing Sort By')); } } } diff --git a/app/code/core/Mage/Catalog/Model/Category/Attribute/Backend/Urlkey.php b/app/code/core/Mage/Catalog/Model/Category/Attribute/Backend/Urlkey.php index ac72ab27af..4091161707 100644 --- a/app/code/core/Mage/Catalog/Model/Category/Attribute/Backend/Urlkey.php +++ b/app/code/core/Mage/Catalog/Model/Category/Attribute/Backend/Urlkey.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Category/Attribute/Source/Layout.php b/app/code/core/Mage/Catalog/Model/Category/Attribute/Source/Layout.php index b90f062fd0..3f8f483dc1 100644 --- a/app/code/core/Mage/Catalog/Model/Category/Attribute/Source/Layout.php +++ b/app/code/core/Mage/Catalog/Model/Category/Attribute/Source/Layout.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Category/Attribute/Source/Mode.php b/app/code/core/Mage/Catalog/Model/Category/Attribute/Source/Mode.php index fb161f93ab..994a2f4817 100644 --- a/app/code/core/Mage/Catalog/Model/Category/Attribute/Source/Mode.php +++ b/app/code/core/Mage/Catalog/Model/Category/Attribute/Source/Mode.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Category/Attribute/Source/Page.php b/app/code/core/Mage/Catalog/Model/Category/Attribute/Source/Page.php index 820e9be776..3522926908 100644 --- a/app/code/core/Mage/Catalog/Model/Category/Attribute/Source/Page.php +++ b/app/code/core/Mage/Catalog/Model/Category/Attribute/Source/Page.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -39,7 +39,7 @@ public function getAllOptions() $this->_options = Mage::getResourceModel('cms/block_collection') ->load() ->toOptionArray(); - array_unshift($this->_options, array('value'=>'', 'label'=>Mage::helper('catalog')->__('Please select static block ...'))); + array_unshift($this->_options, array('value'=>'', 'label'=>Mage::helper('catalog')->__('Please select a static block ...'))); } return $this->_options; } diff --git a/app/code/core/Mage/Catalog/Model/Category/Attribute/Source/Sortby.php b/app/code/core/Mage/Catalog/Model/Category/Attribute/Source/Sortby.php index 549cfabd0c..90306a82c0 100644 --- a/app/code/core/Mage/Catalog/Model/Category/Attribute/Source/Sortby.php +++ b/app/code/core/Mage/Catalog/Model/Category/Attribute/Source/Sortby.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Category/Indexer/Flat.php b/app/code/core/Mage/Catalog/Model/Category/Indexer/Flat.php index d40f71770d..b94744c0cd 100644 --- a/app/code/core/Mage/Catalog/Model/Category/Indexer/Flat.php +++ b/app/code/core/Mage/Catalog/Model/Category/Indexer/Flat.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Category/Indexer/Product.php b/app/code/core/Mage/Catalog/Model/Category/Indexer/Product.php index 32144825c1..627df87f68 100644 --- a/app/code/core/Mage/Catalog/Model/Category/Indexer/Product.php +++ b/app/code/core/Mage/Catalog/Model/Category/Indexer/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Config.php b/app/code/core/Mage/Catalog/Model/Config.php index 5404f29398..e900b6e9b9 100644 --- a/app/code/core/Mage/Catalog/Model/Config.php +++ b/app/code/core/Mage/Catalog/Model/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Convert.php b/app/code/core/Mage/Catalog/Model/Convert.php index 19740a840c..cfce5196c5 100644 --- a/app/code/core/Mage/Catalog/Model/Convert.php +++ b/app/code/core/Mage/Catalog/Model/Convert.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Convert/Adapter/Catalog.php b/app/code/core/Mage/Catalog/Model/Convert/Adapter/Catalog.php index a7dc88912f..9d0d186a88 100644 --- a/app/code/core/Mage/Catalog/Model/Convert/Adapter/Catalog.php +++ b/app/code/core/Mage/Catalog/Model/Convert/Adapter/Catalog.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php b/app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php index 35c6fbbcc1..760cc78ade 100644 --- a/app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php +++ b/app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -411,16 +411,16 @@ public function save() if ($collections instanceof Mage_Catalog_Model_Entity_Product_Collection) { $collections = array($collections->getEntity()->getStoreId()=>$collections); } elseif (!is_array($collections)) { - $this->addException(Mage::helper('catalog')->__('No product collections found'), Mage_Dataflow_Model_Convert_Exception::FATAL); + $this->addException(Mage::helper('catalog')->__('No product collections found.'), Mage_Dataflow_Model_Convert_Exception::FATAL); } //$stockItems = $this->getInventoryItems(); $stockItems = Mage::registry('current_imported_inventory'); if ($collections) foreach ($collections as $storeId=>$collection) { - $this->addException(Mage::helper('catalog')->__('Records for "'.$stores[$storeId].'" store found')); + $this->addException(Mage::helper('catalog')->__('Records for "'.$stores[$storeId].'" store found.')); if (!$collection instanceof Mage_Catalog_Model_Entity_Product_Collection) { - $this->addException(Mage::helper('catalog')->__('Product collection expected'), Mage_Dataflow_Model_Convert_Exception::FATAL); + $this->addException(Mage::helper('catalog')->__('Product collection expected.'), Mage_Dataflow_Model_Convert_Exception::FATAL); } try { $i = 0; @@ -488,10 +488,10 @@ public function save() unset($model); $i++; } - $this->addException(Mage::helper('catalog')->__("Saved ".$i." record(s)")); + $this->addException(Mage::helper('catalog')->__("Saved %d record(s)", $i)); } catch (Exception $e) { if (!$e instanceof Mage_Dataflow_Model_Convert_Exception) { - $this->addException(Mage::helper('catalog')->__('Problem saving the collection, aborting. Error: %s', $e->getMessage()), + $this->addException(Mage::helper('catalog')->__('An error occurred while saving the collection, aborting. Error message: %s', $e->getMessage()), Mage_Dataflow_Model_Convert_Exception::FATAL); } } @@ -517,7 +517,7 @@ public function saveRow(array $importData) if (!is_null($this->getBatchParams('store'))) { $store = $this->getStoreById($this->getBatchParams('store')); } else { - $message = Mage::helper('catalog')->__('Skip import row, required field "%s" not defined', 'store'); + $message = Mage::helper('catalog')->__('Skipping import row, required field "%s" is not defined.', 'store'); Mage::throwException($message); } } @@ -526,12 +526,12 @@ public function saveRow(array $importData) } if ($store === false) { - $message = Mage::helper('catalog')->__('Skip import row, store "%s" field not exists', $importData['store']); + $message = Mage::helper('catalog')->__('Skipping import row, store "%s" field does not exist.', $importData['store']); Mage::throwException($message); } if (empty($importData['sku'])) { - $message = Mage::helper('catalog')->__('Skip import row, required field "%s" not defined', 'sku'); + $message = Mage::helper('catalog')->__('Skipping import row, required field "%s" is not defined.', 'sku'); Mage::throwException($message); } $product->setStoreId($store->getId()); @@ -558,7 +558,7 @@ public function saveRow(array $importData) */ if (empty($importData['attribute_set']) || !isset($productAttributeSets[$importData['attribute_set']])) { $value = isset($importData['attribute_set']) ? $importData['attribute_set'] : ''; - $message = Mage::helper('catalog')->__('Skip import row, is not valid value "%s" for field "%s"', $value, 'attribute_set'); + $message = Mage::helper('catalog')->__('Skip import row, the value "%s" is invalid for field "%s"', $value, 'attribute_set'); Mage::throwException($message); } $product->setAttributeSetId($productAttributeSets[$importData['attribute_set']]); @@ -566,7 +566,7 @@ public function saveRow(array $importData) foreach ($this->_requiredFields as $field) { $attribute = $this->getAttribute($field); if (!isset($importData[$field]) && $attribute && $attribute->getIsRequired()) { - $message = Mage::helper('catalog')->__('Skip import row, required field "%s" for new products not defined', $field); + $message = Mage::helper('catalog')->__('Skipping import row, required field "%s" for new products is not defined.', $field); Mage::throwException($message); } } @@ -694,7 +694,7 @@ public function saveRow(array $importData) foreach ($imageData as $file => $fields) { try { - $product->addImageToMediaGallery(Mage::getBaseDir('media') . DS . 'import' . $file, $fields); + $product->addImageToMediaGallery(Mage::getBaseDir('media') . DS . 'import' . trim($file), $fields); } catch (Exception $e) {} } diff --git a/app/code/core/Mage/Catalog/Model/Convert/Parser/Product.php b/app/code/core/Mage/Catalog/Model/Convert/Parser/Product.php index f1f4a40b98..81dca4941e 100644 --- a/app/code/core/Mage/Catalog/Model/Convert/Parser/Product.php +++ b/app/code/core/Mage/Catalog/Model/Convert/Parser/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -269,7 +269,7 @@ public function parse() try { // validate SKU if (empty($row['sku'])) { - $this->addException(Mage::helper('catalog')->__('Missing SKU, skipping the record'), Mage_Dataflow_Model_Convert_Exception::ERROR); + $this->addException(Mage::helper('catalog')->__('Missing SKU, skipping the record.'), Mage_Dataflow_Model_Convert_Exception::ERROR); continue; } $this->setPosition('Line: '.($i+1).', SKU: '.$row['sku']); @@ -286,7 +286,7 @@ public function parse() // get attribute_set_id, if not throw error $row['attribute_set_id'] = $this->getAttributeSetId($entityTypeId, $row['attribute_set']); if (!$row['attribute_set_id']) { - $this->addException(Mage::helper('catalog')->__("Invalid attribute set specified, skipping the record"), Mage_Dataflow_Model_Convert_Exception::ERROR); + $this->addException(Mage::helper('catalog')->__("Invalid attribute set specified, skipping the record."), Mage_Dataflow_Model_Convert_Exception::ERROR); continue; } @@ -296,14 +296,14 @@ public function parse() // get product type_id, if not throw error $row['type_id'] = $this->getProductTypeId($row['type']); if (!$row['type_id']) { - $this->addException(Mage::helper('catalog')->__("Invalid product type specified, skipping the record"), Mage_Dataflow_Model_Convert_Exception::ERROR); + $this->addException(Mage::helper('catalog')->__("Invalid product type specified, skipping the record."), Mage_Dataflow_Model_Convert_Exception::ERROR); continue; } // get store ids $storeIds = $this->getStoreIds(isset($row['store']) ? $row['store'] : $this->getVar('store')); if (!$storeIds) { - $this->addException(Mage::helper('catalog')->__("Invalid store specified, skipping the record"), Mage_Dataflow_Model_Convert_Exception::ERROR); + $this->addException(Mage::helper('catalog')->__("Invalid store specified, skipping the record."), Mage_Dataflow_Model_Convert_Exception::ERROR); continue; } @@ -328,14 +328,14 @@ public function parse() $inventoryFields[$row['sku']][$field] = $value; } continue; - #$this->addException(Mage::helper('catalog')->__("Unknown attribute: %s", $field), Mage_Dataflow_Model_Convert_Exception::ERROR); + #$this->addException(Mage::helper('catalog')->__("Unknown attribute: %s.", $field), Mage_Dataflow_Model_Convert_Exception::ERROR); } if ($attribute->usesSource()) { $source = $attribute->getSource(); $optionId = $this->getSourceOptionId($source, $value); if (is_null($optionId)) { $rowError = true; - $this->addException(Mage::helper('catalog')->__("Invalid attribute option specified for attribute %s (%s), skipping the record", $field, $value), Mage_Dataflow_Model_Convert_Exception::ERROR); + $this->addException(Mage::helper('catalog')->__("Invalid attribute option specified for attribute %s (%s), skipping the record.", $field, $value), Mage_Dataflow_Model_Convert_Exception::ERROR); continue; } $value = $optionId; @@ -434,7 +434,7 @@ public function unparse() if ($attribute->usesSource()) { $option = $attribute->getSource()->getOptionText($value); if ($value && empty($option)) { - $message = Mage::helper('catalog')->__("Invalid option id specified for %s (%s), skipping the record", $field, $value); + $message = Mage::helper('catalog')->__("Invalid option ID specified for %s (%s), skipping the record.", $field, $value); $this->addException($message, Mage_Dataflow_Model_Convert_Exception::ERROR); continue; } diff --git a/app/code/core/Mage/Catalog/Model/Design.php b/app/code/core/Mage/Catalog/Model/Design.php index 2958a40e77..ee2cead4ff 100644 --- a/app/code/core/Mage/Catalog/Model/Design.php +++ b/app/code/core/Mage/Catalog/Model/Design.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Entity/Attribute.php b/app/code/core/Mage/Catalog/Model/Entity/Attribute.php index 286395bdab..73f5d74c97 100644 --- a/app/code/core/Mage/Catalog/Model/Entity/Attribute.php +++ b/app/code/core/Mage/Catalog/Model/Entity/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Entity/Product/Attribute/Design/Options/Container.php b/app/code/core/Mage/Catalog/Model/Entity/Product/Attribute/Design/Options/Container.php index 29a27b7ac1..722fd98c1a 100644 --- a/app/code/core/Mage/Catalog/Model/Entity/Product/Attribute/Design/Options/Container.php +++ b/app/code/core/Mage/Catalog/Model/Entity/Product/Attribute/Design/Options/Container.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Entity/Product/Attribute/Frontend/Image.php b/app/code/core/Mage/Catalog/Model/Entity/Product/Attribute/Frontend/Image.php index 7b19ada3b1..14e368bf80 100644 --- a/app/code/core/Mage/Catalog/Model/Entity/Product/Attribute/Frontend/Image.php +++ b/app/code/core/Mage/Catalog/Model/Entity/Product/Attribute/Frontend/Image.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Index.php b/app/code/core/Mage/Catalog/Model/Index.php index df5435e50d..4bd9621930 100644 --- a/app/code/core/Mage/Catalog/Model/Index.php +++ b/app/code/core/Mage/Catalog/Model/Index.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Indexer/Url.php b/app/code/core/Mage/Catalog/Model/Indexer/Url.php index 0914af50b2..141d8dc86b 100644 --- a/app/code/core/Mage/Catalog/Model/Indexer/Url.php +++ b/app/code/core/Mage/Catalog/Model/Indexer/Url.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -75,7 +75,7 @@ class Mage_Catalog_Model_Indexer_Url extends Mage_Index_Model_Indexer_Abstract */ public function getName() { - return Mage::helper('catalog')->__('Catalog Url Rewrites'); + return Mage::helper('catalog')->__('Catalog URL Rewrites'); } /** @@ -85,7 +85,7 @@ public function getName() */ public function getDescription() { - return Mage::helper('catalog')->__('Index product and categories url rewrites'); + return Mage::helper('catalog')->__('Index product and categories URL rewrites'); } /** @@ -215,18 +215,26 @@ protected function _registerCategoryEvent(Mage_Index_Model_Event $event) protected function _processEvent(Mage_Index_Model_Event $event) { $data = $event->getNewData(); - if (!empty($data['catalog_url_reindex_all'])) { $this->reindexAll(); } + + $urlModel = Mage::getSingleton('catalog/url'); + + // Force rewrites history saving + $dataObject = $event->getDataObject(); + if ($dataObject instanceof Varien_Object && $dataObject->hasData('save_rewrites_history')) { + $urlModel->setShouldSaveRewritesHistory($dataObject->getData('save_rewrites_history')); + } + if(isset($data['rewrite_product_ids'])) { foreach ($data['rewrite_product_ids'] as $productId) { - Mage::getSingleton('catalog/url')->refreshProductRewrite($productId); + $urlModel->refreshProductRewrite($productId); } } if (isset($data['rewrite_category_ids'])) { foreach ($data['rewrite_category_ids'] as $categoryId) { - Mage::getSingleton('catalog/url')->refreshCategoryRewrite($categoryId); + $urlModel->refreshCategoryRewrite($categoryId); } } } diff --git a/app/code/core/Mage/Catalog/Model/Layer.php b/app/code/core/Mage/Catalog/Model/Layer.php index 00d6764fe6..cecfc9ae00 100644 --- a/app/code/core/Mage/Catalog/Model/Layer.php +++ b/app/code/core/Mage/Catalog/Model/Layer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -183,10 +183,10 @@ public function setCurrentCategory($category) $category = Mage::getModel('catalog/category')->load($category); } if (!$category instanceof Mage_Catalog_Model_Category) { - Mage::throwException(Mage::helper('catalog')->__('Category must be instance of Mage_Catalog_Model_Category')); + Mage::throwException(Mage::helper('catalog')->__('Category must be an instance of Mage_Catalog_Model_Category.')); } if (!$category->getId()) { - Mage::throwException(Mage::helper('catalog')->__('Invalid category')); + Mage::throwException(Mage::helper('catalog')->__('Invalid category.')); } if ($category->getId() != $this->getCurrentCategory()->getId()) { diff --git a/app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php b/app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php index 76e5a095a0..1854152acc 100644 --- a/app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php +++ b/app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -236,7 +236,7 @@ public function getAttributeModel() { $attribute = $this->getData('attribute_model'); if (is_null($attribute)) { - Mage::throwException(Mage::helper('catalog')->__('Attribute model not defined')); + Mage::throwException(Mage::helper('catalog')->__('The attribute model is not defined')); } return $attribute; } diff --git a/app/code/core/Mage/Catalog/Model/Layer/Filter/Attribute.php b/app/code/core/Mage/Catalog/Model/Layer/Filter/Attribute.php index e89aaebcb0..23dd222e9c 100644 --- a/app/code/core/Mage/Catalog/Model/Layer/Filter/Attribute.php +++ b/app/code/core/Mage/Catalog/Model/Layer/Filter/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Layer/Filter/Category.php b/app/code/core/Mage/Catalog/Model/Layer/Filter/Category.php index bf8509cd93..6c878622d9 100644 --- a/app/code/core/Mage/Catalog/Model/Layer/Filter/Category.php +++ b/app/code/core/Mage/Catalog/Model/Layer/Filter/Category.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Layer/Filter/Decimal.php b/app/code/core/Mage/Catalog/Model/Layer/Filter/Decimal.php index 7e022390aa..261f7023af 100644 --- a/app/code/core/Mage/Catalog/Model/Layer/Filter/Decimal.php +++ b/app/code/core/Mage/Catalog/Model/Layer/Filter/Decimal.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Layer/Filter/Item.php b/app/code/core/Mage/Catalog/Model/Layer/Filter/Item.php index 55e00c9458..489f2fa749 100644 --- a/app/code/core/Mage/Catalog/Model/Layer/Filter/Item.php +++ b/app/code/core/Mage/Catalog/Model/Layer/Filter/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -43,7 +43,7 @@ public function getFilter() $filter = $this->getData('filter'); if (!is_object($filter)) { Mage::throwException( - Mage::helper('catalog')->__('Filter must be as object. Set correct filter please') + Mage::helper('catalog')->__('Filter must be an object. Please set correct filter.') ); } return $filter; diff --git a/app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php b/app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php index becc7fc1d2..1128981a2f 100644 --- a/app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php +++ b/app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Layer/State.php b/app/code/core/Mage/Catalog/Model/Layer/State.php index 0a53e5fa80..7cea65d0eb 100644 --- a/app/code/core/Mage/Catalog/Model/Layer/State.php +++ b/app/code/core/Mage/Catalog/Model/Layer/State.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -56,7 +56,7 @@ public function addFilter($filter) public function setFilters($filters) { if (!is_array($filters)) { - Mage::throwException(Mage::helper('catalog')->__('Filters must be as array')); + Mage::throwException(Mage::helper('catalog')->__('The filters must be an array.')); } $this->setData('filters', $filters); return $this; diff --git a/app/code/core/Mage/Catalog/Model/Observer.php b/app/code/core/Mage/Catalog/Model/Observer.php index 8fd71c34a1..12941014eb 100644 --- a/app/code/core/Mage/Catalog/Model/Observer.php +++ b/app/code/core/Mage/Catalog/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -218,4 +218,17 @@ public function categorySaveAfter(Varien_Event_Observer $observer) } return $this; } + + /** + * Checking whether the using static urls in WYSIWYG allowed event + * + * @param Varien_Event_Observer $observer + * @return Mage_Catalog_Model_Observer + */ + public function catalogCheckIsUsingStaticUrlsAllowed(Varien_Event_Observer $observer) + { + $storeId = $observer->getEvent()->getData('store_id'); + $result = $observer->getEvent()->getData('result'); + $result->isAllowed = Mage::helper('catalog')->setStoreId($storeId)->isUsingStaticUrlsAllowed(); + } } diff --git a/app/code/core/Mage/Catalog/Model/Product.php b/app/code/core/Mage/Catalog/Model/Product.php index f4be02e8e8..920538d1a6 100644 --- a/app/code/core/Mage/Catalog/Model/Product.php +++ b/app/code/core/Mage/Catalog/Model/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -128,7 +128,7 @@ public function getStoreId() public function getResourceCollection() { if (empty($this->_resourceCollectionName)) { - Mage::throwException(Mage::helper('core')->__('Model collection resource name is not defined')); + Mage::throwException(Mage::helper('core')->__('The model collection resource name is not defined.')); } $collection = Mage::getResourceModel($this->_resourceCollectionName); $collection->setStoreId($this->getStoreId()); @@ -151,10 +151,17 @@ public function getUrlModel() /** * Validate Product Data * + * @todo implement full validation process with errors returning which are ignoring now + * * @return Mage_Catalog_Model_Product */ public function validate() { +// $this->getAttributes(); +// Mage::dispatchEvent($this->_eventPrefix.'_validate_before', array($this->_eventObject=>$this)); +// $result = $this->_getResource()->validate($this); +// Mage::dispatchEvent($this->_eventPrefix.'_validate_after', array($this->_eventObject=>$this)); +// return $result; Mage::dispatchEvent($this->_eventPrefix.'_validate_before', array($this->_eventObject=>$this)); $this->_getResource()->validate($this); Mage::dispatchEvent($this->_eventPrefix.'_validate_after', array($this->_eventObject=>$this)); @@ -308,7 +315,7 @@ public function setCategoryIds($ids) $ids = explode(',', $ids); } elseif (!is_array($ids)) { - Mage::throwException(Mage::helper('catalog')->__('Invalid category IDs')); + Mage::throwException(Mage::helper('catalog')->__('Invalid category IDs.')); } foreach ($ids as $i => $v) { if (empty($v)) { @@ -1205,6 +1212,16 @@ public function isVirtual() return $this->getIsVirtual(); } + /** + * Whether the product is a recurring payment + * + * @return bool + */ + public function isRecurring() + { + return $this->getIsRecurring() == '1'; + } + public function isSaleable() { return $this->isSalable(); diff --git a/app/code/core/Mage/Catalog/Model/Product/Action.php b/app/code/core/Mage/Catalog/Model/Product/Action.php index c6630f6aad..1f970b5bc7 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Action.php +++ b/app/code/core/Mage/Catalog/Model/Product/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Api.php b/app/code/core/Mage/Catalog/Model/Product/Api.php index ad31e346b0..1613eab2d6 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Api.php +++ b/app/code/core/Mage/Catalog/Model/Product/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -162,11 +162,19 @@ public function create($type, $set, $sku, $productData) $this->_prepareDataForSave($product, $productData); - if (is_array($errors = $product->validate())) { - $this->_fault('data_invalid', implode("\n", $errors)); - } - try { + /** + * @todo implement full validation process with errors returning which are ignoring now + * @todo see Mage_Catalog_Model_Product::validate() + */ + if (is_array($errors = $product->validate())) { + $strErrors = array(); + foreach($errors as $code=>$error) { + $strErrors[] = ($error === true)? Mage::helper('catalog')->__('Attribute "%s" is invalid.', $code) : $error; + } + $this->_fault('data_invalid', implode("\n", $strErrors)); + } + $product->save(); } catch (Mage_Core_Exception $e) { $this->_fault('data_invalid', $e->getMessage()); @@ -207,15 +215,20 @@ public function update($productId, $productData, $store = null, $identifierType $this->_prepareDataForSave($product, $productData); + try { + /** + * @todo implement full validation process with errors returning which are ignoring now + * @todo see Mage_Catalog_Model_Product::validate() + */ if (is_array($errors = $product->validate())) { - $this->_fault('data_invalid', implode("\n", $errors)); + $strErrors = array(); + foreach($errors as $code=>$error) { + $strErrors[] = ($error === true)? Mage::helper('catalog')->__('Value for "%s" is invalid.', $code) : Mage::helper('catalog')->__('Value for "%s" is invalid: %s', $code, $error); + } + $this->_fault('data_invalid', implode("\n", $strErrors)); } - } catch (Mage_Core_Exception $e) { - $this->_fault('data_invalid', $e->getMessage()); - } - try { $product->save(); } catch (Mage_Core_Exception $e) { $this->_fault('data_invalid', $e->getMessage()); @@ -255,6 +268,11 @@ protected function _prepareDataForSave ($product, $productData) if (isset($productData['stock_data']) && is_array($productData['stock_data'])) { $product->setStockData($productData['stock_data']); } + + if (isset($productData['tier_price']) && is_array($productData['tier_price'])) { + $tierPrices = Mage::getModel('catalog/product_attribute_tierprice_api')->prepareTierPrices($product, $productData['tier_price']); + $product->setData(Mage_Catalog_Model_Product_Attribute_Tierprice_Api::ATTRIBUTE_CODE, $tierPrices); + } } /** diff --git a/app/code/core/Mage/Catalog/Model/Product/Api/V2.php b/app/code/core/Mage/Catalog/Model/Product/Api/V2.php index 94e365b19c..10009a1134 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Api/V2.php +++ b/app/code/core/Mage/Catalog/Model/Product/Api/V2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -192,11 +192,19 @@ public function create($type, $set, $sku, $productData) $this->_prepareDataForSave($product, $productData); - if (is_array($errors = $product->validate())) { - $this->_fault('data_invalid', implode("\n", $errors)); - } - try { + /** + * @todo implement full validation process with errors returning which are ignoring now + * @todo see Mage_Catalog_Model_Product::validate() + */ + if (is_array($errors = $product->validate())) { + $strErrors = array(); + foreach($errors as $code=>$error) { + $strErrors[] = ($error === true)? Mage::helper('catalog')->__('Attribute "%s" is invalid.', $code) : $error; + } + $this->_fault('data_invalid', implode("\n", $strErrors)); + } + $product->save(); } catch (Mage_Core_Exception $e) { $this->_fault('data_invalid', $e->getMessage()); @@ -247,14 +255,18 @@ public function update($productId, $productData, $store = null, $identifierType $this->_prepareDataForSave($product, $productData); try { + /** + * @todo implement full validation process with errors returning which are ignoring now + * @todo see Mage_Catalog_Model_Product::validate() + */ if (is_array($errors = $product->validate())) { - $this->_fault('data_invalid', implode("\n", $errors)); + $strErrors = array(); + foreach($errors as $code=>$error) { + $strErrors[] = ($error === true)? Mage::helper('catalog')->__('Value for "%s" is invalid.', $code) : Mage::helper('catalog')->__('Value for "%s" is invalid: %s', $code, $error); + } + $this->_fault('data_invalid', implode("\n", $strErrors)); } - } catch (Mage_Core_Exception $e) { - $this->_fault('data_invalid', $e->getMessage()); - } - try { $product->save(); } catch (Mage_Core_Exception $e) { $this->_fault('data_invalid', $e->getMessage()); @@ -298,6 +310,11 @@ protected function _prepareDataForSave ($product, $productData) } $product->setStockData($_stockData); } + + if (property_exists($productData, 'tier_price')) { + $tierPrices = Mage::getModel('catalog/product_attribute_tierprice_api_V2')->prepareTierPrices($product, $productData->tier_price); + $product->setData(Mage_Catalog_Model_Product_Attribute_Tierprice_Api_V2::ATTRIBUTE_CODE, $tierPrices); + } } /** diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Api.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Api.php index c9b315db04..b9ff2a171a 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Api.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Api/V2.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Api/V2.php index acbeaa447f..901ff1da28 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Api/V2.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Api/V2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php index 3dafc124fd..22dbdfd55f 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -69,6 +69,33 @@ protected function _getDefaultValue($key, &$image) return ''; } + /** + * Validate media_gallery attribute data + * + * @param Mage_Catalog_Model_Product $object + * @throws Mage_Core_Exception + * @return bool + */ + public function validate($object) + { + if ($this->getAttribute()->getIsRequired()) { + $value = $object->getData($this->getAttribute()->getAttributeCode()); + if ($this->getAttribute()->isValueEmpty($value)) { + if ( !(is_array($value) && count($value)>0) ) { + return false; + } + } + } + if ($this->getAttribute()->getIsUnique()) { + if (!$this->getAttribute()->getEntity()->checkAttributeUniqueValue($this->getAttribute(), $object)) { + $label = $this->getAttribute()->getFrontend()->getLabel(); + Mage::throwException(Mage::helper('eav')->__('The value of attribute "%s" must be unique.', $label)); + } + } + + return true; + } + public function beforeSave($object) { $attrCode = $this->getAttribute()->getAttributeCode(); @@ -218,11 +245,11 @@ public function addImage(Mage_Catalog_Model_Product $product, $file, $mediaAttri $file = realpath($file); if (!$file || !file_exists($file)) { - Mage::throwException(Mage::helper('catalog')->__('Image not exists')); + Mage::throwException(Mage::helper('catalog')->__('Image does not exist.')); } $pathinfo = pathinfo($file); if (!isset($pathinfo['extension']) || !in_array(strtolower($pathinfo['extension']), array('jpg','jpeg','gif','png'))) { - Mage::throwException(Mage::helper('catalog')->__('Invalid image file type')); + Mage::throwException(Mage::helper('catalog')->__('Invalid image file type.')); } $fileName = Varien_File_Uploader::getCorrectFileName($pathinfo['basename']); diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Price.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Price.php index 85909002f9..511fb18af1 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Price.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Recurring.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Recurring.php new file mode 100644 index 0000000000..2fa5f3865b --- /dev/null +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Recurring.php @@ -0,0 +1,62 @@ +hasIsRecurring()) { + if ($product->isRecurring()) { + parent::beforeSave($product); + } else { + $product->unsRecurringProfile(); + } + } + } + + /** + * Unserialize or remove on failure + * @param Mage_Catalog_Model_Product $product + */ + protected function _unserialize(Varien_Object $product) + { + if ($product->hasIsRecurring()) { + if ($product->isRecurring()) { + parent::_unserialize($product); + } else { + $product->unsRecurringProfile(); + } + } + } +} diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Startdate.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Startdate.php index 1570391be5..0f97fe8c53 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Startdate.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Startdate.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -37,19 +37,18 @@ class Mage_Catalog_Model_Product_Attribute_Backend_Startdate extends Mage_Eav_Mo { public function beforeSave($object) { - $attributeName = $this->getAttribute()->getName(); - - $startDate = $object->getData($attributeName); - - if ($startDate=='' && $object->getSpecialPrice()) { + $attributeName = $this->getAttribute()->getName(); + $startDate = $object->getData($attributeName); + if ($startDate === false) { + return $this; + } + if ($startDate == '' && $object->getSpecialPrice()) { $startDate = Mage::app()->getLocale()->date(); -// $startDate = Mage::getModel('core/date')->gmtDate(''); } $object->setData($attributeName, $startDate); parent::beforeSave($object); - return $this; } diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Tierprice.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Tierprice.php index f42ff2833a..451c325e0f 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Tierprice.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Tierprice.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Urlkey.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Urlkey.php index 9478ebca40..e6815b767b 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Urlkey.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Urlkey.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Frontend/Image.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Frontend/Image.php index 5593f74bef..64159301cd 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Frontend/Image.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Frontend/Image.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api.php index 6e7465ca51..2a2e68dccc 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -119,7 +119,7 @@ public function create($productId, $data, $store = null, $identifierType = null) $gallery = $this->_getGalleryAttribute($product); if (!isset($data['file']) || !isset($data['file']['mime']) || !isset($data['file']['content'])) { - $this->_fault('data_invalid', Mage::helper('catalog')->__('Image not specified.')); + $this->_fault('data_invalid', Mage::helper('catalog')->__('The image is not specified.')); } if (!isset($this->_mimeTypes[$data['file']['mime']])) { @@ -128,7 +128,7 @@ public function create($productId, $data, $store = null, $identifierType = null) $fileContent = @base64_decode($data['file']['content'], true); if (!$fileContent) { - $this->_fault('data_invalid', Mage::helper('catalog')->__('Image content is not valid base64 data.')); + $this->_fault('data_invalid', Mage::helper('catalog')->__('The image contents is not valid base64 data.')); } unset($data['file']['content']); @@ -172,7 +172,7 @@ public function create($productId, $data, $store = null, $identifierType = null) } catch (Mage_Core_Exception $e) { $this->_fault('not_created', $e->getMessage()); } catch (Exception $e) { - $this->_fault('not_created', Mage::helper('catalog')->__('Can\'t create image.')); + $this->_fault('not_created', Mage::helper('catalog')->__('Cannot create image.')); } return $gallery->getBackend()->getRenamedImage($file); diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api/V2.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api/V2.php index ffa98e5258..cd18d91945 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api/V2.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api/V2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -72,7 +72,7 @@ public function create($productId, $data, $store = null, $identifierType = null) $gallery = $this->_getGalleryAttribute($product); if (!isset($data->file) || !isset($data->file->mime) || !isset($data->file->content)) { - $this->_fault('data_invalid', Mage::helper('catalog')->__('Image not specified.')); + $this->_fault('data_invalid', Mage::helper('catalog')->__('The image is not specified.')); } if (!isset($this->_mimeTypes[$data->file->mime])) { @@ -81,7 +81,7 @@ public function create($productId, $data, $store = null, $identifierType = null) $fileContent = @base64_decode($data->file->content, true); if (!$fileContent) { - $this->_fault('data_invalid', Mage::helper('catalog')->__('Image content is not valid base64 data.')); + $this->_fault('data_invalid', Mage::helper('catalog')->__('The image contents is not valid base64 data.')); } unset($data->file->content); @@ -127,7 +127,7 @@ public function create($productId, $data, $store = null, $identifierType = null) } catch (Mage_Core_Exception $e) { $this->_fault('not_created', $e->getMessage()); } catch (Exception $e) { - $this->_fault('not_created', Mage::helper('catalog')->__('Can\'t create image.')); + $this->_fault('not_created', Mage::helper('catalog')->__('Cannot create image.')); } return $gallery->getBackend()->getRenamedImage($file); diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Set/Api.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Set/Api.php index 607eda3a08..02eb81c567 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Set/Api.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Set/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Set/Api/V2.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Set/Api/V2.php index 0ce2bfc685..08b13290e7 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Set/Api/V2.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Set/Api/V2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Source/Layout.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Source/Layout.php index 59110a8277..0240d0d3f6 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Source/Layout.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Source/Layout.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -37,7 +37,7 @@ public function getAllOptions() { if (!$this->_options) { $this->_options = Mage::getSingleton('page/source_layout')->toOptionArray(); - array_unshift($this->_options, array('value'=>'', 'label'=>Mage::helper('catalog')->__('No layout updates'))); + array_unshift($this->_options, array('value'=>'', 'label'=>Mage::helper('catalog')->__('No layout updates.'))); } return $this->_options; } diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api.php index 109350fc71..0f7601f593 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -64,9 +64,57 @@ public function info($productId, $identifierType = null) return $result; } + /** + * Update tier prices of product + * + * @param int|string $productId + * @param array $tierPrices + * @return boolean + */ public function update($productId, $tierPrices, $identifierType = null) { $product = $this->_initProduct($productId, $identifierType); + + $updatedTierPrices = $this->prepareTierPrices($product, $tierPrices); + if (is_null($updatedTierPrices)) { + $this->_fault('data_invalid', Mage::helper('catalog')->__('Invalid Tier Prices')); + } + + $product->setData(self::ATTRIBUTE_CODE, $updatedTierPrices); + try { + /** + * @todo implement full validation process with errors returning which are ignoring now + * @todo see Mage_Catalog_Model_Product::validate() + */ + if (is_array($errors = $product->validate())) { + $strErrors = array(); + foreach($errors as $code=>$error) { + $strErrors[] = ($error === true)? Mage::helper('catalog')->__('Value for "%s" is invalid.', $code) : Mage::helper('catalog')->__('Value for "%s" is invalid: %s', $code, $error); + } + $this->_fault('data_invalid', implode("\n", $strErrors)); + } + + $product->save(); + } catch (Mage_Core_Exception $e) { + $this->_fault('not_updated', $e->getMessage()); + } + + return true; + } + + /** + * Prepare tier prices for save + * + * @param Mage_Catalog_Model_Product $product + * @param array $tierPrices + * @return array + */ + public function prepareTierPrices($product, $tierPrices = null) + { + if (!is_array($tierPrices)) { + return null; + } + if (!is_array($tierPrices)) { $this->_fault('data_invalid', Mage::helper('catalog')->__('Invalid Tier Prices')); } @@ -91,7 +139,7 @@ public function update($productId, $tierPrices, $identifierType = null) } if (intval($tierPrice['website']) > 0 && !in_array($tierPrice['website'], $product->getWebsiteIds())) { - $this->_fault('data_invalid', Mage::helper('catalog')->__('Invalid tier prices. Product is not associated to the requested website.')); + $this->_fault('data_invalid', Mage::helper('catalog')->__('Invalid tier prices. The product is not associated to the requested website.')); } if (!isset($tierPrice['customer_group_id'])) { @@ -110,25 +158,9 @@ public function update($productId, $tierPrices, $identifierType = null) ); } - try { - if (is_array($errors = $product->validate())) { - $this->_fault('data_invalid', implode("\n", $errors)); - } - } catch (Mage_Core_Exception $e) { - $this->_fault('data_invalid', $e->getMessage()); - } - - try { - $product->setData(self::ATTRIBUTE_CODE ,$updateValue); - $product->validate(); - $product->save(); - } catch (Mage_Core_Exception $e) { - $this->_fault('not_updated', $e->getMessage()); - } - - return true; + return $updateValue; } - + /** * Retrieve product * diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api/V2.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api/V2.php index 13c065c225..08bd9675c0 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api/V2.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api/V2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -34,17 +34,16 @@ class Mage_Catalog_Model_Product_Attribute_Tierprice_Api_V2 extends Mage_Catalog_Model_Product_Attribute_Tierprice_Api { /** - * Update tier prices of product + * Prepare tier prices for save * - * @param int|string $productId - * @param array $tierPrices - * @return boolean + * @param Mage_Catalog_Model_Product $product + * @param array $tierPrices + * @return array */ - public function update($productId, $tierPrices, $identifierType = null) + public function prepareTierPrices($product, $tierPrices = null) { - $product = $this->_initProduct($productId, $identifierType); if (!is_array($tierPrices)) { - $this->_fault('data_invalid', Mage::helper('catalog')->__('Invalid Tier Prices')); + return null; } $updateValue = array(); @@ -67,7 +66,7 @@ public function update($productId, $tierPrices, $identifierType = null) } if (intval($tierPrice->website) > 0 && !in_array($tierPrice->website, $product->getWebsiteIds())) { - $this->_fault('data_invalid', Mage::helper('catalog')->__('Invalid tier prices. Product is not associated to the requested website.')); + $this->_fault('data_invalid', Mage::helper('catalog')->__('Invalid tier prices. The product is not associated to the requested website.')); } if (!isset($tierPrice->customer_group_id)) { @@ -87,22 +86,6 @@ public function update($productId, $tierPrices, $identifierType = null) } - try { - if (is_array($errors = $product->validate())) { - $this->_fault('data_invalid', implode("\n", $errors)); - } - } catch (Mage_Core_Exception $e) { - $this->_fault('data_invalid', $e->getMessage()); - } - - try { - $product->setData(self::ATTRIBUTE_CODE ,$updateValue); - $product->validate(); - $product->save(); - } catch (Mage_Core_Exception $e) { - $this->_fault('not_updated', $e->getMessage()); - } - - return true; + return $updateValue; } } diff --git a/app/code/core/Mage/Catalog/Model/Product/Compare/Item.php b/app/code/core/Mage/Catalog/Model/Product/Compare/Item.php index c7a54894ce..8fa658624d 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Compare/Item.php +++ b/app/code/core/Mage/Catalog/Model/Product/Compare/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Compare/List.php b/app/code/core/Mage/Catalog/Model/Product/Compare/List.php index fb64710f11..5be469479d 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Compare/List.php +++ b/app/code/core/Mage/Catalog/Model/Product/Compare/List.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Condition.php b/app/code/core/Mage/Catalog/Model/Product/Condition.php index 5b01a140b5..3d1c49bff8 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Condition.php +++ b/app/code/core/Mage/Catalog/Model/Product/Condition.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Condition/Interface.php b/app/code/core/Mage/Catalog/Model/Product/Condition/Interface.php index 90ed1b646a..f5a149d9eb 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Condition/Interface.php +++ b/app/code/core/Mage/Catalog/Model/Product/Condition/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Flat/Flag.php b/app/code/core/Mage/Catalog/Model/Product/Flat/Flag.php index d88dddbbef..2461988ca7 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Flat/Flag.php +++ b/app/code/core/Mage/Catalog/Model/Product/Flat/Flag.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php b/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php index 7cf9a41a7c..ef0dd8509f 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php +++ b/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Flat/Observer.php b/app/code/core/Mage/Catalog/Model/Product/Flat/Observer.php index aef0932153..00e96d4ad2 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Flat/Observer.php +++ b/app/code/core/Mage/Catalog/Model/Product/Flat/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Image.php b/app/code/core/Mage/Catalog/Model/Product/Image.php index be9af71f0f..9801e7d2bf 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Image.php +++ b/app/code/core/Mage/Catalog/Model/Product/Image.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -181,14 +181,20 @@ protected function _checkMemory($file = null) protected function _getMemoryLimit() { - $memoryLimit = ini_get('memory_limit'); + $memoryLimit = trim(strtoupper(ini_get('memory_limit'))); if (!isSet($memoryLimit[0])){ $memoryLimit = "128M"; } + if (substr($memoryLimit, -1) == 'K') { + return substr($memoryLimit, 0, -1) * 1024; + } if (substr($memoryLimit, -1) == 'M') { - return (int)$memoryLimit * 1024 * 1024; + return substr($memoryLimit, 0, -1) * 1024 * 1024; + } + if (substr($memoryLimit, -1) == 'G') { + return substr($memoryLimit, 0, -1) * 1024 * 1024 * 1024; } return $memoryLimit; } @@ -234,7 +240,7 @@ protected function _getNeedMemoryForFile($file = null) * @param array $rgbArray * @return string */ - private function _rgbToString($rgbArray) + protected function _rgbToString($rgbArray) { $result = array(); foreach ($rgbArray as $value) { @@ -299,7 +305,7 @@ public function setBaseFile($file) $baseFile = $baseDir . $file; if ((!$file) || (!file_exists($baseFile))) { - throw new Exception(Mage::helper('catalog')->__('Image file not found')); + throw new Exception(Mage::helper('catalog')->__('Image file was not found.')); } $this->_baseFile = $baseFile; diff --git a/app/code/core/Mage/Catalog/Model/Product/Indexer/Eav.php b/app/code/core/Mage/Catalog/Model/Product/Indexer/Eav.php index b262e75913..c470047962 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Indexer/Eav.php +++ b/app/code/core/Mage/Catalog/Model/Product/Indexer/Eav.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php b/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php index d428751f3e..3d20f15128 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php +++ b/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Catalog_Model_Product_Indexer_Flat extends Mage_Index_Model_Indexer_Abstract diff --git a/app/code/core/Mage/Catalog/Model/Product/Indexer/Price.php b/app/code/core/Mage/Catalog/Model/Product/Indexer/Price.php index 5a69d47893..dc7c34e7a1 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Indexer/Price.php +++ b/app/code/core/Mage/Catalog/Model/Product/Indexer/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Link.php b/app/code/core/Mage/Catalog/Model/Product/Link.php index 35246e36bf..1a325f2cc3 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Link.php +++ b/app/code/core/Mage/Catalog/Model/Product/Link.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Link/Api.php b/app/code/core/Mage/Catalog/Model/Product/Link/Api.php index 49b29edffc..21dfda856e 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Link/Api.php +++ b/app/code/core/Mage/Catalog/Model/Product/Link/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -120,7 +120,7 @@ public function assign($type, $productId, $linkedProductId, $data = array(), $id try { $link->getResource()->saveProductLinks($product, $links, $typeId); } catch (Exception $e) { - $this->_fault('data_invalid', Mage::helper('catalog')->__('Link product not exists.')); + $this->_fault('data_invalid', Mage::helper('catalog')->__('Link product does not exist.')); } return true; @@ -162,7 +162,7 @@ public function update($type, $productId, $linkedProductId, $data = array(), $id try { $link->getResource()->saveProductLinks($product, $links, $typeId); } catch (Exception $e) { - $this->_fault('data_invalid', Mage::helper('catalog')->__('Link product not exists.')); + $this->_fault('data_invalid', Mage::helper('catalog')->__('Link product does not exist.')); } return true; diff --git a/app/code/core/Mage/Catalog/Model/Product/Link/Api/V2.php b/app/code/core/Mage/Catalog/Model/Product/Link/Api/V2.php index 260b75d8f9..205edde51c 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Link/Api/V2.php +++ b/app/code/core/Mage/Catalog/Model/Product/Link/Api/V2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -69,7 +69,7 @@ public function assign($type, $productId, $linkedProductId, $data = array(), $id try { $link->getResource()->saveProductLinks($product, $links, $typeId); } catch (Exception $e) { - $this->_fault('data_invalid', Mage::helper('catalog')->__('Link product not exists.')); + $this->_fault('data_invalid', Mage::helper('catalog')->__('Link product does not exist.')); } return true; @@ -111,7 +111,7 @@ public function update($type, $productId, $linkedProductId, $data = array(), $id try { $link->getResource()->saveProductLinks($product, $links, $typeId); } catch (Exception $e) { - $this->_fault('data_invalid', Mage::helper('catalog')->__('Link product not exists.')); + $this->_fault('data_invalid', Mage::helper('catalog')->__('Link product does not exist.')); } return true; diff --git a/app/code/core/Mage/Catalog/Model/Product/Media/Config.php b/app/code/core/Mage/Catalog/Model/Product/Media/Config.php index 8310676d96..b412479263 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Media/Config.php +++ b/app/code/core/Mage/Catalog/Model/Product/Media/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Option.php b/app/code/core/Mage/Catalog/Model/Product/Option.php index 5956142995..c6656ea8be 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Option.php +++ b/app/code/core/Mage/Catalog/Model/Product/Option.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Option/Observer.php b/app/code/core/Mage/Catalog/Model/Product/Option/Observer.php index d19513cd54..6b0856606c 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Option/Observer.php +++ b/app/code/core/Mage/Catalog/Model/Product/Option/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php b/app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php index ed1ee6c4f0..5d4d695511 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php +++ b/app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -81,11 +81,11 @@ public function validateUserValue($values) } elseif (!$isValid && $option->getIsRequire() && !$this->getProduct()->getSkipCheckRequiredOption()) { $this->setIsValid(false); if (!$dateValid) { - Mage::throwException(Mage::helper('catalog')->__('Please specify date required option(s)')); + Mage::throwException(Mage::helper('catalog')->__('Please specify date required option(s).')); } elseif (!$timeValid) { - Mage::throwException(Mage::helper('catalog')->__('Please specify time required option(s)')); + Mage::throwException(Mage::helper('catalog')->__('Please specify time required option(s).')); } else { - Mage::throwException(Mage::helper('catalog')->__('Please specify the product required option(s)')); + Mage::throwException(Mage::helper('catalog')->__('Please specify the product required option(s).')); } } else { $this->setUserValue(null); diff --git a/app/code/core/Mage/Catalog/Model/Product/Option/Type/Default.php b/app/code/core/Mage/Catalog/Model/Product/Option/Type/Default.php index 0e8ebfe0c6..e5f2e177fa 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Option/Type/Default.php +++ b/app/code/core/Mage/Catalog/Model/Product/Option/Type/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -79,7 +79,7 @@ public function getOption() if ($this->_option instanceof Mage_Catalog_Model_Product_Option) { return $this->_option; } - Mage::throwException(Mage::helper('catalog')->__('Wrong option instance type in options group')); + Mage::throwException(Mage::helper('catalog')->__('Wrong option instance type in options group.')); } /** @@ -105,7 +105,7 @@ public function getProduct() if ($this->_product instanceof Mage_Catalog_Model_Product) { return $this->_product; } - Mage::throwException(Mage::helper('catalog')->__('Wrong product instance type in options group')); + Mage::throwException(Mage::helper('catalog')->__('Wrong product instance type in options group.')); } /** @@ -118,7 +118,7 @@ public function getQuoteItemOption() if ($this->_getData('quote_item_option') instanceof Mage_Sales_Model_Quote_Item_Option) { return $this->_getData('quote_item_option'); } - Mage::throwException(Mage::helper('catalog')->__('Wrong quote item option instance in options group')); + Mage::throwException(Mage::helper('catalog')->__('Wrong quote item option instance in options group.')); } /** @@ -131,7 +131,7 @@ public function getQuoteItem() if ($this->_getData('quote_item') instanceof Mage_Sales_Model_Quote_Item) { return $this->_getData('quote_item'); } - Mage::throwException(Mage::helper('catalog')->__('Wrong quote item instance in options group')); + Mage::throwException(Mage::helper('catalog')->__('Wrong quote item instance in options group.')); } /** @@ -144,7 +144,7 @@ public function getRequest() if ($this->_getData('request') instanceof Varien_Object) { return $this->_getData('request'); } - Mage::throwException(Mage::helper('catalog')->__('Wrong BuyRequest instance in options group')); + Mage::throwException(Mage::helper('catalog')->__('Wrong BuyRequest instance in options group.')); } /** @@ -173,7 +173,7 @@ public function validateUserValue($values) $option = $this->getOption(); if (!isset($values[$option->getId()]) && $option->getIsRequire() && !$this->getProduct()->getSkipCheckRequiredOption()) { - Mage::throwException(Mage::helper('catalog')->__('Please specify the product required option(s)')); + Mage::throwException(Mage::helper('catalog')->__('Please specify the product required option(s).')); } elseif (isset($values[$option->getId()])) { $this->setUserValue($values[$option->getId()]); $this->setIsValid(true); @@ -192,7 +192,7 @@ public function prepareForCart() if ($this->getIsValid()) { return $this->getUserValue(); } - Mage::throwException(Mage::helper('catalog')->__('Option validation failed to add product to cart')); + Mage::throwException(Mage::helper('catalog')->__('Option validation failed to add product to cart.')); } /** diff --git a/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php b/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php index 96ebdd21bc..1199907e26 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php +++ b/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -316,7 +316,7 @@ protected function _getOptionHtml($optionValue) $sizes ); } catch (Exception $e) { - Mage::throwException(Mage::helper('catalog')->__("File options format is not valid")); + Mage::throwException(Mage::helper('catalog')->__("File options format is not valid.")); } } @@ -483,7 +483,7 @@ protected function _createWriteableDir($path) { $io = new Varien_Io_File(); if (!$io->isWriteable($path) && !$io->mkdir($path, 0777, true)) { - Mage::throwException(Mage::helper('catalog')->__("Cannot create writeable directory '%s'", $path)); + Mage::throwException(Mage::helper('catalog')->__("Cannot create writeable directory '%s'.", $path)); } } diff --git a/app/code/core/Mage/Catalog/Model/Product/Option/Type/Select.php b/app/code/core/Mage/Catalog/Model/Product/Option/Type/Select.php index 5f173a0b9f..edd13cf5e2 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Option/Type/Select.php +++ b/app/code/core/Mage/Catalog/Model/Product/Option/Type/Select.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -49,14 +49,14 @@ public function validateUserValue($values) if (empty($value) && $option->getIsRequire() && !$this->getProduct()->getSkipCheckRequiredOption()) { $this->setIsValid(false); - Mage::throwException(Mage::helper('catalog')->__('Please specify the product required option(s)')); + Mage::throwException(Mage::helper('catalog')->__('Please specify the product required option(s).')); } if (!$this->_isSingleSelection()) { $valuesCollection = $option->getOptionValuesByOptionId($value, $this->getProduct()->getStoreId()) ->load(); if ($valuesCollection->count() != count($value)) { $this->setIsValid(false); - Mage::throwException(Mage::helper('catalog')->__('Please specify the product required option(s)')); + Mage::throwException(Mage::helper('catalog')->__('Please specify the product required option(s).')); } } return $this; @@ -123,7 +123,7 @@ public function getEditableOptionValue($optionValue) $this->getListener() ->setHasError(true) ->setMessage( - Mage::helper('catalog')->__('Some of the products below don\'t have all the required options. Please remove them and add again with all the required options.') + Mage::helper('catalog')->__('Some of the products below do not have all the required options. Please remove them and add again with all the required options.') ); $result = ''; break; @@ -139,7 +139,7 @@ public function getEditableOptionValue($optionValue) $this->getListener() ->setHasError(true) ->setMessage( - Mage::helper('catalog')->__('Some of the products below don\'t have all the required options. Please remove them and add again with all the required options.') + Mage::helper('catalog')->__('Some of the products below do not have all the required options. Please remove them and add again with all the required options.') ); } $result = ''; @@ -215,7 +215,7 @@ public function getOptionPrice($optionValue, $basePrice) $this->getListener() ->setHasError(true) ->setMessage( - Mage::helper('catalog')->__('Some of the products below don\'t have all the required options. Please remove them and add again with all the required options.') + Mage::helper('catalog')->__('Some of the products below do not have all the required options. Please remove them and add again with all the required options.') ); break; } @@ -233,7 +233,7 @@ public function getOptionPrice($optionValue, $basePrice) $this->getListener() ->setHasError(true) ->setMessage( - Mage::helper('catalog')->__('Some of the products below don\'t have all the required options. Please remove them and add again with all the required options.') + Mage::helper('catalog')->__('Some of the products below do not have all the required options. Please remove them and add again with all the required options.') ); } } @@ -263,7 +263,7 @@ public function getOptionSku($optionValue, $skuDelimiter) $this->getListener() ->setHasError(true) ->setMessage( - Mage::helper('catalog')->__('Some of the products below don\'t have all the required options. Please remove them and add again with all the required options.') + Mage::helper('catalog')->__('Some of the products below do not have all the required options. Please remove them and add again with all the required options.') ); break; } @@ -278,7 +278,7 @@ public function getOptionSku($optionValue, $skuDelimiter) $this->getListener() ->setHasError(true) ->setMessage( - Mage::helper('catalog')->__('Some of the products below don\'t have all the required options. Please remove them and add again with all the required options.') + Mage::helper('catalog')->__('Some of the products below do not have all the required options. Please remove them and add again with all the required options.') ); } return ''; diff --git a/app/code/core/Mage/Catalog/Model/Product/Option/Type/Text.php b/app/code/core/Mage/Catalog/Model/Product/Option/Type/Text.php index 2a65fdc50d..8bf5cefba1 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Option/Type/Text.php +++ b/app/code/core/Mage/Catalog/Model/Product/Option/Type/Text.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -48,11 +48,11 @@ public function validateUserValue($values) $value = trim($this->getUserValue()); if (strlen($value) == 0 && $option->getIsRequire() && !$this->getProduct()->getSkipCheckRequiredOption()) { $this->setIsValid(false); - Mage::throwException(Mage::helper('catalog')->__('Please specify the product required option(s)')); + Mage::throwException(Mage::helper('catalog')->__('Please specify the product\'s required option(s).')); } if (strlen($value) > $option->getMaxCharacters() && $option->getMaxCharacters() > 0) { $this->setIsValid(false); - Mage::throwException(Mage::helper('catalog')->__('Length of text is too long')); + Mage::throwException(Mage::helper('catalog')->__('The text is too long')); } $this->setUserValue($value); return $this; diff --git a/app/code/core/Mage/Catalog/Model/Product/Option/Value.php b/app/code/core/Mage/Catalog/Model/Product/Option/Value.php index 3771db8c57..e649f22afd 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Option/Value.php +++ b/app/code/core/Mage/Catalog/Model/Product/Option/Value.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Status.php b/app/code/core/Mage/Catalog/Model/Product/Status.php index 3f16f8359a..1081ef9dba 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Status.php +++ b/app/code/core/Mage/Catalog/Model/Product/Status.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Type.php b/app/code/core/Mage/Catalog/Model/Product/Type.php index 9a8f00af9f..8a48882647 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Type.php +++ b/app/code/core/Mage/Catalog/Model/Product/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php b/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php index c4c4e7a0a0..ac0f272db2 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php +++ b/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -327,6 +327,7 @@ public function prepareForCart(Varien_Object $buyRequest, $product = null) $product->addCustomOption('option_'.$optionId, $optionValue); } } + // set quantity in cart $product->setCartQty($buyRequest->getQty()); @@ -340,7 +341,7 @@ public function prepareForCart(Varien_Object $buyRequest, $product = null) */ public function getSpecifyOptionMessage() { - return Mage::helper('catalog')->__('Please specify the product required option(s)'); + return Mage::helper('catalog')->__('Please specify the product\'s required option(s).'); } /** @@ -352,7 +353,8 @@ public function getSpecifyOptionMessage() */ protected function _prepareOptionsForCart(Varien_Object $buyRequest, $product = null) { - $newOptions = array(); + $transport = new StdClass; + $transport->options = array(); foreach ($this->getProduct($product)->getOptions() as $_option) { /* @var $_option Mage_Catalog_Model_Product_Option */ $group = $_option->groupFactory($_option->getType()) @@ -363,10 +365,13 @@ protected function _prepareOptionsForCart(Varien_Object $buyRequest, $product = $preparedValue = $group->prepareForCart(); if ($preparedValue !== null) { - $newOptions[$_option->getId()] = $preparedValue; + $transport->options[$_option->getId()] = $preparedValue; } } - return $newOptions; + Mage::dispatchEvent('catalog_product_type_prepare_cart_options', array( + 'transport' => $transport, 'buy_request' => $buyRequest, 'product' => $product + )); + return $transport->options; } /** @@ -383,7 +388,7 @@ public function checkProductBuyState($product = null) if ($option->getIsRequire() && (!$this->getProduct($product)->getCustomOption('option_'.$option->getId()) || strlen($this->getProduct($product)->getCustomOption('option_'.$option->getId())->getValue()) == 0)) { Mage::throwException( - Mage::helper('catalog')->__('Product has required options') + Mage::helper('catalog')->__('The product has required options') ); break; } @@ -546,6 +551,9 @@ public function hasOptions($product = null) if ($this->getProduct($product)->getHasOptions()) { return true; } + if ($this->getProduct($product)->isRecurring()) { + return true; + } return false; } @@ -674,11 +682,29 @@ public function setConfig($config) */ public function getSearchableData($product = null) { - $product = $this->getProduct($product); - - $searchData = Mage::getSingleton('catalog/product_option') - ->getSearchableData($product->getId(), $product->getStoreId()); + $product = $this->getProduct($product); + $searchData = array(); + if ($product->getHasOptions()){ + $searchData = Mage::getSingleton('catalog/product_option') + ->getSearchableData($product->getId(), $product->getStoreId()); + } return $searchData; } + + /** + * Retrieve products divided into groups required to purchase + * At least one product in each group has to be purchased + * + * @param Mage_Catalog_Model_Product $product + * @return array + */ + public function getProductsToPurchaseByReqGroups($product = null) + { + $product = $this->getProduct($product); + if ($this->isComposite($product)) { + return array(); + } + return array(array($product)); + } } diff --git a/app/code/core/Mage/Catalog/Model/Product/Type/Api.php b/app/code/core/Mage/Catalog/Model/Product/Type/Api.php index b6424ae7a1..a5ee89dc21 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Type/Api.php +++ b/app/code/core/Mage/Catalog/Model/Product/Type/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Type/Api/V2.php b/app/code/core/Mage/Catalog/Model/Product/Type/Api/V2.php index b9d81b5c1d..251a82e363 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Type/Api/V2.php +++ b/app/code/core/Mage/Catalog/Model/Product/Type/Api/V2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php b/app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php index 3115c7ae22..4717ab0f3c 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php +++ b/app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -307,6 +307,7 @@ public function getUsedProductIds($product = null) /** * Retrieve array of "subproducts" * + * @param array * @param Mage_Catalog_Model_Product $product * @return array */ @@ -540,7 +541,7 @@ public function prepareForCart(Varien_Object $buyRequest, $product = null) } if (!isset($_result[0])) { - return Mage::helper('checkout')->__('Can not add item to shopping cart'); + return Mage::helper('checkout')->__('Cannot add the item to shopping cart'); } /** @@ -577,7 +578,7 @@ public function prepareForCart(Varien_Object $buyRequest, $product = null) */ public function getSpecifyOptionMessage() { - return Mage::helper('catalog')->__('Please specify the product option(s)'); + return Mage::helper('catalog')->__('Please specify the product\'s option(s).'); } /** @@ -682,4 +683,17 @@ public function assignProductToOption($optionProduct, $option, $product = null) return $this; } + + /** + * Retrieve products divided into groups required to purchase + * At least one product in each group has to be purchased + * + * @param Mage_Catalog_Model_Product $product + * @return array + */ + public function getProductsToPurchaseByReqGroups($product = null) + { + $product = $this->getProduct($product); + return array($this->getUsedProducts(null, $product)); + } } diff --git a/app/code/core/Mage/Catalog/Model/Product/Type/Configurable/Attribute.php b/app/code/core/Mage/Catalog/Model/Product/Type/Configurable/Attribute.php index d7f7d01a06..8a53ba6926 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Type/Configurable/Attribute.php +++ b/app/code/core/Mage/Catalog/Model/Product/Type/Configurable/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Type/Configurable/Price.php b/app/code/core/Mage/Catalog/Model/Product/Type/Configurable/Price.php index 3cc6dc11c5..6b523a1ecf 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Type/Configurable/Price.php +++ b/app/code/core/Mage/Catalog/Model/Product/Type/Configurable/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Type/Grouped.php b/app/code/core/Mage/Catalog/Model/Product/Type/Grouped.php index 168aa1f433..729ced9174 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Type/Grouped.php +++ b/app/code/core/Mage/Catalog/Model/Product/Type/Grouped.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -130,8 +130,8 @@ public function getAssociatedProducts($product = null) ->addStoreFilter($this->getStoreFilter($product)) ->addAttributeToFilter('status', array('in' => $this->getStatusFilters($product))); - foreach ($collection as $product) { - $associatedProducts[] = $product; + foreach ($collection as $item) { + $associatedProducts[] = $item; } $this->getProduct($product)->setData($this->_keyAssociatedProducts, $associatedProducts); @@ -199,8 +199,8 @@ public function getAssociatedProductIds($product = null) { if (!$this->getProduct($product)->hasData($this->_keyAssociatedProductIds)) { $associatedProductIds = array(); - foreach ($this->getAssociatedProducts($product) as $product) { - $associatedProductIds[] = $product->getId(); + foreach ($this->getAssociatedProducts($product) as $item) { + $associatedProductIds[] = $item->getId(); } $this->getProduct($product)->setData($this->_keyAssociatedProductIds, $associatedProductIds); } @@ -275,7 +275,7 @@ public function prepareForCart(Varien_Object $buyRequest, $product = null) foreach ($associatedProducts as $subProduct) { if(isset($productsInfo[$subProduct->getId()])) { $qty = $productsInfo[$subProduct->getId()]; - if (!empty($qty)) { + if (!empty($qty) && is_numeric($qty)) { $_result = $subProduct->getTypeInstance(true) ->prepareForCart($buyRequest, $subProduct); @@ -284,7 +284,7 @@ public function prepareForCart(Varien_Object $buyRequest, $product = null) } if (!isset($_result[0])) { - return Mage::helper('checkout')->__('Can not add item to shopping cart'); + return Mage::helper('checkout')->__('Cannot add the item to shopping cart.'); } $_result[0]->setCartQty($qty); @@ -306,6 +306,19 @@ public function prepareForCart(Varien_Object $buyRequest, $product = null) return $products; } } - return Mage::helper('catalog')->__('Please specify the product(s) quantity'); + return Mage::helper('catalog')->__('Please specify the quantity of product(s).'); + } + + /** + * Retrieve products divided into groups required to purchase + * At least one product in each group has to be purchased + * + * @param Mage_Catalog_Model_Product $product + * @return array + */ + public function getProductsToPurchaseByReqGroups($product = null) + { + $product = $this->getProduct($product); + return array($this->getAssociatedProducts($product)); } } diff --git a/app/code/core/Mage/Catalog/Model/Product/Type/Price.php b/app/code/core/Mage/Catalog/Model/Product/Type/Price.php index eee4640a69..f93abd8415 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Type/Price.php +++ b/app/code/core/Mage/Catalog/Model/Product/Type/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Type/Simple.php b/app/code/core/Mage/Catalog/Model/Product/Type/Simple.php index 2292b83774..89b8f91b0f 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Type/Simple.php +++ b/app/code/core/Mage/Catalog/Model/Product/Type/Simple.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Type/Virtual.php b/app/code/core/Mage/Catalog/Model/Product/Type/Virtual.php index a666f74862..967efc1190 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Type/Virtual.php +++ b/app/code/core/Mage/Catalog/Model/Product/Type/Virtual.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Url.php b/app/code/core/Mage/Catalog/Model/Product/Url.php index f30ee5f72b..fe32a188a1 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Url.php +++ b/app/code/core/Mage/Catalog/Model/Product/Url.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Visibility.php b/app/code/core/Mage/Catalog/Model/Product/Visibility.php index d51e98ff1a..14cff3a450 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Visibility.php +++ b/app/code/core/Mage/Catalog/Model/Product/Visibility.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Product/Website.php b/app/code/core/Mage/Catalog/Model/Product/Website.php index 16542df952..1d6f9600b2 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Website.php +++ b/app/code/core/Mage/Catalog/Model/Product/Website.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -67,7 +67,7 @@ public function removeProducts($websiteIds, $productIds) } catch (Exception $e) { Mage::throwException( - Mage::helper('catalog')->__('There was an error while removing products from websites') + Mage::helper('catalog')->__('An error occurred while removing products from websites.') ); } return $this; @@ -87,7 +87,7 @@ public function addProducts($websiteIds, $productIds) } catch (Exception $e) { Mage::throwException( - Mage::helper('catalog')->__('There was an error while adding products to websites') + Mage::helper('catalog')->__('An error occurred while adding products to websites.') ); } return $this; diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Attribute.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Attribute.php index e176c1b07c..952ef1c521 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Attribute.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Abstract.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Abstract.php index 0e87172f0d..e7260c7097 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Abstract.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -95,7 +95,7 @@ protected function _getLoadAttributesSelect($object, $table) if ($storeId != $this->getDefaultStoreId()) { $storeIds[] = $storeId; } - $select = $this->_read->select() + $select = $this->_getReadAdapter()->select() ->from(array('attr_table' => $table)) ->where('attr_table.'.$this->getEntityIdField().'=?', $object->getId()) ->where('attr_table.store_id IN (?)', $storeIds); @@ -462,11 +462,11 @@ protected function _collectOrigData($object) foreach ($this->getAttributesByTable() as $table=>$attributes) { $entityIdField = current($attributes)->getBackend()->getEntityIdField(); - $select = $this->_read->select() + $select = $this->_getReadAdapter()->select() ->from($table) ->where($this->getEntityIdField()."=?", $object->getId()); - $where = $this->_read->quoteInto("store_id=?", $storeId); + $where = $this->_getReadAdapter()->quoteInto("store_id=?", $storeId); $globalAttributeIds = array(); foreach ($attributes as $attrCode=>$attr) { @@ -475,11 +475,11 @@ protected function _collectOrigData($object) } } if (!empty($globalAttributeIds)) { - $where .= ' or '.$this->_read->quoteInto('attribute_id in (?)', $globalAttributeIds); + $where .= ' or '.$this->_getReadAdapter()->quoteInto('attribute_id in (?)', $globalAttributeIds); } $select->where($where); - $values = $this->_read->fetchAll($select); + $values = $this->_getReadAdapter()->fetchAll($select); if (empty($values)) { continue; @@ -530,47 +530,90 @@ protected function _prepareValueForSave($value, Mage_Eav_Model_Entity_Attribute_ * Retrieve attribute's raw value from DB. * * @param int $entityId - * @param int|string $attribute atrribute's id or code + * @param int|string|array $attribute atrribute's ids or codes * @param int|Mage_Core_Model_Store $store - * @return bool|string + * @return bool|string|array */ public function getAttributeRawValue($entityId, $attribute, $store) { - /* @var $attribute Mage_Catalog_Model_Entity_Attribute */ - $attribute = $this->getAttribute($attribute); - if ($attribute) { - /* @var $select Zend_Db_Select */ - $select = $this->_read->select(); - $attributeCode = $attribute->getAttributeCode(); - $attrTable = $attribute->getBackend()->getTable(); - $isStatic = $attribute->getBackend()->isStatic(); - $attrField = $isStatic ? $attributeCode : 'value'; - $select->from(array('default_value' => $attrTable), array()) - ->where('default_value.' . $this->getEntityIdField() . ' = ?', $entityId); - + if (!$entityId || empty($attribute)) { + return false; + } + if (!is_array($attribute)) { + $attribute = array($attribute); + } + $attributesData = array(); + $staticAttributes = array(); + $typedAttributes = array(); + $staticTable = null; + foreach ($attribute as $_attribute) { + /* @var $attribute Mage_Catalog_Model_Entity_Attribute */ + $_attribute = $this->getAttribute($_attribute); + if (!$_attribute) { + continue; + } + $attributeCode = $_attribute->getAttributeCode(); + $attrTable = $_attribute->getBackend()->getTable(); + $isStatic = $_attribute->getBackend()->isStatic(); if ($isStatic) { - $select->columns($attrField); - } else { - $select->where('default_value.attribute_id = ?', $attribute->getId()) - ->where('default_value.store_id = 0'); + $staticAttributes[] = $attributeCode; + $staticTable = $attrTable; + } + else { + /** + * That structure needed to avoid farther sql joins for getting attribute's code by id + */ + $typedAttributes[$attrTable][$_attribute->getId()] = $attributeCode; + } - if ($store instanceof Mage_Core_Model_Store) { - $store = $store->getId(); - } + } + /* @var $select Zend_Db_Select */ + $select = $this->_getReadAdapter()->select(); + /** + * Collecting static attributes + */ + if ($staticAttributes) { + $select->from($staticTable, $staticAttributes) + ->where($this->getEntityIdField() . ' = ?', $entityId); + $attributesData = $this->_getReadAdapter()->fetchRow($select); + } - $joinCondition = $this->_read->quoteInto('store_value.entity_id = ?', $entityId); - $joinCondition .= ' AND ' . $this->_read->quoteInto('store_value.attribute_id = ?', $attribute->getId()); - $joinCondition .= ' AND ' . $this->_read->quoteInto('store_value.store_id = ?', $store); + /** + * Collecting typed attributes, performing separate SQL query for each attribute type table + */ + if ($store instanceof Mage_Core_Model_Store) { + $store = $store->getId(); + } + $store = (int)$store; + if ($typedAttributes) { + foreach ($typedAttributes as $table => $_attributes) { + $select->reset()->from(array('default_value' => $table), array()); + $select->where('default_value.attribute_id IN (?)', array_keys($_attributes)) + ->where('default_value.entity_type_id = ? ', $this->getTypeId()) + ->where('default_value.entity_id = ? ', $entityId) + ->where('default_value.store_id = 0'); - $select->joinLeft(array('store_value' => $attrTable), - $joinCondition, - array('IFNULL(store_value.' . $attrField . ', default_value.' . $attrField . ')') - ); + $joinCondition = $this->_getReadAdapter()->quoteInto('store_value.attribute_id IN (?)', array_keys($_attributes)); + $joinCondition .= ' AND ' . $this->_getReadAdapter()->quoteInto('store_value.entity_type_id = ?', $this->getTypeId()); + $joinCondition .= ' AND ' . $this->_getReadAdapter()->quoteInto('store_value.entity_id = ?', $entityId); + $joinCondition .= ' AND ' . $this->_getReadAdapter()->quoteInto('store_value.store_id = ?', $store); + + $select->joinLeft(array('store_value' => $table), + $joinCondition, + array('attr_value' => 'IFNULL(store_value.value, default_value.value)', 'default_value.attribute_id') + ); + $result = $this->_getReadAdapter()->fetchAll($select); + foreach ($result as $key => $_attribute) { + $attributeCode = $typedAttributes[$table][$_attribute['attribute_id']]; + $attributesData[$attributeCode] = $_attribute['attr_value']; + } } - return $this->_read->fetchOne($select); } - - return false; + if (sizeof($attributesData) == 1) { + $_data = each($attributesData); + $attributesData = $_data[1]; + } + return $attributesData ? $attributesData : false; } /** diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Attribute.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Attribute.php index 313a5ad087..defb971e54 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Attribute.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category.php index c14a0c576a..e30f300ef5 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Collection.php index df9f6e1b81..e0ba638338 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Collection.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Frontend/Image.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Frontend/Image.php index 28da702035..30e2190d3d 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Frontend/Image.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Frontend/Image.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Source/Layout.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Source/Layout.php index 7fcd3a281f..791e776efd 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Source/Layout.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Source/Layout.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -43,7 +43,7 @@ public function getAllOptions() 'label'=>(string)$layoutConfig->label ); } - array_unshift($this->_options, array('value'=>'', 'label'=>Mage::helper('catalog')->__('No layout updates'))); + array_unshift($this->_options, array('value'=>'', 'label'=>Mage::helper('catalog')->__('No layout updates.'))); } return $this->_options; } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Source/Mode.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Source/Mode.php index 07cf38c529..13a76b92c6 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Source/Mode.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Source/Mode.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Source/Page.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Source/Page.php index 8d44790905..c258e77ccb 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Source/Page.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Attribute/Source/Page.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -39,7 +39,7 @@ public function getAllOptions() $this->_options = Mage::getResourceModel('cms/block_collection') ->load() ->toOptionArray(); - array_unshift($this->_options, array('value'=>'', 'label'=>Mage::helper('catalog')->__('Please select static block ...'))); + array_unshift($this->_options, array('value'=>'', 'label'=>Mage::helper('catalog')->__('Please select a static block ...'))); } return $this->_options; } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Collection.php index 68695b2f03..681b6fae31 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Collection.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Flat.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Flat.php index de76ec1e4a..da32b7ff44 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Flat.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Flat.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Flat/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Flat/Collection.php index 92e6e5932e..5a3b13dfdc 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Flat/Collection.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Flat/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Indexer/Product.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Indexer/Product.php index eb0fb43926..8ce1318f08 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Indexer/Product.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Indexer/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Indexer_Product extends Mage_Index_Model_Mysql4_Abstract @@ -456,10 +456,8 @@ protected function _getStatusAttributeInfo() */ public function reindexAll() { - /** - * Create temporary index table - */ - $this->cloneIndexTable(); + $this->useIdxTable(true); + $this->clearTemporaryIndexTable(); $idxTable = $this->getIdxTable(); $idxAdapter = $this->_getIndexAdapter(); $stores = $this->_getStoresInfo(); @@ -504,16 +502,13 @@ public function reindexAll() WHERE cp.product_id IS NULL"; $idxAdapter->query($sql); + /** * Prepare anchor categories products */ - $anchorProductsTable = $this->_resources->getTableName('tmp_category_index_anchor_products'); - $idxAdapter->query('DROP TABLE IF EXISTS ' . $anchorProductsTable); - $sql = "CREATE TABLE `{$anchorProductsTable}` ( - `category_id` int(10) unsigned NOT NULL DEFAULT '0', - `product_id` int(10) unsigned NOT NULL DEFAULT '0' - ) ENGINE=MyISAM"; - $idxAdapter->query($sql); + $anchorProductsTable = $this->_getAnchorCategoriesProductsTemporaryTable(); + $idxAdapter->delete($anchorProductsTable); + $sql = "SELECT STRAIGHT_JOIN DISTINCT ca.category_id, cp.product_id @@ -541,13 +536,15 @@ public function reindexAll() $idxAdapter->query($sql); } $this->syncData(); - $tmpTables = array( - $idxAdapter->quoteIdentifier($idxTable), - $idxAdapter->quoteIdentifier($enabledTable), - $idxAdapter->quoteIdentifier($anchorTable), - $idxAdapter->quoteIdentifier($anchorProductsTable) - ); - $idxAdapter->query('DROP TABLE IF EXISTS '.implode(',', $tmpTables)); + + /** + * Clean up temporary tables + */ + $this->clearTemporaryIndexTable(); + $idxAdapter->delete($enabledTable); + $idxAdapter->delete($anchorTable); + $idxAdapter->delete($anchorProductsTable); + return $this; } @@ -585,18 +582,13 @@ protected function _prepareEnabledProductsVisibility($websiteId, $storeId) $visibilityAttributeId = $visibilityAttribute->getId(); $statusTable = $statusAttribute->getBackend()->getTable(); $visibilityTable = $visibilityAttribute->getBackend()->getTable(); + /** * Prepare temporary table */ - $tmpTable = $this->_resources->getTableName('tmp_category_index_enabled_products'); - $sql = 'DROP TABLE IF EXISTS ' . $tmpTable; - $this->_getIndexAdapter()->query($sql); - $sql = "CREATE TABLE {$tmpTable} ( - `product_id` int(10) unsigned NOT NULL DEFAULT '0', - `visibility` int(11) unsigned NOT NULL DEFAULT '0', - KEY `IDX_PRODUCT` (`product_id`) - ) ENGINE=MyISAM"; - $this->_getIndexAdapter()->query($sql); + $tmpTable = $this->_getEnabledProductsTemporaryTable(); + $this->_getIndexAdapter()->delete($tmpTable); + $sql = "SELECT pw.product_id AS product_id, IF(pvs.value_id>0, pvs.value, pvd.value) AS visibility @@ -617,6 +609,19 @@ protected function _prepareEnabledProductsVisibility($websiteId, $storeId) return $tmpTable; } + /** + * Retrieve temporary table of category enabled products + * + * @return string + */ + protected function _getEnabledProductsTemporaryTable() + { + if ($this->useIdxTable()) { + return $this->getTable('catalog/category_product_enabled_indexer_idx'); + } + return $this->getTable('catalog/category_product_enabled_indexer_tmp'); + } + /** * Create temporary table with list of anchor categories * @@ -628,15 +633,10 @@ protected function _prepareAnchorCategories($storeId, $rootPath) $isAnchorAttribute = Mage::getSingleton('eav/config')->getAttribute('catalog_category', 'is_anchor'); $anchorAttributeId = $isAnchorAttribute->getId(); $anchorTable = $isAnchorAttribute->getBackend()->getTable(); - $tmpTable = $this->_resources->getTableName('tmp_category_index_anchor_categories'); - $sql = 'DROP TABLE IF EXISTS ' . $tmpTable; - $this->_getIndexAdapter()->query($sql); - $sql = "CREATE TABLE {$tmpTable} ( - `category_id` int(10) unsigned NOT NULL DEFAULT '0', - `path` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '', - KEY `IDX_CATEGORY` (`category_id`) - ) ENGINE=MyISAM"; - $this->_getIndexAdapter()->query($sql); + + $tmpTable = $this->_getAnchorCategoriesTemporaryTable(); + $this->_getIndexAdapter()->delete($tmpTable); + $sql = "SELECT ce.entity_id AS category_id, concat(ce.path, '/%') AS path @@ -652,4 +652,43 @@ protected function _prepareAnchorCategories($storeId, $rootPath) $this->insertFromSelect($sql, $tmpTable, array('category_id' , 'path')); return $tmpTable; } + + /** + * Retrieve temporary table of anchor categories + * + * @return string + */ + protected function _getAnchorCategoriesTemporaryTable() + { + if ($this->useIdxTable()) { + return $this->getTable('catalog/category_anchor_indexer_idx'); + } + return $this->getTable('catalog/category_anchor_indexer_idx'); + } + + /** + * Retrieve temporary table of anchor categories products + * + * @return string + */ + protected function _getAnchorCategoriesProductsTemporaryTable() + { + if ($this->useIdxTable()) { + return $this->getTable('catalog/category_anchor_products_indexer_idx'); + } + return $this->getTable('catalog/category_anchor_products_indexer_tmp'); + } + + /** + * Retrieve temporary decimal index table name + * + * @return string + */ + public function getIdxTable($table = null) + { + if ($this->useIdxTable()) { + return $this->getTable('catalog/category_product_indexer_idx'); + } + return $this->getTable('catalog/category_product_indexer_tmp'); + } } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Tree.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Tree.php index dbe84f7c32..54e1e1f215 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Tree.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category/Tree.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -143,6 +143,7 @@ public function addCollectionData($collection=null, $sorted=false, $exclude=arra $collection->addFieldToFilter('entity_id', array('nin'=>$disabledIds)); } $collection->addAttributeToFilter('is_active', 1); + $collection->addAttributeToFilter('include_in_menu', 1); } if ($this->_joinUrlRewriteIntoCollection) { @@ -569,4 +570,24 @@ protected function _createCollectionDataSelect($sorted = true, $optionalAttribut return $select; } + + /** + * Get real existing category ids by specified ids + * + * @param array $ids + * @return array + */ + public function getExistingCategoryIdsBySpecifiedIds($ids) + { + if (empty($ids)) { + return array(); + } + if (!is_array($ids)) { + $ids = array($ids); + } + $select = $this->_conn->select() + ->from($this->_table, array('entity_id')) + ->where(sprintf('entity_id IN (%s)', implode(', ', $ids))); + return $this->_conn->fetchCol($select); + } } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Collection/Abstract.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Collection/Abstract.php index c12a09013e..940aaf4e99 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Collection/Abstract.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Collection/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -118,7 +118,7 @@ protected function _getLoadAttributesSelect($table, $attributeIds = array()) $entityId = $valueInfo[$entityIdField]; if (!isset($this->_items[$entityId])) { Mage::throwException('Mage_Eav', - Mage::helper('eav')->__('Data integrity: No header row found for attribute') + Mage::helper('eav')->__('Data integrity: No header row found for attribute.') ); } $attributeCode = $this->getEntity()->getAttribute($valueInfo['attribute_id']) diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Config.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Config.php index 4cf5421f94..7965de0eda 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Config.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -85,10 +85,7 @@ public function getStoreId() public function getEntityTypeId() { if (is_null($this->_entityTypeId)) { - $select = $this->_getReadAdapter()->select() - ->from($this->getTable('eav/entity_type'), 'entity_type_id') - ->where('entity_type_code=?', 'catalog_product'); - $this->_entityTypeId = $this->_getReadAdapter()->fetchOne($select); + $this->_entityTypeId = Mage::getSingleton('eav/config')->getEntityType('catalog_product')->getId(); } return $this->_entityTypeId; } @@ -103,8 +100,7 @@ public function getAttributesUsedInListing() { ->from(array('main_table' => $this->getTable('eav/attribute'))) ->join( array('additional_table' => $this->getTable('catalog/eav_attribute')), - 'main_table.attribute_id = additional_table.attribute_id', - array() + 'main_table.attribute_id = additional_table.attribute_id' ) ->joinLeft( array('al' => $this->getTable('eav/attribute_label')), diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Layer/Filter/Attribute.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Layer/Filter/Attribute.php index ea85cab25f..0dfabd17aa 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Layer/Filter/Attribute.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Layer/Filter/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Layer/Filter/Decimal.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Layer/Filter/Decimal.php index 985ab005c2..abc424b6ae 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Layer/Filter/Decimal.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Layer/Filter/Decimal.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Layer/Filter/Price.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Layer/Filter/Price.php index ee4e5f02e5..c0178d6e2c 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Layer/Filter/Price.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Layer/Filter/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product.php index f80402f40c..5c7f3aa496 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -44,11 +44,7 @@ public function __construct() parent::__construct(); $resource = Mage::getSingleton('core/resource'); $this->setType('catalog_product') - ->setConnection( - $resource->getConnection('catalog_read'), - $resource->getConnection('catalog_write') - ); - + ->setConnection('catalog_read', 'catalog_write'); $this->_productWebsiteTable = $resource->getTableName('catalog/product_website'); $this->_productCategoryTable= $resource->getTableName('catalog/category_product'); } @@ -99,7 +95,7 @@ public function getCategoryIds($product) */ public function getIdBySku($sku) { - return $this->_read->fetchOne('select entity_id from '.$this->getEntityTable().' where sku=?', $sku); + return $this->_getReadAdapter()->fetchOne('select entity_id from '.$this->getEntityTable().' where sku=?', $sku); } /** @@ -333,7 +329,7 @@ public function refreshEnabledIndex($store=null, $product=null) $indexTable = $this->getTable('catalog/product_enabled_index'); if (is_null($store) && is_null($product)) { Mage::throwException( - Mage::helper('catalog')->__('For reindex enabled product(s) you need specify store or product') + Mage::helper('catalog')->__('To reindex the enabled product(s), the store or product must be specified.') ); } elseif (is_null($product) || is_array($product)) { $storeId = $store->getId(); @@ -456,11 +452,15 @@ public function getDefaultAttributeSourceModel() /** * Validate all object's attributes against configuration * + * @todo implement full validation process with errors returning which are ignoring now + * * @param Varien_Object $object * @return Varien_Object */ public function validate($object) { +// $this->walkAttributes('backend/beforeSave', array($object)); +// return parent::validate($object); parent::validate($object); return $this; } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Action.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Action.php index 3674e7c831..555a5e0902 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Action.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Gallery.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Gallery.php index 9b3241b28a..4194680ad9 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Gallery.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Gallery.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Image.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Image.php index 758bbef51a..66b16ed1d5 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Image.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Image.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Media.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Media.php index 3573765944..d55fb9bf98 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Media.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Media.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Tierprice.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Tierprice.php index cb121fff57..f67cd26a43 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Tierprice.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Tierprice.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Urlkey.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Urlkey.php index f5aeec6681..2aefdbd4e6 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Urlkey.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Backend/Urlkey.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Collection.php index 0a54a026a3..72bf54a60a 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Collection.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Frontend/Image.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Frontend/Image.php index c4ce7c425e..9872fee66d 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Frontend/Image.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Frontend/Image.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Frontend/Tierprice.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Frontend/Tierprice.php index eced6f0247..793f2e5579 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Frontend/Tierprice.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Attribute/Frontend/Tierprice.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Collection.php index 903d9c951d..c0ea8b08b9 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Collection.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -358,6 +358,14 @@ protected function _afterLoad() if (count($this) > 0) { Mage::dispatchEvent('catalog_product_collection_load_after', array('collection'=>$this)); } + + foreach ($this as $product) { + if ($product->isRecurring() && $profile = $product->getRecurringProfile()) { + $product->setRecurringProfile(unserialize($profile)); + } + // Mage::getSilgleton('catalog/product_attribute_backend_recurring')->afterLoad($product); + } + return $this; } @@ -525,7 +533,7 @@ public function addCategoryFilter(Mage_Catalog_Model_Category $category) $this->_productLimitationFilters['category_is_anchor'] = 1; } - $this->_applyProductLimitations(); + ($this->getStoreId() == 0)? $this->_applyZeroStoreProductLimitations() : $this->_applyProductLimitations(); return $this; } @@ -1115,21 +1123,21 @@ public function addAttributeToFilter($attribute, $condition=null, $joinType='inn $this->_allIdsCache = null; if (is_string($attribute) && $attribute == 'is_saleable') { - $isStockManagedInConfig = (int) Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_MANAGE_STOCK); + $isStockManagedInConfig = (int) Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_MANAGE_STOCK); $inventoryTable = $this->getTable('cataloginventory_stock_item'); $this->getSelect()->where( $this->_getConditionSql( "( IF( IF( - $inventoryTable.use_config_manage_stock, - $isStockManagedInConfig, + $inventoryTable.use_config_manage_stock, + $isStockManagedInConfig, $inventoryTable.manage_stock - ), - $inventoryTable.is_in_stock, + ), + $inventoryTable.is_in_stock, 1 ) - )", + )", $condition ) ); @@ -1474,7 +1482,7 @@ protected function _productLimitationJoinPrice() $this->getSelect()->join( array('price_index' => $this->getTable('catalog/product_index_price')), $joinCond, - array('price', 'final_price', 'minimal_price'=>$minimalExpr , 'min_price', 'max_price', 'tier_price') + array('price', 'tax_class_id', 'final_price', 'minimal_price'=>$minimalExpr , 'min_price', 'max_price', 'tier_price') ); } else { $fromPart['price_index']['joinCondition'] = $joinCond; @@ -1484,13 +1492,32 @@ protected function _productLimitationJoinPrice() return $this; } + /** + * Apply front-end price limitation filters to the collection + * + * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection + * + */ + public function applyFrontendPriceLimitations() + { + $this->_productLimitationFilters['use_price_index'] = true; + if (!isset($this->_productLimitationFilters['customer_group_id'])) { + $this->_productLimitationFilters['customer_group_id'] = Mage::getSingleton('customer/session')->getCustomerGroupId(); + } + if (!isset($this->_productLimitationFilters['website_id'])) { + $this->_productLimitationFilters['website_id'] = Mage::app()->getStore($this->getStoreId())->getWebsiteId(); + } + $this->_applyProductLimitations(); + return $this; + } + /** * Apply limitation filters to collection * - * Method allow use one time category product index table (or product website table) + * Method allows using one time category product index table (or product website table) * for different combinations of store_id/category_id/visibility filter states * - * Mehod support multiple changes in one collection object for this parameters + * Method supports multiple changes in one collection object for this parameters * * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */ @@ -1542,4 +1569,38 @@ protected function _applyProductLimitations() return $this; } + + /** + * Apply limitation filters to collection base on API + * + * Method allows using one time category product table + * for combinations of category_id filter states + * + * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection + */ + protected function _applyZeroStoreProductLimitations() + { + $filters = $this->_productLimitationFilters; + + $conditions = array( + 'cat_pro.product_id=e.entity_id', + $this->getConnection()->quoteInto('cat_pro.category_id=?', $filters['category_id']) + ); + $joinCond = join(' AND ', $conditions); + + $fromPart = $this->getSelect()->getPart(Zend_Db_Select::FROM); + if (isset($fromPart['cat_pro'])) { + $fromPart['cat_pro']['joinCondition'] = $joinCond; + $this->getSelect()->setPart(Zend_Db_Select::FROM, $fromPart); + } + else { + $this->getSelect()->join( + array('cat_pro' => $this->getTable('catalog/category_product')), + $joinCond, + array('cat_index_position' => 'position') + ); + } + + return $this; + } } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Compare/Item.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Compare/Item.php index b5a9f0b9a4..bfd2f55864 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Compare/Item.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Compare/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -222,4 +222,29 @@ public function updateCustomerFromVisitor($object) return $this; } + /** + * Clear compare items by visitor and/or customer + * + * @param int $visitor_id + * @param int $customer_id + * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Compare_Item + */ + public function clearItems($visitor_id = null, $customer_id = null) + { + $where = array(); + if ($customer_id) { + $customer_id = (int)$customer_id; + $where[] = $this->_getWriteAdapter()->quoteInto('customer_id=?', $customer_id); + } + if ($visitor_id) { + $visitor_id = (int)$visitor_id; + $where[] = $this->_getWriteAdapter()->quoteInto('visitor_id=?', $visitor_id); + } + if (!$where) { + return $this; + } + $this->_getWriteAdapter()->delete($this->getMainTable(), $where); + return $this; + } + } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Compare/Item/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Compare/Item/Collection.php index 00cc0d942e..216bd275aa 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Compare/Item/Collection.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Compare/Item/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -312,21 +312,8 @@ public function getProductIds() */ public function clear() { - $where = array(); - if ($this->getCustomerId()) { - $where[] = $this->getConnection()->quoteInto('customer_id=?', $this->getCustomerId()); - } - if ($this->getVisitorId()) { - $where[] = $this->getConnection()->quoteInto('visitor_id=?', $this->getVisitorId()); - } - if (!$where) { - return $this; - } - - $this->getConnection()->delete($this->getTable('catalog/compare_item'), $where); - + Mage::getResourceSingleton('catalog/product_compare_item')->clearItems($this->getVisitorId(), $this->getCustomerId()); Mage::dispatchEvent('catalog_product_compare_item_collection_clear'); - return $this; } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Flat.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Flat.php index 2b56a35716..5e97fa0cba 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Flat.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Flat.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Flat/Indexer.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Flat/Indexer.php index 8cba3565ee..5b75e6fde1 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Flat/Indexer.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Flat/Indexer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -248,7 +248,7 @@ public function getAttribute($attributeCode) $attribute = Mage::getModel('catalog/resource_eav_attribute') ->loadByCode($this->getEntityTypeId(), $attributeCode); if (!$attribute->getId()) { - Mage::throwException(Mage::helper('catalog')->__('Invalid attribute %s', $attributeCode)); + Mage::throwException(Mage::helper('catalog')->__('Invalid attribute %s.', $attributeCode)); } $entity = Mage::getSingleton('eav/config') ->getEntityType($this->getEntityType()) @@ -518,7 +518,7 @@ public function prepareFlatTable($store) $maxIndex = Mage::getConfig()->getNode(self::XML_NODE_MAX_INDEX_COUNT); if (count($indexes) > $maxIndex) { - Mage::throwException(Mage::helper('catalog')->__("Flat Catalog module has a limit of %2\$d filterable and/or sort able attributes. Currently there are %1\$d. Please reduce the number of filterable/sort able attributes in order to use this module.", count($indexes), $maxIndex)); + Mage::throwException(Mage::helper('catalog')->__("The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes. Currently there are %1\$d of them. Please reduce the number of filterable/sortable attributes in order to use this module.", count($indexes), $maxIndex)); } $tableName = $this->getFlatTableName($store); diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Abstract.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Abstract.php index c9d7b68d6b..d3f11d0602 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Abstract.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Eav.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Eav.php index f8a31d381d..66dad8cdab 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Eav.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Eav.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -77,7 +77,7 @@ public function getIndexer($type) { $indexers = $this->getIndexers(); if (!isset($indexers[$type])) { - Mage::throwException(Mage::helper('catalog')->__('Unknown eav indexer type "%s"', $type)); + Mage::throwException(Mage::helper('catalog')->__('Unknown EAV indexer type "%s".', $type)); } return $indexers[$type]; } @@ -179,6 +179,7 @@ public function catalogEavAttributeSave(Mage_Index_Model_Event $event) */ public function reindexAll() { + $this->useIdxTable(true); foreach ($this->getIndexers() as $indexer) { /* @var $indexer Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Eav_Abstract */ $indexer->reindexAll(); @@ -186,4 +187,17 @@ public function reindexAll() return $this; } + + /** + * Retrieve temporary source index table name + * + * @return string + */ + public function getIdxTable($table = null) + { + if ($this->useIdxTable()) { + return $this->getTable('catalog/product_eav_indexer_idx'); + } + return $this->getTable('catalog/product_eav_indexer_tmp'); + } } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Eav/Abstract.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Eav/Abstract.php index 1a4e60f4e0..ab63df422d 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Eav/Abstract.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Eav/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,8 +42,8 @@ abstract class Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Eav_Abstra */ public function reindexAll() { - $this->cloneIndexTable(true); - + $this->useIdxTable(true); + $this->clearTemporaryIndexTable(); $this->_prepareIndex(); $this->_prepareRelationIndex(); $this->_removeNotVisibleEntityFromIndex(); @@ -63,7 +63,7 @@ public function reindexEntities($processIds) { $adapter = $this->_getWriteAdapter(); - $this->cloneIndexTable(true); + $this->clearTemporaryIndexTable(); if (!is_array($processIds)) { $processIds = array($processIds); @@ -113,7 +113,7 @@ public function reindexAttribute($attributeId, $isIndexable = true) if (!$isIndexable) { $this->_removeAttributeIndexData($attributeId); } else { - $this->cloneIndexTable(true); + $this->clearTemporaryIndexTable(); $this->_prepareIndex(null, $attributeId); $this->_prepareRelationIndex(); diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Eav/Decimal.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Eav/Decimal.php index 8bacb14ab8..6fc3a6c9e6 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Eav/Decimal.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Eav/Decimal.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -127,5 +127,18 @@ protected function _getIndexableAttributes() return $adapter->fetchCol($select); } + + /** + * Retrieve temporary decimal index table name + * + * @return string + */ + public function getIdxTable($table = null) + { + if ($this->useIdxTable()) { + return $this->getTable('catalog/product_eav_decimal_indexer_idx'); + } + return $this->getTable('catalog/product_eav_decimal_indexer_tmp'); + } } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Eav/Source.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Eav/Source.php index 2d317b82d4..3bd23761fe 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Eav/Source.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Eav/Source.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -261,4 +261,17 @@ protected function _saveIndexData(array $data) $adapter->insertArray($this->getIdxTable(), array('entity_id', 'attribute_id', 'store_id', 'value'), $data); return $this; } + + /** + * Retrieve temporary source index table name + * + * @return string + */ + public function getIdxTable($table = null) + { + if ($this->useIdxTable()) { + return $this->getTable('catalog/product_eav_indexer_idx'); + } + return $this->getTable('catalog/product_eav_indexer_tmp'); + } } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price.php index ab0019d5ae..9946ffd373 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -92,7 +92,7 @@ public function catalogProductDelete(Mage_Index_Model_Event $event) return $this; } - $this->cloneIndexTable(true); + $this->clearTemporaryIndexTable(); $processIds = array_keys($data['reindex_price_parent_ids']); $parentIds = array(); @@ -161,7 +161,7 @@ public function catalogProductSave(Mage_Index_Model_Event $event) return $this; } - $this->cloneIndexTable(true); + $this->clearTemporaryIndexTable(); $this->_prepareWebsiteDateTable(); $indexer = $this->_getIndexer($data['product_type_id']); @@ -238,7 +238,7 @@ public function catalogProductMassAction(Mage_Index_Model_Event $event) return $this->reindexAll(); } - $this->cloneIndexTable(true); + $this->clearTemporaryIndexTable(); // retrieve products types $select = $write->select() @@ -308,7 +308,7 @@ protected function _getIndexer($productTypeId) { $types = $this->getTypeIndexers(); if (!isset($types[$productTypeId])) { - Mage::throwException(Mage::helper('catalog')->__('Unsupported product type "%s"', $productTypeId)); + Mage::throwException(Mage::helper('catalog')->__('Unsupported product type "%s".', $productTypeId)); } return $types[$productTypeId]; } @@ -348,7 +348,8 @@ public function getTypeIndexers() */ public function reindexAll() { - $this->cloneIndexTable(true); + $this->useIdxTable(true); + $this->clearTemporaryIndexTable(); $this->_prepareWebsiteDateTable(); $this->_prepareTierPriceIndex(); @@ -475,7 +476,8 @@ protected function _prepareWebsiteDateTable() array('csg' => $this->getTable('core/store_group')), 'cw.default_group_id = csg.group_id', array('store_id' => 'default_store_id')) - ->where('cw.website_id != 0'); + ->where('cw.website_id != 0') + ->group('cw.website_id'); $data = array(); foreach ($write->fetchAll($select) as $item) { @@ -511,4 +513,17 @@ protected function _prepareWebsiteDateTable() return $this; } + + /** + * Retrieve temporary index table name + * + * @return string + */ + public function getIdxTable($table = null) + { + if ($this->useIdxTable()) { + return $this->getTable('catalog/product_price_indexer_idx'); + } + return $this->getTable('catalog/product_price_indexer_tmp'); + } } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price/Configurable.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price/Configurable.php index 1976884c58..5ff1cbac49 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price/Configurable.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price/Configurable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,6 +42,7 @@ class Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Price_Configurable */ public function reindexAll() { + $this->useIdxTable(true); $this->_prepareFinalPriceData(); $this->_applyCustomOption(); $this->_applyConfigurableOption(); @@ -73,7 +74,10 @@ public function reindexEntity($entityIds) */ protected function _getConfigurableOptionAggregateTable() { - return $this->getIdxTable() . '_cfg_opt_aggregate'; + if ($this->useIdxTable()) { + return $this->getTable('catalog/product_price_indexer_cfg_option_aggregate_idx'); + } + return $this->getTable('catalog/product_price_indexer_cfg_option_aggregate_tmp'); } /** @@ -83,7 +87,10 @@ protected function _getConfigurableOptionAggregateTable() */ protected function _getConfigurableOptionPriceTable() { - return $this->getIdxTable() . '_cfg_option'; + if ($this->useIdxTable()) { + return $this->getTable('catalog/product_price_indexer_cfg_option_idx'); + } + return $this->getTable('catalog/product_price_indexer_cfg_option_tmp'); } /** @@ -93,24 +100,7 @@ protected function _getConfigurableOptionPriceTable() */ protected function _prepareConfigurableOptionAggregateTable() { - $write = $this->_getWriteAdapter(); - $table = $this->_getConfigurableOptionAggregateTable(); - - $query = sprintf('DROP TABLE IF EXISTS %s', $write->quoteIdentifier($table)); - $write->query($query); - - $query = sprintf('CREATE TABLE %s (' - . ' `parent_id` INT(10) UNSIGNED NOT NULL,' - . ' `child_id` INT(10) UNSIGNED NOT NULL,' - . ' `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL,' - . ' `website_id` SMALLINT(5) UNSIGNED NOT NULL,' - . ' `price` DECIMAL(12,4) DEFAULT NULL,' - . ' `tier_price` DECIMAL(12,4) DEFAULT NULL,' - . ' PRIMARY KEY (`parent_id`, `child_id`, `customer_group_id`, `website_id`)' - . ') ENGINE=MYISAM DEFAULT CHARSET=utf8', - $write->quoteIdentifier($table)); - $write->query($query); - + $this->_getWriteAdapter()->delete($this->_getConfigurableOptionAggregateTable()); return $this; } @@ -121,24 +111,7 @@ protected function _prepareConfigurableOptionAggregateTable() */ protected function _prepareConfigurableOptionPriceTable() { - $write = $this->_getWriteAdapter(); - $table = $this->_getConfigurableOptionPriceTable(); - - $query = sprintf('DROP TABLE IF EXISTS %s', $write->quoteIdentifier($table)); - $write->query($query); - - $query = sprintf('CREATE TABLE %s (' - . ' `entity_id` INT(10) UNSIGNED NOT NULL,' - . ' `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL,' - . ' `website_id` SMALLINT(5) UNSIGNED NOT NULL,' - . ' `min_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `max_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `tier_price` DECIMAL(12,4) DEFAULT NULL,' - . ' PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`)' - . ') ENGINE=MYISAM DEFAULT CHARSET=utf8', - $write->quoteIdentifier($table)); - $write->query($query); - + $this->_getWriteAdapter()->delete($this->_getConfigurableOptionPriceTable()); return $this; } @@ -223,8 +196,14 @@ protected function _applyConfigurableOption() $query = $select->crossUpdateFromSelect($table); $write->query($query); - $write->truncate($coaTable); - $write->truncate($copTable); + if ($this->useIdxTable()) { + $write->truncate($coaTable); + $write->truncate($copTable); + } + else { + $write->delete($coaTable); + $write->delete($copTable); + } return $this; } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price/Default.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price/Default.php index ed4258aa6f..a0bc0670b6 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price/Default.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -81,7 +81,7 @@ public function setTypeId($typeCode) public function getTypeId() { if (is_null($this->_typeId)) { - Mage::throwException(Mage::helper('catalog')->__('Not defined Product Type for Indexer')); + Mage::throwException(Mage::helper('catalog')->__('A product type is not defined for the indexer.')); } return $this->_typeId; } @@ -115,6 +115,7 @@ public function getIsComposite() */ public function reindexAll() { + $this->useIdxTable(true); $this->_prepareFinalPriceData(); $this->_applyCustomOption(); $this->_movePriceDataToIndexTable(); @@ -144,7 +145,10 @@ public function reindexEntity($entityIds) */ protected function _getDefaultFinalPriceTable() { - return $this->getIdxTable($this->getMainTable() . '_final'); + if ($this->useIdxTable()) { + return $this->getTable('catalog/product_price_indexer_final_idx'); + } + return $this->getTable('catalog/product_price_indexer_final_tmp'); } /** @@ -154,28 +158,7 @@ protected function _getDefaultFinalPriceTable() */ protected function _prepareDefaultFinalPriceTable() { - $write = $this->_getWriteAdapter(); - $table = $this->_getDefaultFinalPriceTable(); - - $query = sprintf('DROP TABLE IF EXISTS %s', $write->quoteIdentifier($table)); - $write->query($query); - - $query = sprintf('CREATE TABLE %s (' - . ' `entity_id` INT(10) UNSIGNED NOT NULL,' - . ' `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL,' - . ' `website_id` SMALLINT(5) UNSIGNED NOT NULL,' - . ' `tax_class_id` SMALLINT(5) UNSIGNED DEFAULT \'0\',' - . ' `orig_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `price` DECIMAL(12,4) DEFAULT NULL,' - . ' `min_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `max_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `tier_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `base_tier` DECIMAL(12,4) DEFAULT NULL,' - . ' PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`)' - . ') ENGINE=MYISAM DEFAULT CHARSET=utf8', - $write->quoteIdentifier($table)); - $write->query($query); - + $this->_getWriteAdapter()->delete($this->_getDefaultFinalPriceTable()); return $this; } @@ -303,7 +286,10 @@ protected function _prepareFinalPriceData($entityIds = null) */ protected function _getCustomOptionAggregateTable() { - return $this->getIdxTable() . '_option_aggregate'; + if ($this->useIdxTable()) { + return $this->getTable('catalog/product_price_indexer_option_aggregate_idx'); + } + return $this->getTable('catalog/product_price_indexer_option_aggregate_idx'); } /** @@ -313,7 +299,10 @@ protected function _getCustomOptionAggregateTable() */ protected function _getCustomOptionPriceTable() { - return $this->getIdxTable() . '_option'; + if ($this->useIdxTable()) { + return $this->getTable('catalog/product_price_indexer_option_idx'); + } + return $this->getTable('catalog/product_price_indexer_option_tmp'); } /** @@ -323,25 +312,7 @@ protected function _getCustomOptionPriceTable() */ protected function _prepareCustomOptionAggregateTable() { - $write = $this->_getWriteAdapter(); - $table = $this->_getCustomOptionAggregateTable(); - - $query = sprintf('DROP TABLE IF EXISTS %s', $write->quoteIdentifier($table)); - $write->query($query); - - $query = sprintf('CREATE TABLE %s (' - . ' `entity_id` INT(10) UNSIGNED NOT NULL,' - . ' `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL,' - . ' `website_id` SMALLINT(5) UNSIGNED NOT NULL,' - . ' `option_id` INT(10) UNSIGNED DEFAULT \'0\',' - . ' `min_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `max_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `tier_price` DECIMAL(12,4) DEFAULT NULL,' - . ' PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`, `option_id`)' - . ') ENGINE=MYISAM DEFAULT CHARSET=utf8', - $write->quoteIdentifier($table)); - $write->query($query); - + $this->_getWriteAdapter()->delete($this->_getCustomOptionAggregateTable()); return $this; } @@ -352,24 +323,7 @@ protected function _prepareCustomOptionAggregateTable() */ protected function _prepareCustomOptionPriceTable() { - $write = $this->_getWriteAdapter(); - $table = $this->_getCustomOptionPriceTable(); - - $query = sprintf('DROP TABLE IF EXISTS %s', $write->quoteIdentifier($table)); - $write->query($query); - - $query = sprintf('CREATE TABLE %s (' - . ' `entity_id` INT(10) UNSIGNED NOT NULL,' - . ' `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL,' - . ' `website_id` SMALLINT(5) UNSIGNED NOT NULL,' - . ' `min_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `max_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `tier_price` DECIMAL(12,4) DEFAULT NULL,' - . ' PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`)' - . ') ENGINE=MYISAM DEFAULT CHARSET=utf8', - $write->quoteIdentifier($table)); - $write->query($query); - + $this->_getWriteAdapter()->delete($this->_getCustomOptionPriceTable()); return $this; } @@ -522,8 +476,14 @@ protected function _applyCustomOption() $query = $select->crossUpdateFromSelect($table); $write->query($query); - $write->truncate($coaTable); - $write->truncate($copTable); + if ($this->useIdxTable()) { + $write->truncate($coaTable); + $write->truncate($copTable); + } + else { + $write->delete($coaTable); + $write->delete($copTable); + } return $this; } @@ -555,7 +515,12 @@ protected function _movePriceDataToIndexTable() $query = $select->insertFromSelect($this->getIdxTable()); $write->query($query); - $write->truncate($table); + if ($this->useIdxTable()) { + $write->truncate($table); + } + else { + $write->delete($table); + } return $this; } @@ -577,4 +542,17 @@ protected function _getTierPriceIndexTable() */ public function registerEvent(Mage_Index_Model_Event $event) {} + + /** + * Retrieve temporary index table name + * + * @return string + */ + public function getIdxTable($table = null) + { + if ($this->useIdxTable()) { + return $this->getTable('catalog/product_price_indexer_idx'); + } + return $this->getTable('catalog/product_price_indexer_tmp'); + } } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price/Grouped.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price/Grouped.php index 6eff30c452..52262a8726 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price/Grouped.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price/Grouped.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,6 +42,7 @@ class Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Price_Grouped */ public function reindexAll() { + $this->useIdxTable(true); $this->_prepareGroupedProductPriceData(); return $this; } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price/Interface.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price/Interface.php index 899e6c7058..7f028ae1a4 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price/Interface.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Link.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Link.php index cc3b915374..82b16a2f51 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Link.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Link.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Link/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Link/Collection.php index a17941f656..e88b10c7e1 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Link/Collection.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Link/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Link/Product/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Link/Product/Collection.php index e10e80704d..3d4e53a5ac 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Link/Product/Collection.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Link/Product/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -35,10 +35,39 @@ class Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Link_Product_Collection extends Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection { + /** + * Store product model + * + * @var Mage_Catalog_Model_Product + */ protected $_product; + + /** + * Store product link model + * + * @var Mage_Catalog_Model_Product_Link + */ protected $_linkModel; + + /** + * Store link type id + * + * @var int + */ protected $_linkTypeId; + + /** + * Store strong mode flag that determine if needed for inner join or left join of linked products + * + * @var bool + */ protected $_isStrongMode; + + /** + * Store flag that determine if product filter was enabled + * + * @var bool + */ protected $_hasLinkFilter = false; /** @@ -56,6 +85,11 @@ public function setLinkModel($linkModel) return $this; } + /** + * Enable strong mode for inner join of linked products + * + * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Link_Product_Collection + */ public function setIsStrongMode() { $this->_isStrongMode = true; @@ -81,6 +115,9 @@ public function getLinkModel() public function setProduct($product) { $this->_product = $product; + if ($product && $product->getId()) { + $this->_hasLinkFilter = true; + } return $this; } @@ -94,16 +131,24 @@ public function getProduct() return $this->_product; } + /** + * Exclude products from filter + * + * @param array $products + * @return Mage_Eav_Model_Entity_Collection_Abstract + */ public function addExcludeProductFilter($products) { - if (is_array($products) && !empty($products)) { + if (!empty($products)) { + if (!is_array($products)) { + $products = array($products); + } $this->_hasLinkFilter = true; $this->getSelect()->where('links.linked_product_id NOT IN (?)', $products); } return $this; } - /** * Add attribute to sort order * @@ -113,20 +158,13 @@ public function addExcludeProductFilter($products) */ public function addAttributeToSort($attribute, $dir='asc') { - /* - * position is not eav attributes so we cannot use default attributes to sort - */ + /** + * Position is not eav attribute (it is links attribute) so we cannot use default attributes to sort + */ if ($attribute == 'position') { - - // dont sort by position, when creating product (#5090) - if (!is_object($this->getProduct())) { - return $this; + if ($this->_hasLinkFilter) { + $this->getSelect()->order($attribute.' '.$dir); } - if (!$this->getProduct()->getId()) { - return $this; - } - - $this->getSelect()->order($attribute.' '.$dir); } else { parent::addAttributeToSort($attribute, $dir); @@ -134,18 +172,30 @@ public function addAttributeToSort($attribute, $dir='asc') return $this; } + /** + * Add products to filter + * + * @param array|int|string $products + * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Link_Product_Collection + */ public function addProductFilter($products) { - $this->_hasLinkFilter = true; if (is_array($products) && !empty($products)) { $this->getSelect()->where('links.product_id IN (?)', $products); + $this->_hasLinkFilter = true; } elseif (is_string($products) || is_numeric($products)) { $this->getSelect()->where('links.product_id=?', $products); + $this->_hasLinkFilter = true; } return $this; } + /** + * Add random sorting order + * + * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Link_Product_Collection + */ public function setRandomOrder() { $this->getSelect()->order(new Zend_Db_Expr('RAND()')); @@ -164,6 +214,11 @@ public function setGroupBy($groupBy = 'e.entity_id') return $this; } + /** + * Join linked products when specified link model + * + * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Link_Product_Collection + */ protected function _beforeLoad() { if ($this->getLinkModel()) { @@ -172,27 +227,59 @@ protected function _beforeLoad() return parent::_beforeLoad(); } + /** + * Join linked products and their attributes + * + * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Link_Product_Collection + */ protected function _joinLinks() { - $joinCondition = 'links.linked_product_id=e.entity_id AND links.link_type_id='.$this->_linkTypeId; - + $joinCondition = 'links.linked_product_id = e.entity_id AND links.link_type_id = ' . $this->_linkTypeId; + $joinType = 'join'; if ($this->getProduct() && $this->getProduct()->getId()) { if ($this->_isStrongMode) { - $joinType = 'join'; - $this->getSelect()->where('links.product_id=?', $this->getProduct()->getId()); + $this->getSelect()->where('links.product_id = ?', $this->getProduct()->getId()); } else { $joinType = 'joinLeft'; - $joinCondition.= ' AND links.product_id='. $this->getProduct()->getId(); + $joinCondition.= ' AND links.product_id = ' . $this->getProduct()->getId(); } - $this->getSelect()->where('e.entity_id!=?', $this->getProduct()->getId()); - + $this->getSelect()->where('e.entity_id != ?', $this->getProduct()->getId()); + } + elseif ($this->_isStrongMode) { + $this->getSelect()->where('e.entity_id = -1'); + } + if($this->_hasLinkFilter) { $this->getSelect()->$joinType( - array('links'=>$this->getTable('catalog/product_link')), + array('links' => $this->getTable('catalog/product_link')), $joinCondition, array('link_id') ); + $this->joinAttributes(); + } + return $this; + } + /** + * Enable sorting products by its position + * + * @param string $dir sort type asc|desc + * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Link_Product_Collection + */ + public function setPositionOrder($dir = 'asc') + { + $this->setOrder('position', $dir); + return $this; + } + + /** + * Join attributes + * + * @return Mage_Catalog_Model_Product + */ + public function joinAttributes() + { + if ($this->getLinkModel()) { $attributes = $this->getLinkModel()->getAttributes(); $attributesByType = array(); foreach ($attributes as $attribute) { @@ -205,26 +292,6 @@ protected function _joinLinks() ); } } - else { - if ($this->_isStrongMode) { - $this->getSelect()->where('e.entity_id=-1'); - } - elseif($this->_hasLinkFilter) { - $this->getSelect()->join( - array('links'=>$this->getTable('catalog/product_link')), - 'links.linked_product_id=e.entity_id AND links.link_type_id='.$this->_linkTypeId, - array('link_id') - ); - } - } - return $this; - } - - public function setPositionOrder($dir='asc') - { - if ($this->getProduct() && $this->getProduct()->getId()) { - $this->setOrder('position', $dir); - } return $this; } } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Option.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Option.php index 20974a72ba..f4a7be58b9 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Option.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Option.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Option/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Option/Collection.php index efa35eaa21..8980317be7 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Option/Collection.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Option/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Option/Value.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Option/Value.php index f4e731deef..9b250c6587 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Option/Value.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Option/Value.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Option/Value/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Option/Value/Collection.php index 92ae9a8eeb..22a1704d3f 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Option/Value/Collection.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Option/Value/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Relation.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Relation.php index 37eae63390..a5aa2b2a66 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Relation.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Relation.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Status.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Status.php index 9b13f0c3ea..62e6119fcc 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Status.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Status.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Type/Configurable.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Type/Configurable.php index 56776f92d5..3e95d12acd 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Type/Configurable.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Type/Configurable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Type/Configurable/Attribute.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Type/Configurable/Attribute.php index 1cd8782071..e5f595e1f4 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Type/Configurable/Attribute.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Type/Configurable/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Type/Configurable/Attribute/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Type/Configurable/Attribute/Collection.php index 6a4986cde9..d8d7e587c6 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Type/Configurable/Attribute/Collection.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Type/Configurable/Attribute/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Type/Configurable/Product/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Type/Configurable/Product/Collection.php index 09a4b7ecaf..98dea5aca5 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Type/Configurable/Product/Collection.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Type/Configurable/Product/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Website.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Website.php index 9cc201b584..9e5b66c070 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Website.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Website.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Sendfriend.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Sendfriend.php index 00bfe55047..16a0854a35 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Sendfriend.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Sendfriend.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Sendfriend/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Sendfriend/Collection.php index 72e37f7b85..cdfae10ce9 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Sendfriend/Collection.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Sendfriend/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Setup.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Setup.php index 55aba909a2..799138c570 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Setup.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Setup.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -558,7 +558,7 @@ public function getDefaultEntities() 'available_sort_by' => array( 'input' => 'multiselect', 'type' => 'text', - 'label' => 'Available Product Listing Sort by', + 'label' => 'Available Product Listing Sort By', 'source' => 'catalog/category_attribute_source_sortby', 'backend' => 'catalog/category_attribute_backend_sortby', 'required' => true, @@ -568,7 +568,7 @@ public function getDefaultEntities() ), 'default_sort_by' => array( 'input' => 'select', - 'label' => 'Default Product Listing Sort by', + 'label' => 'Default Product Listing Sort By', 'source' => 'catalog/category_attribute_source_sortby', 'backend' => 'catalog/category_attribute_backend_sortby', 'required' => true, @@ -1169,7 +1169,7 @@ public function getDefaultEntities() 'source' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'visible' => false, - 'required' => true, + 'required' => false, 'user_defined' => false, 'default' => '', 'searchable' => false, @@ -1179,6 +1179,51 @@ public function getDefaultEntities() 'unique' => false, 'apply_to' => 'simple,configurable,virtual', ), + 'is_recurring' => array( + 'group' => 'Recurring Profile', + 'type' => 'int', + 'backend' => '', + 'frontend' => '', + 'label' => 'Enable Recurring Profile', + 'note' => 'Nominal price option may be used for manipulating recurring fees.', + 'input' => 'select', + 'class' => '', + 'source' => 'eav/entity_attribute_source_boolean', + 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, + 'visible' => true, + 'required' => false, + 'user_defined' => false, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'unique' => false, + 'apply_to' => 'simple,virtual', + 'is_configurable' => false + ), + 'recurring_profile' => array( + 'group' => 'Recurring Profile', + 'type' => 'text', + 'backend' => 'catalog/product_attribute_backend_recurring', + 'frontend' => '', + 'label' => 'Recurring Profile', + 'input' => 'text', // doesn't matter + 'class' => '', + 'source' => '', + 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, + 'visible' => true, + 'required' => false, + 'user_defined' => false, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'unique' => false, + 'apply_to' => 'simple,virtual', + 'is_configurable' => false + ), 'visibility' => array( 'group' => 'General', 'type' => 'int', @@ -1348,11 +1393,13 @@ public function getDefaultEntities() 'visible' => false, 'default' => false, 'used_in_product_listing' => true, + 'required' => false, ), 'has_options' => array( 'type' => 'static', 'visible' =>false, 'default' => false, + 'required' => false, ), 'image_label' => array( 'type' => 'varchar', diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Url.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Url.php index e1f509a1ef..c2cc7f4ad6 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Url.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Url.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -232,6 +232,17 @@ public function saveRewrite($rewriteData, $rewrite) $rewriteData, $where ); + + // Update existing rewrites history and avoid chain redirects + $where = $this->_getWriteAdapter()->quoteInto('target_path=?', $rewrite->getRequestPath()); + if ($rewrite->getStoreId()) { + $where .= $this->_getWriteAdapter()->quoteInto(' AND store_id=?', $rewrite->getStoreId()); + } + $this->_getWriteAdapter()->update( + $this->getMainTable(), + array('target_path' => $rewriteData['request_path']), + $where + ); } } else { @@ -239,12 +250,25 @@ public function saveRewrite($rewriteData, $rewrite) $this->_getWriteAdapter()->insert($this->getMainTable(), $rewriteData); } catch (Exception $e) { - Mage::throwException(Mage::helper('catalog')->__('URL rewrite save problem.')); + Mage::throwException(Mage::helper('catalog')->__('An error occurred while saving the URL rewrite.')); } } unset($rewriteData); return $this; } + + public function saveRewriteHistory($rewriteData) + { + $rewriteData = new Varien_Object($rewriteData); + // check if rewrite exists with save request_path + $rewrite = $this->getRewriteByRequestPath($rewriteData->getRequestPath(), $rewriteData->getStoreId()); + if ($rewrite === false) { + // create permanent redirect + $this->_getWriteAdapter()->insert($this->getMainTable(), $rewriteData->getData()); + } + + return $this; + } /** * Save category attribute @@ -607,7 +631,7 @@ protected function _getCategories($categoryIds, $storeId = null, $path = null) $rowSet = $this->_getWriteAdapter()->fetchAll($select); foreach ($rowSet as $row) { - if (!is_null($storeId) && substr($row['path'], 0, $rootCategoryPathLength) != $rootCategoryPath) { + if (!is_null($storeId) && (strlen($row['path']) > $rootCategoryPathLength) && substr($row['path'], $rootCategoryPathLength, 1) != '/') { continue; } @@ -902,7 +926,7 @@ public function clearCategoryProduct($storeId) * * @param int $productId Product entity Id * @param int $storeId Store Id for rewrites - * @param array $excludeCategoryIds Array of category Ids that should be skipped + * @param array $excludeCategoryIds Array of category Ids that should be skipped * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Url */ public function clearProductRewrites($productId, $storeId, $excludeCategoryIds = array()) diff --git a/app/code/core/Mage/Catalog/Model/Sendfriend.php b/app/code/core/Mage/Catalog/Model/Sendfriend.php index efb6870e9f..44df6f197e 100644 --- a/app/code/core/Mage/Catalog/Model/Sendfriend.php +++ b/app/code/core/Mage/Catalog/Model/Sendfriend.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -63,7 +63,7 @@ public function send() $this->_emailModel->load($this->getTemplate()); if (!$this->_emailModel->getId()) { Mage::throwException( - Mage::helper('catalog')->__('Invalid transactional email code') + Mage::helper('catalog')->__('Invalid transactional email code.') ); } @@ -78,7 +78,7 @@ public function send() if (count($errors)) { Mage::throwException( - Mage::helper('catalog')->__('Email to %s was not sent', implode(', ', $errors)) + Mage::helper('catalog')->__('Email to %s was not sent.', implode(', ', $errors)) ); } } @@ -87,7 +87,7 @@ public function canSend() { if (!$this->canEmailToFriend()) { Mage::throwException( - Mage::helper('catalog')->__('You cannot email this product to a friend') + Mage::helper('catalog')->__('You cannot email this product to a friend.') ); } @@ -99,26 +99,26 @@ public function canSend() if ($amount >= $this->getMaxSendsToFriend()){ Mage::throwException( - Mage::helper('catalog')->__('You have exceeded limit of %d sends in an hour', $this->getMaxSendsToFriend()) + Mage::helper('catalog')->__('You have exceeded limit of %d sends in an hour.', $this->getMaxSendsToFriend()) ); } $maxRecipients = $this->getMaxRecipients(); if (count($this->_emails) > $maxRecipients) { Mage::throwException( - Mage::helper('catalog')->__('You cannot send more than %d emails at a time', $this->getMaxRecipients()) + Mage::helper('catalog')->__('You cannot send more than %d emails at a time.', $this->getMaxRecipients()) ); } if (count($this->_emails) < 1) { Mage::throwException( - Mage::helper('catalog')->__('You have to specify at least one recipient') + Mage::helper('catalog')->__('You have to specify at least one recipient.') ); } if (!$this->getTemplate()){ Mage::throwException( - Mage::helper('catalog')->__('Email template is not specified by administrator') + Mage::helper('catalog')->__('The email template is not specified by administrator.') ); } diff --git a/app/code/core/Mage/Catalog/Model/Session.php b/app/code/core/Mage/Catalog/Model/Session.php index b07be2624d..9d3b36e03d 100644 --- a/app/code/core/Mage/Catalog/Model/Session.php +++ b/app/code/core/Mage/Catalog/Model/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/Model/Template/Filter.php b/app/code/core/Mage/Catalog/Model/Template/Filter.php new file mode 100644 index 0000000000..a61e6a6b74 --- /dev/null +++ b/app/code/core/Mage/Catalog/Model/Template/Filter.php @@ -0,0 +1,106 @@ + + * @todo Needs to be reimplemented to get rid of the copypasted methods + */ +class Mage_Catalog_Model_Template_Filter extends Varien_Filter_Template +{ + /** + * Retrieve Skin URL directive + * + * @param array $construction + * @return string + * @see Mage_Core_Model_Email_Template_Filter::skinDirective() method has been copypasted + */ + public function skinDirective($construction) + { + $params = $this->_getIncludeParameters($construction[2]); + $params['_absolute'] = $this->_useAbsoluteLinks; + + $url = Mage::getDesign()->getSkinUrl($params['url'], $params); + + return $url; + } + + /** + * Retrieve media file URL directive + * + * @param array $construction + * @return string + * @see Mage_Core_Model_Email_Template_Filter::mediaDirective() method has been copypasted + */ + public function mediaDirective($construction) + { + $params = $this->_getIncludeParameters($construction[2]); + return Mage::getBaseUrl('media') . $params['url']; + } + + /** + * Retrieve store URL directive + * Support url and direct_url properties + * + * @param array $construction + * @return string + * @see Mage_Core_Model_Email_Template_Filter::storeDirective() method has been copypasted + */ + public function storeDirective($construction) + { + $params = $this->_getIncludeParameters($construction[2]); + if (!isset($params['_query'])) { + $params['_query'] = array(); + } + foreach ($params as $k => $v) { + if (strpos($k, '_query_') === 0) { + $params['_query'][substr($k, 7)] = $v; + unset($params[$k]); + } + } + $params['_absolute'] = $this->_useAbsoluteLinks; + + if ($this->_useSessionInUrl === false) { + $params['_nosid'] = true; + } + + if (isset($params['direct_url'])) { + $path = ''; + $params['_direct'] = $params['direct_url']; + unset($params['direct_url']); + } + else { + $path = isset($params['url']) ? $params['url'] : ''; + unset($params['url']); + } + + return Mage::app()->getStore(Mage::getDesign()->getStore())->getUrl($path, $params); + } +} diff --git a/app/code/core/Mage/Catalog/Model/Url.php b/app/code/core/Mage/Catalog/Model/Url.php index a41a196b45..b4e05eafb0 100644 --- a/app/code/core/Mage/Catalog/Model/Url.php +++ b/app/code/core/Mage/Catalog/Model/Url.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -90,6 +90,13 @@ class Mage_Catalog_Model_Url */ protected $_categoryUrlSuffix = array(); + /** + * Flag to overwrite config settings for Catalog URL rewrites history maintainance + * + * @var bool + */ + protected $_saveRewritesHistory = null; + /** * Retrieve stores array or store model * @@ -133,7 +140,33 @@ public function getProductModel() { return $this->getResource()->getProductModel(); } - + + /** + * Setter for $_saveRewritesHistory + * Force Rewrites History save bypass config settings + * + * @return Mage_Catalog_Model_Url + */ + public function setShouldSaveRewritesHistory($flag) + { + $this->_saveRewritesHistory = (bool)$flag; + return $this; + } + + /** + * Indicate whether to save URL Rewrite History or not (create redirects to old URLs) + * + * @param int $storeId Store View + * @return bool + */ + public function getShouldSaveRewritesHistory($storeId = null) + { + if ($this->_saveRewritesHistory !== null) { + return $this->_saveRewritesHistory; + } + return Mage::helper('catalog')->shouldSaveUrlRewritesHistory($storeId); + } + /** * Refresh rewrite urls * @@ -188,6 +221,10 @@ protected function _refreshCategoryRewrites(Varien_Object $category, $parentPath ); $this->getResource()->saveRewrite($rewriteData, $this->_rewrite); + + if ($this->getShouldSaveRewritesHistory($category->getStoreId())) { + $this->_saveRewriteHistory($rewriteData, $this->_rewrite); + } if ($category->getUrlKey() != $urlKey) { $category->setUrlKey($urlKey); @@ -259,6 +296,10 @@ protected function _refreshProductRewrite(Varien_Object $product, Varien_Object $this->getResource()->saveRewrite($rewriteData, $this->_rewrite); + if ($this->getShouldSaveRewritesHistory($category->getStoreId())) { + $this->_saveRewriteHistory($rewriteData, $this->_rewrite); + } + if ($updateKeys && $product->getUrlKey() != $urlKey) { $product->setUrlKey($urlKey); $this->getResource()->saveProductAttribute($product, 'url_key'); @@ -603,7 +644,7 @@ public function getProductRequestPath($product, $category) public function generatePath($type = 'target', $product = null, $category = null, $parentPath = null) { if (!$product && !$category) { - Mage::throwException(Mage::helper('core')->__('Specify either category or product, or both.')); + Mage::throwException(Mage::helper('core')->__('Please specify either a category or a product, or both.')); } // generate id_path @@ -644,7 +685,7 @@ public function generatePath($type = 'target', $product = null, $category = null // for product & category if (!$category) { - Mage::throwException(Mage::helper('core')->__('Category object is required for determining product request path')); // why? + Mage::throwException(Mage::helper('core')->__('A category object is required for determining the product request path.')); // why? } if ($product->getUrlKey() == '') { @@ -676,4 +717,36 @@ public function generatePath($type = 'target', $product = null, $category = null } return 'catalog/product/view/id/' . $product->getId(); } + + /** + * Return unique string based on the time in microseconds. + * + * @return string + */ + public function generateUniqueIdPath() + { + return str_replace('0.', '', str_replace(' ', '_', microtime())); + } + + /** + * Create Custom URL Rewrite for old product/category URL after url_key changed + * It will perform permanent redirect from old URL to new URL + * + * @param array $rewriteData New rewrite data + * @param Varien_Object $rewrite Rewrite model + * @return Mage_Catalog_Model_Url + */ + protected function _saveRewriteHistory($rewriteData, $rewrite) + { + if ($rewrite instanceof Varien_Object && $rewrite->getId()) { + $rewriteData['target_path'] = $rewriteData['request_path']; + $rewriteData['request_path'] = $rewrite->getRequestPath(); + $rewriteData['id_path'] = $this->generateUniqueIdPath(); + $rewriteData['is_system'] = 0; + $rewriteData['options'] = 'RP'; // Redirect = Permanent + $this->getResource()->saveRewriteHistory($rewriteData); + } + + return $this; + } } diff --git a/app/code/core/Mage/Catalog/controllers/CategoryController.php b/app/code/core/Mage/Catalog/controllers/CategoryController.php index ceefe66926..62ba122115 100644 --- a/app/code/core/Mage/Catalog/controllers/CategoryController.php +++ b/app/code/core/Mage/Catalog/controllers/CategoryController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/controllers/IndexController.php b/app/code/core/Mage/Catalog/controllers/IndexController.php index ad98e1983f..9a983f98e5 100644 --- a/app/code/core/Mage/Catalog/controllers/IndexController.php +++ b/app/code/core/Mage/Catalog/controllers/IndexController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/controllers/Product/CompareController.php b/app/code/core/Mage/Catalog/controllers/Product/CompareController.php index 72dd04f0a5..07a3397286 100644 --- a/app/code/core/Mage/Catalog/controllers/Product/CompareController.php +++ b/app/code/core/Mage/Catalog/controllers/Product/CompareController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -75,7 +75,7 @@ public function addAction() if ($product->getId()/* && !$product->isSuper()*/) { Mage::getSingleton('catalog/product_compare_list')->addProduct($product); Mage::getSingleton('catalog/session')->addSuccess( - $this->__('Product %s successfully added to compare list', Mage::helper('core')->htmlEscape($product->getName())) + $this->__('The product %s has been added to comparison list.', Mage::helper('core')->htmlEscape($product->getName())) ); Mage::dispatchEvent('catalog_product_compare_add_product', array('product'=>$product)); } @@ -109,7 +109,7 @@ public function removeAction() if($item->getId()) { $item->delete(); Mage::getSingleton('catalog/session')->addSuccess( - $this->__('Product %s successfully removed from compare list', $product->getName()) + $this->__('The product %s has been removed from comparison list.', $product->getName()) ); Mage::dispatchEvent('catalog_product_compare_remove_product', array('product'=>$item)); Mage::helper('catalog/product_compare')->calculate(); @@ -138,14 +138,14 @@ public function clearAction() try { $items->clear(); - $session->addSuccess($this->__('Compare list successfully cleared')); + $session->addSuccess($this->__('The comparison list was cleared.')); Mage::helper('catalog/product_compare')->calculate(); } catch (Mage_Core_Exception $e) { $session->addError($e->getMessage()); } catch (Exception $e) { - $session->addException($e, $this->__('There was an error while cleared compare list')); + $session->addException($e, $this->__('An error occurred while clearing comparison list.')); } $this->_redirectReferer(); diff --git a/app/code/core/Mage/Catalog/controllers/ProductController.php b/app/code/core/Mage/Catalog/controllers/ProductController.php index 59ab5a6f8a..ef7a46cb10 100644 --- a/app/code/core/Mage/Catalog/controllers/ProductController.php +++ b/app/code/core/Mage/Catalog/controllers/ProductController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/controllers/Seo/SitemapController.php b/app/code/core/Mage/Catalog/controllers/Seo/SitemapController.php index 62dffcf495..15e0643d73 100644 --- a/app/code/core/Mage/Catalog/controllers/Seo/SitemapController.php +++ b/app/code/core/Mage/Catalog/controllers/Seo/SitemapController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/etc/adminhtml.xml b/app/code/core/Mage/Catalog/etc/adminhtml.xml index c917d6f8ca..753a1217ea 100644 --- a/app/code/core/Mage/Catalog/etc/adminhtml.xml +++ b/app/code/core/Mage/Catalog/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Catalog/etc/api.xml b/app/code/core/Mage/Catalog/etc/api.xml index b9a12ab8ab..0888eab4a2 100644 --- a/app/code/core/Mage/Catalog/etc/api.xml +++ b/app/code/core/Mage/Catalog/etc/api.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Catalog/etc/config.xml b/app/code/core/Mage/Catalog/etc/config.xml index 1c4d133b23..b4c38cc08e 100644 --- a/app/code/core/Mage/Catalog/etc/config.xml +++ b/app/code/core/Mage/Catalog/etc/config.xml @@ -21,14 +21,14 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - 1.4.0.0.21 + 1.4.0.0.28 @@ -195,6 +195,78 @@ catalog_product_index_price
      catalog_product_index_tier_price
      catalog_product_index_website
      + + catalog_product_index_price_cfg_opt_agr_idx
      +
      + + catalog_product_index_price_cfg_opt_agr_tmp
      +
      + + catalog_product_index_price_cfg_opt_idx
      +
      + + catalog_product_index_price_cfg_opt_tmp
      +
      + + catalog_product_index_price_final_idx
      +
      + + catalog_product_index_price_final_tmp
      +
      + + catalog_product_index_price_opt_idx
      +
      + + catalog_product_index_price_opt_tmp
      +
      + + catalog_product_index_price_opt_agr_idx
      +
      + + catalog_product_index_price_opt_agr_tmp
      +
      + + catalog_product_index_eav_idx
      +
      + + catalog_product_index_eav_tmp
      +
      + + catalog_product_index_eav_decimal_idx
      +
      + + catalog_product_index_eav_decimal_tmp
      +
      + + catalog_product_index_price_idx
      +
      + + catalog_product_index_price_tmp
      +
      + + catalog_category_product_index_idx
      +
      + + catalog_category_product_index_tmp
      +
      + + catalog_category_product_index_enbl_idx
      +
      + + catalog_category_product_index_enbl_tmp
      +
      + + catalog_category_anc_categs_index_idx
      +
      + + catalog_category_anc_categs_index_tmp
      +
      + + catalog_category_anc_products_index_idx
      +
      + + catalog_category_anc_products_index_tmp
      +
      @@ -477,6 +549,9 @@ 0 + + catalog/template_filter + @@ -522,6 +597,16 @@ + + + + + catalog/observer + catalogCheckIsUsingStaticUrlsAllowed + + + + @@ -635,6 +720,7 @@ 10 0 position + 1 0 @@ -652,6 +738,7 @@ .html .html 1 + 1 - 0 0 diff --git a/app/code/core/Mage/Catalog/etc/convert.xml b/app/code/core/Mage/Catalog/etc/convert.xml index a19df36f1e..00c5a017ed 100644 --- a/app/code/core/Mage/Catalog/etc/convert.xml +++ b/app/code/core/Mage/Catalog/etc/convert.xml @@ -1,4 +1,4 @@ - + diff --git a/app/code/core/Mage/Catalog/etc/system.xml b/app/code/core/Mage/Catalog/etc/system.xml index c7e8a30a03..1f94aaad55 100644 --- a/app/code/core/Mage/Catalog/etc/system.xml +++ b/app/code/core/Mage/Catalog/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -61,8 +61,8 @@ 1 - - comma separated + + Comma-separated. text 2 @@ -71,8 +71,8 @@ 1 - - must be in the allowed values list + + Must be in the allowed values list. text 3 @@ -81,8 +81,8 @@ 1 - - comma separated + + Comma-separated. text 4 @@ -91,8 +91,8 @@ 1 - - must be in the allowed values list + + Must be in the allowed values list. text 5 @@ -122,7 +122,7 @@ 0 - + select adminhtml/system_config_source_catalog_listSort 6 @@ -132,7 +132,7 @@ - whether to show "All" option in the "Show X Per Page" dropdown + Whether to show "All" option in the "Show X Per Page" dropdown. select adminhtml/system_config_source_yesno 6 @@ -140,6 +140,16 @@ 1 1 + + + E.g. {{media url="path/to/image.jpg"}} {{skin url="path/to/picture.gif"}}. Dynamic directives parsing impacts catalog performance. + select + adminhtml/system_config_source_yesno + 200 + 1 + 1 + 1 +
      @@ -160,7 +170,7 @@ 1 - + text 5 1 @@ -207,7 +217,7 @@ 1 1 1 - cache refresh needed + Cache refresh needed. @@ -216,10 +226,10 @@ 1 1 1 - cache refresh needed + Cache refresh needed. - + select adminhtml/system_config_source_yesno adminhtml/system_config_backend_seo_product @@ -228,10 +238,19 @@ 1 1 + + + select + adminhtml/system_config_source_yesno + 5 + 1 + 1 + 1 + text - 5 + 6 1 1 1 @@ -240,7 +259,7 @@ select adminhtml/system_config_source_yesno - 6 + 7 1 1 1 @@ -249,7 +268,7 @@ select adminhtml/system_config_source_yesno - 7 + 8 1 1 1 @@ -265,8 +284,9 @@ 0 0 - + + "Currency Options" > "Base Currency")]]>. select adminhtml/system_config_source_price_scope adminhtml/system_config_backend_price_scope @@ -312,7 +332,7 @@ 1 - + select adminhtml/catalog_form_renderer_config_dateFieldsOrder 2 @@ -321,7 +341,7 @@ 1 - + select adminhtml/system_config_source_catalog_timeFormat 3 @@ -331,7 +351,7 @@ - Please, use four-digit year format + Use four-digit year format. text adminhtml/catalog_form_renderer_config_yearRange 4 @@ -379,7 +399,7 @@ 1 1 1 - Example format 200x300 + Example format: 200x300. @@ -399,7 +419,7 @@ 1 1 1 - Allowed file types (jpeg, gif, png). + Allowed file types: jpeg, gif, png. @@ -414,5 +434,23 @@ + + + + + + + Applicable to catalog products and categories only. Any media content will be inserted into editor as a static URL. It is not updated if the system configuration base URL changes. + adminhtml/system_config_source_yesno + select + 10 + 1 + 0 + 0 + + + + + diff --git a/app/code/core/Mage/Catalog/etc/widget.xml b/app/code/core/Mage/Catalog/etc/widget.xml index a154f24e18..79c2e8f09b 100644 --- a/app/code/core/Mage/Catalog/etc/widget.xml +++ b/app/code/core/Mage/Catalog/etc/widget.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Catalog/etc/wsdl.xml b/app/code/core/Mage/Catalog/etc/wsdl.xml index 82eab59728..edde80dc7d 100644 --- a/app/code/core/Mage/Catalog/etc/wsdl.xml +++ b/app/code/core/Mage/Catalog/etc/wsdl.xml @@ -57,7 +57,7 @@ - + @@ -88,7 +88,7 @@ - + diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-install-0.7.0.php index b16672a7a2..4bae218f93 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-install-1.4.0.0.0.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-install-1.4.0.0.0.php index f9c9864c5d..46aa147f1c 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-install-1.4.0.0.0.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-install-1.4.0.0.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.6.40-0.7.0.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.6.40-0.7.0.php index 4a19087845..157cd6eb5f 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.6.40-0.7.0.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.6.40-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.0-0.7.1.php index 758128986f..7ab8c28b11 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.1-0.7.2.php index c19c440e9e..917d571aea 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.11-0.7.12.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.11-0.7.12.php index b79c4d7a90..b4dab7b943 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.11-0.7.12.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.11-0.7.12.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.12-0.7.13.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.12-0.7.13.php index ede799bb82..460f9d0664 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.12-0.7.13.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.12-0.7.13.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.13-0.7.14.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.13-0.7.14.php index 868343a8ac..94215d482b 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.13-0.7.14.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.13-0.7.14.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.14-0.7.15.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.14-0.7.15.php index 8dbb3b4924..416c242e95 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.14-0.7.15.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.14-0.7.15.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $this->startSetup()->run(" diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.15-0.7.16.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.15-0.7.16.php index 7ff45ad585..32737f5a60 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.15-0.7.16.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.15-0.7.16.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.16-0.7.17.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.16-0.7.17.php index ede799bb82..460f9d0664 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.16-0.7.17.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.16-0.7.17.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.17-0.7.18.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.17-0.7.18.php index dac90ba144..f821b97d8b 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.17-0.7.18.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.17-0.7.18.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.18-0.7.19.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.18-0.7.19.php index ecc6a2c401..74fcc6d29b 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.18-0.7.19.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.18-0.7.19.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.19-0.7.20.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.19-0.7.20.php index b79c4d7a90..b4dab7b943 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.19-0.7.20.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.19-0.7.20.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.2-0.7.3.php index 2d74d2310b..69f1bf1341 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.2-0.7.3.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.2-0.7.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.20-0.7.21.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.20-0.7.21.php index 612ba2fe23..91915fc46d 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.20-0.7.21.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.20-0.7.21.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.21-0.7.22.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.21-0.7.22.php index a7af3c8878..c9a2e1e383 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.21-0.7.22.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.21-0.7.22.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.22-0.7.23.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.22-0.7.23.php index 9d2a0442c0..4460503a12 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.22-0.7.23.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.22-0.7.23.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.23-0.7.24.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.23-0.7.24.php index 039e748029..e96ce82e9e 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.23-0.7.24.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.23-0.7.24.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.24-0.7.25.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.24-0.7.25.php index 26da8027d5..45fb3dd973 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.24-0.7.25.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.24-0.7.25.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.25-0.7.26.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.25-0.7.26.php index 26da8027d5..45fb3dd973 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.25-0.7.26.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.25-0.7.26.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.26-0.7.27.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.26-0.7.27.php index 59de5a6114..cba27c31c0 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.26-0.7.27.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.26-0.7.27.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.27-0.7.28.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.27-0.7.28.php index 7a64ee1236..7751ae3ea1 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.27-0.7.28.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.27-0.7.28.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.28-0.7.29.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.28-0.7.29.php index 2bb37305ad..62a86cc842 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.28-0.7.29.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.28-0.7.29.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.29-0.7.30.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.29-0.7.30.php index edf3cc1c92..ffac7f5e6d 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.29-0.7.30.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.29-0.7.30.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.30-0.7.31.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.30-0.7.31.php index 2dfe654a73..31ba1c9675 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.30-0.7.31.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.30-0.7.31.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.31-0.7.32.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.31-0.7.32.php index aebd26022a..7fe37daba0 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.31-0.7.32.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.31-0.7.32.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.32-0.7.33.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.32-0.7.33.php index 2daf6cea98..bb8043a759 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.32-0.7.33.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.32-0.7.33.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.33-0.7.34.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.33-0.7.34.php index 36644bbcbb..1306399a45 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.33-0.7.34.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.33-0.7.34.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.34-0.7.35.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.34-0.7.35.php index 665dcb2bac..6af1399550 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.34-0.7.35.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.34-0.7.35.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.35-0.7.36.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.35-0.7.36.php index 663e86b3e1..c85e65dbc6 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.35-0.7.36.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.35-0.7.36.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.36-0.7.37.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.36-0.7.37.php index d0081484b1..a50f2721ae 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.36-0.7.37.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.36-0.7.37.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.37-0.7.38.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.37-0.7.38.php index 333b5ba300..5a651b1c2f 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.37-0.7.38.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.37-0.7.38.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.38-0.7.39.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.38-0.7.39.php index b6eb518caf..b6d4f2fcf2 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.38-0.7.39.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.38-0.7.39.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.39-0.7.40.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.39-0.7.40.php index 8cda5ce85f..aa52128ef6 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.39-0.7.40.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.39-0.7.40.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.4-0.7.5.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.4-0.7.5.php index 237e4bd5eb..e1e67e7f9d 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.4-0.7.5.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.4-0.7.5.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.40-0.7.41.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.40-0.7.41.php index 62e1f5710b..d31b7a620e 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.40-0.7.41.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.40-0.7.41.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.41-0.7.42.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.41-0.7.42.php index b8fa03aea5..719e502796 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.41-0.7.42.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.41-0.7.42.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.43-0.7.44.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.43-0.7.44.php index 85fd42801d..dc37803394 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.43-0.7.44.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.43-0.7.44.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.44-0.7.45.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.44-0.7.45.php index 8f00ab7aa9..867fa10a42 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.44-0.7.45.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.44-0.7.45.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.45-0.7.46.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.45-0.7.46.php index 902aad3563..f99d36d8ba 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.45-0.7.46.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.45-0.7.46.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.46-0.7.47.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.46-0.7.47.php index 488edb9911..f1aecf086a 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.46-0.7.47.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.46-0.7.47.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.47-0.7.48.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.47-0.7.48.php index 80a4ee1cff..e10bd74748 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.47-0.7.48.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.47-0.7.48.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.48-0.7.49.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.48-0.7.49.php index 52e3874e57..b76f6b1529 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.48-0.7.49.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.48-0.7.49.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.49-0.7.50.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.49-0.7.50.php index 513adfdccb..488eebd572 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.49-0.7.50.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.49-0.7.50.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.5-0.7.6.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.5-0.7.6.php index 732984c803..c50a94c895 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.5-0.7.6.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.5-0.7.6.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.50-0.7.51.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.50-0.7.51.php index 85f9280b71..45d0fa02ee 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.50-0.7.51.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.50-0.7.51.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.51-0.7.52.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.51-0.7.52.php index 4e543d590f..d9ac5b5f34 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.51-0.7.52.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.51-0.7.52.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.52-0.7.53.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.52-0.7.53.php index a70f51c245..ad3e23f2bd 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.52-0.7.53.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.52-0.7.53.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.53-0.7.54.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.53-0.7.54.php index f877dd312d..3524725466 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.53-0.7.54.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.53-0.7.54.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.54-0.7.55.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.54-0.7.55.php index 0be8ec53af..e822f2a614 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.54-0.7.55.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.54-0.7.55.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.55-0.7.56.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.55-0.7.56.php index 0cb9714c9f..4a809c59b0 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.55-0.7.56.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.55-0.7.56.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.56-0.7.57.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.56-0.7.57.php index 12e8d11407..807fa1f4bc 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.56-0.7.57.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.56-0.7.57.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.57-0.7.58.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.57-0.7.58.php index ea280cd511..bb220f8f88 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.57-0.7.58.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.57-0.7.58.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -118,7 +118,7 @@ $installer->addAttribute($entityTypeId, 'available_sort_by', array( 'input' => 'multiselect', 'type' => 'text', - 'label' => 'Available Product Listing Sort by', + 'label' => 'Available Product Listing Sort By', 'source' => 'catalog/category_attribute_source_sortby', 'backend' => 'catalog/category_attribute_backend_sortby', 'required' => 1, @@ -128,7 +128,7 @@ )); $installer->addAttribute($entityTypeId, 'default_sort_by', array( 'input' => 'select', - 'label' => 'Default Product Listing Sort by', + 'label' => 'Default Product Listing Sort By', 'source' => 'catalog/category_attribute_source_sortby', 'backend' => 'catalog/category_attribute_backend_sortby', 'required' => 1, diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.58-0.7.59.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.58-0.7.59.php index 38d804b17b..d3cdd2acec 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.58-0.7.59.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.58-0.7.59.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.59-0.7.60.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.59-0.7.60.php index 931642d3de..7f6050bbd3 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.59-0.7.60.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.59-0.7.60.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.6-0.7.7.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.6-0.7.7.php index b79c4d7a90..b4dab7b943 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.6-0.7.7.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.6-0.7.7.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.60-0.7.61.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.60-0.7.61.php index 19df73101c..910c6bc598 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.60-0.7.61.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.60-0.7.61.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.61-0.7.62.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.61-0.7.62.php index 52a8f68fea..0efd8eb23a 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.61-0.7.62.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.61-0.7.62.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.62-0.7.63.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.62-0.7.63.php index 5e450ff84d..85069d55dc 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.62-0.7.63.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.62-0.7.63.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.63-0.7.64.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.63-0.7.64.php index 57f8cad2fe..4adf074866 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.63-0.7.64.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.63-0.7.64.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.64-0.7.65.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.64-0.7.65.php index e1c0a74f32..ca168561b7 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.64-0.7.65.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.64-0.7.65.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.65-0.7.66.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.65-0.7.66.php index 7efc8e5f66..8b61bef664 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.65-0.7.66.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.65-0.7.66.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.66-0.7.67.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.66-0.7.67.php index 3152f8d242..22a1f03e68 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.66-0.7.67.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.66-0.7.67.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.67-0.7.68.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.67-0.7.68.php index 4fa0ae2a30..ef5584aa55 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.67-0.7.68.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.67-0.7.68.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.68-0.7.69.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.68-0.7.69.php index ea814bacd4..04d0572a93 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.68-0.7.69.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.68-0.7.69.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.69-0.7.70.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.69-0.7.70.php index 2420b4c715..de0c9f94f4 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.69-0.7.70.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.69-0.7.70.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.7-0.7.8.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.7-0.7.8.php index 5867b46cac..4eb2d388cf 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.7-0.7.8.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.7-0.7.8.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.70-0.7.71.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.70-0.7.71.php index 415ccc40df..7506963f29 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.70-0.7.71.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.70-0.7.71.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.71-0.7.72.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.71-0.7.72.php index 29a3b3fd4e..724d1165ed 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.71-0.7.72.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.71-0.7.72.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.72-0.7.73.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.72-0.7.73.php index 4fecd82d2e..243e3db042 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.72-0.7.73.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.72-0.7.73.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.73-1.4.0.0.0.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.73-1.4.0.0.0.php index bef7b29f81..60102b12bd 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.73-1.4.0.0.0.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.73-1.4.0.0.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.8-0.7.9.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.8-0.7.9.php index 183f2ba2aa..2c0255d7d9 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.8-0.7.9.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.8-0.7.9.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.0-1.4.0.0.1.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.0-1.4.0.0.1.php index f6206ffa55..7430222c7f 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.0-1.4.0.0.1.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.0-1.4.0.0.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.1-1.4.0.0.2.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.1-1.4.0.0.2.php index 0feb751558..ca8238bf8b 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.1-1.4.0.0.2.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.1-1.4.0.0.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.10-1.4.0.0.11.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.10-1.4.0.0.11.php index 7d11863335..3653938b5d 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.10-1.4.0.0.11.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.10-1.4.0.0.11.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.11-1.4.0.0.12.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.11-1.4.0.0.12.php index b3f2188b5b..b78f997e9d 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.11-1.4.0.0.12.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.11-1.4.0.0.12.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.12-1.4.0.0.13.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.12-1.4.0.0.13.php index 6f60c7c090..5933a983a4 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.12-1.4.0.0.13.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.12-1.4.0.0.13.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.13-1.4.0.0.14.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.13-1.4.0.0.14.php index 60f57acb65..42c020a21c 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.13-1.4.0.0.14.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.13-1.4.0.0.14.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.14-1.4.0.0.15.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.14-1.4.0.0.15.php index 8e06c810c1..17c83ca76b 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.14-1.4.0.0.15.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.14-1.4.0.0.15.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.15-1.4.0.0.16.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.15-1.4.0.0.16.php index c37097bf88..4f91101b7f 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.15-1.4.0.0.16.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.15-1.4.0.0.16.php @@ -20,6 +20,6 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.16-1.4.0.0.17.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.16-1.4.0.0.17.php index 92afc0f3a0..b7e8abbb5f 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.16-1.4.0.0.17.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.16-1.4.0.0.17.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.17-1.4.0.0.18.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.17-1.4.0.0.18.php index fe3fbf42ef..528e264fe7 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.17-1.4.0.0.18.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.17-1.4.0.0.18.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.18-1.4.0.0.19.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.18-1.4.0.0.19.php index bdc810578b..8931f5c9c6 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.18-1.4.0.0.19.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.18-1.4.0.0.19.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.19-1.4.0.0.20.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.19-1.4.0.0.20.php index ac1242ea86..390623b1b5 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.19-1.4.0.0.20.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.19-1.4.0.0.20.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.2-1.4.0.0.3.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.2-1.4.0.0.3.php index 630ada05cf..975eff3398 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.2-1.4.0.0.3.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.2-1.4.0.0.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.20-1.4.0.0.21.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.20-1.4.0.0.21.php index 14eda31d53..12291b37e6 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.20-1.4.0.0.21.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.20-1.4.0.0.21.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.21-1.4.0.0.22.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.21-1.4.0.0.22.php new file mode 100644 index 0000000000..006cb5783f --- /dev/null +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.21-1.4.0.0.22.php @@ -0,0 +1,62 @@ +startSetup(); + +$entityTypeId = $installer->getEntityTypeId('catalog_category'); +$attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId); +$attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId); + +$installer->addAttribute('catalog_category', 'include_in_menu', array( + 'type' => 'int', + 'label' => 'Include in Navigation Menu', + 'input' => 'select', + 'source' => 'eav/entity_attribute_source_boolean', + 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, + 'required' => false, + 'default' => 1 +)); + +$installer->addAttributeToGroup( + $entityTypeId, + $attributeSetId, + $attributeGroupId, + 'include_in_menu', + '10' +); + +$attributeId = $installer->getAttributeId($entityTypeId, 'include_in_menu'); + +$installer->run(" +INSERT INTO `{$installer->getTable('catalog_category_entity_int')}` +(`entity_type_id`, `attribute_id`, `entity_id`, `value`) + SELECT '{$entityTypeId}', '{$attributeId}', `entity_id`, '1' + FROM `{$installer->getTable('catalog_category_entity')}`; +"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.22-1.4.0.0.23.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.22-1.4.0.0.23.php new file mode 100644 index 0000000000..ade1be567c --- /dev/null +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.22-1.4.0.0.23.php @@ -0,0 +1,32 @@ +startSetup(); +$installer->getConnection()->addKey($installer->getTable('catalog/product_link'), + 'IDX_UNIQUE', array('link_type_id', 'product_id', 'linked_product_id'), 'unique'); +$installer->endSetup(); diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.23-1.4.0.0.24.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.23-1.4.0.0.24.php new file mode 100644 index 0000000000..847f0fb042 --- /dev/null +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.23-1.4.0.0.24.php @@ -0,0 +1,322 @@ +startSetup(); +$installer->run(" + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_index_price')}_idx_cfg_opt_aggregate`; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_price_indexer_cfg_option_aggregate_idx')}`; +CREATE TABLE `{$installer->getTable('catalog/product_price_indexer_cfg_option_aggregate_idx')}` ( + `parent_id` int(10) unsigned NOT NULL, + `child_id` int(10) unsigned NOT NULL, + `customer_group_id` smallint(5) unsigned NOT NULL, + `website_id` smallint(5) unsigned NOT NULL, + `price` decimal(12,4) default NULL, + `tier_price` decimal(12,4) default NULL, + PRIMARY KEY (`parent_id`,`child_id`,`customer_group_id`,`website_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_price_indexer_cfg_option_aggregate_tmp')}`; +CREATE TABLE `{$installer->getTable('catalog/product_price_indexer_cfg_option_aggregate_tmp')}` ( + `entity_id` int(10) unsigned NOT NULL, + `customer_group_id` smallint(5) unsigned NOT NULL, + `website_id` smallint(5) unsigned NOT NULL, + `min_price` decimal(12,4) default NULL, + `max_price` decimal(12,4) default NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_index_price')}_idx_cfg_option`; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_price_indexer_cfg_option_idx')}`; +CREATE TABLE `{$installer->getTable('catalog/product_price_indexer_cfg_option_idx')}` ( + `entity_id` int(10) unsigned NOT NULL, + `customer_group_id` smallint(5) unsigned NOT NULL, + `website_id` smallint(5) unsigned NOT NULL, + `min_price` decimal(12,4) default NULL, + `max_price` decimal(12,4) default NULL, + `tier_price` decimal(12,4) default NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_price_indexer_cfg_option_tmp')}`; +CREATE TABLE `{$installer->getTable('catalog/product_price_indexer_cfg_option_tmp')}` ( + `entity_id` int(10) unsigned NOT NULL, + `customer_group_id` smallint(5) unsigned NOT NULL, + `website_id` smallint(5) unsigned NOT NULL, + `min_price` decimal(12,4) default NULL, + `max_price` decimal(12,4) default NULL, + `tier_price` decimal(12,4) default NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_index_price')}_final_idx`; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_price_indexer_final_idx')}`; +CREATE TABLE `{$installer->getTable('catalog/product_price_indexer_final_idx')}` ( + `entity_id` INT(10) UNSIGNED NOT NULL, + `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL, + `website_id` SMALLINT(5) UNSIGNED NOT NULL, + `tax_class_id` SMALLINT(5) UNSIGNED DEFAULT '0', + `orig_price` DECIMAL(12,4) DEFAULT NULL, + `price` DECIMAL(12,4) DEFAULT NULL, + `min_price` DECIMAL(12,4) DEFAULT NULL, + `max_price` DECIMAL(12,4) DEFAULT NULL, + `tier_price` DECIMAL(12,4) DEFAULT NULL, + `base_tier` DECIMAL(12,4) DEFAULT NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_price_indexer_final_tmp')}`; +CREATE TABLE `{$installer->getTable('catalog/product_price_indexer_final_tmp')}` ( + `entity_id` INT(10) UNSIGNED NOT NULL, + `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL, + `website_id` SMALLINT(5) UNSIGNED NOT NULL, + `tax_class_id` SMALLINT(5) UNSIGNED DEFAULT '0', + `orig_price` DECIMAL(12,4) DEFAULT NULL, + `price` DECIMAL(12,4) DEFAULT NULL, + `min_price` DECIMAL(12,4) DEFAULT NULL, + `max_price` DECIMAL(12,4) DEFAULT NULL, + `tier_price` DECIMAL(12,4) DEFAULT NULL, + `base_tier` DECIMAL(12,4) DEFAULT NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_index_price')}_idx_option`; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_price_indexer_option_idx')}`; +CREATE TABLE `{$installer->getTable('catalog/product_price_indexer_option_idx')}` ( + `entity_id` INT(10) UNSIGNED NOT NULL, + `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL, + `website_id` SMALLINT(5) UNSIGNED NOT NULL, + `min_price` DECIMAL(12,4) DEFAULT NULL, + `max_price` DECIMAL(12,4) DEFAULT NULL, + `tier_price` DECIMAL(12,4) DEFAULT NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_price_indexer_option_tmp')}`; +CREATE TABLE `{$installer->getTable('catalog/product_price_indexer_option_tmp')}` ( + `entity_id` INT(10) UNSIGNED NOT NULL, + `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL, + `website_id` SMALLINT(5) UNSIGNED NOT NULL, + `min_price` DECIMAL(12,4) DEFAULT NULL, + `max_price` DECIMAL(12,4) DEFAULT NULL, + `tier_price` DECIMAL(12,4) DEFAULT NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_index_price')}_idx_option_aggregate`; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_price_indexer_option_aggregate_idx')}`; +CREATE TABLE `{$installer->getTable('catalog/product_price_indexer_option_aggregate_idx')}` ( + `entity_id` INT(10) UNSIGNED NOT NULL, + `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL, + `website_id` SMALLINT(5) UNSIGNED NOT NULL, + `option_id` INT(10) UNSIGNED DEFAULT '0', + `min_price` DECIMAL(12,4) DEFAULT NULL, + `max_price` DECIMAL(12,4) DEFAULT NULL, + `tier_price` DECIMAL(12,4) DEFAULT NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`, `option_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_price_indexer_option_aggregate_tmp')}`; +CREATE TABLE `{$installer->getTable('catalog/product_price_indexer_option_aggregate_tmp')}` ( + `entity_id` INT(10) UNSIGNED NOT NULL, + `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL, + `website_id` SMALLINT(5) UNSIGNED NOT NULL, + `option_id` INT(10) UNSIGNED DEFAULT '0', + `min_price` DECIMAL(12,4) DEFAULT NULL, + `max_price` DECIMAL(12,4) DEFAULT NULL, + `tier_price` DECIMAL(12,4) DEFAULT NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`, `option_id`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8; + + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_index_eav')}_idx`; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_eav_indexer_idx')}`; +CREATE TABLE `{$installer->getTable('catalog/product_eav_indexer_idx')}` ( + `entity_id` int(10) unsigned NOT NULL, + `attribute_id` smallint(5) unsigned NOT NULL, + `store_id` smallint(5) unsigned NOT NULL, + `value` int(10) unsigned NOT NULL, + PRIMARY KEY (`entity_id`,`attribute_id`,`store_id`,`value`), + KEY `IDX_ENTITY` (`entity_id`), + KEY `IDX_ATTRIBUTE` (`attribute_id`), + KEY `IDX_STORE` (`store_id`), + KEY `IDX_VALUE` (`value`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_eav_indexer_tmp')}`; +CREATE TABLE `{$installer->getTable('catalog/product_eav_indexer_tmp')}` ( + `entity_id` int(10) unsigned NOT NULL, + `attribute_id` smallint(5) unsigned NOT NULL, + `store_id` smallint(5) unsigned NOT NULL, + `value` int(10) unsigned NOT NULL, + PRIMARY KEY (`entity_id`,`attribute_id`,`store_id`,`value`), + KEY `IDX_ENTITY` (`entity_id`), + KEY `IDX_ATTRIBUTE` (`attribute_id`), + KEY `IDX_STORE` (`store_id`), + KEY `IDX_VALUE` (`value`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_index_eav_decimal')}_idx`; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_eav_decimal_indexer_idx')}`; +CREATE TABLE `{$installer->getTable('catalog/product_eav_decimal_indexer_idx')}` ( + `entity_id` int(10) unsigned NOT NULL, + `attribute_id` smallint(5) unsigned NOT NULL, + `store_id` smallint(5) unsigned NOT NULL, + `value` decimal(12,4) NOT NULL, + PRIMARY KEY (`entity_id`,`attribute_id`,`store_id`,`value`), + KEY `IDX_ENTITY` (`entity_id`), + KEY `IDX_ATTRIBUTE` (`attribute_id`), + KEY `IDX_STORE` (`store_id`), + KEY `IDX_VALUE` (`value`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_eav_decimal_indexer_tmp')}`; +CREATE TABLE `{$installer->getTable('catalog/product_eav_decimal_indexer_tmp')}` ( + `entity_id` int(10) unsigned NOT NULL, + `attribute_id` smallint(5) unsigned NOT NULL, + `store_id` smallint(5) unsigned NOT NULL, + `value` decimal(12,4) NOT NULL, + PRIMARY KEY (`entity_id`,`attribute_id`,`store_id`,`value`), + KEY `IDX_ENTITY` (`entity_id`), + KEY `IDX_ATTRIBUTE` (`attribute_id`), + KEY `IDX_STORE` (`store_id`), + KEY `IDX_VALUE` (`value`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_index_price')}_idx`; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_price_indexer_idx')}`; +CREATE TABLE `{$installer->getTable('catalog/product_price_indexer_idx')}` ( + `entity_id` int(10) unsigned NOT NULL, + `customer_group_id` smallint(5) unsigned NOT NULL, + `website_id` smallint(5) unsigned NOT NULL, + `tax_class_id` smallint(5) unsigned default '0', + `price` decimal(12,4) default NULL, + `final_price` decimal(12,4) default NULL, + `min_price` decimal(12,4) default NULL, + `max_price` decimal(12,4) default NULL, + `tier_price` decimal(12,4) default NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`), + KEY `IDX_CUSTOMER_GROUP` (`customer_group_id`), + KEY `IDX_WEBSITE` (`website_id`), + KEY `IDX_MIN_PRICE` (`min_price`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_price_indexer_tmp')}`; +CREATE TABLE `{$installer->getTable('catalog/product_price_indexer_tmp')}` ( + `entity_id` int(10) unsigned NOT NULL, + `customer_group_id` smallint(5) unsigned NOT NULL, + `website_id` smallint(5) unsigned NOT NULL, + `tax_class_id` smallint(5) unsigned default '0', + `price` decimal(12,4) default NULL, + `final_price` decimal(12,4) default NULL, + `min_price` decimal(12,4) default NULL, + `max_price` decimal(12,4) default NULL, + `tier_price` decimal(12,4) default NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`), + KEY `IDX_CUSTOMER_GROUP` (`customer_group_id`), + KEY `IDX_WEBSITE` (`website_id`), + KEY `IDX_MIN_PRICE` (`min_price`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/category_product_index')}_idx`; + +CREATE TABLE `{$installer->getTable('catalog/category_product_indexer_idx')}` ( + `category_id` int(10) unsigned NOT NULL default '0', + `product_id` int(10) unsigned NOT NULL default '0', + `position` int(10) NOT NULL default '0', + `is_parent` tinyint(1) unsigned NOT NULL default '0', + `store_id` smallint(5) unsigned NOT NULL default '0', + `visibility` tinyint(3) unsigned NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/category_product_indexer_tmp')}`; +CREATE TABLE `{$installer->getTable('catalog/category_product_indexer_tmp')}` ( + `category_id` int(10) unsigned NOT NULL default '0', + `product_id` int(10) unsigned NOT NULL default '0', + `position` int(10) NOT NULL default '0', + `is_parent` tinyint(1) unsigned NOT NULL default '0', + `store_id` smallint(5) unsigned NOT NULL default '0', + `visibility` tinyint(3) unsigned NOT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('tmp_category_index_enabled_products')}`; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/category_product_enabled_indexer_idx')}`; +CREATE TABLE `{$installer->getTable('catalog/category_product_enabled_indexer_idx')}` ( + `product_id` int(10) unsigned NOT NULL DEFAULT '0', + `visibility` int(11) unsigned NOT NULL DEFAULT '0', + KEY `IDX_PRODUCT` (`product_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/category_product_enabled_indexer_tmp')}`; +CREATE TABLE `{$installer->getTable('catalog/category_product_enabled_indexer_tmp')}` ( + `product_id` int(10) unsigned NOT NULL DEFAULT '0', + `visibility` int(11) unsigned NOT NULL DEFAULT '0', + KEY `IDX_PRODUCT` (`product_id`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('tmp_category_index_anchor_categories')}`; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/category_anchor_indexer_idx')}`; +CREATE TABLE `{$installer->getTable('catalog/category_anchor_indexer_idx')}` ( + `category_id` int(10) unsigned NOT NULL DEFAULT '0', + `path` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '', + KEY `IDX_CATEGORY` (`category_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/category_anchor_indexer_tmp')}`; +CREATE TABLE `{$installer->getTable('catalog/category_anchor_indexer_tmp')}` ( + `category_id` int(10) unsigned NOT NULL DEFAULT '0', + `path` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '', + KEY `IDX_CATEGORY` (`category_id`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('tmp_category_index_anchor_products')}`; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/category_anchor_products_indexer_idx')}`; +CREATE TABLE `{$installer->getTable('catalog/category_anchor_products_indexer_idx')}` ( + `category_id` int(10) unsigned NOT NULL DEFAULT '0', + `product_id` int(10) unsigned NOT NULL DEFAULT '0' +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `{$installer->getTable('catalog/category_anchor_products_indexer_tmp')}`; +CREATE TABLE `{$installer->getTable('catalog/category_anchor_products_indexer_tmp')}` ( + `category_id` int(10) unsigned NOT NULL DEFAULT '0', + `product_id` int(10) unsigned NOT NULL DEFAULT '0' +) ENGINE=MEMORY DEFAULT CHARSET=utf8; + +"); +$installer->endSetup(); diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.24-1.4.0.0.25.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.24-1.4.0.0.25.php new file mode 100644 index 0000000000..8dae940ebf --- /dev/null +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.24-1.4.0.0.25.php @@ -0,0 +1,42 @@ +getConnection()->modifyColumn( + $installer->getTable('catalog/eav_attribute'), 'is_used_for_price_rules', + "TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'deprecated after 1.4.0.1'" +); + +$installer->getConnection()->addColumn( + $installer->getTable('catalog/eav_attribute'), 'is_used_for_promo_rules', + "TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'" +); + +$installer->run("UPDATE {$installer->getTable('catalog/eav_attribute')} + SET is_used_for_promo_rules = is_used_for_price_rules" +); diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.25-1.4.0.0.26.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.25-1.4.0.0.26.php new file mode 100644 index 0000000000..9918049826 --- /dev/null +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.25-1.4.0.0.26.php @@ -0,0 +1,41 @@ +run(" + DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_price_indexer_cfg_option_aggregate_tmp')}`; + CREATE TABLE `{$installer->getTable('catalog/product_price_indexer_cfg_option_aggregate_tmp')}` ( + `parent_id` int(10) unsigned NOT NULL, + `child_id` int(10) unsigned NOT NULL, + `customer_group_id` smallint(5) unsigned NOT NULL, + `website_id` smallint(5) unsigned NOT NULL, + `price` decimal(12,4) default NULL, + `tier_price` decimal(12,4) default NULL, + PRIMARY KEY (`parent_id`,`child_id`,`customer_group_id`,`website_id`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8; +"); diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.26-1.4.0.0.27.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.26-1.4.0.0.27.php new file mode 100644 index 0000000000..55de68a78b --- /dev/null +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.26-1.4.0.0.27.php @@ -0,0 +1,38 @@ +startSetup(); + +$productEntityTypeId = $installer->getEntityTypeId('catalog_product'); + +$installer->updateAttribute($productEntityTypeId, 'minimal_price', 'is_required', 0); +$installer->updateAttribute($productEntityTypeId, 'required_options', 'is_required', 0); +$installer->updateAttribute($productEntityTypeId, 'has_options', 'is_required', 0); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.27-1.4.0.0.28.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.27-1.4.0.0.28.php new file mode 100644 index 0000000000..de5565a17f --- /dev/null +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.27-1.4.0.0.28.php @@ -0,0 +1,78 @@ +addAttribute('catalog_product', 'is_recurring', array( + 'group' => 'Recurring Profile', + 'type' => 'int', + 'backend' => '', + 'frontend' => '', + 'label' => 'Enable Recurring Profile', + 'note' => 'Products with recurring profile participate in catalog as nominal items.', + 'input' => 'select', + 'class' => '', + 'source' => 'eav/entity_attribute_source_boolean', + 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, + 'visible' => true, + 'required' => false, + 'user_defined' => false, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'unique' => false, + 'apply_to' => 'simple,virtual', + 'is_configurable' => false +)); + +// recurring payment profile +$installer->addAttribute('catalog_product', 'recurring_profile', array( + 'group' => 'Recurring Profile', + 'type' => 'text', + 'backend' => 'catalog/product_attribute_backend_recurring', + 'frontend' => '', + 'label' => 'Recurring Payment Profile', + 'input' => 'text', // doesn't matter + 'class' => '', + 'source' => '', + 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, + 'visible' => true, + 'required' => false, + 'user_defined' => false, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'unique' => false, + 'apply_to' => 'simple,virtual', + 'is_configurable' => false +)); + diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.3-1.4.0.0.4.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.3-1.4.0.0.4.php index 1bed6a8c7d..03504dc52a 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.3-1.4.0.0.4.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.3-1.4.0.0.4.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.4-1.4.0.0.5.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.4-1.4.0.0.5.php index 1f3be0e6cb..990f720b85 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.4-1.4.0.0.5.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.4-1.4.0.0.5.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.5-1.4.0.0.6.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.5-1.4.0.0.6.php index cce1b89c1e..78f67f6c33 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.5-1.4.0.0.6.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.5-1.4.0.0.6.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.6-1.4.0.0.7.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.6-1.4.0.0.7.php index a8f608eaf0..0e1a5f90b8 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.6-1.4.0.0.7.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.6-1.4.0.0.7.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.7-1.4.0.0.8.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.7-1.4.0.0.8.php index 7e1783296b..2bfaf600d2 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.7-1.4.0.0.8.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.7-1.4.0.0.8.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.8-1.4.0.0.9.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.8-1.4.0.0.9.php index c822ac9df4..734d964217 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.8-1.4.0.0.9.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.8-1.4.0.0.9.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.9-1.4.0.0.10.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.9-1.4.0.0.10.php index 44084a2efe..70488d33da 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.9-1.4.0.0.10.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.4.0.0.9-1.4.0.0.10.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Catalog - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Aggregation.php b/app/code/core/Mage/CatalogIndex/Model/Aggregation.php index 988f68ccb8..5917fa4ca1 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Aggregation.php +++ b/app/code/core/Mage/CatalogIndex/Model/Aggregation.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Attribute.php b/app/code/core/Mage/CatalogIndex/Model/Attribute.php index f66924096c..5327b059b2 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Attribute.php +++ b/app/code/core/Mage/CatalogIndex/Model/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Catalog/Index/Flag.php b/app/code/core/Mage/CatalogIndex/Model/Catalog/Index/Flag.php index 7f9d6c54d8..6a2d14f826 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Catalog/Index/Flag.php +++ b/app/code/core/Mage/CatalogIndex/Model/Catalog/Index/Flag.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Catalog/Index/Kill/Flag.php b/app/code/core/Mage/CatalogIndex/Model/Catalog/Index/Kill/Flag.php index 628a643983..c4bb82e2a2 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Catalog/Index/Kill/Flag.php +++ b/app/code/core/Mage/CatalogIndex/Model/Catalog/Index/Kill/Flag.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Data/Abstract.php b/app/code/core/Mage/CatalogIndex/Model/Data/Abstract.php index 9e57b249fa..37a6264db4 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Data/Abstract.php +++ b/app/code/core/Mage/CatalogIndex/Model/Data/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Data/Configurable.php b/app/code/core/Mage/CatalogIndex/Model/Data/Configurable.php index 9031fedd99..1f94fbc209 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Data/Configurable.php +++ b/app/code/core/Mage/CatalogIndex/Model/Data/Configurable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Data/Grouped.php b/app/code/core/Mage/CatalogIndex/Model/Data/Grouped.php index 195d5403d2..ae6f86ed2a 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Data/Grouped.php +++ b/app/code/core/Mage/CatalogIndex/Model/Data/Grouped.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Data/Simple.php b/app/code/core/Mage/CatalogIndex/Model/Data/Simple.php index 80d7d15fd0..a07bce7c32 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Data/Simple.php +++ b/app/code/core/Mage/CatalogIndex/Model/Data/Simple.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Data/Virtual.php b/app/code/core/Mage/CatalogIndex/Model/Data/Virtual.php index b109df280a..055c8fa3a8 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Data/Virtual.php +++ b/app/code/core/Mage/CatalogIndex/Model/Data/Virtual.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Indexer.php b/app/code/core/Mage/CatalogIndex/Model/Indexer.php index 6fbb17449c..43d21b8345 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Indexer.php +++ b/app/code/core/Mage/CatalogIndex/Model/Indexer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Indexer/Abstract.php b/app/code/core/Mage/CatalogIndex/Model/Indexer/Abstract.php index a6bb4c2276..8772582f75 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Indexer/Abstract.php +++ b/app/code/core/Mage/CatalogIndex/Model/Indexer/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Indexer/Eav.php b/app/code/core/Mage/CatalogIndex/Model/Indexer/Eav.php index 3951576e94..3ad0c19332 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Indexer/Eav.php +++ b/app/code/core/Mage/CatalogIndex/Model/Indexer/Eav.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Indexer/Interface.php b/app/code/core/Mage/CatalogIndex/Model/Indexer/Interface.php index 008d46ddf6..3c74d88b9e 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Indexer/Interface.php +++ b/app/code/core/Mage/CatalogIndex/Model/Indexer/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Indexer/Minimalprice.php b/app/code/core/Mage/CatalogIndex/Model/Indexer/Minimalprice.php index 459b8479ac..4a0a53c125 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Indexer/Minimalprice.php +++ b/app/code/core/Mage/CatalogIndex/Model/Indexer/Minimalprice.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Indexer/Price.php b/app/code/core/Mage/CatalogIndex/Model/Indexer/Price.php index 65b7a16af2..1ad69fc968 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Indexer/Price.php +++ b/app/code/core/Mage/CatalogIndex/Model/Indexer/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Indexer/Tierprice.php b/app/code/core/Mage/CatalogIndex/Model/Indexer/Tierprice.php index eb0bbac020..2623b58073 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Indexer/Tierprice.php +++ b/app/code/core/Mage/CatalogIndex/Model/Indexer/Tierprice.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Abstract.php b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Abstract.php index 0f26f90efe..7e814928ad 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Abstract.php +++ b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Aggregation.php b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Aggregation.php index c58aab2c74..8d4fbf12c0 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Aggregation.php +++ b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Aggregation.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Attribute.php b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Attribute.php index a4dd5cb18e..074c4d58b5 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Attribute.php +++ b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Data/Abstract.php b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Data/Abstract.php index c3d1491fbd..bbb2f67c57 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Data/Abstract.php +++ b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Data/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Data/Configurable.php b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Data/Configurable.php index 5022bc7094..c7a17adb3e 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Data/Configurable.php +++ b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Data/Configurable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Data/Grouped.php b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Data/Grouped.php index c55d79a717..532570acda 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Data/Grouped.php +++ b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Data/Grouped.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer.php b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer.php index 268e4cafd9..8971fdde5f 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer.php +++ b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer/Abstract.php b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer/Abstract.php index f96ec1c460..975079972e 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer/Abstract.php +++ b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer/Eav.php b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer/Eav.php index 45e22961be..dbbd65335f 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer/Eav.php +++ b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer/Eav.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer/Minimalprice.php b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer/Minimalprice.php index f475eb8aa7..c112151475 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer/Minimalprice.php +++ b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer/Minimalprice.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer/Price.php b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer/Price.php index 705bf69d8b..15075bbc81 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer/Price.php +++ b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Price.php b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Price.php index c78e865ece..54cddc28c5 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Price.php +++ b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Retreiver.php b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Retreiver.php index b9b575b152..2feee937b4 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Retreiver.php +++ b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Retreiver.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Setup.php b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Setup.php index 680b60cdb1..bdaa6e622f 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Mysql4/Setup.php +++ b/app/code/core/Mage/CatalogIndex/Model/Mysql4/Setup.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Observer.php b/app/code/core/Mage/CatalogIndex/Model/Observer.php index 396ef797e4..e1d959c5d7 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Observer.php +++ b/app/code/core/Mage/CatalogIndex/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Price.php b/app/code/core/Mage/CatalogIndex/Model/Price.php index b9916cc55e..280292107f 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Price.php +++ b/app/code/core/Mage/CatalogIndex/Model/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/Model/Retreiver.php b/app/code/core/Mage/CatalogIndex/Model/Retreiver.php index a76dc374ff..59c65cca03 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Retreiver.php +++ b/app/code/core/Mage/CatalogIndex/Model/Retreiver.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/etc/config.xml b/app/code/core/Mage/CatalogIndex/etc/config.xml index 87e5ff7887..62aae34be1 100644 --- a/app/code/core/Mage/CatalogIndex/etc/config.xml +++ b/app/code/core/Mage/CatalogIndex/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-install-0.7.0.php index 507600db25..1677081746 100644 --- a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.0-0.7.1.php index 07b2a095e2..c09dae8108 100644 --- a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.1-0.7.2.php index 8abfca6b60..a227f30281 100644 --- a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.2-0.7.3.php index 666730358a..50266179c6 100644 --- a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.2-0.7.3.php +++ b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.2-0.7.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.3-0.7.4.php b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.3-0.7.4.php index 524fa3294d..b3005a5414 100644 --- a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.3-0.7.4.php +++ b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.3-0.7.4.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.4-0.7.5.php b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.4-0.7.5.php index f38aa9ebb4..159250c145 100644 --- a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.4-0.7.5.php +++ b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.4-0.7.5.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.5-0.7.6.php b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.5-0.7.6.php index 08fda72d23..3b055f27a5 100644 --- a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.5-0.7.6.php +++ b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.5-0.7.6.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.6-0.7.7.php b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.6-0.7.7.php index 283cbfdcec..40ed7479df 100644 --- a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.6-0.7.7.php +++ b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.6-0.7.7.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.7-0.7.8.php b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.7-0.7.8.php index c19127dfe0..8e872ce2f2 100644 --- a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.7-0.7.8.php +++ b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.7-0.7.8.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.8-0.7.9.php b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.8-0.7.9.php index 5a04f51ce8..9c98bef4a1 100644 --- a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.8-0.7.9.php +++ b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.8-0.7.9.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.9-0.7.10.php b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.9-0.7.10.php index b1fc3ae8d9..089481324b 100644 --- a/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.9-0.7.10.php +++ b/app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/mysql4-upgrade-0.7.9-0.7.10.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogIndex - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogInventory/Block/Adminhtml/Form/Field/Customergroup.php b/app/code/core/Mage/CatalogInventory/Block/Adminhtml/Form/Field/Customergroup.php new file mode 100644 index 0000000000..82ec8c4c3b --- /dev/null +++ b/app/code/core/Mage/CatalogInventory/Block/Adminhtml/Form/Field/Customergroup.php @@ -0,0 +1,95 @@ + + */ +class Mage_CatalogInventory_Block_Adminhtml_Form_Field_Customergroup extends Mage_Core_Block_Html_Select +{ + /** + * Customer groups cache + * + * @var array + */ + private $_customerGroups; + + /** + * Flag whether to add group all option or no + * + * @var bool + */ + protected $_addGroupAllOption = true; + + /** + * Retrieve allowed customer groups + * + * @param int $groupId return name by customer group id + * @return array|string + */ + protected function _getCustomerGroups($groupId = null) + { + if (is_null($this->_customerGroups)) { + $this->_customerGroups = array(); + $collection = Mage::getModel('customer/group')->getCollection(); + foreach ($collection as $item) { + /* @var $item Mage_Customer_Model_Group */ + $this->_customerGroups[$item->getId()] = $item->getCustomerGroupCode(); + } + } + if (!is_null($groupId)) { + return isset($this->_customerGroups[$groupId]) ? $this->_customerGroups[$groupId] : null; + } + return $this->_customerGroups; + } + + public function setInputName($value) + { + return $this->setName($value); + } + + /** + * Render block HTML + * + * @return string + */ + public function _toHtml() + { + if (!$this->getOptions()) { + if ($this->_addGroupAllOption) { + $this->addOption(Mage_Customer_Model_Group::CUST_GROUP_ALL, Mage::helper('customer')->__('ALL GROUPS')); + } + foreach ($this->_getCustomerGroups() as $groupId => $groupLabel) { + $this->addOption($groupId, $groupLabel); + } + } + return parent::_toHtml(); + } +} diff --git a/app/code/core/Mage/CatalogInventory/Block/Adminhtml/Form/Field/Minsaleqty.php b/app/code/core/Mage/CatalogInventory/Block/Adminhtml/Form/Field/Minsaleqty.php new file mode 100644 index 0000000000..dddac8c659 --- /dev/null +++ b/app/code/core/Mage/CatalogInventory/Block/Adminhtml/Form/Field/Minsaleqty.php @@ -0,0 +1,88 @@ + + */ +class Mage_CatalogInventory_Block_Adminhtml_Form_Field_Minsaleqty extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract +{ + /** + * @var Mage_CatalogInventory_Block_Adminhtml_Form_Field_Customergroup + */ + protected $_groupRenderer; + + /** + * Retrieve group column renderer + * + * @return Mage_CatalogInventory_Block_Adminhtml_Form_Field_Customergroup + */ + protected function _getGroupRenderer() + { + if (!$this->_groupRenderer) { + $this->_groupRenderer = $this->getLayout()->createBlock( + 'cataloginventory/adminhtml_form_field_customergroup', '', + array('is_render_to_js_template' => true) + ); + $this->_groupRenderer->setClass('customer_group_select'); + $this->_groupRenderer->setExtraParams('style="width:120px"'); + } + return $this->_groupRenderer; + } + + /** + * Prepare to render + */ + protected function _prepareToRender() + { + $this->addColumn('customer_group_id', array( + 'label' => Mage::helper('customer')->__('Customer Group'), + 'renderer' => $this->_getGroupRenderer(), + )); + $this->addColumn('min_sale_qty', array( + 'label' => Mage::helper('cataloginventory')->__('Minimum Qty'), + 'style' => 'width:100px', + )); + $this->_addAfter = false; + $this->_addButtonLabel = Mage::helper('cataloginventory')->__('Add Minimum Qty'); + } + + /** + * Prepare existing row data object + * + * @param Varien_Object + */ + protected function _prepareArrayRow(Varien_Object $row) + { + $row->setData( + 'option_extra_attr_' . $this->_getGroupRenderer()->calcOptionHash($row->getData('customer_group_id')), + 'selected="selected"' + ); + } +} diff --git a/app/code/core/Mage/CatalogInventory/Block/Stockqty/Abstract.php b/app/code/core/Mage/CatalogInventory/Block/Stockqty/Abstract.php new file mode 100644 index 0000000000..d4106bce93 --- /dev/null +++ b/app/code/core/Mage/CatalogInventory/Block/Stockqty/Abstract.php @@ -0,0 +1,100 @@ + + */ +abstract class Mage_CatalogInventory_Block_Stockqty_Abstract extends Mage_Core_Block_Template +{ + const XML_PATH_STOCK_THRESHOLD_QTY = 'cataloginventory/options/stock_threshold_qty'; + + /** + * Retrieve current product object + * + * @return Mage_Catalog_Model_Product + */ + protected function _getProduct() + { + return Mage::registry('current_product'); + } + + /** + * Retrieve current product stock qty + * + * @return float + */ + public function getStockQty() + { + if (!$this->hasData('product_stock_qty')) { + $qty = 0; + if ($stockItem = $this->_getProduct()->getStockItem()) { + $qty = (float) $stockItem->getStockQty(); + } + $this->setData('product_stock_qty', $qty); + } + return $this->getData('product_stock_qty'); + } + + /** + * Retrieve threshold of qty to display stock qty message + * + * @return string + */ + public function getThresholdQty() + { + if (!$this->hasData('threshold_qty')) { + $qty = (float) Mage::getStoreConfig(self::XML_PATH_STOCK_THRESHOLD_QTY); + $this->setData('threshold_qty', $qty); + } + return $this->getData('threshold_qty'); + } + + /** + * Retrieve id of message placeholder in template + * + * @return string + */ + public function getPlaceholderId() + { + return 'stock-qty-' . $this->_getProduct()->getId(); + } + + /** + * Retrieve visibility of stock qty message + * + * @return bool + */ + public function isMsgVisible() + { + return ($this->getStockQty() > 0 && $this->getStockQty() <= $this->getThresholdQty()); + } + +} diff --git a/app/code/core/Mage/CatalogInventory/Block/Stockqty/Composite.php b/app/code/core/Mage/CatalogInventory/Block/Stockqty/Composite.php new file mode 100644 index 0000000000..5dfa49eef2 --- /dev/null +++ b/app/code/core/Mage/CatalogInventory/Block/Stockqty/Composite.php @@ -0,0 +1,83 @@ + + */ +abstract class Mage_CatalogInventory_Block_Stockqty_Composite extends Mage_CatalogInventory_Block_Stockqty_Default +{ + /** + * Child products cache + * + * @var array + */ + private $_childProducts; + + /** + * Retrieve child products + * + * @return array + */ + abstract protected function _getChildProducts(); + + /** + * Retrieve child products (using cache) + * + * @return array + */ + public function getChildProducts() + { + if ($this->_childProducts === null) { + $this->_childProducts = $this->_getChildProducts(); + } + return $this->_childProducts; + } + + /** + * Retrieve product stock qty + * + * @return float + */ + public function getProductStockQty($product) + { + return $product->getStockItem()->getStockQty(); + } + + /** + * Retrieve id of details table placeholder in template + * + * @return string + */ + public function getDetailsPlaceholderId() + { + return $this->getPlaceholderId() . '-details'; + } +} diff --git a/app/code/core/Mage/CatalogInventory/Block/Stockqty/Default.php b/app/code/core/Mage/CatalogInventory/Block/Stockqty/Default.php new file mode 100644 index 0000000000..d6091c984d --- /dev/null +++ b/app/code/core/Mage/CatalogInventory/Block/Stockqty/Default.php @@ -0,0 +1,49 @@ + + */ +class Mage_CatalogInventory_Block_Stockqty_Default extends Mage_CatalogInventory_Block_Stockqty_Abstract +{ + /** + * Render block HTML + * + * @return string + */ + protected function _toHtml() + { + if (!$this->isMsgVisible()) { + return ''; + } + return parent::_toHtml(); + } +} diff --git a/app/code/core/Mage/CatalogInventory/Block/Stockqty/Type/Configurable.php b/app/code/core/Mage/CatalogInventory/Block/Stockqty/Type/Configurable.php new file mode 100644 index 0000000000..70f6e4da29 --- /dev/null +++ b/app/code/core/Mage/CatalogInventory/Block/Stockqty/Type/Configurable.php @@ -0,0 +1,47 @@ + + */ +class Mage_CatalogInventory_Block_Stockqty_Type_Configurable extends Mage_CatalogInventory_Block_Stockqty_Composite +{ + /** + * Retrieve child products + * + * @return array + */ + protected function _getChildProducts() + { + return $this->_getProduct()->getTypeInstance(true) + ->getUsedProducts(null, $this->_getProduct()); + } +} diff --git a/app/code/core/Mage/CatalogInventory/Block/Stockqty/Type/Grouped.php b/app/code/core/Mage/CatalogInventory/Block/Stockqty/Type/Grouped.php new file mode 100644 index 0000000000..087614b7e3 --- /dev/null +++ b/app/code/core/Mage/CatalogInventory/Block/Stockqty/Type/Grouped.php @@ -0,0 +1,47 @@ + + */ +class Mage_CatalogInventory_Block_Stockqty_Type_Grouped extends Mage_CatalogInventory_Block_Stockqty_Composite +{ + /** + * Retrieve child products + * + * @return array + */ + protected function _getChildProducts() + { + return $this->_getProduct()->getTypeInstance(true) + ->getAssociatedProducts($this->_getProduct()); + } +} diff --git a/app/code/core/Mage/CatalogInventory/Helper/Data.php b/app/code/core/Mage/CatalogInventory/Helper/Data.php index cef6d94553..dc51d20afc 100644 --- a/app/code/core/Mage/CatalogInventory/Helper/Data.php +++ b/app/code/core/Mage/CatalogInventory/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -30,6 +30,7 @@ class Mage_CatalogInventory_Helper_Data extends Mage_Core_Helper_Abstract { const XML_PATH_SHOW_OUT_OF_STOCK = 'cataloginventory/options/show_out_of_stock'; + const XML_PATH_ITEM_AUTO_RETURN = 'cataloginventory/item_options/auto_return'; /** * All product types registry in scope of quantity availability @@ -106,4 +107,13 @@ public function isShowOutOfStock() { return Mage::getStoreConfigFlag(self::XML_PATH_SHOW_OUT_OF_STOCK); } + + /** + * Check if creditmemo items auto return option is enabled + * @return bool + */ + public function isAutoReturnEnabled() + { + return Mage::getStoreConfigFlag(self::XML_PATH_ITEM_AUTO_RETURN); + } } diff --git a/app/code/core/Mage/CatalogInventory/Model/Indexer/Stock.php b/app/code/core/Mage/CatalogInventory/Model/Indexer/Stock.php index 2c1e8c9150..27ec760a1f 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Indexer/Stock.php +++ b/app/code/core/Mage/CatalogInventory/Model/Indexer/Stock.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -96,7 +96,7 @@ protected function _getResource() */ public function getName() { - return Mage::helper('cataloginventory')->__('Stock status'); + return Mage::helper('cataloginventory')->__('Stock Status'); } /** @@ -106,7 +106,7 @@ public function getName() */ public function getDescription() { - return Mage::helper('cataloginventory')->__('Index product stock status'); + return Mage::helper('cataloginventory')->__('Index Product Stock Status'); } /** diff --git a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock.php b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock.php index 3cc241dc9f..4e4bfe30e1 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock.php +++ b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -71,15 +71,29 @@ public function cataloginventoryStockItemSave(Mage_Index_Model_Event $event) if (empty($data['product_id'])) { return $this; } - $adapter = $this->_getWriteAdapter(); $productId = $data['product_id']; + $this->reindexProducts($productId); + return $this; + } - $parentIds = $this->getRelationsByChild($productId); + /** + * Refresh stock index for specific product ids + * + * @param array $productIds + * @return Mage_CatalogInventory_Model_Mysql4_Indexer_Stock + */ + public function reindexProducts($productIds) + { + $adapter = $this->_getWriteAdapter(); + if (!is_array($productIds)) { + $productIds = array($productIds); + } + $parentIds = $this->getRelationsByChild($productIds); if ($parentIds) { - $processIds = array_merge($parentIds, array($productId)); + $processIds = array_merge($parentIds, $productIds); } else { - $processIds = array($productId); + $processIds = $productIds; } // retrieve product types by processIds @@ -108,6 +122,7 @@ public function cataloginventoryStockItemSave(Mage_Index_Model_Event $event) $adapter->commit(); return $this; + } /** @@ -225,7 +240,8 @@ public function catalogProductMassAction(Mage_Index_Model_Event $event) */ public function reindexAll() { - $this->cloneIndexTable(true); + $this->useIdxTable(true); + $this->clearTemporaryIndexTable(); foreach ($this->_getTypeIndexers() as $indexer) { $indexer->reindexAll(); @@ -272,7 +288,7 @@ protected function _getIndexer($productTypeId) { $types = $this->_getTypeIndexers(); if (!isset($types[$productTypeId])) { - Mage::throwException(Mage::helper('catalog')->__('Unsupported product type "%s"', $productTypeId)); + Mage::throwException(Mage::helper('catalog')->__('Unsupported product type "%s".', $productTypeId)); } return $types[$productTypeId]; } @@ -360,4 +376,17 @@ protected function _copyIndexDataToMainTable($processIds) return $this; } + + /** + * Retrieve temporary index table name + * + * @return string + */ + public function getIdxTable($table = null) + { + if ($this->useIdxTable()) { + return $this->getTable('cataloginventory/stock_status_indexer_idx'); + } + return $this->getTable('cataloginventory/stock_status_indexer_tmp'); + } } diff --git a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Configurable.php b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Configurable.php index 07ddaaf0c0..1c0409b27b 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Configurable.php +++ b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Configurable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,6 +42,7 @@ class Mage_CatalogInventory_Model_Mysql4_Indexer_Stock_Configurable */ public function reindexAll() { + $this->useIdxTable(true); $this->_prepareIndexTable(); return $this; } diff --git a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Default.php b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Default.php index 5216b24ae9..aa485864f5 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Default.php +++ b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -66,6 +66,7 @@ protected function _construct() */ public function reindexAll() { + $this->useIdxTable(true); $this->_prepareIndexTable(); return $this; } @@ -103,7 +104,7 @@ public function setTypeId($typeId) public function getTypeId() { if (is_null($this->_typeId)) { - Mage::throwException(Mage::helper('cataloginventory')->__('Undefined product type')); + Mage::throwException(Mage::helper('cataloginventory')->__('Undefined product type.')); } return $this->_typeId; } @@ -254,4 +255,17 @@ protected function _updateIndexTable($data) return $this; } + + /** + * Retrieve temporary index table name + * + * @return string + */ + public function getIdxTable($table = null) + { + if ($this->useIdxTable()) { + return $this->getTable('cataloginventory/stock_status_indexer_idx'); + } + return $this->getTable('cataloginventory/stock_status_indexer_tmp'); + } } diff --git a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Grouped.php b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Grouped.php index fb476c2493..c97996bd62 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Grouped.php +++ b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Grouped.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,6 +42,7 @@ class Mage_CatalogInventory_Model_Mysql4_Indexer_Stock_Grouped */ public function reindexAll() { + $this->useIdxTable(true); $this->_prepareIndexTable(); return $this; } diff --git a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Interface.php b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Interface.php index edb79f8ee1..6e631afa79 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Interface.php +++ b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock.php b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock.php index 9b1fc955f6..59f4b323b7 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock.php +++ b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -49,7 +49,7 @@ protected function _construct() public function lockProductItems($stock, $productIds) { $itemTable = $this->getTable('cataloginventory/stock_item'); - $select = $this->_getReadAdapter()->select() + $select = $this->_getWriteAdapter()->select() ->from($itemTable) ->where('stock_id=?', $stock->getId()) ->where('product_id IN(?)', $productIds) @@ -61,6 +61,52 @@ public function lockProductItems($stock, $productIds) return $this; } + /** + * Get stock items data for requested products + * + * @param Mage_CatalogInventory_Model_Stock $stock + * @param array $productIds + * @param bool $lockRows + */ + public function getProductsStock($stock, $productIds, $lockRows = false) + { + $itemTable = $this->getTable('cataloginventory/stock_item'); + $select = $this->_getWriteAdapter()->select() + ->from($itemTable) + ->where('stock_id=?', $stock->getId()) + ->where('product_id IN(?)', $productIds) + ->forUpdate($lockRows); + return $this->_getWriteAdapter()->fetchAll($select); + } + + /** + * Correct particular stock products qty based on operator + * + * @param Mage_CatalogInventory_Model_Stock $stock + * @param array $productQtys array($productId => $qty) + * @param string $operator +/- + * @return Mage_CatalogInventory_Model_Mysql4_Stock + */ + public function correctItemsQty($stock, $productQtys, $operator='-') + { + if (empty($productQtys)) { + return $this; + } + $query = 'UPDATE '.$this->getTable('cataloginventory/stock_item').' SET `qty`=CASE `product_id` '; + foreach ($productQtys as $productId => $qty) { + $query.= $this->_getWriteAdapter()->quoteInto(' WHEN ? ', $productId); + $query.= $this->_getWriteAdapter()->quoteInto(' THEN `qty`'.$operator.'? ', $qty); + } + $query.= ' ELSE `qty` END'; + $query.= $this->_getWriteAdapter()->quoteInto(' WHERE `product_id` IN (?)', array_keys($productQtys)); + $query.= $this->_getWriteAdapter()->quoteInto(' AND `stock_id` =?', $stock->getId()); + + $this->_getWriteAdapter()->beginTransaction(); + $this->_getWriteAdapter()->query($query); + $this->_getWriteAdapter()->commit(); + return $this; + } + /** * add join to select only in stock products * diff --git a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock/Item.php b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock/Item.php index 044e279de0..9fccc4d36a 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock/Item.php +++ b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -101,4 +101,25 @@ public function addCatalogInventoryToProductCollection($productCollection) null, 'left'); return $this; } + + /** + * Use qty correction for qty column update + * + * @param Varien_Object $object + * @param string $table + * @return array + */ + protected function _prepareDataForTable(Varien_Object $object, $table) + { + $data = parent::_prepareDataForTable($object, $table); + if ($object->getQtyCorrection()) { + if ($object->getQtyCorrection() < 0) { + $data['qty'] = new Zend_Db_Expr('`qty`-'.abs($object->getQtyCorrection())); + } else { + $data['qty'] = new Zend_Db_Expr('`qty`+'.$object->getQtyCorrection()); + } + } + return $data; + } + } diff --git a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock/Item/Collection.php b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock/Item/Collection.php index 3cab6a8ad6..b078082b86 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock/Item/Collection.php +++ b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock/Item/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -115,7 +115,7 @@ public function addQtyFilter($comparsionMethod, $qty) { $allowedMethods = array('<', '>', '=', '<=', '>=', '<>'); if (!in_array($comparsionMethod, $allowedMethods)) { - Mage::throwException(Mage::helper('cataloginventory')->__('%s is not correct comparsion method.', $comparsionMethod)); + Mage::throwException(Mage::helper('cataloginventory')->__('%s is not a correct comparsion method.', $comparsionMethod)); } $this->getSelect()->where("main_table.qty {$comparsionMethod} ?", $qty); return $this; diff --git a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock/Status.php b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock/Status.php index ef386a8178..f441380d8b 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock/Status.php +++ b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock/Status.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogInventory/Model/Observer.php b/app/code/core/Mage/CatalogInventory/Model/Observer.php index ec80f45563..5fd60e90ca 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Observer.php +++ b/app/code/core/Mage/CatalogInventory/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -88,7 +88,7 @@ public function addInventoryDataToCollection($observer) } /** - * Saving product inventory data + * Saving product inventory data. Product qty calculated dynamically. * * @param Varien_Event_Observer $observer * @return Mage_CatalogInventory_Model_Observer @@ -115,7 +115,7 @@ public function saveInventoryData($observer) } /** - * Copy product inventory data + * Copy product inventory data (used for product duplicate functionality) * * @param Varien_Event_Observer $observer * @return Mage_CatalogInventory_Model_Observer @@ -169,6 +169,18 @@ protected function _prepareItemForSave($item, $product) && is_null($product->getData('stock_data/use_config_notify_stock_qty'))) { $item->setData('use_config_notify_stock_qty', false); } + $originalQty = $product->getData('stock_data/original_inventory_qty'); + if (strlen($originalQty)>0) { + $item->setQtyCorrection($item->getQty()-$originalQty); + } + if (!is_null($product->getData('stock_data/enable_qty_increments')) + && is_null($product->getData('stock_data/use_config_enable_qty_increments'))) { + $item->setData('use_config_enable_qty_increments', false); + } + if (!is_null($product->getData('stock_data/qty_increments')) + && is_null($product->getData('stock_data/use_config_qty_increments'))) { + $item->setData('use_config_qty_increments', false); + } return $this; } @@ -207,7 +219,7 @@ public function checkQuoteItemQty($observer) $stockItem = $option->getProduct()->getStockItem(); /* @var $stockItem Mage_CatalogInventory_Model_Stock_Item */ if (!$stockItem instanceof Mage_CatalogInventory_Model_Stock_Item) { - Mage::throwException(Mage::helper('cataloginventory')->__('Stock item for Product in option is not valid')); + Mage::throwException(Mage::helper('cataloginventory')->__('The stock item for Product in option is not valid.')); } $qtyForCheck = $this->_getProductQtyForCheck($option->getProduct()->getId(), $increaseOptionQty); @@ -247,7 +259,7 @@ public function checkQuoteItemQty($observer) $stockItem = $quoteItem->getProduct()->getStockItem(); /* @var $stockItem Mage_CatalogInventory_Model_Stock_Item */ if (!$stockItem instanceof Mage_CatalogInventory_Model_Stock_Item) { - Mage::throwException(Mage::helper('cataloginventory')->__('Stock item for Product is not valid')); + Mage::throwException(Mage::helper('cataloginventory')->__('The stock item for Product is not valid.')); } @@ -329,59 +341,137 @@ protected function _getProductQtyForCheck($productId, $itemQty) } /** - * Lock DB rows for order products - * - * We need do it for resolving problems with inventory on placing - * some orders in one time - * - * @param Varien_Event_Observer $observer - * @return Mage_CatalogInventory_Model_Observer + * Subtrack quote items qtys from stock items related with quote items products + * @param Varien_Event_Observer $observer */ - public function lockOrderInventoryData($observer) + public function subtractQuoteInventory(Varien_Event_Observer $observer) { - $order = $observer->getEvent()->getOrder(); - $productIds = array(); + $quote = $observer->getEvent()->getQuote(); + $items = $this->_getProductsQty($quote->getAllItems()); + Mage::getSingleton('cataloginventory/stock')->registerProductsSale($items); + return $this; + } - /** - * Do lock only for new order - */ - if ($order->getId()) { - return $this; - } + /** + * Revert quote items inventory data (cover not success order place case) + * @param $observer + */ + public function revertQuoteInventory($observer) + { + $quote = $observer->getEvent()->getQuote(); + $items = $this->_getProductsQty($quote->getAllItems()); + Mage::getSingleton('cataloginventory/stock')->revertProductsSale($items); + } - if ($order) { - foreach ($order->getAllItems() as $item) { - $productIds[] = $item->getProductId(); + /** + * Prepare array with iformation about used product qty and product stock item + * result is: + * array( + * $productId => array( + * 'qty' => $qty, + * 'item' => $stockItems|null + * ) + * ) + * @param array $relatedItems + * @return array + */ + protected function _getProductsQty($relatedItems) + { + $items = array(); + foreach ($relatedItems as $item) { + $productId = $item->getProductId(); + if (!$productId) { + continue; + } + $children = $item->getChildrenItems(); + if ($children) { + foreach ($children as $childItem) { + $childProductId = $childItem->getProductId(); + if (!$childProductId) { + continue; + } + $childStockItem = null; + if ($childItem->getProduct()) { + $childStockItem = $childItem->getProduct()->getStockItem(); + } + if (isset($item[$childProductId])) { + $items[$childProductId]['qty'] += $childItem->getTotalQty(); + } else { + $items[$childProductId] = array( + 'item'=> $childStockItem, + 'qty' => $childItem->getTotalQty() + ); + } + } + } else { + $stockItem = null; + if ($item->getProduct()) { + $stockItem = $item->getProduct()->getStockItem(); + } + if (isset($item[$productId])) { + $items[$productId]['qty'] += $item->getTotalQty(); + } else { + $items[$productId] = array( + 'item'=> $stockItem, + 'qty' => $item->getTotalQty() + ); + } } } + return $items; + } - if (!empty($productIds)) { - Mage::getSingleton('cataloginventory/stock')->lockProductItems($productIds); + /** + * Refresh stock index for specific stock items + * @param $observer + */ + public function reindexQuoteInventory($observer) + { + $quote = $observer->getEvent()->getQuote(); + $productIds = array(); + foreach ($quote->getAllItems() as $item) { + $productIds[$item->getProductId()] = $item->getProductId(); + $children = $item->getChildrenItems(); + if ($children) { + foreach ($children as $childItem) { + $productIds[$childItem->getProductId()] = $childItem->getProductId(); + } + } } - + Mage::getResourceSingleton('cataloginventory/indexer_stock')->reindexProducts($productIds); return $this; } /** - * Register saving order item + * Return creditmemo items qty to stock * - * @param Varien_Event_Observer $observer - * @return Mage_CatalogInventory_Model_Observer + * @param Varien_Event_Observer $observer */ - public function createOrderItem($observer) + public function refundOrderInventory($observer) { - $item = $observer->getEvent()->getItem(); - /** - * Before creating order item need subtract ordered qty from product stock - */ - - $children = $item->getChildrenItems(); - - if (!$item->getId() && empty($children)) { - Mage::getSingleton('cataloginventory/stock')->registerItemSale($item); + $creditmemo = $observer->getEvent()->getCreditmemo(); + $items = array(); + foreach ($creditmemo->getAllItems() as $item) { + $return = false; + if ($item->hasBackToStock()) { + if ($item->getBackToStock() && $item->getQty()) { + $return = true; + } + } elseif (Mage::helper('cataloginventory')->isAutoReturnEnabled()) { + $return = true; + } + if ($return) { + if (isset($items[$item->getProductId()])) { + $items[$item->getProductId()]['qty'] += $item->getQty(); + } else { + $items[$item->getProductId()] = array( + 'qty' => $item->getQty(), + 'item'=> null, + ); + } + } } - - return $this; + Mage::getSingleton('cataloginventory/stock')->revertProductsSale($items); } /** @@ -404,21 +494,6 @@ public function cancelOrderItem($observer) return $this; } - /** - * Back refunded item qty to stock - * - * @param Varien_Event_Observer $observer - * @return Mage_CatalogInventory_Model_Observer - */ - public function refundOrderItem($observer) - { - $item = $observer->getEvent()->getCreditmemoItem(); - if ($item->getId() && $item->getBackToStock() && ($productId = $item->getProductId()) && ($qty = $item->getQty())) { - Mage::getSingleton('cataloginventory/stock')->backItemQty($productId, $qty); - } - return $this; - } - /** * Update items stock status and low stock date. * @@ -502,4 +577,85 @@ public function prepareCatalogProductIndexSelect(Varien_Event_Observer $observer return $this; } + + + + + + + + + /** + * Lock DB rows for order products + * + * We need do it for resolving problems with inventory on placing + * some orders in one time + * @deprecated after 1.4 + * @param Varien_Event_Observer $observer + * @return Mage_CatalogInventory_Model_Observer + */ + public function lockOrderInventoryData($observer) + { + $order = $observer->getEvent()->getOrder(); + $productIds = array(); + + /** + * Do lock only for new order + */ + if ($order->getId()) { + return $this; + } + + if ($order) { + foreach ($order->getAllItems() as $item) { + $productIds[] = $item->getProductId(); + } + } + + if (!empty($productIds)) { + Mage::getSingleton('cataloginventory/stock')->lockProductItems($productIds); + } + + return $this; + } + + /** + * Register saving order item + * + * @deprecated after 1.4 + * @param Varien_Event_Observer $observer + * @return Mage_CatalogInventory_Model_Observer + */ + public function createOrderItem($observer) + { + $item = $observer->getEvent()->getItem(); + /** + * Before creating order item need subtract ordered qty from product stock + */ + + $children = $item->getChildrenItems(); + + if (!$item->getId() && empty($children)) { + Mage::getSingleton('cataloginventory/stock')->registerItemSale($item); + } + + return $this; + } + + /** + * Back refunded item qty to stock + * + * @deprecated after 1.4 + * @param Varien_Event_Observer $observer + * @return Mage_CatalogInventory_Model_Observer + */ + public function refundOrderItem($observer) + { + $item = $observer->getEvent()->getCreditmemoItem(); + if ($item->getId() && $item->getBackToStock() && ($productId = $item->getProductId()) && ($qty = $item->getQty())) { + Mage::getSingleton('cataloginventory/stock')->backItemQty($productId, $qty); + } + return $this; + } + } diff --git a/app/code/core/Mage/CatalogInventory/Model/Source/Backorders.php b/app/code/core/Mage/CatalogInventory/Model/Source/Backorders.php index f091cdc875..b2277d800d 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Source/Backorders.php +++ b/app/code/core/Mage/CatalogInventory/Model/Source/Backorders.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogInventory/Model/Source/Stock.php b/app/code/core/Mage/CatalogInventory/Model/Source/Stock.php index 36fc187a6e..ab3eb115d2 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Source/Stock.php +++ b/app/code/core/Mage/CatalogInventory/Model/Source/Stock.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogInventory/Model/Stock.php b/app/code/core/Mage/CatalogInventory/Model/Stock.php index 1ae5d26a4c..2397ca792f 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Stock.php +++ b/app/code/core/Mage/CatalogInventory/Model/Stock.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -94,6 +94,61 @@ public function getItemCollection() ->addStockFilter($this->getId()); } + /** + * Prepare array($productId=>$qty) based on array($productId => array('qty'=>$qty, 'item'=>$stockItem)) + * + * @param array $items + */ + protected function _prepareProductQtys($items) + { + $qtys = array(); + foreach ($items as $productId => $item) { + if (empty($item['item'])) { + $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId); + } else { + $stockItem = $item['item']; + } + if ($stockItem->getId() && Mage::helper('catalogInventory')->isQty($stockItem->getTypeId())) { + $qtys[$productId] = $item['qty']; + } + } + return $qtys; + } + + /** + * Subtract product qtys from stock + * + * @param array $items + */ + public function registerProductsSale($items) + { + $qtys = $this->_prepareProductQtys($items); + $item = Mage::getModel('cataloginventory/stock_item'); + $this->_getResource()->beginTransaction(); + $stockInfo = $this->_getResource()->getProductsStock($this, array_keys($qtys), true); + foreach ($stockInfo as $itemInfo) { + $item->setData($itemInfo); + if (!$item->checkQty($qtys[$item->getProductId()])) { + $this->_getResource()->commit(); + Mage::throwException(Mage::helper('cataloginventory')->__('Not all products are available in the requested quantity')); + } + } + $this->_getResource()->correctItemsQty($this, $qtys, '-'); + $this->_getResource()->commit(); + return $this; + } + + /** + * + * @param unknown_type $items + */ + public function revertProductsSale($items) + { + $qtys = $this->_prepareProductQtys($items); + $this->_getResource()->correctItemsQty($this, $qtys, '+'); + return $this; + } + /** * Subtract ordered qty for product * @@ -115,7 +170,7 @@ public function registerItemSale(Varien_Object $item) } } else { - Mage::throwException(Mage::helper('cataloginventory')->__('Can not specify product identifier for order item')); + Mage::throwException(Mage::helper('cataloginventory')->__('Cannot specify product identifier for the order item.')); } return $this; } diff --git a/app/code/core/Mage/CatalogInventory/Model/Stock/Item.php b/app/code/core/Mage/CatalogInventory/Model/Stock/Item.php index a30cc6f6de..46d53808d3 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Stock/Item.php +++ b/app/code/core/Mage/CatalogInventory/Model/Stock/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -38,16 +38,28 @@ class Mage_CatalogInventory_Model_Stock_Item extends Mage_Core_Model_Abstract const XML_PATH_CAN_SUBTRACT = 'cataloginventory/options/can_subtract'; const XML_PATH_CAN_BACK_IN_STOCK = 'cataloginventory/options/can_back_in_stock'; - const XML_PATH_ITEM = 'cataloginventory/item_options/'; - const XML_PATH_MIN_QTY = 'cataloginventory/item_options/min_qty'; - const XML_PATH_MIN_SALE_QTY = 'cataloginventory/item_options/min_sale_qty'; - const XML_PATH_MAX_SALE_QTY = 'cataloginventory/item_options/max_sale_qty'; - const XML_PATH_BACKORDERS = 'cataloginventory/item_options/backorders'; - const XML_PATH_NOTIFY_STOCK_QTY = 'cataloginventory/item_options/notify_stock_qty'; - const XML_PATH_MANAGE_STOCK = 'cataloginventory/item_options/manage_stock'; + const XML_PATH_ITEM = 'cataloginventory/item_options/'; + const XML_PATH_MIN_QTY = 'cataloginventory/item_options/min_qty'; + const XML_PATH_MIN_SALE_QTY = 'cataloginventory/item_options/min_sale_qty'; + const XML_PATH_MAX_SALE_QTY = 'cataloginventory/item_options/max_sale_qty'; + const XML_PATH_BACKORDERS = 'cataloginventory/item_options/backorders'; + const XML_PATH_NOTIFY_STOCK_QTY = 'cataloginventory/item_options/notify_stock_qty'; + const XML_PATH_MANAGE_STOCK = 'cataloginventory/item_options/manage_stock'; + const XML_PATH_ENABLE_QTY_INCREMENTS = 'cataloginventory/item_options/enable_qty_increments'; + const XML_PATH_QTY_INCREMENTS = 'cataloginventory/item_options/qty_increments'; const ENTITY = 'cataloginventory_stock_item'; + /** + * @var array + */ + private $_minSaleQtyCache = array(); + + /** + * @var float|false + */ + protected $_qtyIncrements; + /** * Prefix of model events names * @@ -64,6 +76,20 @@ class Mage_CatalogInventory_Model_Stock_Item extends Mage_Core_Model_Abstract */ protected $_eventObject = 'item'; + /** + * Associated product instance + * + * @var Mage_Catalog_Model_Product + */ + protected $_productInstance = null; + + /** + * Customer group id + * + * @var int|null + */ + protected $_customerGroupId; + /** * Initialize resource model * @@ -165,7 +191,7 @@ public function getStoreId() } /** - * Adding stoc data to product + * Adding stock data to product * * @param Mage_Catalog_Model_Product $product * @return Mage_CatalogInventory_Model_Stock_Item @@ -200,16 +226,66 @@ public function getMinQty() } /** - * Retrieve Minimum Qty Allowed in Shopping Cart data wraper + * Getter for customer group id * * @return int */ + public function getCustomerGroupId() + { + return $this->_customerGroupId; + } + + /** + * Setter for customer group id + * + * @param int Value of customer group id + * @return Mage_CatalogInventory_Model_Stock_Item + */ + public function setCustomerGroupId($value) + { + $this->_customerGroupId = $value; + return $this; + } + + /** + * Retrieve Minimum Qty Allowed in Shopping Cart or NULL when there is no limitation + * + * @return float|null + */ public function getMinSaleQty() { - if ($this->getUseConfigMinSaleQty()) { - return (float) Mage::getStoreConfig(self::XML_PATH_MIN_SALE_QTY); + if ($this->getCustomerGroupId()) { + $customerGroupId = $this->getCustomerGroupId(); + } else if (Mage::app()->getStore()->isAdmin()) { + $customerGroupId = Mage_Customer_Model_Group::CUST_GROUP_ALL; + } else { + $customerGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId(); } - return $this->getData('min_sale_qty'); + if (!array_key_exists($customerGroupId, $this->_minSaleQtyCache)) { + $minSaleQty = null; + if ($this->getUseConfigMinSaleQty()) { + $backendModel = Mage::getSingleton('cataloginventory/system_config_backend_minsaleqty'); + $backendModel->loadByValue(Mage::getStoreConfig(self::XML_PATH_MIN_SALE_QTY)); + $minSaleQtyItems = $backendModel->getValue(); + if ($minSaleQtyItems && is_array($minSaleQtyItems)) { + foreach ($minSaleQtyItems as $_id => $item) { + if ($item['customer_group_id'] == $customerGroupId) { + $minSaleQty = $item['min_sale_qty']; + break; + } else if ($item['customer_group_id'] == Mage_Customer_Model_Group::CUST_GROUP_ALL) { + $minSaleQty = $item['min_sale_qty']; + } + } + } + } else { + $minSaleQty = $this->getData('min_sale_qty'); + } + if ($minSaleQty !== null) { + $minSaleQty = (float)$minSaleQty; + } + $this->_minSaleQtyCache[$customerGroupId] = $minSaleQty; + } + return $this->_minSaleQtyCache[$customerGroupId]; } /** @@ -238,6 +314,43 @@ public function getNotifyStockQty() return (float)$this->getData('notify_stock_qty'); } + /** + * Retrieve whether Quantity Increments is enabled + * + * @return bool + */ + public function getEnableQtyIncrements() + { + if ($this->getUseConfigEnableQtyIncrements()) { + return Mage::getStoreConfigFlag(self::XML_PATH_ENABLE_QTY_INCREMENTS); + } + return (bool)$this->getData('enable_qty_increments'); + } + + /** + * Retrieve Quantity Increments data wraper + * + * @return float|false + */ + public function getQtyIncrements() + { + if ($this->_qtyIncrements === null) { + $this->_qtyIncrements = false; + if ($this->getEnableQtyIncrements()) { + if ($this->getUseConfigQtyIncrements()) { + $this->_qtyIncrements = Mage::getStoreConfig(self::XML_PATH_QTY_INCREMENTS); + } else { + $this->_qtyIncrements = $this->getData('qty_increments'); + } + $this->_qtyIncrements = (float)$this->_qtyIncrements; + if ($this->_qtyIncrements <= 0) { + $this->_qtyIncrements = false; + } + } + } + return $this->_qtyIncrements; + } + /** * Retrieve backorders status * @@ -283,6 +396,9 @@ public function getCanBackInStock() */ public function checkQty($qty) { + if (!$this->getManageStock()) { + return true; + } if ($this->getQty() - $qty < 0) { switch ($this->getBackorders()) { case Mage_CatalogInventory_Model_Stock::BACKORDERS_YES_NONOTIFY: @@ -346,7 +462,7 @@ public function checkQuoteItemQty($qty, $summaryQty, $origQty = 0) if ($this->getMinSaleQty() && ($qty) < $this->getMinSaleQty()) { $result->setHasError(true) ->setMessage(Mage::helper('cataloginventory')->__('The minimum quantity allowed for purchase is %s.', $this->getMinSaleQty() * 1)) - ->setQuoteMessage(Mage::helper('cataloginventory')->__('Some of the products cannot be ordered in the requested quantity')) + ->setQuoteMessage(Mage::helper('cataloginventory')->__('Some of the products cannot be ordered in requested quantity.')) ->setQuoteMessageIndex('qty'); return $result; } @@ -354,7 +470,7 @@ public function checkQuoteItemQty($qty, $summaryQty, $origQty = 0) if ($this->getMaxSaleQty() && ($qty) > $this->getMaxSaleQty()) { $result->setHasError(true) ->setMessage(Mage::helper('cataloginventory')->__('The maximum quantity allowed for purchase is %s.', $this->getMaxSaleQty() * 1)) - ->setQuoteMessage(Mage::helper('cataloginventory')->__('Some of the products can not be ordered in requested quantity')) + ->setQuoteMessage(Mage::helper('cataloginventory')->__('Some of the products cannot be ordered in requested quantity.')) ->setQuoteMessageIndex('qty'); return $result; } @@ -372,6 +488,14 @@ public function checkQuoteItemQty($qty, $summaryQty, $origQty = 0) return $result; } + if ($this->getQtyIncrements() && ($qty % $this->getQtyIncrements() != 0)) { + $result->setHasError(true) + ->setMessage(Mage::helper('cataloginventory')->__('This product is available for purchase in increments of %s only.', $this->getQtyIncrements() * 1)) + ->setQuoteMessage(Mage::helper('cataloginventory')->__('Some of the products cannot be ordered in the requested quantity.')) + ->setQuoteMessageIndex('qty'); + return $result; + } + if (!$this->checkQty($summaryQty)) { $message = Mage::helper('cataloginventory')->__('The requested quantity for "%s" is not available.', $this->getProductName()); $result->setHasError(true) @@ -444,10 +568,11 @@ protected function _beforeSave() $isQty = Mage::helper('catalogInventory')->isQty($typeId); if ($isQty) { - if ($this->getBackorders() == Mage_CatalogInventory_Model_Stock::BACKORDERS_NO - && $this->getQty() <= $this->getMinQty()) { - $this->setIsInStock(false) - ->setStockStatusChangedAutomaticallyFlag(true); + if ($this->getBackorders() == Mage_CatalogInventory_Model_Stock::BACKORDERS_NO) { + if ($this->getQty() <= $this->getMinQty()) { + $this->setIsInStock(false) + ->setStockStatusChangedAutomaticallyFlag(true); + } } // if qty is below notify qty, update the low stock date to today date otherwise set null @@ -514,6 +639,44 @@ public function setProduct($product) ->setProductStatusChanged($product->dataHasChangedFor('status')) ->setProductChangedWebsites($product->getIsChangedWebsites()); + $this->_productInstance = $product; + return $this; } + + /** + * Retrieve stock qty whether product is composite or no + * + * @return float + */ + public function getStockQty() + { + if (!$this->hasStockQty()) { + $this->setStockQty(0); // prevent possible recursive loop + $product = $this->_productInstance; + if (!$product || !$product->isComposite()) { + $stockQty = $this->getQty(); + } else { + $stockQty = null; + $productsByGroups = $product->getTypeInstance(true)->getProductsToPurchaseByReqGroups($product); + foreach ($productsByGroups as $productsInGroup) { + $qty = 0; + foreach ($productsInGroup as $childProduct) { + if ($childProduct->hasStockItem()) { + $qty += $childProduct->getStockItem()->getStockQty(); + } + } + if (is_null($stockQty) || $qty < $stockQty) { + $stockQty = $qty; + } + } + } + $stockQty = (float) $stockQty; + if ($stockQty < 0 || !$this->getManageStock() || !$this->getIsInStock() || ($product && !$product->isSaleable())) { + $stockQty = 0; + } + $this->setStockQty($stockQty); + } + return $this->getData('stock_qty'); + } } diff --git a/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api.php b/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api.php index 225fe68cf6..44f93ce769 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api.php +++ b/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api/V2.php b/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api/V2.php index 22caf96197..652d5cc5b6 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api/V2.php +++ b/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api/V2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogInventory/Model/Stock/Status.php b/app/code/core/Mage/CatalogInventory/Model/Stock/Status.php index bd1df05f3a..fed80102b5 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Stock/Status.php +++ b/app/code/core/Mage/CatalogInventory/Model/Stock/Status.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php b/app/code/core/Mage/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php new file mode 100644 index 0000000000..a1cad4540f --- /dev/null +++ b/app/code/core/Mage/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php @@ -0,0 +1,95 @@ +getValue(); + if (empty($value)) { + $this->setValue(array()); + } else { + try { + parent::_afterLoad(); + } catch(Exception $e) { + $this->setValue(array( + Mage::helper('core')->uniqHash('_') => array( + 'customer_group_id' => Mage_Customer_Model_Group::CUST_GROUP_ALL, + 'min_sale_qty' => $value, + ) + )); + } + } + } + + /** + * Prepare data before save + */ + protected function _beforeSave() + { + $value = $this->getValue(); + if (is_array($value)) { + unset($value['__empty']); + + $foundGroups = array(); + $hasGroupAllOnly = false; + $groupAllQty = null; + foreach ($value as $k => $v) { + if (in_array($v['customer_group_id'], $foundGroups)) { + unset($value[$k]); + continue; + } + $foundGroups[] = $v['customer_group_id']; + if ($v['customer_group_id'] == Mage_Customer_Model_Group::CUST_GROUP_ALL) { + $hasGroupAllOnly = true; + $groupAllQty = $v['min_sale_qty']; + } else { + $hasGroupAllOnly = false; + } + } + if ($hasGroupAllOnly) { + $this->setValue($groupAllQty); + } else { + parent::_beforeSave(); + } + } + } + + /** + * Load model by raw value + */ + public function loadByValue($value) + { + return $this->setValue($value)->afterLoad(); + } +} diff --git a/app/code/core/Mage/CatalogInventory/etc/adminhtml.xml b/app/code/core/Mage/CatalogInventory/etc/adminhtml.xml index 25c0dc8669..77725519af 100644 --- a/app/code/core/Mage/CatalogInventory/etc/adminhtml.xml +++ b/app/code/core/Mage/CatalogInventory/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/CatalogInventory/etc/api.xml b/app/code/core/Mage/CatalogInventory/etc/api.xml index cb39729c8b..527f54b046 100644 --- a/app/code/core/Mage/CatalogInventory/etc/api.xml +++ b/app/code/core/Mage/CatalogInventory/etc/api.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/CatalogInventory/etc/config.xml b/app/code/core/Mage/CatalogInventory/etc/config.xml index 77b555d3fe..29256fe3fd 100644 --- a/app/code/core/Mage/CatalogInventory/etc/config.xml +++ b/app/code/core/Mage/CatalogInventory/etc/config.xml @@ -21,14 +21,14 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - 0.7.5 + 0.7.8 @@ -49,6 +49,12 @@ cataloginventory_stock_status
      + + cataloginventory_stock_status_idx
      +
      + + cataloginventory_stock_status_tmp
      +
      @@ -65,6 +71,9 @@ + + Mage_CatalogInventory_Block + @@ -115,22 +124,30 @@ - + cataloginventory/observer - lockOrderInventoryData + subtractQuoteInventory - - + + cataloginventory/observer - createOrderItem + reindexQuoteInventory - + + + + + cataloginventory/observer + revertQuoteInventory + + + @@ -139,14 +156,14 @@ - + cataloginventory/observer - refundOrderItem + refundOrderInventory - + @@ -207,7 +224,7 @@ - + @@ -228,6 +245,13 @@
      + + + + cataloginventory.xml + + + @@ -257,6 +281,7 @@ 1 1 0 + 0 1 @@ -265,6 +290,8 @@ 1 0 1 + 0 + 1 diff --git a/app/code/core/Mage/CatalogInventory/etc/system.xml b/app/code/core/Mage/CatalogInventory/etc/system.xml index 448739daa3..a6b64943e0 100644 --- a/app/code/core/Mage/CatalogInventory/etc/system.xml +++ b/app/code/core/Mage/CatalogInventory/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -63,7 +63,7 @@ 1 - + select adminhtml/system_config_source_yesno 3 @@ -71,10 +71,18 @@ 0 0 + + + text + 4 + 1 + 1 + 0 +
      - <strong>Please note</strong>, that these Settings are applicable to cart line Items, not the whole Cart. + <strong>Note</strong> that these settings are applicable to cart line items, not the whole cart. text 10 @@ -110,7 +118,7 @@ 0 - + text 5 1 @@ -119,7 +127,8 @@ - text + cataloginventory/adminhtml_form_field_minsaleqty + cataloginventory/system_config_backend_minsaleqty 6 1 0 @@ -133,6 +142,33 @@ 0 0 + + + select + adminhtml/system_config_source_yesno + 10 + 1 + 0 + 0 + + + + select + adminhtml/system_config_source_yesno + 8 + 1 + 0 + 0 + + + + text + 9 + 1 + 0 + 0 + 1 + diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-install-0.7.0.php index f1db56d9e5..04f9355259 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.0-0.7.1.php index a333e242c7..06812be102 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.1-0.7.2.php index 1eeb1fdc23..c5e7c0f501 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.2-0.7.3.php index 78c9130d0b..da95a5a4a9 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.2-0.7.3.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.2-0.7.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.3-0.7.4.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.3-0.7.4.php index ab5a0928b7..2e9c02da41 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.3-0.7.4.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.3-0.7.4.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.4-0.7.5.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.4-0.7.5.php index 5fbe0e0b3e..080be44c52 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.4-0.7.5.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.4-0.7.5.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogInventory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.5-0.7.6.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.5-0.7.6.php new file mode 100644 index 0000000000..b55f8c5426 --- /dev/null +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.5-0.7.6.php @@ -0,0 +1,36 @@ +getTable('cataloginventory_stock_item'); + +$connection = $installer->getConnection(); +/* @var $connection Varien_Db_Adapter_Pdo_Mysql */ + +$connection->addColumn($tableCataloginventoryStockItem, 'use_config_qty_increments', "tinyint(1) unsigned NOT NULL default '1'"); +$connection->addColumn($tableCataloginventoryStockItem, 'qty_increments', "decimal(12,4) NOT NULL DEFAULT '0.0000'"); diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.6-0.7.7.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.6-0.7.7.php new file mode 100644 index 0000000000..2df413ec94 --- /dev/null +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.6-0.7.7.php @@ -0,0 +1,55 @@ +startSetup(); +$installer->run(" +DROP TABLE IF EXISTS `{$installer->getTable('cataloginventory/stock_status')}_idx`; + +CREATE TABLE `{$installer->getTable('cataloginventory/stock_status_indexer_idx')}` ( + `product_id` int(10) unsigned NOT NULL, + `website_id` smallint(5) unsigned NOT NULL, + `stock_id` smallint(4) unsigned NOT NULL, + `qty` decimal(12,4) NOT NULL default '0.0000', + `stock_status` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`product_id`,`website_id`,`stock_id`), + KEY `FK_CATALOGINVENTORY_STOCK_STATUS_STOCK` (`stock_id`), + KEY `FK_CATALOGINVENTORY_STOCK_STATUS_WEBSITE` (`website_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('cataloginventory/stock_status_indexer_tmp')}` ( + `product_id` int(10) unsigned NOT NULL, + `website_id` smallint(5) unsigned NOT NULL, + `stock_id` smallint(4) unsigned NOT NULL, + `qty` decimal(12,4) NOT NULL default '0.0000', + `stock_status` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`product_id`,`website_id`,`stock_id`), + KEY `FK_CATALOGINVENTORY_STOCK_STATUS_STOCK` (`stock_id`), + KEY `FK_CATALOGINVENTORY_STOCK_STATUS_WEBSITE` (`website_id`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8; +"); +$installer->endSetup(); diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.7-0.7.8.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.7-0.7.8.php new file mode 100644 index 0000000000..384d554e28 --- /dev/null +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.7-0.7.8.php @@ -0,0 +1,36 @@ +getTable('cataloginventory/stock_item'); + +$connection = $installer->getConnection(); +/* @var $connection Varien_Db_Adapter_Pdo_Mysql */ + +$connection->addColumn($tableCataloginventoryStockItem, 'use_config_enable_qty_increments', "tinyint(1) unsigned NOT NULL default '1'"); +$connection->addColumn($tableCataloginventoryStockItem, 'enable_qty_increments', "tinyint(1) unsigned NOT NULL default '0'"); diff --git a/app/code/core/Mage/CatalogRule/Helper/Data.php b/app/code/core/Mage/CatalogRule/Helper/Data.php index 3d2c72ec15..f23837559a 100644 --- a/app/code/core/Mage/CatalogRule/Helper/Data.php +++ b/app/code/core/Mage/CatalogRule/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogRule/Model/Mysql4/Rule.php b/app/code/core/Mage/CatalogRule/Model/Mysql4/Rule.php index 41e7ad064c..c00513f043 100644 --- a/app/code/core/Mage/CatalogRule/Model/Mysql4/Rule.php +++ b/app/code/core/Mage/CatalogRule/Model/Mysql4/Rule.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -315,7 +315,7 @@ protected function _getRuleProductsStmt($fromDate, $toDate, $productId=null, $we ->from(array('rp'=>$this->getTable('catalogrule/rule_product'))) ->where($read->quoteInto('rp.from_time=0 or rp.from_time<=?', $toDate) ." or ".$read->quoteInto('rp.to_time=0 or rp.to_time>=?', $fromDate)) - ->order(array('rp.website_id', 'rp.customer_group_id', 'rp.product_id', 'rp.sort_order')); + ->order(array('rp.website_id', 'rp.customer_group_id', 'rp.product_id', 'rp.sort_order', 'rp.rule_id')); if (!is_null($productId)) { $select->where('rp.product_id=?', $productId); @@ -513,9 +513,12 @@ public function applyAllRulesForDateRange($fromDate=null, $toDate=null, $product $write->delete($this->getTable('catalogrule/rule_group_website'), array()); + $timestamp = Mage::getModel('core/date')->gmtTimestamp(); + $select = $write->select() ->distinct(true) - ->from($this->getTable('catalogrule/rule_product'), array('rule_id', 'customer_group_id', 'website_id')); + ->from($this->getTable('catalogrule/rule_product'), array('rule_id', 'customer_group_id', 'website_id')) + ->where("{$timestamp} >= from_time AND {$timestamp} <= to_time"); $query = $select->insertFromSelect($this->getTable('catalogrule/rule_group_website')); $write->query($query); diff --git a/app/code/core/Mage/CatalogRule/Model/Mysql4/Rule/Collection.php b/app/code/core/Mage/CatalogRule/Model/Mysql4/Rule/Collection.php index 89a98b298b..e5ce52113d 100644 --- a/app/code/core/Mage/CatalogRule/Model/Mysql4/Rule/Collection.php +++ b/app/code/core/Mage/CatalogRule/Model/Mysql4/Rule/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogRule/Model/Mysql4/Rule/Product/Price.php b/app/code/core/Mage/CatalogRule/Model/Mysql4/Rule/Product/Price.php index 21ab33635f..e2ff0d8f9d 100644 --- a/app/code/core/Mage/CatalogRule/Model/Mysql4/Rule/Product/Price.php +++ b/app/code/core/Mage/CatalogRule/Model/Mysql4/Rule/Product/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogRule/Model/Mysql4/Rule/Product/Price/Collection.php b/app/code/core/Mage/CatalogRule/Model/Mysql4/Rule/Product/Price/Collection.php index 134f5c0841..23abb89059 100644 --- a/app/code/core/Mage/CatalogRule/Model/Mysql4/Rule/Product/Price/Collection.php +++ b/app/code/core/Mage/CatalogRule/Model/Mysql4/Rule/Product/Price/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogRule/Model/Observer.php b/app/code/core/Mage/CatalogRule/Model/Observer.php index 7a7c63b54d..9a072c4e13 100644 --- a/app/code/core/Mage/CatalogRule/Model/Observer.php +++ b/app/code/core/Mage/CatalogRule/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -101,6 +101,8 @@ public function processFrontFinalPrice($observer) if ($observer->hasCustomerGroupId()) { $gId = $observer->getEvent()->getCustomerGroupId(); + } elseif ($product->hasCustomerGroupId()) { + $gId = $product->hasCustomerGroupId(); } else { $gId = Mage::getSingleton('customer/session')->getCustomerGroupId(); } diff --git a/app/code/core/Mage/CatalogRule/Model/Rule.php b/app/code/core/Mage/CatalogRule/Model/Rule.php index d5067a78b8..e4afe8b95b 100644 --- a/app/code/core/Mage/CatalogRule/Model/Rule.php +++ b/app/code/core/Mage/CatalogRule/Model/Rule.php @@ -20,13 +20,15 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_CatalogRule_Model_Rule extends Mage_Rule_Model_Rule { + const XML_NODE_RELATED_CACHE = 'global/catalogrule/related_cache_types'; + /** * Prefix of model events names * @@ -91,8 +93,8 @@ public function toString($format='') $str = Mage::helper('catalogrule')->__("Name: %s", $this->getName()) ."\n" . Mage::helper('catalogrule')->__("Start at: %s", $this->getStartAt()) ."\n" . Mage::helper('catalogrule')->__("Expire at: %s", $this->getExpireAt()) ."\n" - . Mage::helper('catalogrule')->__("Customer registered: %s", $this->getCustomerRegistered()) ."\n" - . Mage::helper('catalogrule')->__("Customer is new buyer: %s", $this->getCustomerNewBuyer()) ."\n" + . Mage::helper('catalogrule')->__("Customer Registered: %s", $this->getCustomerRegistered()) ."\n" + . Mage::helper('catalogrule')->__("Customer is a New Buyer: %s", $this->getCustomerNewBuyer()) ."\n" . Mage::helper('catalogrule')->__("Description: %s", $this->getDescription()) ."\n\n" . $this->getConditions()->toStringRecursive() ."\n\n" . $this->getActions()->toStringRecursive() ."\n\n"; @@ -120,6 +122,21 @@ public function toArray(array $arrAttributes = array()) return $out; } + /** + * Invalidate related cache types + * + * @return Mage_CatalogRule_Model_Rule + */ + protected function _invalidateCache() + { + $types = Mage::getConfig()->getNode(self::XML_NODE_RELATED_CACHE); + if ($types) { + $types = $types->asArray(); + Mage::app()->getCacheInstance()->invalidateType(array_keys($types)); + } + return $this; + } + /** * Process rule related data after rule save * @@ -219,13 +236,14 @@ public function getCustomerGroupIds() } /** - * Apply all price rules and refresh price index + * Apply all price rules, invalidate related cache and refresh price index * * @return Mage_CatalogRule_Model_Rule */ public function applyAll() { $this->_getResource()->applyAllRulesForDateRange(); + $this->_invalidateCache(); $indexProcess = Mage::getSingleton('index/indexer')->getProcessByCode('catalog_product_price'); if ($indexProcess) { $indexProcess->reindexAll(); diff --git a/app/code/core/Mage/CatalogRule/Model/Rule/Action/Collection.php b/app/code/core/Mage/CatalogRule/Model/Rule/Action/Collection.php index 1893d9decc..8076c21595 100644 --- a/app/code/core/Mage/CatalogRule/Model/Rule/Action/Collection.php +++ b/app/code/core/Mage/CatalogRule/Model/Rule/Action/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogRule/Model/Rule/Action/Product.php b/app/code/core/Mage/CatalogRule/Model/Rule/Action/Product.php index 0e5fea2297..9f4d0b4121 100644 --- a/app/code/core/Mage/CatalogRule/Model/Rule/Action/Product.php +++ b/app/code/core/Mage/CatalogRule/Model/Rule/Action/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogRule/Model/Rule/Condition/Combine.php b/app/code/core/Mage/CatalogRule/Model/Rule/Condition/Combine.php index 2fad277113..876e3c224f 100644 --- a/app/code/core/Mage/CatalogRule/Model/Rule/Condition/Combine.php +++ b/app/code/core/Mage/CatalogRule/Model/Rule/Condition/Combine.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogRule/Model/Rule/Condition/Product.php b/app/code/core/Mage/CatalogRule/Model/Rule/Condition/Product.php index b161a708d5..31552e1dea 100644 --- a/app/code/core/Mage/CatalogRule/Model/Rule/Condition/Product.php +++ b/app/code/core/Mage/CatalogRule/Model/Rule/Condition/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -50,7 +50,7 @@ class Mage_CatalogRule_Model_Rule_Condition_Product extends Mage_Rule_Model_Cond * * @var string */ - protected $_isUsedForRuleProperty = 'is_used_for_price_rules'; + protected $_isUsedForRuleProperty = 'is_used_for_promo_rules'; /** * Retrieve attribute object diff --git a/app/code/core/Mage/CatalogRule/Model/Rule/Product/Price.php b/app/code/core/Mage/CatalogRule/Model/Rule/Product/Price.php index d87fa39a0d..4903df7f87 100644 --- a/app/code/core/Mage/CatalogRule/Model/Rule/Product/Price.php +++ b/app/code/core/Mage/CatalogRule/Model/Rule/Product/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogRule/etc/adminhtml.xml b/app/code/core/Mage/CatalogRule/etc/adminhtml.xml index bc6ae9ef65..e7b0546a8f 100644 --- a/app/code/core/Mage/CatalogRule/etc/adminhtml.xml +++ b/app/code/core/Mage/CatalogRule/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/CatalogRule/etc/config.xml b/app/code/core/Mage/CatalogRule/etc/config.xml index 2197ac24dc..d74e50426f 100644 --- a/app/code/core/Mage/CatalogRule/etc/config.xml +++ b/app/code/core/Mage/CatalogRule/etc/config.xml @@ -21,14 +21,14 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - 0.7.8 + 0.7.10 @@ -70,6 +70,11 @@ + + + + + diff --git a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-install-0.7.0.php index 7094726496..0548239fcf 100644 --- a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.0-0.7.1.php index 8429ffab1d..a37c94a4c0 100644 --- a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.1-0.7.2.php index 974638f6ca..6b289ae1a8 100644 --- a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.2-0.7.3.php index 125a55a05f..e0739abe9a 100644 --- a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.2-0.7.3.php +++ b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.2-0.7.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.3-0.7.4.php b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.3-0.7.4.php index efdb625140..57fe42d3da 100644 --- a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.3-0.7.4.php +++ b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.3-0.7.4.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.4-0.7.5.php b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.4-0.7.5.php index d7ee6f42a0..26e80e6cdc 100644 --- a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.4-0.7.5.php +++ b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.4-0.7.5.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.5-0.7.6.php b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.5-0.7.6.php index b87d8df5d2..f2d29e20bf 100644 --- a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.5-0.7.6.php +++ b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.5-0.7.6.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.6-0.7.7.php b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.6-0.7.7.php index 299f379c3d..1435da27bf 100644 --- a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.6-0.7.7.php +++ b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.6-0.7.7.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.7-0.7.8.php b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.7-0.7.8.php index 9dfbafef1e..d6f7d0a284 100644 --- a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.7-0.7.8.php +++ b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.7-0.7.8.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.8-0.7.9.php b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.8-0.7.9.php new file mode 100644 index 0000000000..c2778e0600 --- /dev/null +++ b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.8-0.7.9.php @@ -0,0 +1,31 @@ +getConnection(); +$connection->addKey($installer->getTable('catalogrule/rule_product'), 'IDX_FROM_TIME', 'from_time'); +$connection->addKey($installer->getTable('catalogrule/rule_product'), 'IDX_TO_TIME', 'to_time'); diff --git a/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.9-0.7.10.php b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.9-0.7.10.php new file mode 100644 index 0000000000..edfc0a523c --- /dev/null +++ b/app/code/core/Mage/CatalogRule/sql/catalogrule_setup/mysql4-upgrade-0.7.9-0.7.10.php @@ -0,0 +1,37 @@ +startSetup(); + +$installer->getConnection() + ->modifyColumn($this->getTable('catalogrule'), + 'customer_group_ids', + 'TEXT'); + +$installer->endSetup(); diff --git a/app/code/core/Mage/CatalogSearch/Block/Advanced/Form.php b/app/code/core/Mage/CatalogSearch/Block/Advanced/Form.php index 09ce9044e0..dec0d4954b 100644 --- a/app/code/core/Mage/CatalogSearch/Block/Advanced/Form.php +++ b/app/code/core/Mage/CatalogSearch/Block/Advanced/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/Block/Advanced/Result.php b/app/code/core/Mage/CatalogSearch/Block/Advanced/Result.php index 7d893e170d..fa86716764 100644 --- a/app/code/core/Mage/CatalogSearch/Block/Advanced/Result.php +++ b/app/code/core/Mage/CatalogSearch/Block/Advanced/Result.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/Block/Autocomplete.php b/app/code/core/Mage/CatalogSearch/Block/Autocomplete.php index fa1844ef45..17f535fb7f 100644 --- a/app/code/core/Mage/CatalogSearch/Block/Autocomplete.php +++ b/app/code/core/Mage/CatalogSearch/Block/Autocomplete.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/Block/Layer.php b/app/code/core/Mage/CatalogSearch/Block/Layer.php index a91b25085d..13fe59d931 100644 --- a/app/code/core/Mage/CatalogSearch/Block/Layer.php +++ b/app/code/core/Mage/CatalogSearch/Block/Layer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -57,6 +57,10 @@ public function getLayer() */ public function canShowBlock() { + $_isLNAllowedByEngine = Mage::helper('catalogsearch')->getEngine()->isLeyeredNavigationAllowed(); + if (!$_isLNAllowedByEngine) { + return false; + } $availableResCount = (int) Mage::app()->getStore() ->getConfig(Mage_CatalogSearch_Model_Layer::XML_PATH_DISPLAY_LAYER_COUNT ); diff --git a/app/code/core/Mage/CatalogSearch/Block/Layer/Filter/Attribute.php b/app/code/core/Mage/CatalogSearch/Block/Layer/Filter/Attribute.php index add5533d9b..9377d035ae 100644 --- a/app/code/core/Mage/CatalogSearch/Block/Layer/Filter/Attribute.php +++ b/app/code/core/Mage/CatalogSearch/Block/Layer/Filter/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/Block/Result.php b/app/code/core/Mage/CatalogSearch/Block/Result.php index d789536058..9e2d600b83 100644 --- a/app/code/core/Mage/CatalogSearch/Block/Result.php +++ b/app/code/core/Mage/CatalogSearch/Block/Result.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/Block/Term.php b/app/code/core/Mage/CatalogSearch/Block/Term.php index 55dd6bd5a5..5a33f5c9b8 100644 --- a/app/code/core/Mage/CatalogSearch/Block/Term.php +++ b/app/code/core/Mage/CatalogSearch/Block/Term.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/Helper/Data.php b/app/code/core/Mage/CatalogSearch/Helper/Data.php index 680a31ec56..92d52ac762 100644 --- a/app/code/core/Mage/CatalogSearch/Helper/Data.php +++ b/app/code/core/Mage/CatalogSearch/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -300,4 +300,49 @@ public function checkNotes($store = null) } } } + + /** + * Join index array to string by separator + * Support 2 level array gluing + * + * @param array $index + * @param string $separator + * @return string + */ + public function prepareIndexdata($index, $separator = ' ') + { + $_index = array(); + foreach ($index as $key => $value) { + if (!is_array($value)) { + $_index[] = $value; + } + else { + $_index = array_merge($_index, $value); + } + } + return join($separator, $_index); + } + + /** + * Get current search engine resource model + * + * @return object|false + */ + public function getEngine() + { +// $engine = (string)Mage::getConfig()->getNode('global/search/engine'); + $engine = Mage::getStoreConfig('catalog/search/engine'); + /** + * This needed if there already was saved in configuartion some none-default engine + * and module of that engine was disabled after that. + * Problem is in this engine in database configuration still set. + */ + if ($engine && Mage::getConfig()->getResourceModelClassName($engine)) { + $model = Mage::getResourceSingleton($engine); + if ($model && $model->test()) { + return $model; + } + } + return Mage::getResourceSingleton('catalogsearch/fulltext_engine'); + } } diff --git a/app/code/core/Mage/CatalogSearch/Model/Advanced.php b/app/code/core/Mage/CatalogSearch/Model/Advanced.php index 0f574792ec..96e5477658 100644 --- a/app/code/core/Mage/CatalogSearch/Model/Advanced.php +++ b/app/code/core/Mage/CatalogSearch/Model/Advanced.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -167,7 +167,7 @@ public function addFilters($values) if ($allConditions) { $this->getProductCollection()->addFieldsToFilter($allConditions); } else if (!$hasConditions) { - Mage::throwException(Mage::helper('catalogsearch')->__('You have to specify at least one search term')); + Mage::throwException(Mage::helper('catalogsearch')->__('Please specify at least one search term.')); } return $this; diff --git a/app/code/core/Mage/CatalogSearch/Model/Fulltext.php b/app/code/core/Mage/CatalogSearch/Model/Fulltext.php index a0d64bafa7..424a328632 100644 --- a/app/code/core/Mage/CatalogSearch/Model/Fulltext.php +++ b/app/code/core/Mage/CatalogSearch/Model/Fulltext.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/Model/Fulltext/Observer.php b/app/code/core/Mage/CatalogSearch/Model/Fulltext/Observer.php index 0aa543413d..c65188a192 100644 --- a/app/code/core/Mage/CatalogSearch/Model/Fulltext/Observer.php +++ b/app/code/core/Mage/CatalogSearch/Model/Fulltext/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -112,7 +112,7 @@ public function eavAttributeChange(Varien_Event_Observer $observer) if ($showNotice) { $url = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/system_cache'); Mage::getSingleton('adminhtml/session')->addNotice( - Mage::helper('catalogsearch')->__('Attribute setting change related with Search Index. Please run Rebuild Search Index process', $url) + Mage::helper('catalogsearch')->__('Attribute setting change related with Search Index. Please run Rebuild Search Index process.', $url) ); } diff --git a/app/code/core/Mage/CatalogSearch/Model/Indexer/Fulltext.php b/app/code/core/Mage/CatalogSearch/Model/Indexer/Fulltext.php index b0b5d1c537..19a04d8c59 100644 --- a/app/code/core/Mage/CatalogSearch/Model/Indexer/Fulltext.php +++ b/app/code/core/Mage/CatalogSearch/Model/Indexer/Fulltext.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/Model/Layer.php b/app/code/core/Mage/CatalogSearch/Model/Layer.php index 0a52eb3ee4..98e9d8f6f8 100644 --- a/app/code/core/Mage/CatalogSearch/Model/Layer.php +++ b/app/code/core/Mage/CatalogSearch/Model/Layer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -39,7 +39,8 @@ public function getProductCollection() $collection = $this->_productCollections[$this->getCurrentCategory()->getId()]; } else { - $collection = Mage::getResourceModel('catalogsearch/fulltext_collection'); + $engine = Mage::helper('catalogsearch')->getEngine(); + $collection = $engine->getResultCollection(); $this->prepareProductCollection($collection); $this->_productCollections[$this->getCurrentCategory()->getId()] = $collection; } diff --git a/app/code/core/Mage/CatalogSearch/Model/Layer/Filter/Attribute.php b/app/code/core/Mage/CatalogSearch/Model/Layer/Filter/Attribute.php index 1c9988feb7..e749fe95ef 100644 --- a/app/code/core/Mage/CatalogSearch/Model/Layer/Filter/Attribute.php +++ b/app/code/core/Mage/CatalogSearch/Model/Layer/Filter/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/Model/Mysql4/Advanced.php b/app/code/core/Mage/CatalogSearch/Model/Mysql4/Advanced.php index eec025b49b..8c350bc1b6 100644 --- a/app/code/core/Mage/CatalogSearch/Model/Mysql4/Advanced.php +++ b/app/code/core/Mage/CatalogSearch/Model/Mysql4/Advanced.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -134,9 +134,6 @@ public function addIndexableAttributeFilter($object, $attribute, $value) if (is_string($value) && strlen($value) == 0) { return false; } - if (is_array($value) && (isset($value['from']) || isset($value['to']))) { - return false; - } if ($attribute->getIndexType() == 'decimal') { $table = $this->getTable('catalog/product_index_eav_decimal'); @@ -155,6 +152,17 @@ public function addIndexableAttributeFilter($object, $attribute, $value) . " AND {$tableAlias}.store_id={$storeId}", array() ); + + if (is_array($value) && (isset($value['from']) || isset($value['to']))) { + if (isset($value['from']) && !empty($value['from'])) { + $select->where("{$tableAlias}.`value` >= ?", $value['from']); + } + if (isset($value['to']) && !empty($value['to'])) { + $select->where("{$tableAlias}.`value` <= ?", $value['to']); + } + return true; + } + $select->where("{$tableAlias}.`value` IN(?)", $value); return true; diff --git a/app/code/core/Mage/CatalogSearch/Model/Mysql4/Advanced/Collection.php b/app/code/core/Mage/CatalogSearch/Model/Mysql4/Advanced/Collection.php index c8e633f9aa..ece0d54f3e 100644 --- a/app/code/core/Mage/CatalogSearch/Model/Mysql4/Advanced/Collection.php +++ b/app/code/core/Mage/CatalogSearch/Model/Mysql4/Advanced/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext.php b/app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext.php index 5e2efe3397..4b430e5118 100644 --- a/app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext.php +++ b/app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -61,12 +61,19 @@ class Mage_CatalogSearch_Model_Mysql4_Fulltext extends Mage_Core_Model_Mysql4_Ab */ protected $_productTypes = array(); + /** + * Store search engine instance + * @var object + */ + protected $_engine = null; + /** * Init resource model */ protected function _construct() { $this->_init('catalogsearch/fulltext', 'product_id'); + $this->_engine = Mage::helper('catalogsearch')->getEngine(); } /** @@ -198,6 +205,11 @@ protected function _getSearchableProducts($storeId, array $staticFields, $produc array('website' => $this->getTable('catalog/product_website')), $this->_getWriteAdapter()->quoteInto('website.product_id=e.entity_id AND website.website_id=?', $store->getWebsiteId()), array() + ) + ->join( + array('stock_status' => $this->getTable('cataloginventory/stock_status')), + $this->_getWriteAdapter()->quoteInto('stock_status.product_id=e.entity_id AND stock_status.website_id=?', $store->getWebsiteId()), + array('in_stock' => 'stock_status') ); if (!is_null($productIds)) { @@ -243,16 +255,9 @@ public function resetSearchResults() */ public function cleanIndex($storeId = null, $productId = null) { - $where = array(); - - if (!is_null($storeId)) { - $where[] = $this->_getWriteAdapter()->quoteInto('store_id=?', $storeId); - } - if (!is_null($productId)) { - $where[] = $this->_getWriteAdapter()->quoteInto('product_id IN(?)', $productId); + if ($this->_engine) { + $this->_engine->cleanIndex($storeId, $productId); } - - $this->_getWriteAdapter()->delete($this->getMainTable(), join(' AND ', $where)); return $this; } @@ -516,14 +521,37 @@ protected function _prepareProductIndex($indexData, $productData, $storeId) foreach ($this->_getSearchableAttributes('static') as $attribute) { if (isset($productData[$attribute->getAttributeCode()])) { if ($value = $this->_getAttributeValue($attribute->getId(), $productData[$attribute->getAttributeCode()], $storeId)) { - $index[] = $value; + + //For grouped products + if (isset($index[$attribute->getAttributeCode()])) { + if (!is_array($index[$attribute->getAttributeCode()])) { + $index[$attribute->getAttributeCode()] = array($index[$attribute->getAttributeCode()]); + } + $index[$attribute->getAttributeCode()][] = $value; + } + //For other types of products + else { + $index[$attribute->getAttributeCode()] = $value; + } } } } foreach ($indexData as $attributeData) { foreach ($attributeData as $attributeId => $attributeValue) { if ($value = $this->_getAttributeValue($attributeId, $attributeValue, $storeId)) { - $index[] = $value; + $code = $this->_getSearchableAttribute($attributeId)->getAttributeCode(); + + //For grouped products + if (isset($index[$code])) { + if (!is_array($index[$code])) { + $index[$code] = array($index[$code]); + } + $index[$code][] = $value; + } + //For other types of products + else { + $index[$code] = $value; + } } } } @@ -534,10 +562,17 @@ protected function _prepareProductIndex($indexData, $productData, $storeId) ->setStoreId($storeId); $typeInstance = $this->_getProductTypeInstance($productData['type_id']); if ($data = $typeInstance->getSearchableData($product)) { - $index = array_merge($index, $data); + $index['options'] = $data; } - return join($this->_separator, $index); + if (isset($productData['in_stock'])) { + $index['in_stock'] = $productData['in_stock']; + } + + if ($this->_engine) { + return $this->_engine->prepareEntityIndex($index, $this->_separator); + } + return Mage::helper('catalogsearch')->prepareIndexdata($index, $this->_separator); } /** @@ -581,11 +616,9 @@ protected function _getAttributeValue($attributeId, $value, $storeId) */ protected function _saveProductIndex($productId, $storeId, $index) { - $this->_getWriteAdapter()->insert($this->getMainTable(), array( - 'product_id' => $productId, - 'store_id' => $storeId, - 'data_index' => $index - )); + if ($this->_engine) { + $this->_engine->saveEntityIndex($productId, $storeId, $index); + } return $this; } @@ -598,21 +631,9 @@ protected function _saveProductIndex($productId, $storeId, $index) */ protected function _saveProductIndexes($storeId, $productIndexes) { - $adapter = $this->_getWriteAdapter(); - $data = array(); - $storeId = (int)$storeId; - foreach ($productIndexes as $productId => &$index) { - $data[] = array( - 'product_id' => (int)$productId, - 'store_id' => $storeId, - 'data_index' => $index - ); + if ($this->_engine) { + $this->_engine->saveEntityIndexes($storeId, $productIndexes); } - - if ($data) { - $adapter->insertOnDuplicate($this->getMainTable(), $data, array('data_index')); - } - return $this; } diff --git a/app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext/Collection.php b/app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext/Collection.php index dd27e6ebb2..c90826a2a9 100644 --- a/app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext/Collection.php +++ b/app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -41,7 +41,7 @@ protected function _getQuery() /** * Add search query filter * - * @param Mage_CatalogSearch_Model_Query $query + * @param string $query * @return Mage_CatalogSearch_Model_Mysql4_Search_Collection */ public function addSearchFilter($query) @@ -67,7 +67,7 @@ public function addSearchFilter($query) * @param string $dir * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection */ - public function setOrder($attribute, $dir='desc') + public function setOrder($attribute, $dir = 'desc') { if ($attribute == 'relevance') { $this->getSelect()->order("relevance {$dir}"); diff --git a/app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext/Engine.php b/app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext/Engine.php new file mode 100644 index 0000000000..81d8eb2b97 --- /dev/null +++ b/app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext/Engine.php @@ -0,0 +1,157 @@ + + */ +class Mage_CatalogSearch_Model_Mysql4_Fulltext_Engine extends Mage_Core_Model_Mysql4_Abstract +{ + /** + * Init resource model + * + */ + protected function _construct() + { + $this->_init('catalogsearch/fulltext', 'product_id'); + } + + /** + * Add entity data to fulltext search table + * + * @param int $entityId + * @param int $storeId + * @param array $index + * @param string $entity 'product'|'cms' + * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Engine + */ + public function saveEntityIndex($entityId, $storeId, $index, $entity = 'product') + { + $this->_getWriteAdapter()->insert($this->getMainTable(), array( + 'product_id' => $entityId, + 'store_id' => $storeId, + 'data_index' => $index + )); + return $this; + } + + /** + * Multi add entities data to fulltext search table + * + * @param int $storeId + * @param array $entityIndexes + * @param string $entity 'product'|'cms' + * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Engine + */ + public function saveEntityIndexes($storeId, $entityIndexes, $entity = 'product') + { + $adapter = $this->_getWriteAdapter(); + $data = array(); + $storeId = (int)$storeId; + foreach ($entityIndexes as $entityId => &$index) { + $data[] = array( + 'product_id' => (int)$entityId, + 'store_id' => $storeId, + 'data_index' => $index + ); + } + + if ($data) { + $adapter->insertOnDuplicate($this->getMainTable(), $data, array('data_index')); + } + + return $this; + } + + /** + * Remove entity data from fulltext search table + * + * @param int $storeId + * @param int $entityId + * @param string $entity 'product'|'cms' + * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Engine + */ + public function cleanIndex($storeId = null, $entityId = null, $entity = 'product') + { + $where = array(); + + if (!is_null($storeId)) { + $where[] = $this->_getWriteAdapter()->quoteInto('store_id=?', $storeId); + } + if (!is_null($entityId)) { + $where[] = $this->_getWriteAdapter()->quoteInto('product_id IN(?)', $entityId); + } + + $this->_getWriteAdapter()->delete($this->getMainTable(), join(' AND ', $where)); + + return $this; + } + + /** + * Prepare index array as a string glued by separator + * + * @param array $index + * @param string $separator + * @return string + */ + public function prepareEntityIndex($index, $separator = ' ') + { + return Mage::helper('catalogsearch')->prepareIndexdata($index, $separator); + } + + /** + * Retrieve fulltext search result data collection + * + * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection + */ + public function getResultCollection() + { + return Mage::getResourceModel('catalogsearch/fulltext_collection'); + } + + /** + * Define if Layered Navigation is allowed + * + * @return bool + */ + public function isLeyeredNavigationAllowed() + { + return true; + } + + /** + * Define if engine is avaliable + * + * @return bool + */ + public function test() + { + return true; + } +} diff --git a/app/code/core/Mage/CatalogSearch/Model/Mysql4/Query.php b/app/code/core/Mage/CatalogSearch/Model/Mysql4/Query.php index 1dcaafae3f..8e39cfb57d 100644 --- a/app/code/core/Mage/CatalogSearch/Model/Mysql4/Query.php +++ b/app/code/core/Mage/CatalogSearch/Model/Mysql4/Query.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/Model/Mysql4/Query/Collection.php b/app/code/core/Mage/CatalogSearch/Model/Mysql4/Query/Collection.php index 50636c2b08..3539033d1a 100644 --- a/app/code/core/Mage/CatalogSearch/Model/Mysql4/Query/Collection.php +++ b/app/code/core/Mage/CatalogSearch/Model/Mysql4/Query/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/Model/Mysql4/Search/Collection.php b/app/code/core/Mage/CatalogSearch/Model/Mysql4/Search/Collection.php index 8cba764a7a..1fcdbd7d76 100644 --- a/app/code/core/Mage/CatalogSearch/Model/Mysql4/Search/Collection.php +++ b/app/code/core/Mage/CatalogSearch/Model/Mysql4/Search/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/Model/Query.php b/app/code/core/Mage/CatalogSearch/Model/Query.php index 6fa443d0c4..378208c9da 100644 --- a/app/code/core/Mage/CatalogSearch/Model/Query.php +++ b/app/code/core/Mage/CatalogSearch/Model/Query.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -112,7 +112,7 @@ public function loadByQuery($text) } /** - * Load Query object only by query text (skip 'synonym for') + * Load Query object only by query text (skip 'synonym For') * * @param string $text * @return Mage_CatalogSearch_Model_Query diff --git a/app/code/core/Mage/CatalogSearch/Model/Session.php b/app/code/core/Mage/CatalogSearch/Model/Session.php index 32ea0be09d..c5fde29305 100644 --- a/app/code/core/Mage/CatalogSearch/Model/Session.php +++ b/app/code/core/Mage/CatalogSearch/Model/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/Model/System/Config/Backend/Sitemap.php b/app/code/core/Mage/CatalogSearch/Model/System/Config/Backend/Sitemap.php index 6fca5efb7e..69f838580e 100644 --- a/app/code/core/Mage/CatalogSearch/Model/System/Config/Backend/Sitemap.php +++ b/app/code/core/Mage/CatalogSearch/Model/System/Config/Backend/Sitemap.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/controllers/AdvancedController.php b/app/code/core/Mage/CatalogSearch/controllers/AdvancedController.php index a8c96500bc..cea25bee44 100644 --- a/app/code/core/Mage/CatalogSearch/controllers/AdvancedController.php +++ b/app/code/core/Mage/CatalogSearch/controllers/AdvancedController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/controllers/AjaxController.php b/app/code/core/Mage/CatalogSearch/controllers/AjaxController.php index ac6614231a..9150100679 100644 --- a/app/code/core/Mage/CatalogSearch/controllers/AjaxController.php +++ b/app/code/core/Mage/CatalogSearch/controllers/AjaxController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/controllers/ResultController.php b/app/code/core/Mage/CatalogSearch/controllers/ResultController.php index e1c60c98d9..210664efed 100644 --- a/app/code/core/Mage/CatalogSearch/controllers/ResultController.php +++ b/app/code/core/Mage/CatalogSearch/controllers/ResultController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/controllers/TermController.php b/app/code/core/Mage/CatalogSearch/controllers/TermController.php index ae62544be2..70fb661a73 100644 --- a/app/code/core/Mage/CatalogSearch/controllers/TermController.php +++ b/app/code/core/Mage/CatalogSearch/controllers/TermController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/etc/adminhtml.xml b/app/code/core/Mage/CatalogSearch/etc/adminhtml.xml index a03efee663..1765d7265c 100644 --- a/app/code/core/Mage/CatalogSearch/etc/adminhtml.xml +++ b/app/code/core/Mage/CatalogSearch/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/CatalogSearch/etc/config.xml b/app/code/core/Mage/CatalogSearch/etc/config.xml index 77188de172..5d2af0ad3d 100644 --- a/app/code/core/Mage/CatalogSearch/etc/config.xml +++ b/app/code/core/Mage/CatalogSearch/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/CatalogSearch/etc/system.xml b/app/code/core/Mage/CatalogSearch/etc/system.xml index 6b72e4fc5f..1a7516e862 100644 --- a/app/code/core/Mage/CatalogSearch/etc/system.xml +++ b/app/code/core/Mage/CatalogSearch/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -32,7 +32,7 @@ - + select adminhtml/system_config_source_enabledisable 1 @@ -41,7 +41,7 @@ 1 - + select adminhtml/system_config_source_enabledisable catalogsearch/system_config_backend_sitemap @@ -63,7 +63,7 @@ text - 1 + 5 1 1 1 @@ -71,7 +71,7 @@ text - 2 + 10 1 1 1 @@ -79,30 +79,30 @@ text - 3 + 15 1 1 1 - Applies for "Like" Search type only + Applies for "Like" search type only. select adminhtml/system_config_backend_catalog_search_type adminhtml/system_config_source_catalog_search_type - 4 + 20 1 1 1 - + text - 5 + 25 1 1 1 - Please enter "0" to enable layered navigation for any number of results + Enter "0" to enable layered navigation for any number of results. diff --git a/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-install-0.7.0.php index 30432b4ce2..ba1bb34093 100644 --- a/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.1-0.7.2.php index d1d565a982..2644f44c2c 100644 --- a/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.2-0.7.3.php index cc7be61202..0f439760a4 100644 --- a/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.2-0.7.3.php +++ b/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.2-0.7.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.3-0.7.4.php b/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.3-0.7.4.php index 515ec6c675..0cecbaa184 100644 --- a/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.3-0.7.4.php +++ b/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.3-0.7.4.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.4-0.7.5.php b/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.4-0.7.5.php index fb6c828afe..543c083d44 100644 --- a/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.4-0.7.5.php +++ b/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.4-0.7.5.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.5-0.7.6.php b/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.5-0.7.6.php index bda7c4f263..2f3c5bbb3d 100644 --- a/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.5-0.7.6.php +++ b/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.5-0.7.6.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.6-0.7.7.php b/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.6-0.7.7.php index 38aa3480f0..d363b67ffa 100644 --- a/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.6-0.7.7.php +++ b/app/code/core/Mage/CatalogSearch/sql/catalogsearch_setup/mysql4-upgrade-0.7.6-0.7.7.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_CatalogSearch - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Centinel/Block/Adminhtml/Validation.php b/app/code/core/Mage/Centinel/Block/Adminhtml/Validation.php index 60f0cbf1b3..3fa54fdeb2 100644 --- a/app/code/core/Mage/Centinel/Block/Adminhtml/Validation.php +++ b/app/code/core/Mage/Centinel/Block/Adminhtml/Validation.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Centinel/Block/Adminhtml/Validation/Form.php b/app/code/core/Mage/Centinel/Block/Adminhtml/Validation/Form.php index 2479b86da0..da9c55c57f 100644 --- a/app/code/core/Mage/Centinel/Block/Adminhtml/Validation/Form.php +++ b/app/code/core/Mage/Centinel/Block/Adminhtml/Validation/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Centinel/Block/Authentication.php b/app/code/core/Mage/Centinel/Block/Authentication.php index c75363ab40..cb275d1c27 100644 --- a/app/code/core/Mage/Centinel/Block/Authentication.php +++ b/app/code/core/Mage/Centinel/Block/Authentication.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,6 +29,43 @@ */ class Mage_Centinel_Block_Authentication extends Mage_Core_Block_Template { + /** + * Strage for identifiers of related blocks + * + * @var array + */ + protected $_relatedBlocks = array(); + + /** + * Flag - authentication start mode + * @see self::setAuthenticationStartMode + * + * @var bool + */ + protected $_authenticationStartMode = false; + + /** + * Add identifier of related block + * + * @param string $blockId + * @return Mage_Centinel_Block_Authentication + */ + public function addRelatedBlock($blockId) + { + $this->_relatedBlocks[] = $blockId; + return $this; + } + + /** + * Return identifiers of related blocks + * + * @return array + */ + public function getRelatedBlocks() + { + return $this->_relatedBlocks; + } + /** * Check whether authentication is required and prepare some template data * @@ -37,14 +74,14 @@ class Mage_Centinel_Block_Authentication extends Mage_Core_Block_Template protected function _toHtml() { $method = Mage::getSingleton('checkout/session')->getQuote()->getPayment()->getMethodInstance(); - if (!$method->getIsCentinelValidationEnabled()) { - return ''; - } - $centinel = $method->getCentinelValidator(); - if ($centinel && $centinel->shouldAuthenticate()) { - $this->setFrameUrl($centinel->getAuthenticationStartUrl()); - return parent::_toHtml(); + if ($method->getIsCentinelValidationEnabled()) { + $centinel = $method->getCentinelValidator(); + if ($centinel && $centinel->shouldAuthenticate()) { + $this->setAuthenticationStart(true); + $this->setFrameUrl($centinel->getAuthenticationStartUrl()); + return parent::_toHtml(); + } } - return ''; + return parent::_toHtml(); } } diff --git a/app/code/core/Mage/Centinel/Block/Authentication/Complete.php b/app/code/core/Mage/Centinel/Block/Authentication/Complete.php index e67227e6bb..94c099a8d8 100644 --- a/app/code/core/Mage/Centinel/Block/Authentication/Complete.php +++ b/app/code/core/Mage/Centinel/Block/Authentication/Complete.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -37,11 +37,11 @@ class Mage_Centinel_Block_Authentication_Complete extends Mage_Core_Block_Templa */ protected function _toHtml() { - $validator = Mage::registry('centinel_validator'); - if (!$validator) { - return ''; + $validator = Mage::registry('current_centinel_validator'); + if ($validator) { + $this->setIsProcessed(true); + $this->setIsSuccess($validator->isAuthenticateSuccessful()); } - $this->setIsSuccess($validator->isAuthenticateSuccessful()); return parent::_toHtml(); } } diff --git a/app/code/core/Mage/Centinel/Block/Authentication/Start.php b/app/code/core/Mage/Centinel/Block/Authentication/Start.php index 218edb4fb0..6c7e833ec5 100644 --- a/app/code/core/Mage/Centinel/Block/Authentication/Start.php +++ b/app/code/core/Mage/Centinel/Block/Authentication/Start.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -37,9 +37,9 @@ class Mage_Centinel_Block_Authentication_Start extends Mage_Core_Block_Template */ protected function _toHtml() { - $validator = Mage::registry('centinel_validator'); + $validator = Mage::registry('current_centinel_validator'); if ($validator && $validator->shouldAuthenticate()) { - $this->setData($validator->getAuthenticateStartData()); + $this->addData($validator->getAuthenticateStartData()); return parent::_toHtml(); } return ''; diff --git a/app/code/core/Mage/Centinel/Block/Logo.php b/app/code/core/Mage/Centinel/Block/Logo.php index 7b66acbe6b..b712eb2d03 100644 --- a/app/code/core/Mage/Centinel/Block/Logo.php +++ b/app/code/core/Mage/Centinel/Block/Logo.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Centinel/Helper/Data.php b/app/code/core/Mage/Centinel/Helper/Data.php index 0783c6ad7b..a46235345d 100644 --- a/app/code/core/Mage/Centinel/Helper/Data.php +++ b/app/code/core/Mage/Centinel/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -140,10 +140,10 @@ private function _getCmpiParesValue($value) } /** - * Enter description here... + * Return centinel block for payment form with logos * - * @param unknown_type $method - * @return unknown + * @param Mage_Payment_Model_Method_Abstract $method + * @return Mage_Centinel_Block_Logo */ public function getMethodFormBlock($method) { diff --git a/app/code/core/Mage/Centinel/Model/Api.php b/app/code/core/Mage/Centinel/Model/Api.php index 6f11457987..c8ed33c65b 100644 --- a/app/code/core/Mage/Centinel/Model/Api.php +++ b/app/code/core/Mage/Centinel/Model/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -34,6 +34,13 @@ */ class Mage_Centinel_Model_Api extends Varien_Object { + /** + * Fields that should be replaced in debug with '***' + * + * @var array + */ + protected $_debugReplacePrivateDataKeys = array('TransactionPwd', 'CardNumber', 'CardExpMonth', 'CardExpYear'); + protected static $_iso4217Currencies = array( 'AED' => '784', 'AFN' => '971', 'ALL' => '008', 'AMD' => '051', 'ANG' => '532', 'AOA' => '973', 'ARS' => '032', 'AUD' => '036', 'AWG' => '533', @@ -142,10 +149,23 @@ protected function _call($method, $data) 'TransactionPwd' => $this->getTransactionPwd(), 'TransactionType' => $this->_getTransactionType(), ), $data); - foreach($request as $key => $val) { - $client->add($key, $val); + + $debugData = array('request' => $request); + + try { + foreach($request as $key => $val) { + $client->add($key, $val); + } + $client->sendHttp($this->_getApiEndpointUrl(), $this->_getTimeoutConnect(), $this->_getTimeoutRead()); + } catch (Exception $e) { + $debugData['response'] = array('error' => $e->getMessage(), 'code' => $e->getCode()); + $this->_debug($debugData); + throw $e; } - $client->sendHttp($this->_getApiEndpointUrl(), $this->_getTimeoutConnect(), $this->_getTimeoutRead()); + + $debugData['response'] = $client->response; + $this->_debug($debugData); + return $client; } @@ -181,7 +201,7 @@ public function callLookup($data) $currencyNumber = isset(self::$_iso4217Currencies[$currencyCode]) ? self::$_iso4217Currencies[$currencyCode] : ''; if (!$currencyNumber) { return $result->setErrorNo(1)->setErrorDesc( - Mage::helper('payment')->__('Not supported currency code %s.', $currencyCode) + Mage::helper('payment')->__('Unsupported currency code: %s.', $currencyCode) ); } @@ -201,6 +221,7 @@ public function callLookup($data) $result->setAcsUrl($clientResponse->getValue('ACSUrl')); $result->setPayload($clientResponse->getValue('Payload')); $result->setEciFlag($clientResponse->getValue('EciFlag')); + return $result; } @@ -225,7 +246,22 @@ public function callAuthentication($data) $result->setCavv($clientResponse->getValue('Cavv')); $result->setEciFlag($clientResponse->getValue('EciFlag')); $result->setXid($clientResponse->getValue('Xid')); + return $result; } + + /** + * Log debug data to file + * + * @param mixed $debugData + */ + protected function _debug($debugData) + { + if ($this->getDebugFlag()) { + Mage::getModel('core/log_adapter', 'card_validation_3d_secure.log') + ->setFilterDataKeys($this->_debugReplacePrivateDataKeys) + ->log($debugData); + } + } } diff --git a/app/code/core/Mage/Centinel/Model/Config.php b/app/code/core/Mage/Centinel/Model/Config.php index e1c189299c..7aab7bfbaa 100644 --- a/app/code/core/Mage/Centinel/Model/Config.php +++ b/app/code/core/Mage/Centinel/Model/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -137,4 +137,14 @@ private function _getServiceConfigValue($key) { return Mage::getStoreConfig($this->_serviceConfigPath . '/' . $key, $this->getStore()); } + + /** + * Define if debugging is enabled + * + * @return bool + */ + public function getDebugFlag() + { + return $this->_getServiceConfigValue('debug'); + } } diff --git a/app/code/core/Mage/Centinel/Model/Observer.php b/app/code/core/Mage/Centinel/Model/Observer.php index b2237e0ee9..ea2a1ddcaf 100644 --- a/app/code/core/Mage/Centinel/Model/Observer.php +++ b/app/code/core/Mage/Centinel/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -95,11 +95,26 @@ public function paymentFormBlockToHtmlBefore($observer) if ($method && $method->getIsCentinelValidationEnabled()) { $paymentFormBlock->setChild( - 'payment.method.'.$method->getCode().'centinel.logo', + 'payment.method.' . $method->getCode() . 'centinel.logo', Mage::helper('centinel')->getMethodFormBlock($method) ); } return $this; } -} + /** + * Reset validation data + * + * @param Varien_Object $observer + * @return Mage_Centinel_Model_Observer + */ + public function salesOrderPaymentPlaceEnd($observer) + { + $payment = $observer->getEvent()->getPayment(); + $method = $payment->getMethodInstance(); + if ($method && $method->getIsCentinelValidationEnabled()) { + $method->getCentinelValidator()->reset(); + } + return $this; + } +} diff --git a/app/code/core/Mage/Centinel/Model/Service.php b/app/code/core/Mage/Centinel/Model/Service.php index b393b0c2b5..2483a0ad0c 100644 --- a/app/code/core/Mage/Centinel/Model/Service.php +++ b/app/code/core/Mage/Centinel/Model/Service.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -32,8 +32,8 @@ class Mage_Centinel_Model_Service extends Varien_Object /** * Cmpi public keys */ - const CMPI_PARES = 'centinel_mpivendor'; - const CMPI_ENROLLED = 'centinel_authstatus'; + const CMPI_PARES = 'centinel_authstatus'; + const CMPI_ENROLLED = 'centinel_mpivendor'; const CMPI_CAVV = 'centinel_cavv'; const CMPI_ECI = 'centinel_eci'; const CMPI_XID = 'centinel_xid'; @@ -116,7 +116,8 @@ private function _getUrl($suffix, $current = false) $params = array( '_secure' => true, '_current' => $current, - 'form_key' => Mage::getSingleton('core/session')->getFormKey() + 'form_key' => Mage::getSingleton('core/session')->getFormKey(), + 'isIframe' => true ); if (Mage::app()->getStore()->isAdmin()) { return Mage::getSingleton('adminhtml/url')->getUrl('*/centinel_index/' . $suffix, $params); @@ -143,6 +144,7 @@ protected function _getApi() ->setMerchantId($config->getMerchantId()) ->setTransactionPwd($config->getTransactionPwd()) ->setIsTestMode($config->getIsTestMode()) + ->setDebugFlag($config->getDebugFlag()) ->setApiEndpointUrl($this->getCustomApiEndpointUrl()); return $this->_api; } @@ -298,6 +300,18 @@ public function validate($data) } } + /** + * Reset validation state and drop api object + * + * @return Mage_Centinel_Model_Service + */ + public function reset() + { + $this->_resetValidationState(); + $this->_api = null; + return $this; + } + /** * Return URL for authentication * diff --git a/app/code/core/Mage/Centinel/Model/Session.php b/app/code/core/Mage/Centinel/Model/Session.php index 36bface825..db55720e3d 100644 --- a/app/code/core/Mage/Centinel/Model/Session.php +++ b/app/code/core/Mage/Centinel/Model/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Centinel/Model/State/Jcb.php b/app/code/core/Mage/Centinel/Model/State/Jcb.php new file mode 100644 index 0000000000..a07eea9b28 --- /dev/null +++ b/app/code/core/Mage/Centinel/Model/State/Jcb.php @@ -0,0 +1,180 @@ +_isLookupStrictSuccessful() || $this->_isLookupSoftSuccessful()) { + return true; + } else { + return false; + } + } + + /** + * Analyse lookup`s results. If it has require params for authenticate, return true + * + * @return bool + */ + public function isAuthenticateAllowed() + { + return $this->_isLookupStrictSuccessful() && is_null($this->getAuthenticateEciFlag()); + } + + /** + * Analyse authenticate`s results. If authenticate is successful return true and false if it failure + * Result depends from flag self::getIsModeStrict() + * + * @return bool + */ + public function isAuthenticateSuccessful() + { + //Test cases 5-9 + if ($this->_isLookupSoftSuccessful()) { + return true; + } + + $paResStatus = $this->getAuthenticatePaResStatus(); + $eciFlag = $this->getAuthenticateEciFlag(); + $xid = $this->getAuthenticateXid(); + $cavv = $this->getAuthenticateCavv(); + $errorNo = $this->getAuthenticateErrorNo(); + $signatureVerification = $this->getAuthenticateSignatureVerification(); + + //Test cases 1-4, 10-11 + if ($this->_isLookupStrictSuccessful()) { + + if ($paResStatus == 'Y' && $eciFlag == '05' && $xid != '' && $cavv != '' && $errorNo == '0') { + //Test case 1 + if ($signatureVerification == 'Y') { + return true; + } + //Test case 2 + if ($signatureVerification == 'N') { + return false; + } + } + + //Test case 3 + if ($paResStatus == 'N' && $signatureVerification == 'Y' && $eciFlag == '07' && + $xid != '' && $cavv == '' && $errorNo == '0') { + return false; + } + + //Test case 4 + if ($paResStatus == 'U' && $signatureVerification == 'Y' && $eciFlag == '07' && + $xid != '' && $cavv == '' && $errorNo == '0') { + if ($this->getIsModeStrict()) { + return false; + } else { + return true; + } + } + + //Test case 5 + if ($paResStatus == 'U' && $signatureVerification == 'Y' && $eciFlag == '07' && + $xid != '' && $cavv == '' && $errorNo == '') { + if ($this->getIsModeStrict()) { + return false; + } else { + return true; + } + } + + //Test case 10 + if ($paResStatus == '' && $signatureVerification == '' && $eciFlag == '07' && + $xid == '' && $cavv == '' && $errorNo != '') { + return false; + } + + //Test case 11 + if ($paResStatus == 'A' && $signatureVerification == 'Y' && $eciFlag == '06' && + $xid != '' && $cavv != '' && $errorNo == '0') { + return true; + } + } + + return false; + } + + /** + * Analyse lookup`s results. If lookup is strict successful return true + * + * @return bool + */ + private function _isLookupStrictSuccessful() + { + //Test cases 1-4, 6, 10-11 + if ($this->getLookupEnrolled() == 'Y' && + $this->getLookupAcsUrl() != '' && + $this->getLookupPayload() != '' && + $this->getLookupErrorNo() == '0') { + return true; + } + return false; + } + + /** + * Analyse lookup`s results. If lookup is soft successful return true + * + * @return bool + */ + private function _isLookupSoftSuccessful() + { + $acsUrl = $this->getLookupAcsUrl(); + $payload = $this->getLookupPayload(); + $errorNo = $this->getLookupErrorNo(); + $enrolled = $this->getLookupEnrolled(); + + //Test cases 5 + if ($enrolled == 'N/A' && $acsUrl == '' && $payload == '' && $errorNo == '0') { + return true; + } + + //Test case 7 + if ($enrolled == 'U' && $acsUrl == '' && $payload == '' && $errorNo == '0') { + return true; + } + + //Test cases 8,9 + if ($enrolled == '' && $acsUrl == '' && $payload == '' && $errorNo != '') { + return true; + } + + return false; + } + +} diff --git a/app/code/core/Mage/Centinel/Model/State/Mastercard.php b/app/code/core/Mage/Centinel/Model/State/Mastercard.php index c4c882e3c4..0f4e1d9764 100644 --- a/app/code/core/Mage/Centinel/Model/State/Mastercard.php +++ b/app/code/core/Mage/Centinel/Model/State/Mastercard.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -53,7 +53,7 @@ public function isLookupSuccessful() */ public function isAuthenticateAllowed() { - return $this->_isLookupStrictSuccessful(); + return $this->_isLookupStrictSuccessful() && is_null($this->getAuthenticateEciFlag()); } /** diff --git a/app/code/core/Mage/Centinel/Model/State/Visa.php b/app/code/core/Mage/Centinel/Model/State/Visa.php index 5a7cb3a9fb..8dbf528791 100644 --- a/app/code/core/Mage/Centinel/Model/State/Visa.php +++ b/app/code/core/Mage/Centinel/Model/State/Visa.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,7 +42,7 @@ public function isLookupSuccessful() } elseif (!$this->getIsModeStrict() && $this->_isLookupSoftSuccessful()) { return true; } else { - return false; + return false; } } @@ -53,7 +53,7 @@ public function isLookupSuccessful() */ public function isAuthenticateAllowed() { - return $this->_isLookupStrictSuccessful(); + return $this->_isLookupStrictSuccessful() && is_null($this->getAuthenticateEciFlag()); } /** diff --git a/app/code/core/Mage/Centinel/Model/StateAbstract.php b/app/code/core/Mage/Centinel/Model/StateAbstract.php index 85a0e6cbbf..901330c4ca 100644 --- a/app/code/core/Mage/Centinel/Model/StateAbstract.php +++ b/app/code/core/Mage/Centinel/Model/StateAbstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -64,8 +64,8 @@ public function getDataStorage() * If $key is empty will return all the data as an array * Otherwise it will return value of the attribute specified by $key * - * If $index is specified it will assume that attribute data is an array - * and retrieve corresponding member. + * $index parameter is ignored + * @see Mage_Core_Model_Session_Abstract::getData() * * @param string $key * @param string|int $index @@ -73,7 +73,7 @@ public function getDataStorage() */ public function getData($key='', $index=null) { - return $this->getDataStorage()->getData($key, $index); + return $this->getDataStorage()->getData($key); } /** diff --git a/app/code/core/Mage/Centinel/controllers/Adminhtml/Centinel/IndexController.php b/app/code/core/Mage/Centinel/controllers/Adminhtml/Centinel/IndexController.php index a8b8ac19d2..7e75f7a2db 100644 --- a/app/code/core/Mage/Centinel/controllers/Adminhtml/Centinel/IndexController.php +++ b/app/code/core/Mage/Centinel/controllers/Adminhtml/Centinel/IndexController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -65,7 +65,7 @@ public function validatePaymentDataAction() public function authenticationStartAction() { if ($validator = $this->_getValidator()) { - Mage::register('centinel_validator', $validator); + Mage::register('current_centinel_validator', $validator); } $this->loadLayout()->renderLayout(); } @@ -76,15 +76,19 @@ public function authenticationStartAction() */ public function authenticationCompleteAction() { - if ($validator = $this->_getValidator()) { - $request = $this->getRequest(); + try { + if ($validator = $this->_getValidator()) { + $request = $this->getRequest(); - $data = new Varien_Object(); - $data->setTransactionId($request->getParam('MD')); - $data->setPaResPayload($request->getParam('PaRes')); + $data = new Varien_Object(); + $data->setTransactionId($request->getParam('MD')); + $data->setPaResPayload($request->getParam('PaRes')); - $validator->authenticate($data); - Mage::register('centinel_validator', $validator); + $validator->authenticate($data); + Mage::register('current_centinel_validator', $validator); + } + } catch (Exception $e) { + Mage::register('current_centinel_validator', false); } $this->loadLayout()->renderLayout(); } diff --git a/app/code/core/Mage/Centinel/controllers/IndexController.php b/app/code/core/Mage/Centinel/controllers/IndexController.php index ced32316ec..21fa5f92d0 100644 --- a/app/code/core/Mage/Centinel/controllers/IndexController.php +++ b/app/code/core/Mage/Centinel/controllers/IndexController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -37,7 +37,7 @@ class Mage_Centinel_IndexController extends Mage_Core_Controller_Front_Action public function authenticationStartAction() { if ($validator = $this->_getValidator()) { - Mage::register('centinel_validator', $validator); + Mage::register('current_centinel_validator', $validator); } $this->loadLayout()->renderLayout(); } @@ -48,15 +48,19 @@ public function authenticationStartAction() */ public function authenticationCompleteAction() { - if ($validator = $this->_getValidator()) { - $request = $this->getRequest(); + try { + if ($validator = $this->_getValidator()) { + $request = $this->getRequest(); - $data = new Varien_Object(); - $data->setTransactionId($request->getParam('MD')); - $data->setPaResPayload($request->getParam('PaRes')); + $data = new Varien_Object(); + $data->setTransactionId($request->getParam('MD')); + $data->setPaResPayload($request->getParam('PaRes')); - $validator->authenticate($data); - Mage::register('centinel_validator', $validator); + $validator->authenticate($data); + Mage::register('current_centinel_validator', $validator); + } + } catch (Exception $e) { + Mage::register('current_centinel_validator', false); } $this->loadLayout()->renderLayout(); } diff --git a/app/code/core/Mage/Centinel/etc/config.xml b/app/code/core/Mage/Centinel/etc/config.xml index c22eed0556..f868ab4fdb 100644 --- a/app/code/core/Mage/Centinel/etc/config.xml +++ b/app/code/core/Mage/Centinel/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -36,12 +36,19 @@ - model centinel/observer salesEventConvertQuoteToOrder + + + + centinel/observer + salesOrderPaymentPlaceEnd + + + @@ -143,6 +150,20 @@ + + + + centinel/state_jcb + + + + + + + centinel/state_mastercard + + + diff --git a/app/code/core/Mage/Centinel/etc/system.xml b/app/code/core/Mage/Centinel/etc/system.xml index d7dacbca05..a5b6b833e9 100644 --- a/app/code/core/Mage/Centinel/etc/system.xml +++ b/app/code/core/Mage/Centinel/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Centinel - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -71,7 +71,7 @@ - Overrides API URL that may be specified by a Payment Method + Overrides API URL that may be specified by a payment method. select adminhtml/system_config_source_yesno 40 @@ -79,6 +79,15 @@ 1 0 + + + select + adminhtml/system_config_source_yesno + 50 + 1 + 1 + 0 + diff --git a/app/code/core/Mage/Checkout/Block/Agreements.php b/app/code/core/Mage/Checkout/Block/Agreements.php index d8df24b772..9aa2da8159 100644 --- a/app/code/core/Mage/Checkout/Block/Agreements.php +++ b/app/code/core/Mage/Checkout/Block/Agreements.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Checkout_Block_Agreements extends Mage_Core_Block_Template diff --git a/app/code/core/Mage/Checkout/Block/Cart.php b/app/code/core/Mage/Checkout/Block/Cart.php index 1058ed409a..23d76f1463 100644 --- a/app/code/core/Mage/Checkout/Block/Cart.php +++ b/app/code/core/Mage/Checkout/Block/Cart.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -129,4 +129,32 @@ public function getIsVirtual() return $this->helper('checkout/cart')->getIsVirtualQuote(); } + /** + * Return list of available checkout methods + * + * @param string $nameInLayout Container block alias in layout + * @return array + */ + public function getMethods($nameInLayout) + { + if ($this->getChild($nameInLayout) instanceof Mage_Core_Block_Abstract) { + return $this->getChild($nameInLayout)->getSortedChildren(); + } + return array(); + } + + /** + * Return HTML of checkout method (link, button etc.) + * + * @param string $name Block name in layout + * @return string + */ + public function getMethodHtml($name) + { + $block = $this->getLayout()->getBlock($name); + if (!$block) { + Mage::throwException(Mage::helper('checkout')->__('Invalid method: %s', $name)); + } + return $block->toHtml(); + } } diff --git a/app/code/core/Mage/Checkout/Block/Cart/Abstract.php b/app/code/core/Mage/Checkout/Block/Cart/Abstract.php index c8f3c95e88..1bb62a6fd6 100644 --- a/app/code/core/Mage/Checkout/Block/Cart/Abstract.php +++ b/app/code/core/Mage/Checkout/Block/Cart/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Cart/Coupon.php b/app/code/core/Mage/Checkout/Block/Cart/Coupon.php index 8e58c96a9d..83608a3abb 100644 --- a/app/code/core/Mage/Checkout/Block/Cart/Coupon.php +++ b/app/code/core/Mage/Checkout/Block/Cart/Coupon.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Cart/Crosssell.php b/app/code/core/Mage/Checkout/Block/Cart/Crosssell.php index 598230a9b1..0b6c2320ea 100644 --- a/app/code/core/Mage/Checkout/Block/Cart/Crosssell.php +++ b/app/code/core/Mage/Checkout/Block/Cart/Crosssell.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -57,7 +57,7 @@ public function getItems() if (!empty($ninProductIds)) { $collection->addExcludeProductFilter($ninProductIds); } - $collection->load(); + $collection->setPositionOrder()->load(); foreach ($collection as $item) { $ninProductIds[] = $item->getId(); @@ -71,7 +71,7 @@ public function getItems() ->addExcludeProductFilter($ninProductIds) ->setPageSize($this->_maxItemCount-count($items)) ->setGroupBy() - ->setRandomOrder() + ->setPositionOrder() ->load(); foreach ($collection as $item) { $items[] = $item; diff --git a/app/code/core/Mage/Checkout/Block/Cart/Item/Renderer.php b/app/code/core/Mage/Checkout/Block/Cart/Item/Renderer.php index aaa2a00d79..7540749264 100644 --- a/app/code/core/Mage/Checkout/Block/Cart/Item/Renderer.php +++ b/app/code/core/Mage/Checkout/Block/Cart/Item/Renderer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -340,4 +340,14 @@ public function getFormatedOptionValue($optionValue) return $result; } + + /** + * Check whether Product is visible in site + * + * @return bool + */ + public function isProductVisible() + { + return $this->getProduct()->isVisibleInSiteVisibility(); + } } diff --git a/app/code/core/Mage/Checkout/Block/Cart/Item/Renderer/Configurable.php b/app/code/core/Mage/Checkout/Block/Cart/Item/Renderer/Configurable.php index c937faeef7..93b86e16f0 100644 --- a/app/code/core/Mage/Checkout/Block/Cart/Item/Renderer/Configurable.php +++ b/app/code/core/Mage/Checkout/Block/Cart/Item/Renderer/Configurable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Cart/Item/Renderer/Grouped.php b/app/code/core/Mage/Checkout/Block/Cart/Item/Renderer/Grouped.php index 601ab26324..714a23b57f 100644 --- a/app/code/core/Mage/Checkout/Block/Cart/Item/Renderer/Grouped.php +++ b/app/code/core/Mage/Checkout/Block/Cart/Item/Renderer/Grouped.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Cart/Shipping.php b/app/code/core/Mage/Checkout/Block/Cart/Shipping.php index 69df5abee0..f9636e52ba 100644 --- a/app/code/core/Mage/Checkout/Block/Cart/Shipping.php +++ b/app/code/core/Mage/Checkout/Block/Cart/Shipping.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Cart/Sidebar.php b/app/code/core/Mage/Checkout/Block/Cart/Sidebar.php index 052146362a..7d02e4bbd3 100644 --- a/app/code/core/Mage/Checkout/Block/Cart/Sidebar.php +++ b/app/code/core/Mage/Checkout/Block/Cart/Sidebar.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -77,14 +77,10 @@ public function getRecentItems($count = null) } $i = 0; - $storeId = Mage::app()->getStore()->getId(); $allItems = array_reverse($this->getItems()); foreach ($allItems as $item) { /* @var $item Mage_Sales_Model_Quote_Item */ if (!$item->getProduct()->isVisibleInSiteVisibility()) { - if ($item->getStoreId() == $storeId) { - continue; - } $productId = $item->getProduct()->getId(); $products = Mage::getResourceSingleton('catalog/url') ->getRewriteByProductStore(array($productId => $item->getStoreId())); @@ -92,9 +88,6 @@ public function getRecentItems($count = null) continue; } $urlDataObject = new Varien_Object($products[$productId]); - if (!in_array($urlDataObject->getVisibility(), $item->getProduct()->getVisibleInSiteVisibilities())) { - continue; - } $item->getProduct()->setUrlDataObject($urlDataObject); } @@ -225,16 +218,12 @@ public function getCheckoutUrl() } /** - * Render block HTML + * Define if Shopping Cart Sidebar enabled * - * @return string + * @return bool */ - protected function _toHtml() + public function getIsNeedToDisplaySideBar() { - $html = ''; - if ((bool) Mage::app()->getStore()->getConfig('checkout/sidebar/display')) { - $html = parent::_toHtml(); - } - return $html; + return (bool) Mage::app()->getStore()->getConfig('checkout/sidebar/display'); } } diff --git a/app/code/core/Mage/Checkout/Block/Cart/Totals.php b/app/code/core/Mage/Checkout/Block/Cart/Totals.php index d60e54a247..29330ff78f 100644 --- a/app/code/core/Mage/Checkout/Block/Cart/Totals.php +++ b/app/code/core/Mage/Checkout/Block/Cart/Totals.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Links.php b/app/code/core/Mage/Checkout/Block/Links.php index 5ee0fde9ef..88d05c754c 100644 --- a/app/code/core/Mage/Checkout/Block/Links.php +++ b/app/code/core/Mage/Checkout/Block/Links.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Multishipping/Abstract.php b/app/code/core/Mage/Checkout/Block/Multishipping/Abstract.php index 0d1581d8a8..2574b9994e 100644 --- a/app/code/core/Mage/Checkout/Block/Multishipping/Abstract.php +++ b/app/code/core/Mage/Checkout/Block/Multishipping/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Multishipping/Address/Select.php b/app/code/core/Mage/Checkout/Block/Multishipping/Address/Select.php index 3f921a7a1c..b4d628efab 100644 --- a/app/code/core/Mage/Checkout/Block/Multishipping/Address/Select.php +++ b/app/code/core/Mage/Checkout/Block/Multishipping/Address/Select.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Multishipping/Addresses.php b/app/code/core/Mage/Checkout/Block/Multishipping/Addresses.php index 5ca8b95447..4e9f32f3d1 100644 --- a/app/code/core/Mage/Checkout/Block/Multishipping/Addresses.php +++ b/app/code/core/Mage/Checkout/Block/Multishipping/Addresses.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Multishipping/Billing.php b/app/code/core/Mage/Checkout/Block/Multishipping/Billing.php index d03742188d..fbe57e3282 100644 --- a/app/code/core/Mage/Checkout/Block/Multishipping/Billing.php +++ b/app/code/core/Mage/Checkout/Block/Multishipping/Billing.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Multishipping/Billing/Items.php b/app/code/core/Mage/Checkout/Block/Multishipping/Billing/Items.php index a3c04faff8..285d167f31 100644 --- a/app/code/core/Mage/Checkout/Block/Multishipping/Billing/Items.php +++ b/app/code/core/Mage/Checkout/Block/Multishipping/Billing/Items.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Multishipping/Link.php b/app/code/core/Mage/Checkout/Block/Multishipping/Link.php index b311bc85ed..0f2442cebd 100644 --- a/app/code/core/Mage/Checkout/Block/Multishipping/Link.php +++ b/app/code/core/Mage/Checkout/Block/Multishipping/Link.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Multishipping/Overview.php b/app/code/core/Mage/Checkout/Block/Multishipping/Overview.php index ac238a752b..be34c3bc74 100644 --- a/app/code/core/Mage/Checkout/Block/Multishipping/Overview.php +++ b/app/code/core/Mage/Checkout/Block/Multishipping/Overview.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Multishipping/Payment/Info.php b/app/code/core/Mage/Checkout/Block/Multishipping/Payment/Info.php index 247a905e94..6e5ca9f792 100644 --- a/app/code/core/Mage/Checkout/Block/Multishipping/Payment/Info.php +++ b/app/code/core/Mage/Checkout/Block/Multishipping/Payment/Info.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Multishipping/Shipping.php b/app/code/core/Mage/Checkout/Block/Multishipping/Shipping.php index c561346203..c550ca9c0e 100644 --- a/app/code/core/Mage/Checkout/Block/Multishipping/Shipping.php +++ b/app/code/core/Mage/Checkout/Block/Multishipping/Shipping.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Multishipping/State.php b/app/code/core/Mage/Checkout/Block/Multishipping/State.php index 59340a30b5..112ea547aa 100644 --- a/app/code/core/Mage/Checkout/Block/Multishipping/State.php +++ b/app/code/core/Mage/Checkout/Block/Multishipping/State.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Multishipping/Success.php b/app/code/core/Mage/Checkout/Block/Multishipping/Success.php index 81ae413033..c3a4a8913c 100644 --- a/app/code/core/Mage/Checkout/Block/Multishipping/Success.php +++ b/app/code/core/Mage/Checkout/Block/Multishipping/Success.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Onepage.php b/app/code/core/Mage/Checkout/Block/Onepage.php index ac6e140389..b0d533a5e0 100644 --- a/app/code/core/Mage/Checkout/Block/Onepage.php +++ b/app/code/core/Mage/Checkout/Block/Onepage.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Onepage/Abstract.php b/app/code/core/Mage/Checkout/Block/Onepage/Abstract.php index 1566c053e8..9ec61698a4 100644 --- a/app/code/core/Mage/Checkout/Block/Onepage/Abstract.php +++ b/app/code/core/Mage/Checkout/Block/Onepage/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Onepage/Billing.php b/app/code/core/Mage/Checkout/Block/Onepage/Billing.php index d2fdcece66..da2871ccff 100644 --- a/app/code/core/Mage/Checkout/Block/Onepage/Billing.php +++ b/app/code/core/Mage/Checkout/Block/Onepage/Billing.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -66,7 +66,7 @@ public function getMethod() return $this->getQuote()->getCheckoutMethod(); } - function getAddress() { + public function getAddress() { if ($this->isCustomerLoggedIn()) { return $this->getQuote()->getBillingAddress(); } else { diff --git a/app/code/core/Mage/Checkout/Block/Onepage/Failure.php b/app/code/core/Mage/Checkout/Block/Onepage/Failure.php index 1441faafa0..8b0ac94b7f 100644 --- a/app/code/core/Mage/Checkout/Block/Onepage/Failure.php +++ b/app/code/core/Mage/Checkout/Block/Onepage/Failure.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Onepage/Link.php b/app/code/core/Mage/Checkout/Block/Onepage/Link.php index 1fcec09c4b..35798f4331 100644 --- a/app/code/core/Mage/Checkout/Block/Onepage/Link.php +++ b/app/code/core/Mage/Checkout/Block/Onepage/Link.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Onepage/Login.php b/app/code/core/Mage/Checkout/Block/Onepage/Login.php index 1e2a56afc6..b0641eb07e 100644 --- a/app/code/core/Mage/Checkout/Block/Onepage/Login.php +++ b/app/code/core/Mage/Checkout/Block/Onepage/Login.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Onepage/Payment.php b/app/code/core/Mage/Checkout/Block/Onepage/Payment.php index de1d7c7aa9..2d90f4a018 100644 --- a/app/code/core/Mage/Checkout/Block/Onepage/Payment.php +++ b/app/code/core/Mage/Checkout/Block/Onepage/Payment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Onepage/Payment/Info.php b/app/code/core/Mage/Checkout/Block/Onepage/Payment/Info.php index e2cc7a5ff7..7f040bfe93 100644 --- a/app/code/core/Mage/Checkout/Block/Onepage/Payment/Info.php +++ b/app/code/core/Mage/Checkout/Block/Onepage/Payment/Info.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Onepage/Payment/Methods.php b/app/code/core/Mage/Checkout/Block/Onepage/Payment/Methods.php index 5a6e4816f0..b78dada134 100644 --- a/app/code/core/Mage/Checkout/Block/Onepage/Payment/Methods.php +++ b/app/code/core/Mage/Checkout/Block/Onepage/Payment/Methods.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -74,6 +74,20 @@ public function getPaymentMethodFormHtml(Mage_Payment_Model_Method_Abstract $met return $this->getChildHtml('payment.method.' . $method->getCode()); } + /** + * Return method title for payment selection page + * + * @param Mage_Payment_Model_Method_Abstract $method + */ + public function getMethodTitle(Mage_Payment_Model_Method_Abstract $method) + { + $form = $this->getChild('payment.method.' . $method->getCode()); + if ($form && $form->hasMethodTitle()) { + return $form->getMethodTitle(); + } + return $method->getTitle(); + } + /** * Payment method additional label part getter * @param Mage_Payment_Model_Method_Abstract $method diff --git a/app/code/core/Mage/Checkout/Block/Onepage/Progress.php b/app/code/core/Mage/Checkout/Block/Onepage/Progress.php index 2370e53285..24f34c52f4 100644 --- a/app/code/core/Mage/Checkout/Block/Onepage/Progress.php +++ b/app/code/core/Mage/Checkout/Block/Onepage/Progress.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -69,11 +69,14 @@ public function getPaymentHtml() return $this->getChildHtml('payment_info'); } + /** + * Get quote shipping price including tax + * @return float + */ public function getShippingPriceInclTax() { - $exclTax = $this->getQuote()->getShippingAddress()->getShippingAmount(); - $taxAmount = $this->getQuote()->getShippingAddress()->getShippingTaxAmount(); - return $this->formatPrice($exclTax + $taxAmount); + $inclTax = $this->getQuote()->getShippingAddress()->getShippingInclTax(); + return $this->formatPrice($inclTax); } public function getShippingPriceExclTax() diff --git a/app/code/core/Mage/Checkout/Block/Onepage/Review.php b/app/code/core/Mage/Checkout/Block/Onepage/Review.php index 275931744d..e9365fa104 100644 --- a/app/code/core/Mage/Checkout/Block/Onepage/Review.php +++ b/app/code/core/Mage/Checkout/Block/Onepage/Review.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Onepage/Review/Info.php b/app/code/core/Mage/Checkout/Block/Onepage/Review/Info.php index 4db25ff90a..e791ea4662 100644 --- a/app/code/core/Mage/Checkout/Block/Onepage/Review/Info.php +++ b/app/code/core/Mage/Checkout/Block/Onepage/Review/Info.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Onepage/Shipping.php b/app/code/core/Mage/Checkout/Block/Onepage/Shipping.php index 3947cc0a30..467dd3f7e8 100644 --- a/app/code/core/Mage/Checkout/Block/Onepage/Shipping.php +++ b/app/code/core/Mage/Checkout/Block/Onepage/Shipping.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Onepage/Shipping/Method.php b/app/code/core/Mage/Checkout/Block/Onepage/Shipping/Method.php index 91e908966c..d299f7a0b5 100644 --- a/app/code/core/Mage/Checkout/Block/Onepage/Shipping/Method.php +++ b/app/code/core/Mage/Checkout/Block/Onepage/Shipping/Method.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Onepage/Shipping/Method/Additional.php b/app/code/core/Mage/Checkout/Block/Onepage/Shipping/Method/Additional.php index 26e8afda92..c71b8aafe3 100644 --- a/app/code/core/Mage/Checkout/Block/Onepage/Shipping/Method/Additional.php +++ b/app/code/core/Mage/Checkout/Block/Onepage/Shipping/Method/Additional.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Onepage/Shipping/Method/Available.php b/app/code/core/Mage/Checkout/Block/Onepage/Shipping/Method/Available.php index b151b60437..00f6ab889e 100644 --- a/app/code/core/Mage/Checkout/Block/Onepage/Shipping/Method/Available.php +++ b/app/code/core/Mage/Checkout/Block/Onepage/Shipping/Method/Available.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Onepage/Success.php b/app/code/core/Mage/Checkout/Block/Onepage/Success.php index 0a8b49f94c..9b3e21899c 100644 --- a/app/code/core/Mage/Checkout/Block/Onepage/Success.php +++ b/app/code/core/Mage/Checkout/Block/Onepage/Success.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -33,50 +33,53 @@ */ class Mage_Checkout_Block_Onepage_Success extends Mage_Core_Block_Template { + /** + * @deprecated after 1.4.0.1 + */ private $_order; /** * Retrieve identifier of created order * * @return string + * @deprecated after 1.4.0.1 */ public function getOrderId() { - return Mage::getSingleton('checkout/session')->getLastRealOrderId(); + return $this->_getData('order_id'); } /** * Check order print availability * * @return bool + * @deprecated after 1.4.0.1 */ public function canPrint() { - return Mage::getSingleton('customer/session')->isLoggedIn() && $this->isOrderVisible(); + return $this->_getData('can_view_order'); } /** * Get url for order detale print * * @return string + * @deprecated after 1.4.0.1 */ public function getPrintUrl() { - /*if (Mage::getSingleton('customer/session')->isLoggedIn()) { - return $this->getUrl('sales/order/print', array('order_id'=>Mage::getSingleton('checkout/session')->getLastOrderId())); - } - return $this->getUrl('sales/guest/printOrder', array('order_id'=>Mage::getSingleton('checkout/session')->getLastOrderId()));*/ - return $this->getUrl('sales/order/print', array('order_id'=>Mage::getSingleton('checkout/session')->getLastOrderId())); + return $this->_getData('print_url'); } /** * Get url for view order details * * @return string + * @deprecated after 1.4.0.1 */ public function getViewOrderUrl() { - return $this->getUrl('sales/order/view/', array('order_id'=>Mage::getSingleton('checkout/session')->getLastOrderId(), '_secure' => true)); + return $this->_getData('view_order_id'); } /** @@ -86,13 +89,93 @@ public function getViewOrderUrl() */ public function isOrderVisible() { - if (!$this->_order) { - $this->_order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId()); + return (bool)$this->_getData('is_order_visible'); + } + + /** + * Getter for recurring profile view page + * + * @param $profile + */ + public function getProfileUrl(Varien_Object $profile) + { + return $this->getUrl('sales/recurring_profile/view', array('profile' => $profile->getId())); + } + + /** + * Initialize data and prepare it for output + */ + protected function _beforeToHtml() + { + $this->_prepareLastOrder(); + $this->_prepareLastBillingAgreement(); + $this->_prepareLastRecurringProfiles(); + return parent::_beforeToHtml(); + } + + /** + * Get last order ID from session, fetch it and check whether it can be viewed, printed etc + */ + protected function _prepareLastOrder() + { + $orderId = Mage::getSingleton('checkout/session')->getLastOrderId(); + if ($orderId) { + $order = Mage::getModel('sales/order')->load($orderId); + if ($order->getId()) { + $isVisible = !in_array($order->getState(), + Mage::getSingleton('sales/order_config')->getInvisibleOnFrontStates()); + $this->addData(array( + 'is_order_visible' => $isVisible, + 'view_order_id' => $this->getUrl('sales/order/view/', array('order_id' => $orderId)), + 'print_url' => $this->getUrl('sales/order/print', array('order_id'=> $orderId)), + 'can_print_order' => $isVisible, + 'can_view_order' => Mage::getSingleton('customer/session')->isLoggedIn() && $isVisible, + 'order_id' => $order->getIncrementId(), + )); + } } - if (!$this->_order) { - return false; + } + + /** + * Prepare billing agreement data from an identifier in the session + */ + protected function _prepareLastBillingAgreement() + { + $agreementId = Mage::getSingleton('checkout/session')->getLastBillingAgreementId(); + $customerId = Mage::getSingleton('customer/session')->getCustomerId(); + if ($agreementId && $customerId) { + $agreement = Mage::getModel('sales/billing_agreement')->load($agreementId); + if ($agreement->getId() && $customerId == $agreement->getCustomerId()) { + $this->addData(array( + 'agreement_ref_id' => $agreement->getReferenceId(), + 'agreement_url' => $this->getUrl('sales/billing_agreement/view', + array('agreement' => $agreementId) + ), + )); + } } - return !in_array($this->_order->getState(), Mage::getSingleton('sales/order_config')->getInvisibleOnFrontStates()); } + /** + * Prepare recurring payment profiles from the session + */ + protected function _prepareLastRecurringProfiles() + { + $profileIds = Mage::getSingleton('checkout/session')->getLastRecurringProfileIds(); + if ($profileIds && is_array($profileIds)) { + $collection = Mage::getModel('sales/recurring_profile')->getCollection() + ->addFieldToFilter('profile_id', array('in' => $profileIds)) + ; + $profiles = array(); + foreach ($collection as $profile) { + $profiles[] = $profile; + } + if ($profiles) { + $this->setRecurringProfiles($profiles); + if (Mage::getSingleton('customer/session')->isLoggedIn()) { + $this->setCanViewProfiles(true); + } + } + } + } } diff --git a/app/code/core/Mage/Checkout/Block/Success.php b/app/code/core/Mage/Checkout/Block/Success.php index 0e93d263d2..12d8516755 100644 --- a/app/code/core/Mage/Checkout/Block/Success.php +++ b/app/code/core/Mage/Checkout/Block/Success.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Total/Default.php b/app/code/core/Mage/Checkout/Block/Total/Default.php index 5a3be21e43..5a2e7805aa 100644 --- a/app/code/core/Mage/Checkout/Block/Total/Default.php +++ b/app/code/core/Mage/Checkout/Block/Total/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Block/Total/Nominal.php b/app/code/core/Mage/Checkout/Block/Total/Nominal.php new file mode 100644 index 0000000000..8ccf6ce114 --- /dev/null +++ b/app/code/core/Mage/Checkout/Block/Total/Nominal.php @@ -0,0 +1,135 @@ +getName(); + } + + /** + * Getter for a quote item row total + * + * @param Mage_Sales_Model_Quote_Item_Abstract $quoteItem + * @return float + */ + public function getItemRowTotal(Mage_Sales_Model_Quote_Item_Abstract $quoteItem) + { + return $quoteItem->getNominalRowTotal(); + } + + /** + * Getter for nominal total item details + * + * @param Mage_Sales_Model_Quote_Item_Abstract $quoteItem + * @return array + */ + public function getTotalItemDetails(Mage_Sales_Model_Quote_Item_Abstract $quoteItem) + { + return $quoteItem->getNominalTotalDetails(); + } + + /** + * Getter for details row label + * + * @param Varien_Object $row + * @return string + */ + public function getItemDetailsRowLabel(Varien_Object $row) + { + return $row->getLabel(); + } + + /** + * Getter for details row amount + * + * @param Varien_Object $row + * @return string + */ + public function getItemDetailsRowAmount(Varien_Object $row) + { + return $row->getAmount(); + } + + /** + * Getter for details row compounded state + * + * @param Varien_Object $row + * @return bool + */ + public function getItemDetailsRowIsCompounded(Varien_Object $row) + { + return $row->getIsCompounded(); + } + + /** + * Format an amount without container + * + * @param float $amount + * @return string + */ + public function formatPrice($amount) + { + return $this->_store->formatPrice($amount, false); + } + + /** + * Import total data into the block, if there are items + * + * @return string + */ + protected function _toHtml() + { + $total = $this->getTotal(); + $items = $total->getItems(); + if ($items) { + foreach ($total->getData() as $key => $value) { + $this->setData("total_{$key}", $value); + } + return parent::_toHtml(); + } + return ''; + } +} diff --git a/app/code/core/Mage/Checkout/Block/Total/Tax.php b/app/code/core/Mage/Checkout/Block/Total/Tax.php index b7922ace0b..ee9507805b 100644 --- a/app/code/core/Mage/Checkout/Block/Total/Tax.php +++ b/app/code/core/Mage/Checkout/Block/Total/Tax.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Controller/Action.php b/app/code/core/Mage/Checkout/Controller/Action.php index fe4a431baf..d8661c7bea 100644 --- a/app/code/core/Mage/Checkout/Controller/Action.php +++ b/app/code/core/Mage/Checkout/Controller/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Exception.php b/app/code/core/Mage/Checkout/Exception.php index ea2e8b89ce..598fd1fef4 100644 --- a/app/code/core/Mage/Checkout/Exception.php +++ b/app/code/core/Mage/Checkout/Exception.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Helper/Cart.php b/app/code/core/Mage/Checkout/Helper/Cart.php index 333a12f62d..d3520adb2d 100644 --- a/app/code/core/Mage/Checkout/Helper/Cart.php +++ b/app/code/core/Mage/Checkout/Helper/Cart.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Helper/Data.php b/app/code/core/Mage/Checkout/Helper/Data.php index 1924fb76b8..afc5242534 100644 --- a/app/code/core/Mage/Checkout/Helper/Data.php +++ b/app/code/core/Mage/Checkout/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -242,7 +242,7 @@ public function isMultishippingCheckoutAvailable() $quote = $this->getQuote(); $isMultiShipping = (bool)(int)Mage::getStoreConfig('shipping/option/checkout_multiple'); if ((!$quote) || !$quote->hasItems()) { - return $isMultiShipping; + return false; } $maximunQty = (int)Mage::getStoreConfig('shipping/option/checkout_multiple_maximum_qty'); return $isMultiShipping @@ -250,6 +250,7 @@ public function isMultishippingCheckoutAvailable() && $quote->validateMinimumAmount(true) && (($quote->getItemsSummaryQty() - $quote->getItemVirtualQty()) > 0) && ($quote->getItemsSummaryQty() <= $maximunQty) + && !$quote->hasNominalItems() ; } diff --git a/app/code/core/Mage/Checkout/Helper/Url.php b/app/code/core/Mage/Checkout/Helper/Url.php index ba3b1654e8..a0694e6b64 100644 --- a/app/code/core/Mage/Checkout/Helper/Url.php +++ b/app/code/core/Mage/Checkout/Helper/Url.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Model/Agreement.php b/app/code/core/Mage/Checkout/Model/Agreement.php index 3e2dc110e8..a51bd0e488 100644 --- a/app/code/core/Mage/Checkout/Model/Agreement.php +++ b/app/code/core/Mage/Checkout/Model/Agreement.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Model/Cart.php b/app/code/core/Mage/Checkout/Model/Cart.php index cd0367119a..65048e91fb 100644 --- a/app/code/core/Mage/Checkout/Model/Cart.php +++ b/app/code/core/Mage/Checkout/Model/Cart.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -36,6 +36,9 @@ class Mage_Checkout_Model_Cart extends Varien_Object protected $_summaryQty = null; protected $_productIds = null; + /** + * Get shopping cart resource model + */ protected function _getResource() { return Mage::getResourceSingleton('checkout/cart'); @@ -87,17 +90,22 @@ public function getQuoteProductIds() return $products; } - /** - * Retrieve current quote object + * Get quote object associated with cart. By default it is current customer session quote * * @return Mage_Sales_Model_Quote */ public function getQuote() { - return $this->getCheckoutSession()->getQuote(); + if (!$this->hasData('quote')) { + $this->setData('quote', $this->getCheckoutSession()->getQuote()); + } + return $this->_getData('quote'); } + /** + * Initialize cart quote state to be able use it on cart page + */ public function init() { $this->getQuote()->setCheckoutMethod(''); @@ -153,7 +161,7 @@ public function addOrderItem($orderItem, $qtyFlag=null) } /** - * Get product for product information + * Get product object based on requested product information * * @param mixed $productInfo * @return Mage_Catalog_Model_Product @@ -162,14 +170,12 @@ protected function _getProduct($productInfo) { if ($productInfo instanceof Mage_Catalog_Model_Product) { $product = $productInfo; - } - elseif (is_int($productInfo)) { + } elseif (is_int($productInfo)) { $product = Mage::getModel('catalog/product') ->setStoreId(Mage::app()->getStore()->getId()) ->load($productInfo); - } - else { - + } else { + Mage::throwException(Mage::helper('checkout')->__('The product could not be found.')); } return $product; } @@ -184,12 +190,10 @@ protected function _getProductRequest($requestInfo) { if ($requestInfo instanceof Varien_Object) { $request = $requestInfo; - } - elseif (is_numeric($requestInfo)) { + } elseif (is_numeric($requestInfo)) { $request = new Varien_Object(); $request->setQty($requestInfo); - } - else { + } else { $request = new Varien_Object($requestInfo); } @@ -225,20 +229,17 @@ public function addProduct($product, $info=null) if ($product->getStockItem()) { $minimumQty = $product->getStockItem()->getMinSaleQty(); //If product was not found in cart and there is set minimal qty for it - if($minimumQty > 0 && $request->getQty() < $minimumQty && $quoteProduct === null){ + if($minimumQty && $minimumQty > 0 && $request->getQty() < $minimumQty && $quoteProduct === null){ $request->setQty($minimumQty); } } if ($product->getId()) { - $result = $this->getQuote()->addProduct($product, $request); - /** * String we can get if prepare process has error */ if (is_string($result)) { - $this->getCheckoutSession()->setRedirectUrl($product->getProductUrl()); if ($this->getCheckoutSession()->getUseNotice() === null) { $this->getCheckoutSession()->setUseNotice(true); @@ -247,7 +248,7 @@ public function addProduct($product, $info=null) } } else { - Mage::throwException(Mage::helper('checkout')->__('Product does not exist')); + Mage::throwException(Mage::helper('checkout')->__('The product does not exist.')); } Mage::dispatchEvent('checkout_cart_product_add_after', array('quote_item'=>$result, 'product'=>$product)); @@ -278,24 +279,22 @@ public function addProductsByIds($productIds) if ($product->getId() && $product->isVisibleInCatalog()) { try { $this->getQuote()->addProduct($product); - } - catch (Exception $e){ + } catch (Exception $e){ $allAdded = false; } - } - else { + } else { $allAvailable = false; } } if (!$allAvailable) { $this->getCheckoutSession()->addError( - Mage::helper('checkout')->__('Some of the products you requested are unavailable') + Mage::helper('checkout')->__('Some of the requested products are unavailable.') ); } if (!$allAdded) { $this->getCheckoutSession()->addError( - Mage::helper('checkout')->__('Some of the products you requested are not available in the desired quantity') + Mage::helper('checkout')->__('Some of the requested products are not available in the desired quantity.') ); } } @@ -371,114 +370,6 @@ public function truncate() } } -// /** -// * Retrieve cart information for sidebar -// * -// * @return Varien_Object -// */ -// public function getCartInfo() -// { -// $store = Mage::app()->getStore(); -// $quoteId = $this->getCheckoutSession()->getQuoteId(); -// -//// $cacheKey = 'CHECKOUT_QUOTE'.$quoteId.'_STORE'.$store->getId(); -//// if (Mage::app()->useCache('checkout_quote') && $cache = Mage::app()->loadCache($cacheKey)) { -//// return unserialize($cache); -//// } -// -// $cart = array('items'=>array(), 'subtotal'=>0); -//// $cacheTags = array('checkout_quote', 'catalogrule_product_price', 'checkout_quote_'.$quoteId); -// -// if ($this->getSummaryQty($quoteId)>0) { -// -// $itemsArr = $this->_getResource()->fetchItems($quoteId); -// $productIds = array(); -// foreach ($itemsArr as $item) { -// $productIds[] = $item['product_id']; -// if (!empty($item['super_product_id'])) { -// $productIds[] = $item['super_product_id']; -// } -// } -// -// $productIds = array_unique($productIds); -// foreach ($productIds as $id) { -// $cacheTags[] = 'catalog_product_'.$id; -// } -// /* +MK -// $quoteItems = Mage::getModel('sales/quote_item') -// ->getCollection() -// ->setQuote( Mage::getSingleton('checkout/session')->getQuote()) -// ->addAttributeToSelect('*'); -// */ -// $products = Mage::getModel('catalog/product')->getCollection() -// ->addAttributeToSelect('*') -// ->addMinimalPrice() -// ->addStoreFilter() -// ->addIdFilter($productIds); -// -// -// foreach ($itemsArr as $it) { -// $product = $products->getItemById($it['product_id']); -// if (!$product) { -// continue; -// } -// $product->setDoNotUseCategoryId(true); -// -// //-MK: -// $item = new Varien_Object($it); -// //+MK $item = $quoteItems->getItemById($it['id']); -// $item->setProduct($product); -// -// $superProduct = null; -// if (!empty($it['super_product_id'])) { -// $superProduct = $products->getItemById($it['super_product_id']); -// $item->setSuperProduct($superProduct); -// $product->setProduct($product); -// $product->setSuperProduct($superProduct); -// $superProduct->setDoNotUseCategoryId(true); -// } -// /* +MK -// if ($item->getCalculationPrice()) { -// $item->setPrice($item->getCalculationPrice()); -// } -// */ -// $item->setProductName(!empty($superProduct) ? $superProduct->getName() : $product->getName()); -// $item->setProductUrl(!empty($superProduct) ? $superProduct->getProductUrl() : $product->getProductUrl()); -// //-MK: -// $item->setPrice($product->getFinalPrice($it['qty'])); -// -// $thumbnailObjOrig = Mage::helper('checkout')->getQuoteItemProductThumbnail($item); -// $thumbnailObj = Mage::getModel('catalog/product'); -// foreach ($thumbnailObjOrig->getData() as $k=>$v) { -// if (is_scalar($v)) { -// $thumbnailObj->setData($k, $v); -// } -// } -// $item->setThumbnailObject($thumbnailObj); -// -// $item->setProductDescription(Mage::helper('catalog/product')->getProductDescription($product)); -// -// Mage::dispatchEvent('checkout_cart_info_item_unset_product_before', array( -// 'item' => $item -// )); -// -// $item->unsProduct()->unsSuperProduct(); -// -// $cart['items'][] = $item; -// -// $cart['subtotal'] += $item->getPrice()*$item->getQty(); -// //+MK $cart['subtotal'] += $item->getCalculationPrice()*$item->getQty(); -// } -// } -// -// $cartObj = new Varien_Object($cart); -//// if (Mage::app()->useCache('checkout_quote')) { -//// Mage::app()->saveCache(serialize($cartObj), $cacheKey, $cacheTags); -//// } -// -// return $cartObj; -// } - public function getProductIds() { $quoteId = Mage::getSingleton('checkout/session')->getQuoteId(); diff --git a/app/code/core/Mage/Checkout/Model/Config/Source/Cart/Summary.php b/app/code/core/Mage/Checkout/Model/Config/Source/Cart/Summary.php index c5dd1fc819..899d4ca582 100644 --- a/app/code/core/Mage/Checkout/Model/Config/Source/Cart/Summary.php +++ b/app/code/core/Mage/Checkout/Model/Config/Source/Cart/Summary.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Checkout_Model_Config_Source_Cart_Summary diff --git a/app/code/core/Mage/Checkout/Model/Mysql4/Agreement.php b/app/code/core/Mage/Checkout/Model/Mysql4/Agreement.php index b9a703248b..5d8db611cf 100644 --- a/app/code/core/Mage/Checkout/Model/Mysql4/Agreement.php +++ b/app/code/core/Mage/Checkout/Model/Mysql4/Agreement.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Model/Mysql4/Agreement/Collection.php b/app/code/core/Mage/Checkout/Model/Mysql4/Agreement/Collection.php index cb21ffac61..7f202b3dfb 100644 --- a/app/code/core/Mage/Checkout/Model/Mysql4/Agreement/Collection.php +++ b/app/code/core/Mage/Checkout/Model/Mysql4/Agreement/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Model/Mysql4/Cart.php b/app/code/core/Mage/Checkout/Model/Mysql4/Cart.php index 27a704554d..55bfc1f6dd 100644 --- a/app/code/core/Mage/Checkout/Model/Mysql4/Cart.php +++ b/app/code/core/Mage/Checkout/Model/Mysql4/Cart.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Model/Mysql4/Setup.php b/app/code/core/Mage/Checkout/Model/Mysql4/Setup.php index abef24ef33..6f8f98b770 100644 --- a/app/code/core/Mage/Checkout/Model/Mysql4/Setup.php +++ b/app/code/core/Mage/Checkout/Model/Mysql4/Setup.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Model/Observer.php b/app/code/core/Mage/Checkout/Model/Observer.php index e76338c3b7..114b604aef 100644 --- a/app/code/core/Mage/Checkout/Model/Observer.php +++ b/app/code/core/Mage/Checkout/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Model/Session.php b/app/code/core/Mage/Checkout/Model/Session.php index 5b02aad97e..8bd7a0576a 100644 --- a/app/code/core/Mage/Checkout/Model/Session.php +++ b/app/code/core/Mage/Checkout/Model/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -30,11 +30,17 @@ class Mage_Checkout_Model_Session extends Mage_Core_Model_Session_Abstract const CHECKOUT_STATE_BEGIN = 'begin'; protected $_quote = null; + /** + * Class constructor. Initialize checkout session namespace + */ public function __construct() { $this->init('checkout'); } + /** + * Unset all data associated with object + */ public function unsetAll() { parent::unsetAll(); @@ -54,7 +60,7 @@ public function getQuote() /* @var $quote Mage_Sales_Model_Quote */ if ($this->getQuoteId()) { - $quote->load($this->getQuoteId()); + $quote->loadActive($this->getQuoteId()); if ($quote->getId()) { /** * If current currency code of quote is not equal current currency code of store, @@ -195,6 +201,19 @@ public function clear() $this->setLastSuccessQuoteId(null); } + /** + * Clear misc checkout parameters + */ + public function clearHelperData() + { + $this->setLastBillingAgreementId(null) + ->setRedirectUrl(null) + ->setLastOrderId(null) + ->setLastRealOrderId(null) + ->setLastRecurringProfileIds(null) + ; + } + public function resetCheckout() { $this->setCheckoutState(self::CHECKOUT_STATE_BEGIN); diff --git a/app/code/core/Mage/Checkout/Model/Type/Abstract.php b/app/code/core/Mage/Checkout/Model/Type/Abstract.php index 23f8cffcc2..6aa8982243 100644 --- a/app/code/core/Mage/Checkout/Model/Type/Abstract.php +++ b/app/code/core/Mage/Checkout/Model/Type/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Model/Type/Multishipping.php b/app/code/core/Mage/Checkout/Model/Type/Multishipping.php index 7cffc942bc..7b99242fd0 100644 --- a/app/code/core/Mage/Checkout/Model/Type/Multishipping.php +++ b/app/code/core/Mage/Checkout/Model/Type/Multishipping.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -243,10 +243,17 @@ public function setShippingItemsInformation($info) if (!$_item->getProduct()->getIsVirtual()) { continue; } - if (isset($itemData[$_item->getId()]['qty']) && ($qty = (int)$itemData[$_item->getId()]['qty'])) { - $_item->setQty($qty); - } - $quote->getBillingAddress()->addItem($_item); + + if (isset($itemData[$_item->getId()]['qty'])) { + if ($qty = (int)$itemData[$_item->getId()]['qty']) { + $_item->setQty($qty); + $quote->getBillingAddress()->addItem($_item); + } else { + $_item->setQty(0); + $_item->delete(); + } + } + } $this->save(); diff --git a/app/code/core/Mage/Checkout/Model/Type/Multishipping/State.php b/app/code/core/Mage/Checkout/Model/Type/Multishipping/State.php index 13cacbbe16..03ab18f0d3 100644 --- a/app/code/core/Mage/Checkout/Model/Type/Multishipping/State.php +++ b/app/code/core/Mage/Checkout/Model/Type/Multishipping/State.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/Model/Type/Onepage.php b/app/code/core/Mage/Checkout/Model/Type/Onepage.php index b914574a7e..0e379e1adf 100644 --- a/app/code/core/Mage/Checkout/Model/Type/Onepage.php +++ b/app/code/core/Mage/Checkout/Model/Type/Onepage.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -148,7 +148,7 @@ public function initCheckout() * * @return string */ - public function getCheckoutMehod() + public function getCheckoutMethod() { if ($this->getCustomerSession()->isLoggedIn()) { return self::METHOD_CUSTOMER; @@ -163,6 +163,17 @@ public function getCheckoutMehod() return $this->getQuote()->getCheckoutMethod(); } + /** + * Get quote checkout method + * + * @deprecated since 1.4.0.1 + * @return string + */ + public function getCheckoutMehod() + { + return $this->getCheckoutMethod(); + } + /** * Specify chceckout method * @@ -172,7 +183,7 @@ public function getCheckoutMehod() public function saveCheckoutMethod($method) { if (empty($method)) { - return array('error' => -1, 'message' => $this->_helper->__('Invalid data')); + return array('error' => -1, 'message' => $this->_helper->__('Invalid data.')); } $this->getQuote()->setCheckoutMethod($method)->save(); @@ -207,7 +218,7 @@ public function getAddress($addressId) public function saveBilling($data, $customerAddressId) { if (empty($data)) { - return array('error' => -1, 'message' => $this->_helper->__('Invalid data')); + return array('error' => -1, 'message' => $this->_helper->__('Invalid data.')); } $address = $this->getQuote()->getBillingAddress(); @@ -356,7 +367,7 @@ protected function _processValidateCustomer(Mage_Sales_Model_Quote_Address $addr public function saveShipping($data, $customerAddressId) { if (empty($data)) { - return array('error' => -1, 'message' => $this->_helper->__('Invalid data')); + return array('error' => -1, 'message' => $this->_helper->__('Invalid data.')); } $address = $this->getQuote()->getShippingAddress(); @@ -426,7 +437,7 @@ public function saveShippingMethod($shippingMethod) public function savePayment($data) { if (empty($data)) { - return array('error' => -1, 'message' => $this->_helper->__('Invalid data')); + return array('error' => -1, 'message' => $this->_helper->__('Invalid data.')); } if ($this->getQuote()->isVirtual()) { $this->getQuote()->getBillingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null); @@ -552,10 +563,10 @@ protected function _prepareCustomerQuote() if (isset($customerBilling) && !$customer->getDefaultBilling()) { $customerBilling->setIsDefaultBilling(true); } - if ($shipping && isset($customerBilling) && !$customer->getDefaultShipping() && $shipping->getSameAsBilling()) { - $customerBilling->setIsDefaultShipping(true); - } elseif ($shipping && isset($customerShipping) && !$customer->getDefaultShipping()) { + if ($shipping && isset($customerShipping) && !$customer->getDefaultShipping()) { $customerShipping->setIsDefaultShipping(true); + } elseif (isset($customerBilling) && !$customer->getDefaultShipping()) { + $customerBilling->setIsDefaultShipping(true); } $quote->setCustomer($customer); } @@ -590,7 +601,7 @@ public function saveOrder() { $this->validate(); $isNewCustomer = false; - switch ($this->getCheckoutMehod()) { + switch ($this->getCheckoutMethod()) { case self::METHOD_GUEST: $this->_prepareGuestQuote(); break; @@ -604,7 +615,7 @@ public function saveOrder() } $service = Mage::getModel('sales/service_quote', $this->getQuote()); - $order = $service->submit(); + $service->submitAll(); if ($isNewCustomer) { try { @@ -613,29 +624,55 @@ public function saveOrder() Mage::logException($e); } } - Mage::dispatchEvent('checkout_type_onepage_save_order_after', array('order'=>$order, 'quote'=>$this->getQuote())); - /** - * a flag to set that there will be redirect to third party after confirmation - * eg: paypal standard ipn - */ - $redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl(); - /** - * we only want to send to customer about new order when there is no redirect to third party - */ - if(!$redirectUrl){ - try { - $order->sendNewOrderEmail(); - } catch (Exception $e) { - Mage::logException($e); + $this->_checkoutSession->setLastQuoteId($this->getQuote()->getId()) + ->setLastSuccessQuoteId($this->getQuote()->getId()) + ->clearHelperData() + ; + + $order = $service->getOrder(); + if ($order) { + Mage::dispatchEvent('checkout_type_onepage_save_order_after', array('order'=>$order, 'quote'=>$this->getQuote())); + + /** + * a flag to set that there will be redirect to third party after confirmation + * eg: paypal standard ipn + */ + $redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl(); + /** + * we only want to send to customer about new order when there is no redirect to third party + */ + if(!$redirectUrl){ + try { + $order->sendNewOrderEmail(); + } catch (Exception $e) { + Mage::logException($e); + } + } + + // add order information to the session + $this->_checkoutSession->setLastOrderId($order->getId()) + ->setRedirectUrl($redirectUrl) + ->setLastRealOrderId($order->getIncrementId()); + + // as well a billing agreement can be created + $agreement = $order->getPayment()->getBillingAgreement(); + if ($agreement) { + $this->_checkoutSession->setLastBillingAgreementId($agreement->getId()); + } + } + + // add recurring profiles information to the session + $profiles = $service->getRecurringPaymentProfiles(); + if ($profiles) { + $ids = array(); + foreach($profiles as $profile) { + $ids[] = $profile->getId(); } + $this->_checkoutSession->setLastRecurringProfileIds($ids); + // TODO: send recurring profile emails } - $this->getCheckout()->setLastQuoteId($this->getQuote()->getId()) - ->setLastOrderId($order->getId()) - ->setLastRealOrderId($order->getIncrementId()) - ->setRedirectUrl($redirectUrl) - ->setLastSuccessQuoteId($this->getQuote()->getId()); return $this; } @@ -741,7 +778,7 @@ public function getLastOrderId() // switch ($this->getQuote()->getCheckoutMethod()) { // case Mage_Sales_Model_Quote::CHECKOUT_METHOD_GUEST: // if (!$this->getQuote()->isAllowedGuestCheckout()) { -// Mage::throwException($this->_helper->__('Sorry, guest checkout is not enabled. Please try again or contact store owner.')); +// Mage::throwException($this->_helper->__('Sorry, guest checkout is not enabled. Please try again or contact the store owner.')); // } // $this->getQuote()->setCustomerId(null) // ->setCustomerEmail($billing->getEmail()) diff --git a/app/code/core/Mage/Checkout/controllers/CartController.php b/app/code/core/Mage/Checkout/controllers/CartController.php index 755f26bc5f..23a5b0f811 100644 --- a/app/code/core/Mage/Checkout/controllers/CartController.php +++ b/app/code/core/Mage/Checkout/controllers/CartController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -73,7 +73,13 @@ protected function _getQuote() */ protected function _goBack() { - if (!Mage::getStoreConfig('checkout/cart/redirect_to_cart') + if ($returnUrl = $this->getRequest()->getParam('return_url')) { + // clear layout messages in case of external url redirect + if ($this->_isUrlInternal($returnUrl)) { + $this->_getSession()->getMessages(true); + } + $this->getResponse()->setRedirect($returnUrl); + } elseif (!Mage::getStoreConfig('checkout/cart/redirect_to_cart') && !$this->getRequest()->getParam('in_cart') && $backUrl = $this->_getRefererUrl()) { @@ -135,10 +141,11 @@ public function indexAction() $this->_getSession()->setCartWasUpdated(true); Varien_Profiler::start(__METHOD__ . 'cart_display'); - $this->loadLayout(); - $this->_initLayoutMessages('checkout/session'); - $this->_initLayoutMessages('catalog/session'); - $this->getLayout()->getBlock('head')->setTitle($this->__('Shopping Cart')); + $this + ->loadLayout() + ->_initLayoutMessages('checkout/session') + ->_initLayoutMessages('catalog/session') + ->getLayout()->getBlock('head')->setTitle($this->__('Shopping Cart')); $this->renderLayout(); Varien_Profiler::stop(__METHOD__ . 'cart_display'); } @@ -158,8 +165,8 @@ public function addAction() $params['qty'] = $filter->filter($params['qty']); } - $product= $this->_initProduct(); - $related= $this->getRequest()->getParam('related_product'); + $product = $this->_initProduct(); + $related = $this->getRequest()->getParam('related_product'); /** * Check product availability @@ -184,9 +191,12 @@ public function addAction() Mage::dispatchEvent('checkout_cart_add_product_complete', array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse()) ); - $message = $this->__('%s was successfully added to your shopping cart.', Mage::helper('core')->htmlEscape($product->getName())); + if (!$this->_getSession()->getNoCartRedirect(true)) { - $this->_getSession()->addSuccess($message); + if (!$cart->getQuote()->getHasError()){ + $message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->htmlEscape($product->getName())); + $this->_getSession()->addSuccess($message); + } $this->_goBack(); } } @@ -208,7 +218,7 @@ public function addAction() } } catch (Exception $e) { - $this->_getSession()->addException($e, $this->__('Cannot add item to shopping cart')); + $this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.')); $this->_goBack(); } } @@ -235,7 +245,7 @@ public function addgroupAction() } } catch (Exception $e) { - $this->_getSession()->addException($e, $this->__('Can not add item to shopping cart')); + $this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.')); $this->_goBack(); } } @@ -274,7 +284,7 @@ public function updatePostAction() $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, $this->__('Cannot update shopping cart')); + $this->_getSession()->addException($e, $this->__('Cannot update shopping cart.')); } $this->_goBack(); } @@ -290,7 +300,7 @@ public function deleteAction() $this->_getCart()->removeItem($id) ->save(); } catch (Exception $e) { - $this->_getSession()->addError($this->__('Cannot remove item')); + $this->_getSession()->addError($this->__('Cannot remove the item.')); } } $this->_redirectReferer(Mage::getUrl('*/*')); @@ -360,7 +370,7 @@ public function couponPostAction() if ($couponCode) { if ($couponCode == $this->_getQuote()->getCouponCode()) { $this->_getSession()->addSuccess( - $this->__('Coupon code "%s" was applied successfully.', Mage::helper('core')->htmlEscape($couponCode)) + $this->__('Coupon code "%s" was applied.', Mage::helper('core')->htmlEscape($couponCode)) ); } else { @@ -369,7 +379,7 @@ public function couponPostAction() ); } } else { - $this->_getSession()->addSuccess($this->__('Coupon code was canceled successfully.')); + $this->_getSession()->addSuccess($this->__('Coupon code was canceled.')); } } @@ -377,7 +387,7 @@ public function couponPostAction() $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addError($this->__('Can not apply coupon code.')); + $this->_getSession()->addError($this->__('Cannot apply the coupon code.')); } $this->_goBack(); diff --git a/app/code/core/Mage/Checkout/controllers/IndexController.php b/app/code/core/Mage/Checkout/controllers/IndexController.php index b94dd11e51..28d9bbede2 100644 --- a/app/code/core/Mage/Checkout/controllers/IndexController.php +++ b/app/code/core/Mage/Checkout/controllers/IndexController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/controllers/Multishipping/AddressController.php b/app/code/core/Mage/Checkout/controllers/Multishipping/AddressController.php index 11799eb032..8861cf210b 100644 --- a/app/code/core/Mage/Checkout/controllers/Multishipping/AddressController.php +++ b/app/code/core/Mage/Checkout/controllers/Multishipping/AddressController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/controllers/MultishippingController.php b/app/code/core/Mage/Checkout/controllers/MultishippingController.php index c9b064ecb9..84f4355abe 100644 --- a/app/code/core/Mage/Checkout/controllers/MultishippingController.php +++ b/app/code/core/Mage/Checkout/controllers/MultishippingController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -200,7 +200,7 @@ public function addressesPostAction() $this->_redirect('*/multishipping_address/newShipping'); return; } - try { + try { if ($this->getRequest()->getParam('continue', false)) { $this->_getCheckout()->setCollectRatesFlag(true); $this->_getState()->setActiveStep( @@ -430,7 +430,7 @@ public function overviewAction() } catch (Exception $e) { Mage::logException($e); - Mage::getSingleton('checkout/session')->addException($e, $this->__('Can\'t open overview page')); + Mage::getSingleton('checkout/session')->addException($e, $this->__('Cannot open the overview page')); $this->_redirect('*/*/billing'); } } diff --git a/app/code/core/Mage/Checkout/controllers/OnepageController.php b/app/code/core/Mage/Checkout/controllers/OnepageController.php index 246b93f7e4..4cba74f960 100644 --- a/app/code/core/Mage/Checkout/controllers/OnepageController.php +++ b/app/code/core/Mage/Checkout/controllers/OnepageController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -144,7 +144,7 @@ public function getOnepage() public function indexAction() { if (!Mage::helper('checkout')->canOnepageCheckout()) { - Mage::getSingleton('checkout/session')->addError($this->__('Sorry, Onepage Checkout is disabled.')); + Mage::getSingleton('checkout/session')->addError($this->__('The onepage checkout is disabled.')); $this->_redirect('checkout/cart'); return; } @@ -203,20 +203,21 @@ public function reviewAction() */ public function successAction() { - if (!$this->getOnepage()->getCheckout()->getLastSuccessQuoteId()) { + $session = $this->getOnepage()->getCheckout(); + if (!$session->getLastSuccessQuoteId()) { $this->_redirect('checkout/cart'); return; } - $lastQuoteId = $this->getOnepage()->getCheckout()->getLastQuoteId(); - $lastOrderId = $this->getOnepage()->getCheckout()->getLastOrderId(); - - if (!$lastQuoteId || !$lastOrderId) { + $lastQuoteId = $session->getLastQuoteId(); + $lastOrderId = $session->getLastOrderId(); + $lastRecurringProfiles = $session->getLastRecurringProfileIds(); + if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) { $this->_redirect('checkout/cart'); return; } - Mage::getSingleton('checkout/session')->clear(); + $session->clear(); $this->loadLayout(); $this->_initLayoutMessages('checkout/session'); Mage::dispatchEvent('checkout_onepage_controller_success_action'); @@ -439,7 +440,7 @@ public function saveOrderAction() if ($diff = array_diff($requiredAgreements, $postedAgreements)) { $result['success'] = false; $result['error'] = true; - $result['error_messages'] = $this->__('Please agree to all Terms and Conditions before placing the order.'); + $result['error_messages'] = $this->__('Please agree to all the terms and conditions before placing the order.'); $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result)); return; } diff --git a/app/code/core/Mage/Checkout/etc/adminhtml.xml b/app/code/core/Mage/Checkout/etc/adminhtml.xml index 6f94f28cab..f1a72b8b06 100644 --- a/app/code/core/Mage/Checkout/etc/adminhtml.xml +++ b/app/code/core/Mage/Checkout/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Checkout/etc/config.xml b/app/code/core/Mage/Checkout/etc/config.xml index 519c635024..2a7e8a4aa5 100644 --- a/app/code/core/Mage/Checkout/etc/config.xml +++ b/app/code/core/Mage/Checkout/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -88,6 +88,15 @@ + + + + + checkout/total_nominal + + + + diff --git a/app/code/core/Mage/Checkout/etc/system.xml b/app/code/core/Mage/Checkout/etc/system.xml index ea6cfe2779..73fb00b965 100644 --- a/app/code/core/Mage/Checkout/etc/system.xml +++ b/app/code/core/Mage/Checkout/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -63,7 +63,7 @@ 1 - + select adminhtml/system_config_source_yesno 20 @@ -90,7 +90,7 @@ 0 - + select adminhtml/system_config_source_yesno 2 @@ -99,7 +99,7 @@ 1 - + select adminhtml/system_config_source_product_thumbnail 3 @@ -108,7 +108,7 @@ 1 - + select adminhtml/system_config_source_product_thumbnail 4 @@ -155,7 +155,7 @@ 1 - + text 2 1 @@ -207,7 +207,7 @@ 1 1 1 - separate by "," + Separate by ",". diff --git a/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-install-0.9.1.php b/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-install-0.9.1.php index 00b933f4d5..3ca9c85152 100644 --- a/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-install-0.9.1.php +++ b/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-install-0.9.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.0-0.9.1.php b/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.0-0.9.1.php index 944adb1c90..fe2a5e7a53 100644 --- a/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.0-0.9.1.php +++ b/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.0-0.9.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.1-0.9.2.php b/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.1-0.9.2.php index 72364ac4a3..d123db4dce 100644 --- a/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.1-0.9.2.php +++ b/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.1-0.9.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.2-0.9.3.php b/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.2-0.9.3.php index 6665e56bed..f04c310c4e 100644 --- a/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.2-0.9.3.php +++ b/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.2-0.9.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.3-0.9.4.php b/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.3-0.9.4.php index 5a7d39b21f..6d80231e7d 100644 --- a/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.3-0.9.4.php +++ b/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.3-0.9.4.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.4-0.9.5.php b/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.4-0.9.5.php index 3c7a0c8d98..9c18134092 100644 --- a/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.4-0.9.5.php +++ b/app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-0.9.4-0.9.5.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Checkout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Chronopay/Block/Form.php b/app/code/core/Mage/Chronopay/Block/Form.php new file mode 100644 index 0000000000..21e08b9147 --- /dev/null +++ b/app/code/core/Mage/Chronopay/Block/Form.php @@ -0,0 +1,42 @@ + + */ +class Mage_Chronopay_Block_Form extends Mage_Payment_Block_Form_Cc +{ + protected function _construct() + { + parent::_construct(); + $this->setTemplate('chronopay/form.phtml'); + } + +} diff --git a/app/code/core/Mage/Chronopay/Block/Info.php b/app/code/core/Mage/Chronopay/Block/Info.php new file mode 100644 index 0000000000..7c21e59768 --- /dev/null +++ b/app/code/core/Mage/Chronopay/Block/Info.php @@ -0,0 +1,48 @@ + + */ +class Mage_Chronopay_Block_Info extends Mage_Payment_Block_Info_Cc +{ + protected function _construct() + { + parent::_construct(); + $this->setTemplate('chronopay/info.phtml'); + } + + public function toPdf() + { + $this->setTemplate('chronopay/pdf/info.phtml'); + return $this->toHtml(); + } + +} diff --git a/app/code/core/Mage/Chronopay/Block/Standard/Failure.php b/app/code/core/Mage/Chronopay/Block/Standard/Failure.php new file mode 100644 index 0000000000..702a545657 --- /dev/null +++ b/app/code/core/Mage/Chronopay/Block/Standard/Failure.php @@ -0,0 +1,37 @@ + +*/ + +class Mage_Chronopay_Block_Standard_Failure extends Mage_Core_Block_Template +{ +} diff --git a/app/code/core/Mage/Chronopay/Block/Standard/Form.php b/app/code/core/Mage/Chronopay/Block/Standard/Form.php new file mode 100644 index 0000000000..0d713414f8 --- /dev/null +++ b/app/code/core/Mage/Chronopay/Block/Standard/Form.php @@ -0,0 +1,43 @@ + + */ + +class Mage_Chronopay_Block_Standard_Form extends Mage_Payment_Block_Form +{ + protected function _construct() + { + $this->setTemplate('chronopay/standard/form.phtml'); + parent::_construct(); + } +} diff --git a/app/code/core/Mage/Chronopay/Block/Standard/Redirect.php b/app/code/core/Mage/Chronopay/Block/Standard/Redirect.php new file mode 100644 index 0000000000..132a0ccbe8 --- /dev/null +++ b/app/code/core/Mage/Chronopay/Block/Standard/Redirect.php @@ -0,0 +1,59 @@ + + */ + +class Mage_Chronopay_Block_Standard_Redirect extends Mage_Core_Block_Abstract +{ + + protected function _toHtml() + { + $standard = Mage::getModel('chronopay/standard'); + $form = new Varien_Data_Form(); + $form->setAction($standard->getChronopayUrl()) + ->setId('chronopay_standard_checkout') + ->setName('chronopay_standard_checkout') + ->setMethod('POST') + ->setUseContainer(true); + foreach ($standard->setOrder($this->getOrder())->getStandardCheckoutFormFields() as $field => $value) { + $form->addField($field, 'hidden', array('name' => $field, 'value' => $value)); + } + $html = ''; + $html.= $this->__('You will be redirected to ChronoPay in a few seconds.'); + $html.= $form->toHtml(); + $html.= ''; + $html.= ''; + + return $html; + } +} diff --git a/app/code/core/Mage/Chronopay/Helper/Data.php b/app/code/core/Mage/Chronopay/Helper/Data.php new file mode 100644 index 0000000000..2644bdcad4 --- /dev/null +++ b/app/code/core/Mage/Chronopay/Helper/Data.php @@ -0,0 +1,38 @@ + + */ +class Mage_Chronopay_Helper_Data extends Mage_Core_Helper_Abstract +{ + +} diff --git a/app/code/core/Mage/Chronopay/Model/Api/Debug.php b/app/code/core/Mage/Chronopay/Model/Api/Debug.php new file mode 100644 index 0000000000..b50d3bfb76 --- /dev/null +++ b/app/code/core/Mage/Chronopay/Model/Api/Debug.php @@ -0,0 +1,41 @@ + + */ +class Mage_Chronopay_Model_Api_Debug extends Mage_Core_Model_Abstract +{ + protected function _construct() + { + $this->_init('chronopay/api_debug'); + } +} diff --git a/app/code/core/Mage/Chronopay/Model/Config.php b/app/code/core/Mage/Chronopay/Model/Config.php new file mode 100644 index 0000000000..b104d2e422 --- /dev/null +++ b/app/code/core/Mage/Chronopay/Model/Config.php @@ -0,0 +1,126 @@ + + */ + +class Mage_Chronopay_Model_Config extends Varien_Object +{ + /** + * Return config var + * + * @param string Var key + * @param string Default value for non-existing key + * @return mixed + */ + public function getConfigData($key, $default=false) + { + if (!$this->hasData($key)) { + $value = Mage::getStoreConfig('payment/chronopay_standard/'.$key); + if (is_null($value) || false===$value) { + $value = $default; + } + $this->setData($key, $value); + } + return $this->getData($key); + } + + /** + * Return Site ID registered in ChronoPay Admnin Panel + * + * @return string Site ID + */ + public function getSiteId () + { + return $this->getConfigData('site_id'); + } + + /** + * Return Product ID (general type payments) registered in ChronoPay Admnin Panel + * + * @return string Product ID + */ + public function getProductId () + { + return $this->getConfigData('product_id'); + } + + /** + * Return Store description sent to Chronopay + * + * @return string Description + */ + public function getDescription () + { + $description = $this->getConfigData('description'); + return $description; + } + + /** + * Return new order status + * + * @return string New order status + */ + public function getNewOrderStatus () + { + return $this->getConfigData('order_status'); + } + + /** + * Return debug flag + * + * @return boolean Debug flag (0/1) + */ + public function getDebug () + { + return $this->getConfigData('debug_flag'); + } + + /** + * Return accepted currency + * + * @return string Currenc + */ + public function getCurrency () + { + return $this->getConfigData('currency'); + } + + /** + * Return client interface language + * + * @return string(2) Accepted language + */ + public function getLanguage () + { + return $this->getConfigData('language'); + } +} diff --git a/app/code/core/Mage/Chronopay/Model/Gateway.php b/app/code/core/Mage/Chronopay/Model/Gateway.php new file mode 100644 index 0000000000..f2c31cdb34 --- /dev/null +++ b/app/code/core/Mage/Chronopay/Model/Gateway.php @@ -0,0 +1,341 @@ + + */ + +class Mage_Chronopay_Model_Gateway extends Mage_Payment_Model_Method_Cc +{ + const CGI_URL = 'https://secure.chronopay.com/gateway.cgi'; + + const OPCODE_CHARGING = 1; + const OPCODE_REFUND = 2; + const OPCODE_AUTHORIZE = 4; + const OPCODE_VOID_AUTHORIZE = 5; + const OPCODE_CONFIRM_AUTHORIZE = 6; + const OPCODE_CUSTOMER_FUND_TRANSFER = 8; + + protected $_code = 'chronopay_gateway'; + + protected $_formBlockType = 'chronopay/form'; + protected $_infoBlockType = 'chronopay/info'; + + /** + * Availability options + */ + protected $_isGateway = true; + protected $_canAuthorize = true; + protected $_canCapture = true; + protected $_canCapturePartial = false; + protected $_canRefund = true; + protected $_canVoid = false; + protected $_canUseInternal = true; + protected $_canUseCheckout = true; + protected $_canUseForMultishipping = true; + protected $_canSaveCc = false; + + /** + * Return ip address of customer + * + * @return string + */ + protected function _getIp () + { + return Mage::helper('core/http')->getRemoteAddr(); + } + + /** + * Return shared secret key from config + * + * @return string + */ + protected function _getSharedSecret () + { + return $this->getConfigData('shared_secret'); + } + + public function authorize(Varien_Object $payment, $amount) + { + $payment->setAmount($amount); + $payment->setOpcode(self::OPCODE_AUTHORIZE); + + $request = $this->_buildRequest($payment); + $result = $this->_postRequest($request); + + if (!$result->getError()) { + $payment->setStatus(self::STATUS_APPROVED) + ->setCcTransId($result->getTransaction()) + ->setTransactionId($result->getTransaction()) + ->setIsTransactionClosed(0); + } else { + Mage::throwException($result->getError()); + } + + return $this; + } + + public function capture(Varien_Object $payment, $amount) + { + $payment->setAmount($amount); + if ($payment->getParentTransactionId()) { + $this->setTransactionId($payment->getParentTransactionId()); + $payment->setOpcode(self::OPCODE_CONFIRM_AUTHORIZE); + } else { + $payment->setOpcode(self::OPCODE_CHARGING); + } + + $request = $this->_buildRequest($payment); + $result = $this->_postRequest($request); + + if (!$result->getError()) { + $payment->setStatus(self::STATUS_APPROVED) + ->setTransactionId($result->getTransaction()); + } else { + Mage::throwException($result->getError()); + } + + return $this; + } + + public function refund(Varien_Object $payment, $amount) + { + $payment->setAmount($amount); + $payment->setOpcode(self::OPCODE_REFUND); + + $this->setTransactionId($payment->getParentTransactionId()); + + $request = $this->_buildRequest($payment); + $result = $this->_postRequest($request); + + $payment->setStatus(self::STATUS_APPROVED) + ->setTransactionId($result->getTransaction()) + ->setIsTransactionClosed(1); + + return $this; + } + + /** + * Building request array + * + * @param Varien_Object + * @return array + */ + protected function _buildRequest(Varien_Object $payment) + { + $order = $payment->getOrder(); + $billing = $order->getBillingAddress(); + $streets = $billing->getStreet(); + $street = isset($streets[0]) && $streets[0] != '' + ? $streets[0] + : (isset($streets[1]) && $streets[1] != '' ? $streets[1] : ''); + + $request = Mage::getModel('chronopay/gateway_request') + ->setOpcode($payment->getOpcode()) + ->setProductId($this->getConfigData('product_id')); + + switch ($request->getOpcode()) { + case self::OPCODE_CUSTOMER_FUND_TRANSFER : + $request->setCustomer($order->getCustomerId()) + ->setAmount(sprintf('%.2f', $payment->getAmount())) + ->setCurrency($order->getBaseCurrencyCode()); + break; + case self::OPCODE_CHARGING : + case self::OPCODE_REFUND : + case self::OPCODE_AUTHORIZE : + case self::OPCODE_VOID_AUTHORIZE : + $request->setFname($billing->getFirstname()) + ->setLname($billing->getLastname()) + ->setCardholder($payment->getCcOwner()) + ->setZip($billing->getPostcode()) + ->setStreet($street) + ->setCity($billing->getCity()) + ->setState($billing->getRegionModel()->getCode()) + ->setCountry($billing->getCountryModel()->getIso3Code()) + ->setEmail($order->getCustomerEmail()) + ->setPhone($billing->getTelephone()) + ->setIp($this->_getIp()) + ->setCardNo($payment->getCcNumber()) + ->setCvv($payment->getCcCid()) + ->setExpirey($payment->getCcExpYear()) + ->setExpirem(sprintf('%02d', $payment->getCcExpMonth())) + ->setAmount(sprintf('%.2f', $payment->getAmount())) + ->setCurrency($order->getBaseCurrencyCode()); + break; + default : + Mage::throwException( + Mage::helper('chronopay')->__('Invalid operation code.') + ); + break; + } + + $request->setShowTransactionId(1); + + if ($this->getTransactionId()) { + $request->setTransaction($this->getTransactionId()); + } + + + $hash = $this->_getHash($request); + $request->setHash($hash); + return $request; + } + + /** + * Send request to gateway + * + * @param Mage_Chronopay_Model_Gateway_Request + * @return mixed + */ + protected function _postRequest(Mage_Chronopay_Model_Gateway_Request $request) + { + $result = Mage::getModel('chronopay/gateway_result'); + + $client = new Varien_Http_Client(); + + $url = $this->getConfigData('cgi_url'); + $client->setUri($url ? $url : self::CGI_URL); + $client->setConfig(array( + 'maxredirects' => 0, + 'timeout' => 30, + )); + $client->setParameterPost($request->getData()); + $client->setMethod(Zend_Http_Client::POST); + + $debugData = array('request' => $request->getData()); + + try { + $response = $client->request(); + $body = $response->getRawBody(); + + if (preg_match('/(T\|(.+)\|[\r\n]{0,}){0,1}(Y\|(.+)?|\|)|(N\|(.+[\r\n]{0,}.+){0,})/', $body, $matches)) { + + $transactionId = $matches[2]; + $message = isset($matches[4])?trim($matches[4], '|'):''; + + if (isset($matches[5], $matches[6])) { + $result->setError($matches[6]); + Mage::throwException($matches[6]); + } + + if ($message == 'Completed') { + $result->setTransaction($request->getTransaction()); + } + + if (strlen($transactionId)) { + $result->setTransaction($transactionId); + } + + if (!$result->getTransaction()) { + Mage::throwException(Mage::helper('chronopay')->__('The transaction ID is invalid.')); + } + } else { + Mage::throwException(Mage::helper('chronopay')->__('Invalid response format.')); + } + } + catch (Exception $e) { + $result->setResponseCode(-1) + ->setResponseReasonCode($e->getCode()) + ->setResponseReasonText($e->getMessage()); + + $exceptionMsg = Mage::helper('chronopay')->__('Gateway request error: %s', $e->getMessage()); + + $debugData['result'] = $result->getData(); + $this->_debug($debugData); + + Mage::throwException($exceptionMsg); + } + + $debugData['result'] = $result->getData(); + $this->_debug($debugData); + return $result; + } + + /** + * Generate MD5 hash for transaction checksum + * + * @param Mage_Chronopay_Model_Gateway_Request + * @return string MD5 + */ + protected function _getHash(Mage_Chronopay_Model_Gateway_Request $request) + { + $hashArray = array( + $this->_getSharedSecret(), + $request->getOpcode(), + $request->getProductId() + ); + + switch ($request->getOpcode()) { + case self::OPCODE_CHARGING : + case self::OPCODE_AUTHORIZE : + $hashArray[] = $request->getFname(); + $hashArray[] = $request->getLname(); + $hashArray[] = $request->getStreet(); + $hashArray[] = $this->_getIp(); + $hashArray[] = $request->getCardNo(); + $hashArray[] = $request->getAmount(); + break; + + case self::OPCODE_VOID_AUTHORIZE : + case self::OPCODE_CONFIRM_AUTHORIZE : + $hashArray[] = $request->getTransaction(); + break; + + case self::OPCODE_REFUND : + $hashArray[] = $request->getTransaction(); + $hashArray[] = $request->getAmount(); + break; + + case self::OPCODE_CUSTOMER_FUND_TRANSFER : + $hashArray[] = $request->getCustomer(); + $hashArray[] = $request->getTransaction(); + $hashArray[] = $request->getAmount(); + break; + + default : + Mage::throwException( + Mage::helper('chronopay')->__('Invalid operation code.') + ); + break; + } + + return md5(implode('', $hashArray)); + } + + /** + * Define if debugging is enabled + * + * @return bool + */ + public function getDebugFlag() + { + return $this->getConfigData('debug_flag'); + } +} diff --git a/app/code/core/Mage/Chronopay/Model/Gateway/Request.php b/app/code/core/Mage/Chronopay/Model/Gateway/Request.php new file mode 100644 index 0000000000..be8d3160c6 --- /dev/null +++ b/app/code/core/Mage/Chronopay/Model/Gateway/Request.php @@ -0,0 +1,38 @@ + + */ + +class Mage_Chronopay_Model_Gateway_Request extends Varien_Object +{ +} diff --git a/app/code/core/Mage/Chronopay/Model/Gateway/Result.php b/app/code/core/Mage/Chronopay/Model/Gateway/Result.php new file mode 100644 index 0000000000..7103156d0b --- /dev/null +++ b/app/code/core/Mage/Chronopay/Model/Gateway/Result.php @@ -0,0 +1,38 @@ + + */ + +class Mage_Chronopay_Model_Gateway_Result extends Varien_Object +{ +} diff --git a/app/code/core/Mage/Chronopay/Model/Mysql4/Api/Debug.php b/app/code/core/Mage/Chronopay/Model/Mysql4/Api/Debug.php new file mode 100644 index 0000000000..f4c855b9c1 --- /dev/null +++ b/app/code/core/Mage/Chronopay/Model/Mysql4/Api/Debug.php @@ -0,0 +1,42 @@ + + */ + +class Mage_Chronopay_Model_Mysql4_Api_Debug extends Mage_Core_Model_Mysql4_Abstract +{ + protected function _construct() + { + $this->_init('chronopay/api_debug', 'debug_id'); + } +} diff --git a/app/code/core/Mage/Chronopay/Model/Mysql4/Api/Debug/Collection.php b/app/code/core/Mage/Chronopay/Model/Mysql4/Api/Debug/Collection.php new file mode 100644 index 0000000000..33f470180d --- /dev/null +++ b/app/code/core/Mage/Chronopay/Model/Mysql4/Api/Debug/Collection.php @@ -0,0 +1,41 @@ + + */ +class Mage_Chronopay_Model_Mysql4_Api_Debug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract +{ + protected function _construct() + { + $this->_init('chronopay/api_debug'); + } +} diff --git a/app/code/core/Mage/Chronopay/Model/Mysql4/Setup.php b/app/code/core/Mage/Chronopay/Model/Mysql4/Setup.php new file mode 100644 index 0000000000..fc7c5c67dd --- /dev/null +++ b/app/code/core/Mage/Chronopay/Model/Mysql4/Setup.php @@ -0,0 +1,39 @@ + + */ + +class Mage_Chronopay_Model_Mysql4_Setup extends Mage_Sales_Model_Mysql4_Setup +{ + +} diff --git a/app/code/core/Mage/Chronopay/Model/Source/Cctype.php b/app/code/core/Mage/Chronopay/Model/Source/Cctype.php new file mode 100644 index 0000000000..d6a75d4873 --- /dev/null +++ b/app/code/core/Mage/Chronopay/Model/Source/Cctype.php @@ -0,0 +1,40 @@ + + */ +class Mage_Chronopay_Model_Source_Cctype extends Mage_Payment_Model_Source_Cctype +{ + public function getAllowedTypes() + { + return array('VI', 'MC', 'AE', 'DICL', 'JCB', 'ENR', 'SS', 'DI'); + } +} diff --git a/app/code/core/Mage/Chronopay/Model/Source/Language.php b/app/code/core/Mage/Chronopay/Model/Source/Language.php new file mode 100644 index 0000000000..28daf9d6eb --- /dev/null +++ b/app/code/core/Mage/Chronopay/Model/Source/Language.php @@ -0,0 +1,50 @@ + + */ + +class Mage_Chronopay_Model_Source_Language +{ + public function toOptionArray() + { + return array( + array('value' => 'EN', 'label' => Mage::helper('chronopay')->__('English')), + array('value' => 'RU', 'label' => Mage::helper('chronopay')->__('Russian')), + array('value' => 'NL', 'label' => Mage::helper('chronopay')->__('Dutch')), + array('value' => 'DE', 'label' => Mage::helper('chronopay')->__('German')), + ); + } +} + + + diff --git a/app/code/core/Mage/Chronopay/Model/Source/PaymentAction.php b/app/code/core/Mage/Chronopay/Model/Source/PaymentAction.php new file mode 100644 index 0000000000..e9c37cd6ca --- /dev/null +++ b/app/code/core/Mage/Chronopay/Model/Source/PaymentAction.php @@ -0,0 +1,49 @@ + + */ +class Mage_Chronopay_Model_Source_PaymentAction +{ + public function toOptionArray() + { + return array( + array( + 'value' => Mage_Chronopay_Model_Gateway::ACTION_AUTHORIZE, + 'label' => Mage::helper('chronopay')->__('Authorize Only') + ), + array( + 'value' => Mage_Chronopay_Model_Gateway::ACTION_AUTHORIZE_CAPTURE, + 'label' => Mage::helper('chronopay')->__('Authorize and Capture') + ), + ); + } +} diff --git a/app/code/core/Mage/Chronopay/Model/Standard.php b/app/code/core/Mage/Chronopay/Model/Standard.php new file mode 100644 index 0000000000..d005f769c8 --- /dev/null +++ b/app/code/core/Mage/Chronopay/Model/Standard.php @@ -0,0 +1,273 @@ + + */ +class Mage_Chronopay_Model_Standard extends Mage_Payment_Model_Method_Abstract +{ + protected $_code = 'chronopay_standard'; + protected $_formBlockType = 'chronopay/standard_form'; + + protected $_isGateway = false; + protected $_canAuthorize = true; + protected $_canCapture = true; + protected $_canCapturePartial = false; + protected $_canRefund = false; + protected $_canVoid = false; + protected $_canUseInternal = false; + protected $_canUseCheckout = true; + protected $_canUseForMultishipping = false; + + protected $_order = null; + + + /** + * Get Config model + * + * @return object Mage_Chronopay_Model_Config + */ + public function getConfig() + { + return Mage::getSingleton('chronopay/config'); + } + + /** + * Payment validation + * + * @param none + * @return Mage_Chronopay_Model_Standard + */ + public function validate() + { + parent::validate(); + $paymentInfo = $this->getInfoInstance(); + if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) { + $currency_code = $paymentInfo->getOrder()->getBaseCurrencyCode(); + } else { + $currency_code = $paymentInfo->getQuote()->getBaseCurrencyCode(); + } + if ($currency_code != $this->getConfig()->getCurrency()) { + Mage::throwException(Mage::helper('chronopay')->__('The selected currency code (%s) is not compatible with ChronoPay.', $currency_code)); + } + return $this; + } + + /** + * Capture payment + * + * @param Varien_Object $orderPayment + * @return Mage_Payment_Model_Abstract + */ + public function capture (Varien_Object $payment, $amount) + { + $payment->setStatus(self::STATUS_APPROVED) + ->setTransactionId($this->getTransactionId()); + + return $this; + } + + /** + * Returns Target URL + * + * @return string Target URL + */ + public function getChronopayUrl () + { + return 'https://secure.chronopay.com/index_shop.cgi'; + } + + /** + * Return URL for Chronopay success response + * + * @return string URL + */ + protected function getSuccessURL () + { + return Mage::getUrl('chronopay/standard/success', array('_secure' => true)); + } + + /** + * Return URL for Chronopay notification + * + * @return string Notification URL + */ + protected function getNotificationURL () + { + return Mage::getUrl('chronopay/standard/notify', array('_secure' => true)); + } + + /** + * Return URL for Chronopay failure response + * + * @return string URL + */ + protected function getFailureURL () + { + return Mage::getUrl('chronopay/standard/failure', array('_secure' => true)); + } + + /** + * Form block description + * + * @return object + */ + public function createFormBlock($name) + { + $block = $this->getLayout()->createBlock('chronopay/form_standard', $name); + $block->setMethod($this->_code); + $block->setPayment($this->getPayment()); + + return $block; + } + + /** + * Return Order Place Redirect URL + * + * @return string Order Redirect URL + */ + public function getOrderPlaceRedirectUrl() + { + return Mage::getUrl('chronopay/standard/redirect'); + } + + /** + * Return Standard Checkout Form Fields for request to Chronopay + * + * @return array Array of hidden form fields + */ + public function getStandardCheckoutFormFields () + { + $order = $this->getOrder(); + if (!($order instanceof Mage_Sales_Model_Order)) { + Mage::throwException($this->_getHelper()->__('Cannot retrieve the order object.')); + } + + $billingAddress = $order->getBillingAddress(); + + $streets = $billingAddress->getStreet(); + $street = isset($streets[0]) && $streets[0] != '' + ? $streets[0] + : (isset($streets[1]) && $streets[1] != '' ? $streets[1] : ''); + + if ($this->getConfig()->getDescription()) { + $transDescription = $this->getConfig()->getDescription(); + } else { + $transDescription = Mage::helper('chronopay')->__('Order #%s', $order->getRealOrderId()); + } + + if ($order->getCustomerEmail()) { + $email = $order->getCustomerEmail(); + } elseif ($billingAddress->getEmail()) { + $email = $billingAddress->getEmail(); + } else { + $email = ''; + } + + $fields = array( + 'product_id' => $this->getConfig()->getProductId(), + 'product_name' => $transDescription, + 'product_price' => $order->getBaseGrandTotal(), + 'language' => $this->getConfig()->getLanguage(), + 'f_name' => $billingAddress->getFirstname(), + 's_name' => $billingAddress->getLastname(), + 'street' => $street, + 'city' => $billingAddress->getCity(), + 'state' => $billingAddress->getRegionModel()->getCode(), + 'zip' => $billingAddress->getPostcode(), + 'country' => $billingAddress->getCountryModel()->getIso3Code(), + 'phone' => $billingAddress->getTelephone(), + 'email' => $email, + 'cb_url' => $this->getNotificationURL(), + 'cb_type' => 'P', // POST method used (G - GET method) + 'decline_url' => $this->getFailureURL(), + 'cs1' => Mage::helper('core')->encrypt($order->getRealOrderId()) + ); + + $this->_debug(array('request' => $fields)); + return $fields; + } + + /** + * Validate Response from ChronoPay + * + * @param array Post data returned from ChronoPay + * @return mixed + */ + public function validateResponse ($data) + { + $order = $this->getOrder(); + + if (!($order instanceof Mage_Sales_Model_Order)) { + Mage::throwException($this->_getHelper()->__('Cannot retrieve the order object.')); + } + + try { + $ok = is_array($data) + && isset($data['transaction_type']) && $data['transaction_type'] != '' + && isset($data['customer_id']) && $data['customer_id'] != '' + && isset($data['site_id']) && $data['site_id'] != '' + && isset($data['product_id']) && $data['product_id'] != ''; + + if (!$ok) { + throw new Exception('Cannot restore order or invalid order ID'); + } + + // validate site ID + if ($this->getConfig()->getSiteId() != $data['site_id']) { + throw new Exception('Invalid site ID'); + } + + // validate product ID + if ($this->getConfig()->getProductId() != $data['product_id']) { + throw new Exception('Invalid product ID'); + } + + // Successful transaction type + if (!in_array($data['transaction_type'], array('initial', 'onetime'))) { + throw new Exception('Transaction is not successful'); + } + + } catch (Exception $e) { + return $e; + } + } + + /** + * Define if debugging is enabled + * + * @return bool + */ + public function getDebugFlag() + { + return $this->getConfigData('debug_flag'); + } +} diff --git a/app/code/core/Mage/Chronopay/controllers/StandardController.php b/app/code/core/Mage/Chronopay/controllers/StandardController.php new file mode 100644 index 0000000000..5a1603eb88 --- /dev/null +++ b/app/code/core/Mage/Chronopay/controllers/StandardController.php @@ -0,0 +1,219 @@ + +*/ +class Mage_Chronopay_StandardController extends Mage_Core_Controller_Front_Action +{ + /** + * Order instance + */ + protected $_order; + + /** + * Return debug flag + * + * @return boolean + */ + public function getDebug () + { + return Mage::getSingleton('chronopay/config')->getDebug(); + } + + /** + * Get order + * + * @return Mage_Sales_Model_Order + */ + public function getOrder () + { + if ($this->_order == null) { + $session = Mage::getSingleton('checkout/session'); + $this->_order = Mage::getModel('sales/order'); + $this->_order->loadByIncrementId($session->getLastRealOrderId()); + } + return $this->_order; + } + + /** + * When a customer chooses Chronopay on Checkout/Payment page + * + */ + public function redirectAction() + { + $session = Mage::getSingleton('checkout/session'); + $session->setChronopayStandardQuoteId($session->getQuoteId()); + + $order = $this->getOrder(); + + if (!$order->getId()) { + $this->norouteAction(); + return; + } + + $order->addStatusToHistory( + $order->getStatus(), + Mage::helper('chronopay')->__('The customer was redirected to Chronopay.') + ); + $order->save(); + + $this->getResponse() + ->setBody($this->getLayout() + ->createBlock('chronopay/standard_redirect') + ->setOrder($order) + ->toHtml()); + + $session->unsQuoteId(); + } + + /** + * Success response from Chronopay + */ + public function successAction() + { + $session = Mage::getSingleton('checkout/session'); + $session->setQuoteId($session->getChronopayStandardQuoteId()); + $session->unsChronopayStandardQuoteId(); + + $order = $this->getOrder(); + + if (!$order->getId()) { + $this->norouteAction(); + return; + } + + $order->addStatusToHistory( + $order->getStatus(), + Mage::helper('chronopay')->__('The customer has successfully returned from Chronopay.') + ); + + $order->save(); + $this->_redirect('checkout/onepage/success'); + } + + + /** + * Notification Action from ChronoPay + */ + public function notifyAction () + { + $postData = $this->getRequest()->getPost(); + + if (!count($postData)) { + $this->norouteAction(); + return; + } + + if ($this->getDebug()) { + $debug = Mage::getModel('chronopay/api_debug'); + if (isset($postData['cs2']) && $postData['cs2'] > 0) { + $debug->setId($postData['cs2']); + } + $debug->setResponseBody(print_r($postData,1))->save(); + } + + $order = Mage::getModel('sales/order'); + $order->loadByIncrementId(Mage::helper('core')->decrypt($postData['cs1'])); + if ($order->getId()) { + $result = $order->getPayment()->getMethodInstance()->setOrder($order)->validateResponse($postData); + + if ($result instanceof Exception) { + if ($order->getId()) { + $order->addStatusToHistory( + $order->getStatus(), + $result->getMessage() + ); + $order->cancel(); + } + Mage::throwException($result->getMessage()); + return; + } + + $order->sendNewOrderEmail(); + + $order->getPayment()->getMethodInstance()->setTransactionId($postData['transaction_id']); + + if ($this->saveInvoice($order)) { + $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true); + } + $order->save(); + } + } + + /** + * Save invoice for order + * + * @param Mage_Sales_Model_Order $order + * @return boolean Can save invoice or not + */ + protected function saveInvoice (Mage_Sales_Model_Order $order) + { + if ($order->canInvoice()) { + $invoice = $order->prepareInvoice(); + $invoice->register()->capture(); + Mage::getModel('core/resource_transaction') + ->addObject($invoice) + ->addObject($invoice->getOrder()) + ->save(); + return true; + } + + return false; + } + + /** + * Failure response from Chronopay + */ + public function failureAction () + { + $errorMsg = Mage::helper('chronopay')->__('An error occurred during the paying process.'); + + $order = $this->getOrder(); + + if (!$order->getId()) { + $this->norouteAction(); + return; + } + + if ($order instanceof Mage_Sales_Model_Order && $order->getId()) { + $order->addStatusToHistory($order->getStatus(), $errorMsg); + $order->cancel(); + $order->save(); + } + + $this->loadLayout(); + $this->renderLayout(); + + Mage::getSingleton('checkout/session')->unsLastRealOrderId(); + } + +} diff --git a/app/code/core/Mage/Chronopay/etc/config.xml b/app/code/core/Mage/Chronopay/etc/config.xml new file mode 100644 index 0000000000..b2bff2d2f3 --- /dev/null +++ b/app/code/core/Mage/Chronopay/etc/config.xml @@ -0,0 +1,142 @@ + + + + + + 0.1.0 + + + + + + Mage_Chronopay_Model + chronopay_mysql4 + + + Mage_Chronopay_Model_Mysql4 + + chronopay_api_debug
      +
      +
      +
      + + + + Mage_Chronopay + Mage_Chronopay_Model_Mysql4_Setup + + + + + Mage_Chronopay_Block + + + + + + DI + Discover + 60 + + + DICL + Diners Club + 62 + + + ENR + enRoute + 63 + + + SS + Maestro/Solo + 64 + + + + +
      + + + /chronopay/standard + + + + standard + + Mage_Chronopay + chronopay + + + + + + + + Mage_Chronopay.csv + + + + + + + + chronopay.xml + + + + + + + + + + Mage_Chronopay.csv + + + + + + + + + chronopay/standard + ChronoPay Standard + 0 + O + + + chronopay/gateway + ChronoPay Gateway + 0 + O + + + +
      diff --git a/app/code/core/Mage/PaypalUk/etc/system.xml b/app/code/core/Mage/Chronopay/etc/system.xml similarity index 61% rename from app/code/core/Mage/PaypalUk/etc/system.xml rename to app/code/core/Mage/Chronopay/etc/system.xml index 8c31562bb0..d330685e18 100644 --- a/app/code/core/Mage/PaypalUk/etc/system.xml +++ b/app/code/core/Mage/Chronopay/etc/system.xml @@ -20,20 +20,20 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Mage - * @package Mage_PaypalUk - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @package Mage_Chronopay + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - - + + - - - Sign up for PayPal Merchant Account now!]]> + + + Specify access URL: {STORE_URL}/chronopay/standard/success in the ChronoPay client admin. text - 150 + 251 1 1 1 @@ -47,114 +47,107 @@ 1 0 - - - select - adminhtml/system_config_source_order_status_processing + + <label>Title</label> + <frontend_type>text</frontend_type> <sort_order>2</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>0</show_in_store> - </order_status> - <payment_action translate="label"> - <label>Payment Action</label> - <frontend_type>select</frontend_type> - <source_model>paypaluk/config::getPaymentActions</source_model> - <sort_order>2</sort_order> + <show_in_store>1</show_in_store> + + + + text + 3 1 1 0 - - - + + + text - 100 + 4 1 1 0 - - - <label>Title</label> + </product_id> + <description translate="label comment"> + <label>Transaction Description</label> + <comment>Order number will be used if left empty.</comment> <frontend_type>text</frontend_type> - <sort_order>2</sort_order> + <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - - - - multiselect - paypaluk/config::getDirectCcTypesAsOptionArray - 15 + 0 + + + + select + adminhtml/system_config_source_currency + 6 1 1 0 - - - + + + select - adminhtml/system_config_source_yesno - 20 + chronopay/source_language + 7 1 1 0 - - - - Severe Validation Removes Chargeback Liability on Merchant + + + select adminhtml/system_config_source_yesno - 25 + 8 1 1 0 - 1 - - - - Leave Empty for Default Value - text - adminhtml/system_config_source_yesno - 30 + + + + select + adminhtml/system_config_source_order_status_processing + 9 1 1 0 - 1 - - - + + + allowspecific - 50 + 10 adminhtml/system_config_source_payment_allspecificcountries 1 1 0 - + multiselect - 51 + 11 adminhtml/system_config_source_country 1 1 0 - - - select - adminhtml/system_config_source_yesno - 50 + + + text + 12 1 1 - http://www.paypal.com/mts.]]> - + 0 + - - - - Sign up for PayPal Merchant Account now!]]> + + + text - 150 + 251 1 1 1 @@ -163,7 +156,7 @@ select adminhtml/system_config_source_yesno - 10 + 0 1 1 0 @@ -171,143 +164,109 @@ <label>Title</label> <frontend_type>text</frontend_type> - <sort_order>20</sort_order> + <sort_order>10</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> - - + + select - adminhtml/system_config_source_yesno + chronopay/source_paymentAction + 20 + 1 + 1 + 0 + + + + text 30 1 1 0 - - - + + + + text + 40 + 1 + 1 + 0 + + + + text + 50 + 1 + 1 + 0 + + + + multiselect + chronopay/source_cctype + 60 + 1 + 1 + 0 + + + select - adminhtml/system_config_source_yesno - 35 + adminhtml/system_config_source_currency + 70 1 1 - http://www.paypal.com/mts.]]> - - - + 0 + + + select - paypaluk/config::getPaymentActions - 40 + adminhtml/system_config_source_yesno + 80 1 1 0 - + - + select adminhtml/system_config_source_order_status_processing - 50 + 90 1 1 0 - + allowspecific - 60 + 100 adminhtml/system_config_source_payment_allspecificcountries 1 1 0 - + multiselect - 70 + 110 adminhtml/system_config_source_country 1 1 0 - + text - 80 + 120 1 1 0 - + - - - - - Sign up for PayPal Merchant Account now!]]> - text - 1 - 1 - 1 - 0 - - - - text - 2 - 1 - 1 - 0 - - - - obscure - adminhtml/system_config_backend_encrypted - 3 - 1 - 1 - 0 - - - - text - 4 - 1 - 1 - 0 - - - - obscure - adminhtml/system_config_backend_encrypted - 5 - 1 - 1 - 0 - - - - select - adminhtml/system_config_source_yesno - 7 - 1 - 1 - 0 - - - - select - adminhtml/system_config_source_yesno - 8 - 1 - 1 - 0 - - - - - diff --git a/app/code/core/Mage/Chronopay/sql/chronopay_setup/mysql4-install-0.1.0.php b/app/code/core/Mage/Chronopay/sql/chronopay_setup/mysql4-install-0.1.0.php new file mode 100644 index 0000000000..505f38aba2 --- /dev/null +++ b/app/code/core/Mage/Chronopay/sql/chronopay_setup/mysql4-install-0.1.0.php @@ -0,0 +1,45 @@ +startSetup(); + +$installer->run(" +CREATE TABLE `{$this->getTable('chronopay_api_debug')}` ( + `debug_id` int(10) unsigned NOT NULL auto_increment, + `debug_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `request_body` text, + `response_body` text, + PRIMARY KEY (`debug_id`), + KEY `debug_at` (`debug_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + "); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Cms/Block/Block.php b/app/code/core/Mage/Cms/Block/Block.php index cc115e442d..a7f935defd 100644 --- a/app/code/core/Mage/Cms/Block/Block.php +++ b/app/code/core/Mage/Cms/Block/Block.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/Block/Page.php b/app/code/core/Mage/Cms/Block/Page.php index 2dbc739120..89ab20599b 100644 --- a/app/code/core/Mage/Cms/Block/Page.php +++ b/app/code/core/Mage/Cms/Block/Page.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/Block/Widget/Block.php b/app/code/core/Mage/Cms/Block/Widget/Block.php index 120e906527..15b8b623c7 100644 --- a/app/code/core/Mage/Cms/Block/Widget/Block.php +++ b/app/code/core/Mage/Cms/Block/Widget/Block.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/Block/Widget/Page/Link.php b/app/code/core/Mage/Cms/Block/Widget/Page/Link.php index 965c384887..d129ed51b7 100644 --- a/app/code/core/Mage/Cms/Block/Widget/Page/Link.php +++ b/app/code/core/Mage/Cms/Block/Widget/Page/Link.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/Controller/Router.php b/app/code/core/Mage/Cms/Controller/Router.php index 83aa3f1f2f..99c8c16a52 100644 --- a/app/code/core/Mage/Cms/Controller/Router.php +++ b/app/code/core/Mage/Cms/Controller/Router.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/Helper/Data.php b/app/code/core/Mage/Cms/Helper/Data.php index fa2ac17c8c..b134415515 100644 --- a/app/code/core/Mage/Cms/Helper/Data.php +++ b/app/code/core/Mage/Cms/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/Helper/Page.php b/app/code/core/Mage/Cms/Helper/Page.php index 86806119a9..ed08490766 100644 --- a/app/code/core/Mage/Cms/Helper/Page.php +++ b/app/code/core/Mage/Cms/Helper/Page.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -64,6 +64,11 @@ protected function _renderPage(Mage_Core_Controller_Varien_Action $action, $pag { $page = Mage::getSingleton('cms/page'); if (!is_null($pageId) && $pageId!==$page->getId()) { + $delimeterPosition = strrpos($pageId, '|'); + if ($delimeterPosition) { + $pageId = substr($pageId, 0, $delimeterPosition); + } + $page->setStoreId(Mage::app()->getStore()->getId()); if (!$page->load($pageId)) { return false; @@ -97,7 +102,6 @@ protected function _renderPage(Mage_Core_Controller_Varien_Action $action, $pag $action->getLayout()->helper('page/layout')->applyHandle($handle); } - Mage::dispatchEvent('cms_page_render', array('page' => $page, 'controller_action' => $action)); $action->loadLayoutUpdates(); diff --git a/app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php b/app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php index 1210f60c56..a11a6df095 100644 --- a/app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php +++ b/app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,6 +42,25 @@ class Mage_Cms_Helper_Wysiwyg_Images extends Mage_Core_Helper_Abstract */ protected $_currentUrl; + /** + * Currenty selected store ID if applicable + * + * @var int + */ + protected $_storeId = null; + + + /** + * Set a specified store ID value + * + * @param $store + */ + public function setStoreId($store) + { + $this->_storeId = $store; + return $this; + } + /** * Images Storage root directory * @@ -126,23 +145,43 @@ public function convertPathToUrl($path) return str_replace(DS, '/', $path); } + /** + * Check whether using static URLs is allowed + * + * @return boolean + */ + public function isUsingStaticUrlsAllowed() + { + $checkResult = new StdClass; + $checkResult->isAllowed = false; + Mage::dispatchEvent('cms_wysiwyg_images_static_urls_allowed', array( + 'result' => $checkResult, + 'store_id' => $this->_storeId + )); + return $checkResult->isAllowed; + } + /** * Prepare Image insertion declaration for Wysiwyg or textarea(as_is mode) * * @param string $filename Filename transferred via Ajax - * @param bool $asIs Leave image HTML as is or transform it to controller directive + * @param bool $renderAsTag Leave image HTML as is or transform it to controller directive * @return string */ - public function getImageHtmlDeclaration($filename, $asIs = false) + public function getImageHtmlDeclaration($filename, $renderAsTag = false) { $fileurl = $this->getCurrentUrl() . $filename; $mediaPath = str_replace(Mage::getBaseUrl('media'), '', $fileurl); $directive = sprintf('{{media url="%s"}}', $mediaPath); - if ($asIs) { - $html = sprintf('', $directive); + if ($renderAsTag) { + $html = sprintf('', $this->isUsingStaticUrlsAllowed() ? $fileurl : $directive); } else { - $directive = Mage::helper('core')->urlEncode($directive); - $html = Mage::helper('adminhtml')->getUrl('*/cms_wysiwyg/directive', array('___directive' => $directive)); + if ($this->isUsingStaticUrlsAllowed()) { + $html = $fileurl; // $mediaPath; + } else { + $directive = Mage::helper('core')->urlEncode($directive); + $html = Mage::helper('adminhtml')->getUrl('*/cms_wysiwyg/directive', array('___directive' => $directive)); + } } return $html; } @@ -167,7 +206,7 @@ public function getCurrentPath() } $io = new Varien_Io_File(); if (!$io->isWriteable($currentPath) && !$io->mkdir($currentPath)) { - $message = Mage::helper('cms')->__('Directory %s is not writable by server',$currentPath); + $message = Mage::helper('cms')->__('The directory %s is not writable by server.',$currentPath); Mage::throwException($message); } $this->_currentPath = $currentPath; @@ -185,7 +224,8 @@ public function getCurrentUrl() if (!$this->_currentUrl) { $path = str_replace(Mage::getConfig()->getOptions()->getMediaDir(), '', $this->getCurrentPath()); $path = trim($path, DS); - $this->_currentUrl = Mage::getBaseUrl('media') . $this->convertPathToUrl($path) . '/'; + $this->_currentUrl = Mage::app()->getStore($this->_storeId)->getBaseUrl('media') . + $this->convertPathToUrl($path) . '/'; } return $this->_currentUrl; } diff --git a/app/code/core/Mage/Cms/Model/Block.php b/app/code/core/Mage/Cms/Model/Block.php index b054854bc7..81ad52f385 100644 --- a/app/code/core/Mage/Cms/Model/Block.php +++ b/app/code/core/Mage/Cms/Model/Block.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/Model/Mysql4/Block.php b/app/code/core/Mage/Cms/Model/Mysql4/Block.php index a194afb78f..4a13955a68 100644 --- a/app/code/core/Mage/Cms/Model/Mysql4/Block.php +++ b/app/code/core/Mage/Cms/Model/Mysql4/Block.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -48,7 +48,7 @@ protected function _construct() protected function _beforeSave(Mage_Core_Model_Abstract $object) { if (!$this->getIsUniqueBlockToStores($object)) { - Mage::throwException(Mage::helper('cms')->__('Such a block identifier in selected store already exist.')); + Mage::throwException(Mage::helper('cms')->__('A block identifier with the same properties already exists in the selected store.')); } if (! $object->getId()) { diff --git a/app/code/core/Mage/Cms/Model/Mysql4/Block/Collection.php b/app/code/core/Mage/Cms/Model/Mysql4/Block/Collection.php index 8de04b7c4c..41d89112f3 100644 --- a/app/code/core/Mage/Cms/Model/Mysql4/Block/Collection.php +++ b/app/code/core/Mage/Cms/Model/Mysql4/Block/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/Model/Mysql4/Page.php b/app/code/core/Mage/Cms/Model/Mysql4/Page.php index a1404552d5..ef44dd22f6 100644 --- a/app/code/core/Mage/Cms/Model/Mysql4/Page.php +++ b/app/code/core/Mage/Cms/Model/Mysql4/Page.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -69,11 +69,11 @@ protected function _beforeSave(Mage_Core_Model_Abstract $object) } if (!$this->getIsUniquePageToStores($object)) { - Mage::throwException(Mage::helper('cms')->__('Page URL Key for specified store already exist.')); + Mage::throwException(Mage::helper('cms')->__('A page URL key for specified store already exists.')); } if ($this->isNumericPageIdentifier($object)) { - Mage::throwException(Mage::helper('cms')->__('Page URL Key cannot consist only of numbers.')); + Mage::throwException(Mage::helper('cms')->__('The page URL key cannot consist only of numbers.')); } if (! $object->getId()) { @@ -106,7 +106,7 @@ protected function _afterSave(Mage_Core_Model_Abstract $object) public function load(Mage_Core_Model_Abstract $object, $value, $field=null) { - if (strcmp($value, (int)$value) !== 0) { + if (!is_numeric($value)) { $field = 'identifier'; } return parent::load($object, $value, $field); @@ -144,12 +144,13 @@ protected function _getLoadSelect($field, $value, $object) { $select = parent::_getLoadSelect($field, $value, $object); - if ($object->getStoreId()) { + $storeId = $object->getStoreId(); + if ($storeId) { $select->join( array('cps' => $this->getTable('cms/page_store')), $this->getMainTable().'.page_id = `cps`.page_id' ) - ->where('is_active=1 AND `cps`.store_id in (' . Mage_Core_Model_App::ADMIN_STORE_ID . ', ?) ', $object->getStoreId()) + ->where('is_active=1 AND `cps`.store_id IN (' . Mage_Core_Model_App::ADMIN_STORE_ID . ', ?) ', $storeId) ->order('store_id DESC') ->limit(1); } @@ -212,7 +213,7 @@ public function checkIdentifier($identifier, $storeId) 'main_table.page_id = `cps`.page_id' ) ->where('main_table.identifier=?', $identifier) - ->where('main_table.is_active=1 AND `cps`.store_id in (' . Mage_Core_Model_App::ADMIN_STORE_ID . ', ?) ', $storeId) + ->where('main_table.is_active=1 AND `cps`.store_id IN (' . Mage_Core_Model_App::ADMIN_STORE_ID . ', ?) ', $storeId) ->order('store_id DESC'); return $this->_getReadAdapter()->fetchOne($select); diff --git a/app/code/core/Mage/Cms/Model/Mysql4/Page/Collection.php b/app/code/core/Mage/Cms/Model/Mysql4/Page/Collection.php index 7597acc3a5..7b951efa7d 100644 --- a/app/code/core/Mage/Cms/Model/Mysql4/Page/Collection.php +++ b/app/code/core/Mage/Cms/Model/Mysql4/Page/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -43,11 +43,44 @@ protected function _construct() $this->_map['fields']['page_id'] = 'main_table.page_id'; } + /** + * deprecated after 1.4.0.1, use toOptionIdArray() + * + * @return array + */ public function toOptionArray() { return $this->_toOptionArray('identifier', 'title'); } + /** + * Returns pairs identifier - title for unique identifiers + * and pairs identifier|page_id - title for non-unique after first + * + * @return array + */ + public function toOptionIdArray() + { + $res = array(); + $existingIdentifiers = array(); + foreach ($this as $item) { + $identifier = $item->getData('identifier'); + + $data['value'] = $identifier; + $data['label'] = $item->getData('title'); + if (in_array($identifier, $existingIdentifiers)) { + $data['value'] .= '|' . $item->getData('page_id'); + } + else { + $existingIdentifiers[] = $identifier; + } + + $res[] = $data; + } + + return $res; + } + public function setFirstStoreFlag($flag = false) { $this->_previewFlag = $flag; diff --git a/app/code/core/Mage/Cms/Model/Observer.php b/app/code/core/Mage/Cms/Model/Observer.php index 37cc431e80..482802b923 100644 --- a/app/code/core/Mage/Cms/Model/Observer.php +++ b/app/code/core/Mage/Cms/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/Model/Page.php b/app/code/core/Mage/Cms/Model/Page.php index 92f1746f2d..5889ed425b 100644 --- a/app/code/core/Mage/Cms/Model/Page.php +++ b/app/code/core/Mage/Cms/Model/Page.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/Model/Template/Filter.php b/app/code/core/Mage/Cms/Model/Template/Filter.php index 8f64ee0185..d6611092c6 100644 --- a/app/code/core/Mage/Cms/Model/Template/Filter.php +++ b/app/code/core/Mage/Cms/Model/Template/Filter.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/Model/Wysiwyg/Config.php b/app/code/core/Mage/Cms/Model/Wysiwyg/Config.php index 226d79a9c4..6cfb33d271 100644 --- a/app/code/core/Mage/Cms/Model/Wysiwyg/Config.php +++ b/app/code/core/Mage/Cms/Model/Wysiwyg/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -90,6 +90,16 @@ public function getConfig($data = array()) return $config; } + /** + * Return URL for skin images placeholder + * + * @return string + */ + public function getSkinImagePlaceholderUrl() + { + return Mage::getDesign()->getSkinUrl('images/wysiwyg/skin_image.png'); + } + /** * Check whether Wysiwyg is enabled or not * diff --git a/app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php b/app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php index 4290127153..1c0a049006 100644 --- a/app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php +++ b/app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -175,7 +175,7 @@ public function createDirectory($name, $path) $newPath = $path . DS . $name; if (file_exists($newPath)) { - Mage::throwException(Mage::helper('cms')->__('Such directory already exists. Try another folder name')); + Mage::throwException(Mage::helper('cms')->__('A directory with the same name already exists. Please try another folder name.')); } $io = new Varien_Io_File(); @@ -188,7 +188,7 @@ public function createDirectory($name, $path) ); return $result; } - Mage::throwException(Mage::helper('cms')->__('Cannot create new directory')); + Mage::throwException(Mage::helper('cms')->__('Cannot create new directory.')); } /** @@ -204,13 +204,13 @@ public function deleteDirectory($path) $pathCmp = rtrim($path, DS); if ($rootCmp == $pathCmp) { - Mage::throwException(Mage::helper('cms')->__('Cannot delete root directory %s', $path)); + Mage::throwException(Mage::helper('cms')->__('Cannot delete root directory %s.', $path)); } $io = new Varien_Io_File(); if (!$io->rmdir($path, true)) { - Mage::throwException(Mage::helper('cms')->__('Cannot delete directory %s', $path)); + Mage::throwException(Mage::helper('cms')->__('Cannot delete directory %s.', $path)); } if (strpos($pathCmp, $rootCmp) === 0) { @@ -255,7 +255,7 @@ public function uploadFile($targetPath, $type = null) $result = $uploader->save($targetPath); if (!$result) { - Mage::throwException( Mage::helper('cms')->__('Cannot upload file') ); + Mage::throwException( Mage::helper('cms')->__('Cannot upload file.') ); } // create thumbnail @@ -322,7 +322,7 @@ public function getThumbnailUrl($filePath, $checkFile = false) * * @param string $source Image path to be resized * @param bool $keepRation Keep aspect ratio or not - * @return bool|string Resized filepath or false if errors were occured + * @return bool|string Resized filepath or false if errors were occurred */ public function resizeFile($source, $keepRation = true) { diff --git a/app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage/Collection.php b/app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage/Collection.php index 2162d6c360..d8efa81ca8 100644 --- a/app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage/Collection.php +++ b/app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/controllers/IndexController.php b/app/code/core/Mage/Cms/controllers/IndexController.php index 422941089c..fbd2ef9ccd 100644 --- a/app/code/core/Mage/Cms/controllers/IndexController.php +++ b/app/code/core/Mage/Cms/controllers/IndexController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/controllers/PageController.php b/app/code/core/Mage/Cms/controllers/PageController.php index a599f0aad3..4419a373d2 100644 --- a/app/code/core/Mage/Cms/controllers/PageController.php +++ b/app/code/core/Mage/Cms/controllers/PageController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/etc/adminhtml.xml b/app/code/core/Mage/Cms/etc/adminhtml.xml index 2d87ad48e4..7d0d1f7026 100644 --- a/app/code/core/Mage/Cms/etc/adminhtml.xml +++ b/app/code/core/Mage/Cms/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Cms/etc/config.xml b/app/code/core/Mage/Cms/etc/config.xml index 87e3f39ad7..d93c8400cb 100644 --- a/app/code/core/Mage/Cms/etc/config.xml +++ b/app/code/core/Mage/Cms/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Cms/etc/system.xml b/app/code/core/Mage/Cms/etc/system.xml index 5528b6ef78..f4a78108d7 100644 --- a/app/code/core/Mage/Cms/etc/system.xml +++ b/app/code/core/Mage/Cms/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -59,7 +59,7 @@ 1 - + select adminhtml/system_config_source_yesno 5 @@ -89,7 +89,7 @@ 1 - + select adminhtml/system_config_source_cms_wysiwyg_enabled 1 diff --git a/app/code/core/Mage/Cms/etc/widget.xml b/app/code/core/Mage/Cms/etc/widget.xml index 7b097fe10d..4d44f1ceda 100644 --- a/app/code/core/Mage/Cms/etc/widget.xml +++ b/app/code/core/Mage/Cms/etc/widget.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-install-0.7.0.php index 9dbb738025..fb2e9fa3ff 100644 --- a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.0-0.7.1.php index 6c88658a25..bc162d8e79 100644 --- a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.1-0.7.2.php index 59effbf7a3..e2ac89a785 100644 --- a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.10-0.7.11.php b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.10-0.7.11.php index e0c44bbc55..b683dd3ab6 100644 --- a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.10-0.7.11.php +++ b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.10-0.7.11.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.11-0.7.12.php b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.11-0.7.12.php index 70f0936eba..465450dd98 100644 --- a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.11-0.7.12.php +++ b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.11-0.7.12.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.12-0.7.13.php b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.12-0.7.13.php index d585bd57ce..da704e7f08 100644 --- a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.12-0.7.13.php +++ b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.12-0.7.13.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.2-0.7.3.php index 652f18d56f..4eaaa0f78c 100644 --- a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.2-0.7.3.php +++ b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.2-0.7.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.4-0.7.5.php b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.4-0.7.5.php index bef721931e..ae2d5dc67c 100644 --- a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.4-0.7.5.php +++ b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.4-0.7.5.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.5-0.7.6.php b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.5-0.7.6.php index d8020803b4..1746fc7b9f 100644 --- a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.5-0.7.6.php +++ b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.5-0.7.6.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.7-0.7.8.php b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.7-0.7.8.php index 48e4b3e15f..aca7b8ffdf 100644 --- a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.7-0.7.8.php +++ b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.7-0.7.8.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.8-0.7.9.php b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.8-0.7.9.php index f557968855..9994d00c64 100644 --- a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.8-0.7.9.php +++ b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.8-0.7.9.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.9-0.7.10.php b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.9-0.7.10.php index 4c281e0f0f..0e0a55ee06 100644 --- a/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.9-0.7.10.php +++ b/app/code/core/Mage/Cms/sql/cms_setup/mysql4-upgrade-0.7.9-0.7.10.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cms - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Compiler/Block/Process.php b/app/code/core/Mage/Compiler/Block/Process.php index 486a215810..5bec7e3629 100644 --- a/app/code/core/Mage/Compiler/Block/Process.php +++ b/app/code/core/Mage/Compiler/Block/Process.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Compiler - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Compiler/Helper/Data.php b/app/code/core/Mage/Compiler/Helper/Data.php index 7a8d9fb4c7..e924dc1328 100644 --- a/app/code/core/Mage/Compiler/Helper/Data.php +++ b/app/code/core/Mage/Compiler/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Compiler - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Compiler/Model/Process.php b/app/code/core/Mage/Compiler/Model/Process.php index 9a35b5dfab..691cd4d786 100644 --- a/app/code/core/Mage/Compiler/Model/Process.php +++ b/app/code/core/Mage/Compiler/Model/Process.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Compiler - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Compiler/controllers/ProcessController.php b/app/code/core/Mage/Compiler/controllers/ProcessController.php index cecf4d6ee6..d7721ac3fe 100644 --- a/app/code/core/Mage/Compiler/controllers/ProcessController.php +++ b/app/code/core/Mage/Compiler/controllers/ProcessController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Compiler - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -66,7 +66,7 @@ public function runAction() try { $this->_getCompiler()->run(); Mage::getSingleton('adminhtml/session')->addSuccess( - Mage::helper('compiler')->__('Compilation successfully finished') + Mage::helper('compiler')->__('The compilation has completed.') ); } catch (Mage_Core_Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); @@ -91,7 +91,7 @@ public function disableAction() { $this->_getCompiler()->registerIncludePath(false); Mage::getSingleton('adminhtml/session')->addSuccess( - Mage::helper('compiler')->__('Compiler include path disabled') + Mage::helper('compiler')->__('Compiler include path is disabled.') ); $this->_redirect('*/*/'); } @@ -100,7 +100,7 @@ public function enableAction() { $this->_getCompiler()->registerIncludePath(); Mage::getSingleton('adminhtml/session')->addSuccess( - Mage::helper('compiler')->__('Compiler include path enabled') + Mage::helper('compiler')->__('Compiler include path is enabled.') ); $this->_redirect('*/*/'); } diff --git a/app/code/core/Mage/Compiler/etc/adminhtml.xml b/app/code/core/Mage/Compiler/etc/adminhtml.xml index ea64d27e27..415e573ff9 100644 --- a/app/code/core/Mage/Compiler/etc/adminhtml.xml +++ b/app/code/core/Mage/Compiler/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Compiler - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Compiler/etc/compilation.xml b/app/code/core/Mage/Compiler/etc/compilation.xml index 1dea0b8f3a..e01ef7d3be 100644 --- a/app/code/core/Mage/Compiler/etc/compilation.xml +++ b/app/code/core/Mage/Compiler/etc/compilation.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Compiler - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Compiler/etc/config.xml b/app/code/core/Mage/Compiler/etc/config.xml index 6b92d426ea..2ca706ff9b 100644 --- a/app/code/core/Mage/Compiler/etc/config.xml +++ b/app/code/core/Mage/Compiler/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Compiler - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Contacts/Helper/Data.php b/app/code/core/Mage/Contacts/Helper/Data.php index a92e9b5b9e..aa5a9b1d1d 100644 --- a/app/code/core/Mage/Contacts/Helper/Data.php +++ b/app/code/core/Mage/Contacts/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Contacts - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Contacts/Model/System/Config/Backend/Links.php b/app/code/core/Mage/Contacts/Model/System/Config/Backend/Links.php index 0de6be8316..5a2029b37c 100644 --- a/app/code/core/Mage/Contacts/Model/System/Config/Backend/Links.php +++ b/app/code/core/Mage/Contacts/Model/System/Config/Backend/Links.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Contacts - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Contacts/controllers/IndexController.php b/app/code/core/Mage/Contacts/controllers/IndexController.php index 13f02dd49f..be65882fff 100644 --- a/app/code/core/Mage/Contacts/controllers/IndexController.php +++ b/app/code/core/Mage/Contacts/controllers/IndexController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Contacts - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Contacts/etc/adminhtml.xml b/app/code/core/Mage/Contacts/etc/adminhtml.xml index 9988e45e4d..69c7472fe4 100644 --- a/app/code/core/Mage/Contacts/etc/adminhtml.xml +++ b/app/code/core/Mage/Contacts/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Contacts - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Contacts/etc/config.xml b/app/code/core/Mage/Contacts/etc/config.xml index 6032086455..dc22769152 100644 --- a/app/code/core/Mage/Contacts/etc/config.xml +++ b/app/code/core/Mage/Contacts/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Contacts - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Contacts/etc/system.xml b/app/code/core/Mage/Contacts/etc/system.xml index 788b8aa956..4968449fdf 100644 --- a/app/code/core/Mage/Contacts/etc/system.xml +++ b/app/code/core/Mage/Contacts/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Contacts - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Contacts/sql/contacts_setup/mysql4-install-0.7.1.php b/app/code/core/Mage/Contacts/sql/contacts_setup/mysql4-install-0.7.1.php index 77081deabf..5f3f0a6e15 100644 --- a/app/code/core/Mage/Contacts/sql/contacts_setup/mysql4-install-0.7.1.php +++ b/app/code/core/Mage/Contacts/sql/contacts_setup/mysql4-install-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Contacts - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Contacts/sql/contacts_setup/mysql4-install-0.8.0.php b/app/code/core/Mage/Contacts/sql/contacts_setup/mysql4-install-0.8.0.php index 2a808dcb2f..9fde540812 100644 --- a/app/code/core/Mage/Contacts/sql/contacts_setup/mysql4-install-0.8.0.php +++ b/app/code/core/Mage/Contacts/sql/contacts_setup/mysql4-install-0.8.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Contacts - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Contacts/sql/contacts_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/Contacts/sql/contacts_setup/mysql4-upgrade-0.7.1-0.7.2.php index a764883f79..4049843466 100644 --- a/app/code/core/Mage/Contacts/sql/contacts_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/Contacts/sql/contacts_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Contacts - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Block/Abstract.php b/app/code/core/Mage/Core/Block/Abstract.php index c7f711c6cb..6778d346f9 100644 --- a/app/code/core/Mage/Core/Block/Abstract.php +++ b/app/code/core/Mage/Core/Block/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -94,6 +94,13 @@ abstract class Mage_Core_Block_Abstract extends Varien_Object */ protected $_childrenHtmlCache = array(); + /** + * Arbitrary groups of child blocks + * + * @var array + */ + protected $_childGroups = array(); + /** * Request object * @@ -157,10 +164,10 @@ protected function _construct() */ public function getRequest() { - if ($controller = Mage::app()->getFrontController()) { + $controller = Mage::app()->getFrontController(); + if ($controller) { $this->_request = $controller->getRequest(); - } - else { + } else { throw new Exception(Mage::helper('core')->__("Can't retrieve request object")); } return $this->_request; @@ -235,6 +242,10 @@ public function getLayout() return $this->_layout; } + /** + * Check if block is using auto generated (Anonymous) name + * @return bool + */ public function getIsAnonymous() { return $this->_isAnonymous; @@ -277,9 +288,8 @@ public function setBlockAlias($alias) public function setNameInLayout($name) { if (!empty($this->_nameInLayout) && $this->getLayout()) { - $this->getLayout() - ->unsetBlock($this->_nameInLayout) - ->setBlock($name, $this); + $this->getLayout()->unsetBlock($this->_nameInLayout) + ->setBlock($name, $this); } $this->_nameInLayout = $name; return $this; @@ -316,14 +326,11 @@ public function setChild($alias, $block) if (is_string($block)) { $block = $this->getLayout()->getBlock($block); } - /** - * @see self::insert() - */ if (!$block) { return $this; } - if ($block->getIsAnonymous()) { + if ($block->getIsAnonymous()) { $suffix = $block->getAnonSuffix(); if (empty($suffix)) { $suffix = 'child'.sizeof($this->_children); @@ -331,9 +338,8 @@ public function setChild($alias, $block) $blockName = $this->getNameInLayout().'.'.$suffix; if ($this->getLayout()) { - $this->getLayout() - ->unsetBlock($block->getNameInLayout()) - ->setBlock($blockName, $block); + $this->getLayout()->unsetBlock($block->getNameInLayout()) + ->setBlock($blockName, $block); } $block->setNameInLayout($blockName); @@ -346,9 +352,7 @@ public function setChild($alias, $block) $block->setParentBlock($this); $block->setBlockAlias($alias); - $this->_children[$alias] = $block; - return $this; } @@ -583,8 +587,7 @@ public function insert($block, $siblingName='', $after=false, $alias='') if (''===$siblingName) { if ($after) { array_push($this->_sortedChildren, $name); - } - else { + } else { array_unshift($this->_sortedChildren, $name); } } else { @@ -597,8 +600,7 @@ public function insert($block, $siblingName='', $after=false, $alias='') } else { if ($after) { array_push($this->_sortedChildren, $name); - } - else { + } else { array_unshift($this->_sortedChildren, $name); } } @@ -620,6 +622,84 @@ public function append($block, $alias='') return $this; } + /** + * Make sure specified block will be registered in the specified child groups + * + * @param string $groupName + * @param Mage_Core_Block_Abstract $child + */ + public function addToChildGroup($groupName, Mage_Core_Block_Abstract $child) + { + if (!isset($this->_childGroups[$groupName])) { + $this->_childGroups[$groupName] = array(); + } + if (!in_array($child->getBlockAlias(), $this->_childGroups[$groupName])) { + $this->_childGroups[$groupName][] = $child->getBlockAlias(); + } + } + + /** + * Add self to the specified group of parent block + * + * @param string $groupName + * @return Mage_Core_Block_Abstract + */ + public function addToParentGroup($groupName) + { + $this->getParentBlock()->addToChildGroup($groupName, $this); + return $this; + } + + /** + * Get a group of child blocks + * + * Returns an array of => + * or an array of => + * The callback currently supports only $this methods and passes the alias as parameter + * + * @param string $groupName + * @param string $callback + * @param bool $skipEmptyResults + * @return array + */ + public function getChildGroup($groupName, $callback = null, $skipEmptyResults = true) + { + $result = array(); + if (!isset($this->_childGroups[$groupName])) { + return $result; + } + foreach ($this->getSortedChildBlocks() as $block) { + $alias = $block->getBlockAlias(); + if (in_array($alias, $this->_childGroups[$groupName])) { + if ($callback) { + $row = $this->$callback($alias); + if (!$skipEmptyResults || $row) { + $result[$alias] = $row; + } + } else { + $result[$alias] = $block; + } + + } + } + return $result; + } + + /** + * Get a value from child block by specified key + * + * @param string $alias + * @param string $key + * @return mixed + */ + public function getChildData($alias, $key = '') + { + $child = $this->getChild($alias); + if ($child) { + return $child->getData($key); + } + } + /** * Before rendering html, but after trying to load cache * @@ -658,12 +738,11 @@ public function setFrameTags($openTag, $closeTag=null) final public function toHtml() { Mage::dispatchEvent('core_block_abstract_to_html_before', array('block' => $this)); - if (Mage::getStoreConfig('advanced/modules_disable_output/'.$this->getModuleName())) { return ''; } - - if (!($html = $this->_loadCache())) { + $html = $this->_loadCache(); + if (!$html) { $translate = Mage::getSingleton('core/translate'); /* @var $translate Mage_Core_Model_Translate */ if ($this->hasData('translate_inline')) { @@ -679,7 +758,6 @@ final public function toHtml() } } $html = $this->_afterToHtml($html); - Mage::dispatchEvent('core_block_abstract_to_html_after', array('block' => $this)); /** * Check framing options @@ -687,6 +765,18 @@ final public function toHtml() if ($this->_frameOpenTag) { $html = '<'.$this->_frameOpenTag.'>'.$html.'<'.$this->_frameCloseTag.'>'; } + + /** + * Use single transport object instance for all blocks + */ + static $transport; + if ($transport === null) { + $transport = new Varien_Object; + } + $transport->setHtml($html); + Mage::dispatchEvent('core_block_abstract_to_html_after', array('block' => $this, 'transport' => $transport)); + $html = $transport->getHtml(); + return $html; } @@ -886,94 +976,46 @@ public function __() } /** - * Get Key for caching block content - * - * @return string - */ - public function getCacheKey() - { - if (!$this->hasData('cache_key')) { - $this->setCacheKey($this->getNameInLayout()); - } - return $this->getData('cache_key'); - } - - /** - * Get tags array for saving cache - * - * @return array - */ - public function getCacheTags() - { - if (!$this->hasData('cache_tags')) { - $tags = array(); - } else { - $tags = $this->getData('cache_tags'); - } - $tags[] = self::CACHE_GROUP; - return $tags; - } - - /** - * Get block cache life time - * - * @return int + * @deprecated after 1.4.0.0-rc1 + * @see self::escapeHtml() */ - public function getCacheLifetime() + public function htmlEscape($data, $allowedTags = null) { - if (!$this->hasData('cache_lifetime')) { - return null; - } - return $this->getData('cache_lifetime'); + return $this->escapeHtml($data, $allowedTags); } /** - * Enter description here... + * Escape html entities * - * @return unknown + * @param mixed $data + * @param array $allowedTags + * @return string */ - protected function _loadCache() + public function escapeHtml($data, $allowedTags = null) { - if (is_null($this->getCacheLifetime()) || !Mage::app()->useCache(self::CACHE_GROUP)) { - return false; - } - return Mage::app()->loadCache($this->getCacheKey()); + return $this->helper('core')->escapeHtml($data, $allowedTags); } /** - * Enter description here... + * Wrapper for standart strip_tags() function with extra functionality for html entities * - * @param unknown_type $data - * @return Mage_Core_Block_Abstract + * @param string $data + * @param string $allowableTags + * @param bool $allowHtmlEntities + * @return string */ - protected function _saveCache($data) + public function stripTags($data, $allowableTags = null, $allowHtmlEntities = false) { - if (is_null($this->getCacheLifetime()) || !Mage::app()->useCache(self::CACHE_GROUP)) { - return false; - } - Mage::app()->saveCache($data, $this->getCacheKey(), $this->getCacheTags(), $this->getCacheLifetime()); - return $this; + return $this->helper('core')->stripTags($data, $allowableTags, $allowHtmlEntities); } /** * @deprecated after 1.4.0.0-rc1 - * @see self::escapeHtml() - */ - public function htmlEscape($data, $allowedTags = null) - { - return $this->escapeHtml($data, $allowedTags); - } - - /** - * Escape html entities - * - * @param mixed $data - * @param array $allowedTags - * @return string + * @see self::escapeUrl() */ - public function escapeHtml($data, $allowedTags = null) + public function urlEscape($data) { - return $this->helper('core')->htmlEscape($data, $allowedTags); + return $this->escapeUrl($data); } /** @@ -982,9 +1024,9 @@ public function escapeHtml($data, $allowedTags = null) * @param string $data * @return string */ - public function urlEscape($data) + public function escapeUrl($data) { - return $this->helper('core')->urlEscape($data); + return $this->helper('core')->escapeUrl($data); } /** @@ -1009,6 +1051,10 @@ public function getNameInLayout() return $this->_nameInLayout; } + /** + * Get chilren blocks count + * @return int + */ public function countChildren() { return count($this->_children); @@ -1043,4 +1089,96 @@ protected function _afterCacheUrl($html) } return $html; } + + /** + * Get cache key informative items + * Provide string array key to share specific info item with FPC placeholder + * + * @return array + */ + public function getCacheKeyInfo() + { + return array( + $this->getNameInLayout() + ); + } + + /** + * Get Key for caching block content + * + * @return string + */ + public function getCacheKey() + { + if ($this->hasData('cache_key')) { + return $this->getData('cache_key'); + } + /** + * don't prevent recalculation by saving generated cache key + * because of ability to render single block instance with different data + */ + $key = $this->getCacheKeyInfo(); + //ksort($key); // ignore order + $key = array_values($key); // ignore array keys + $key = implode('|', $key); + $key = sha1($key); + return $key; + } + + /** + * Get tags array for saving cache + * + * @return array + */ + public function getCacheTags() + { + if (!$this->hasData('cache_tags')) { + $tags = array(); + } else { + $tags = $this->getData('cache_tags'); + } + $tags[] = self::CACHE_GROUP; + return $tags; + } + + /** + * Get block cache life time + * + * @return int + */ + public function getCacheLifetime() + { + if (!$this->hasData('cache_lifetime')) { + return null; + } + return $this->getData('cache_lifetime'); + } + + /** + * Load block html from cache storage + * + * @return string | false + */ + protected function _loadCache() + { + if (is_null($this->getCacheLifetime()) || !Mage::app()->useCache(self::CACHE_GROUP)) { + return false; + } + return Mage::app()->loadCache($this->getCacheKey()); + } + + /** + * Save block content to cache storage + * + * @param string $data + * @return Mage_Core_Block_Abstract + */ + protected function _saveCache($data) + { + if (is_null($this->getCacheLifetime()) || !Mage::app()->useCache(self::CACHE_GROUP)) { + return false; + } + Mage::app()->saveCache($data, $this->getCacheKey(), $this->getCacheTags(), $this->getCacheLifetime()); + return $this; + } } diff --git a/app/code/core/Mage/Core/Block/Flush.php b/app/code/core/Mage/Core/Block/Flush.php index 83ee972036..f07505d894 100644 --- a/app/code/core/Mage/Core/Block/Flush.php +++ b/app/code/core/Mage/Core/Block/Flush.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Block/Html/Calendar.php b/app/code/core/Mage/Core/Block/Html/Calendar.php index a0cbd85467..dee672f64e 100644 --- a/app/code/core/Mage/Core/Block/Html/Calendar.php +++ b/app/code/core/Mage/Core/Block/Html/Calendar.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -89,4 +89,15 @@ public function getTimezoneOffsetSeconds() { return Mage::getSingleton('core/date')->getGmtOffset(); } + + /** + * Getter for store timestamp based on store timezone settings + * + * @param mixed $store + * @return int + */ + public function getStoreTimestamp($store = null) + { + return Mage::getSingleton('core/locale')->storeTimeStamp($store); + } } diff --git a/app/code/core/Mage/Core/Block/Html/Date.php b/app/code/core/Mage/Core/Block/Html/Date.php index 18ce897fc5..15652c222d 100644 --- a/app/code/core/Mage/Core/Block/Html/Date.php +++ b/app/code/core/Mage/Core/Block/Html/Date.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -37,6 +37,8 @@ class Mage_Core_Block_Html_Date extends Mage_Core_Block_Template protected function _toHtml() { + $displayFormat = Varien_Date::convertZendToStrFtime($this->getFormat(), true, (bool)$this->getTime()); + $html = 'getValue().'" class="'.$this->getClass().'" '.$this->getExtraParams().'/> '; @@ -49,7 +51,8 @@ protected function _toHtml() //getId() . '", - ifFormat : "' . $this->getFormat() . '", + ifFormat : "' . $displayFormat . '", + showsTime : "' . ($this->getTime() ? 'true' : 'false') . '", button : "' . $this->getId() . '_trig", align : "Bl", singleClick : true diff --git a/app/code/core/Mage/Core/Block/Html/Link.php b/app/code/core/Mage/Core/Block/Html/Link.php index 563b65b382..bf9a25b0c4 100644 --- a/app/code/core/Mage/Core/Block/Html/Link.php +++ b/app/code/core/Mage/Core/Block/Html/Link.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Block/Html/Select.php b/app/code/core/Mage/Core/Block/Html/Select.php index 430695b85c..3e76e26119 100644 --- a/app/code/core/Mage/Core/Block/Html/Select.php +++ b/app/code/core/Mage/Core/Block/Html/Select.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -148,6 +148,9 @@ protected function _toHtml() protected function _optionToHtml($option, $selected=false) { $selectedHtml = $selected ? ' selected="selected"' : ''; + if ($this->getIsRenderToJsTemplate() === true) { + $selectedHtml .= ' #{option_extra_attr_' . self::calcOptionHash($option['value']) . '}'; + } $html = ''; return $html; @@ -158,4 +161,9 @@ public function getHtml() return $this->toHtml(); } + public function calcOptionHash($optionValue) + { + return sprintf('%u', crc32($this->getName() . $this->getId() . $optionValue)); + } + } diff --git a/app/code/core/Mage/Core/Block/Messages.php b/app/code/core/Mage/Core/Block/Messages.php index 0111495388..dfa739a748 100644 --- a/app/code/core/Mage/Core/Block/Messages.php +++ b/app/code/core/Mage/Core/Block/Messages.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Block/Profiler.php b/app/code/core/Mage/Core/Block/Profiler.php index 46c02886d0..763f33145a 100644 --- a/app/code/core/Mage/Core/Block/Profiler.php +++ b/app/code/core/Mage/Core/Block/Profiler.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Block/Store/Switcher.php b/app/code/core/Mage/Core/Block/Store/Switcher.php index ac38043c7d..062df91586 100644 --- a/app/code/core/Mage/Core/Block/Store/Switcher.php +++ b/app/code/core/Mage/Core/Block/Store/Switcher.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Block/Template.php b/app/code/core/Mage/Core/Block/Template.php index bc7e32a7ed..ed465c3b5c 100644 --- a/app/code/core/Mage/Core/Block/Template.php +++ b/app/code/core/Mage/Core/Block/Template.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -83,7 +83,7 @@ protected function _construct() } /** - * Retrieve path to template used for generating block's output. + * Get relevant path to template * * @return string */ @@ -101,10 +101,29 @@ public function getTemplate() public function setTemplate($template) { $this->_template = $template; - return $this; } + /** + * Get absolute path to template + * + * @return string + */ + public function getTemplateFile() + { + $params = array('_relative'=>true); + $area = $this->getArea(); + if ($area) { + $params['_area'] = $area; + } + $templateName = Mage::getDesign()->getTemplateFilename($this->getTemplate(), $params); + return $templateName; + } + + /** + * Get design area + * @return string + */ public function getArea() { return $this->_getData('area'); @@ -142,6 +161,10 @@ public function setScriptPath($dir) return $this; } + /** + * Check if dirrect output is allowed for block + * @return bool + */ public function getDirectOutput() { if ($this->getLayout()) { @@ -212,20 +235,8 @@ public function fetchView($fileName) */ public function renderView() { - Varien_Profiler::start(__METHOD__); - $this->setScriptPath(Mage::getBaseDir('design')); - $params = array('_relative'=>true); - if ($area = $this->getArea()) { - $params['_area'] = $area; - } - - $templateName = Mage::getDesign()->getTemplateFilename($this->getTemplate(), $params); - - $html = $this->fetchView($templateName); - - Varien_Profiler::stop(__METHOD__); - + $html = $this->fetchView($this->getTemplateFile()); return $html; } @@ -272,4 +283,30 @@ public function getJsUrl($fileName='') return $this->_jsUrl.$fileName; } + /** + * Get data from specified object + * + * @param Varien_Object $object + * @param string $key + * @return mixed + */ + public function getObjectData(Varien_Object $object, $key) + { + return $object->getDataUsingMethod((string)$key); + } + + /** + * Get cache key informative items + * + * @return array + */ + public function getCacheKeyInfo() + { + return array( + 'BLOCK_TPL', + Mage::app()->getStore()->getCode(), + $this->getTemplateFile(), + 'template' => $this->getTemplate() + ); + } } diff --git a/app/code/core/Mage/Core/Block/Template/Facade.php b/app/code/core/Mage/Core/Block/Template/Facade.php index f61366ab32..119d7132f5 100644 --- a/app/code/core/Mage/Core/Block/Template/Facade.php +++ b/app/code/core/Mage/Core/Block/Template/Facade.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Block/Template/Smarty.php b/app/code/core/Mage/Core/Block/Template/Smarty.php index 91b2850268..2e68064d89 100644 --- a/app/code/core/Mage/Core/Block/Template/Smarty.php +++ b/app/code/core/Mage/Core/Block/Template/Smarty.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Block/Template/Zend.php b/app/code/core/Mage/Core/Block/Template/Zend.php index 34279222c7..2a5b62cc28 100644 --- a/app/code/core/Mage/Core/Block/Template/Zend.php +++ b/app/code/core/Mage/Core/Block/Template/Zend.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Block/Text.php b/app/code/core/Mage/Core/Block/Text.php index 3fe458fdc2..31542f9500 100644 --- a/app/code/core/Mage/Core/Block/Text.php +++ b/app/code/core/Mage/Core/Block/Text.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Block/Text/List.php b/app/code/core/Mage/Core/Block/Text/List.php index 9e5f9dd118..fe30ca2af4 100644 --- a/app/code/core/Mage/Core/Block/Text/List.php +++ b/app/code/core/Mage/Core/Block/Text/List.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Block/Text/List/Item.php b/app/code/core/Mage/Core/Block/Text/List/Item.php index ca668a924c..b10cb52be1 100644 --- a/app/code/core/Mage/Core/Block/Text/List/Item.php +++ b/app/code/core/Mage/Core/Block/Text/List/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Block/Text/List/Link.php b/app/code/core/Mage/Core/Block/Text/List/Link.php index 2fe046d6a1..448558c7c5 100644 --- a/app/code/core/Mage/Core/Block/Text/List/Link.php +++ b/app/code/core/Mage/Core/Block/Text/List/Link.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Block/Text/Tag.php b/app/code/core/Mage/Core/Block/Text/Tag.php index 25d8597896..db84f1ec79 100644 --- a/app/code/core/Mage/Core/Block/Text/Tag.php +++ b/app/code/core/Mage/Core/Block/Text/Tag.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Block/Text/Tag/Css.php b/app/code/core/Mage/Core/Block/Text/Tag/Css.php index ceed2bcd41..55057de158 100644 --- a/app/code/core/Mage/Core/Block/Text/Tag/Css.php +++ b/app/code/core/Mage/Core/Block/Text/Tag/Css.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Block/Text/Tag/Css/Admin.php b/app/code/core/Mage/Core/Block/Text/Tag/Css/Admin.php index 5fbd1cdc7e..05293b197a 100644 --- a/app/code/core/Mage/Core/Block/Text/Tag/Css/Admin.php +++ b/app/code/core/Mage/Core/Block/Text/Tag/Css/Admin.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Block/Text/Tag/Debug.php b/app/code/core/Mage/Core/Block/Text/Tag/Debug.php index 009d61ebfa..dc34ad18fa 100644 --- a/app/code/core/Mage/Core/Block/Text/Tag/Debug.php +++ b/app/code/core/Mage/Core/Block/Text/Tag/Debug.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Block/Text/Tag/Js.php b/app/code/core/Mage/Core/Block/Text/Tag/Js.php index 01bb59d655..79ae8fe215 100644 --- a/app/code/core/Mage/Core/Block/Text/Tag/Js.php +++ b/app/code/core/Mage/Core/Block/Text/Tag/Js.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Block/Text/Tag/Meta.php b/app/code/core/Mage/Core/Block/Text/Tag/Meta.php index 140809aa57..345f9128d0 100644 --- a/app/code/core/Mage/Core/Block/Text/Tag/Meta.php +++ b/app/code/core/Mage/Core/Block/Text/Tag/Meta.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Controller/Front/Action.php b/app/code/core/Mage/Core/Controller/Front/Action.php index 39197df38e..90d182f2cf 100644 --- a/app/code/core/Mage/Core/Controller/Front/Action.php +++ b/app/code/core/Mage/Core/Controller/Front/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Controller/Front/Router.php b/app/code/core/Mage/Core/Controller/Front/Router.php index d9a62a0263..8c75e2ded4 100644 --- a/app/code/core/Mage/Core/Controller/Front/Router.php +++ b/app/code/core/Mage/Core/Controller/Front/Router.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Controller/Request/Http.php b/app/code/core/Mage/Core/Controller/Request/Http.php index be6818ee3a..ffa7d59986 100644 --- a/app/code/core/Mage/Core/Controller/Request/Http.php +++ b/app/code/core/Mage/Core/Controller/Request/Http.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -57,6 +57,14 @@ class Mage_Core_Controller_Request_Http extends Zend_Controller_Request_Http protected $_directFrontNames = array(); protected $_controllerModule = null; + /** + * Streight request flag. + * If flag is determined no additional logic is applicable + * + * @var $_isStraight bool + */ + protected $_isStraight = false; + /** * Request's original information before forward. * @@ -437,4 +445,18 @@ public function getBeforeForwardInfo($name = null) return null; } + + /** + * Specify/get _isStraight flag value + * + * @param bool $flag + * @return bool + */ + public function isStraight($flag = null) + { + if ($flag !== null) { + $this->_isStraight = $flag; + } + return $this->_isStraight; + } } diff --git a/app/code/core/Mage/Core/Controller/Response/Http.php b/app/code/core/Mage/Core/Controller/Response/Http.php index 6440b026f1..e871cf3642 100644 --- a/app/code/core/Mage/Core/Controller/Response/Http.php +++ b/app/code/core/Mage/Core/Controller/Response/Http.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Controller/Varien/Action.php b/app/code/core/Mage/Core/Controller/Varien/Action.php index ce3719482b..195df3dfa1 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Action.php +++ b/app/code/core/Mage/Core/Controller/Varien/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Controller/Varien/Exception.php b/app/code/core/Mage/Core/Controller/Varien/Exception.php index 8375e4084b..c4de8c0a1b 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Exception.php +++ b/app/code/core/Mage/Core/Controller/Varien/Exception.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Controller/Varien/Front.php b/app/code/core/Mage/Core/Controller/Varien/Front.php index f1fbd86b0d..80a3c09aee 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Front.php +++ b/app/code/core/Mage/Core/Controller/Varien/Front.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -159,17 +159,17 @@ public function dispatch() // If pre-configured, check equality of base URL and requested URL $this->_checkBaseUrl($request); - - $request->setPathInfo()->setDispatched(false); - - Varien_Profiler::start('mage::dispatch::db_url_rewrite'); - Mage::getModel('core/url_rewrite')->rewrite(); - Varien_Profiler::stop('mage::dispatch::db_url_rewrite'); + $request->setPathInfo()->setDispatched(false); + if (!$request->isStraight()) { + Varien_Profiler::start('mage::dispatch::db_url_rewrite'); + Mage::getModel('core/url_rewrite')->rewrite(); + Varien_Profiler::stop('mage::dispatch::db_url_rewrite'); + } Varien_Profiler::start('mage::dispatch::config_url_rewrite'); $this->rewrite(); Varien_Profiler::stop('mage::dispatch::config_url_rewrite'); - + Varien_Profiler::start('mage::dispatch::routers_match'); $i = 0; while (!$request->isDispatched() && $i++<100) { @@ -284,7 +284,7 @@ protected function _processRewriteUrl($url) } return $url; } - + /** * Auto-redirect to base url (without SID) if the requested url doesn't match it. * By default this feature is enabled in configuration. @@ -305,13 +305,13 @@ protected function _checkBaseUrl($request) if (!$baseUrl) { return; } - + $uri = @parse_url($baseUrl); $host = isset($uri['host']) ? $uri['host'] : ''; $path = isset($uri['path']) ? $uri['path'] : ''; - + $requestUri = $request->getRequestUri() ? $request->getRequestUri() : '/'; - if ($host && $host != $request->getHttpHost() || $path && strpos($requestUri, $path) === false) + if ($host && $host != $request->getHttpHost() || $path && strpos($requestUri, $path) === false) { Mage::app()->getFrontController()->getResponse() ->setRedirect($baseUrl) diff --git a/app/code/core/Mage/Core/Controller/Varien/Router/Abstract.php b/app/code/core/Mage/Core/Controller/Varien/Router/Abstract.php index 26563b03e6..b5b3e37a33 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Router/Abstract.php +++ b/app/code/core/Mage/Core/Controller/Varien/Router/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Controller/Varien/Router/Admin.php b/app/code/core/Mage/Core/Controller/Varien/Router/Admin.php index 699fcffb83..c20dda0140 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Router/Admin.php +++ b/app/code/core/Mage/Core/Controller/Varien/Router/Admin.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Controller/Varien/Router/Default.php b/app/code/core/Mage/Core/Controller/Varien/Router/Default.php index c7c5123838..0a976263be 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Router/Default.php +++ b/app/code/core/Mage/Core/Controller/Varien/Router/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php b/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php index 203f8a5f2a..0c461efb45 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php +++ b/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Exception.php b/app/code/core/Mage/Core/Exception.php index 9de413892b..edc593f73d 100644 --- a/app/code/core/Mage/Core/Exception.php +++ b/app/code/core/Mage/Core/Exception.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Helper/Abstract.php b/app/code/core/Mage/Core/Helper/Abstract.php index 80015eff15..65d645d8f8 100644 --- a/app/code/core/Mage/Core/Helper/Abstract.php +++ b/app/code/core/Mage/Core/Helper/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -130,7 +130,6 @@ protected function _getModuleName() /** * Check whether or not the module output is enabled in Configuration - * TODO: add checking if module exists * * @param string $moduleName Full module name * @return boolean @@ -140,12 +139,40 @@ public function isModuleOutputEnabled($moduleName = null) if ($moduleName === null) { $moduleName = $this->_getModuleName(); } + + if (!$this->isModuleEnabled($moduleName)) { + return false; + } + if (Mage::getStoreConfigFlag('advanced/modules_disable_output/' . $moduleName)) { return false; } return true; } + /** + * Check is module exists and enabled in global config. + * + * @param string $moduleName the full module name, example Mage_Core + * @return boolean + */ + public function isModuleEnabled($moduleName = null) + { + if ($moduleName === null) { + $moduleName = $this->_getModuleName(); + } + + if (!Mage::getConfig()->getNode('modules/' . $moduleName)) { + return false; + } + + $isActive = Mage::getConfig()->getNode('modules/' . $moduleName . '/active'); + if (!$isActive || !in_array((string)$isActive, array('true', '1'))) { + return false; + } + return true; + } + /** * Translate * @@ -159,6 +186,15 @@ public function __() return Mage::app()->getTranslator()->translate($args); } + /** + * @deprecated after 1.4.0.0-rc1 + * @see self::escapeHtml() + */ + public function htmlEscape($data, $allowedTags = null) + { + return $this->escapeHtml($data, $allowedTags); + } + /** * Escape html entities * @@ -166,12 +202,12 @@ public function __() * @param array $allowedTags * @return mixed */ - public function htmlEscape($data, $allowedTags = null) + public function escapeHtml($data, $allowedTags = null) { if (is_array($data)) { $result = array(); foreach ($data as $item) { - $result[] = $this->htmlEscape($item); + $result[] = $this->escapeHtml($item); } } else { // process single item @@ -192,12 +228,35 @@ public function htmlEscape($data, $allowedTags = null) } /** - * Escape html entities in url + * Wrapper for standart strip_tags() function with extra functionality for html entities * * @param string $data + * @param string $allowableTags + * @param bool $escape * @return string */ + public function stripTags($data, $allowableTags = null, $escape = false) + { + $result = strip_tags($data, $allowableTags); + return $escape ? $this->escapeHtml($result, $allowableTags) : $result; + } + + /** + * @deprecated after 1.4.0.0-rc1 + * @see self::escapeHtml() + */ public function urlEscape($data) + { + return $this->escapeUrl($data); + } + + /** + * Escape html entities in url + * + * @param string $data + * @return string + */ + public function escapeUrl($data) { return htmlspecialchars($data); } diff --git a/app/code/core/Mage/Core/Helper/Data.php b/app/code/core/Mage/Core/Helper/Data.php index 7c4f495ba5..9c9e8b2919 100644 --- a/app/code/core/Mage/Core/Helper/Data.php +++ b/app/code/core/Mage/Core/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Helper/Http.php b/app/code/core/Mage/Core/Helper/Http.php index 7215757b14..cab38c8348 100644 --- a/app/code/core/Mage/Core/Helper/Http.php +++ b/app/code/core/Mage/Core/Helper/Http.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Helper/Js.php b/app/code/core/Mage/Core/Helper/Js.php index c6f13078e3..b464a4ebec 100644 --- a/app/code/core/Mage/Core/Helper/Js.php +++ b/app/code/core/Mage/Core/Helper/Js.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -168,17 +168,17 @@ protected function _getTranslateData() 'Please wait, loading...' => $this->__('Please wait, loading...'), 'Please choose to register or to checkout as a guest' => $this->__('Please choose to register or to checkout as a guest'), 'Error: Passwords do not match' => $this->__('Error: Passwords do not match'), - 'Your order can not be completed at this time as there is no shipping methods available for it. Please make necessary changes in your shipping address.' => - $this->__('Your order can not be completed at this time as there is no shipping methods available for it. Please make necessary changes in your shipping address.'), + 'Your order cannot be completed at this time as there is no shipping methods available for it. Please make necessary changes in your shipping address.' => + $this->__('Your order cannot be completed at this time as there is no shipping methods available for it. Please make necessary changes in your shipping address.'), 'Please specify shipping method.' => $this->__('Please specify shipping method.'), - 'Your order can not be completed at this time as there is no payment methods available for it.' => - $this->__('Your order can not be completed at this time as there is no payment methods available for it.'), + 'Your order cannot be completed at this time as there is no payment methods available for it.' => + $this->__('Your order cannot be completed at this time as there is no payment methods available for it.'), 'Please specify payment method.' => $this->__('Please specify payment method.'), - 'Credit card number doesn\'t match credit card type' => $this->__('Credit card number doesn\'t match credit card type'), - 'Card type doesn\'t match credit card number' => $this->__('Card type doesn\'t match credit card number'), + 'Credit card number doesn\'t match credit card type' => $this->__('Credit card number does not match credit card type'), + 'Card type does not match credit card number' => $this->__('Card type does not match credit card number'), 'Please enter a valid credit card verification number.' => $this->__('Please enter a valid credit card verification number.'), 'Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter.' => - $this->__('Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter.'), + $this->__('Please use only letters (a-z or A-Z), numbers (0-9) or underscores (_) in this field, first character must be a letter.'), 'Please input a valid CSS-length. For example 100px or 77pt or 20em or .5ex or 50%' => $this->__('Please input a valid CSS-length. For example 100px or 77pt or 20em or .5ex or 50%'), 'Maximum length exceeded.' => $this->__('Maximum length exceeded.'), @@ -187,6 +187,8 @@ protected function _getTranslateData() 'Your session has been expired, you will be relogged in now.' => $this->__('Your session has been expired, you will be relogged in now.'), 'Incorrect credit card expiration date' => $this->__('Incorrect credit card expiration date'), + // Date + 'This date is a required value.' => $this->__('This date is a required value.'), ); foreach ($this->_translateData as $key=>$value) { if ($key == $value) { diff --git a/app/code/core/Mage/Core/Helper/String.php b/app/code/core/Mage/Core/Helper/String.php index d058428680..e3180a2fe3 100644 --- a/app/code/core/Mage/Core/Helper/String.php +++ b/app/code/core/Mage/Core/Helper/String.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Helper/Url.php b/app/code/core/Mage/Core/Helper/Url.php index ce88fe0f04..f4f2f2bbef 100644 --- a/app/code/core/Mage/Core/Helper/Url.php +++ b/app/code/core/Mage/Core/Helper/Url.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Abstract.php b/app/code/core/Mage/Core/Model/Abstract.php index 7bb0b451ad..7b62e6d86c 100644 --- a/app/code/core/Mage/Core/Model/Abstract.php +++ b/app/code/core/Mage/Core/Model/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -133,7 +133,7 @@ protected function _setResourceModel($resourceName, $resourceCollectionName=null protected function _getResource() { if (empty($this->_resourceName)) { - Mage::throwException(Mage::helper('core')->__('Resource is not set')); + Mage::throwException(Mage::helper('core')->__('Resource is not set.')); } return Mage::getResourceSingleton($this->_resourceName); @@ -161,7 +161,8 @@ public function getIdFieldName() */ public function getId() { - if ($fieldName = $this->getIdFieldName()) { + $fieldName = $this->getIdFieldName(); + if ($fieldName) { return $this->_getData($fieldName); } else { return $this->_getData('id'); @@ -202,7 +203,7 @@ public function getResourceName() public function getResourceCollection() { if (empty($this->_resourceCollectionName)) { - Mage::throwException(Mage::helper('core')->__('Model collection resource name is not defined')); + Mage::throwException(Mage::helper('core')->__('Model collection resource name is not defined.')); } return Mage::getResourceModel($this->_resourceCollectionName, $this->_getResource()); } @@ -220,9 +221,11 @@ public function getCollection() */ public function load($id, $field=null) { + $this->_beforeLoad($id, $field); $this->_getResource()->load($this, $id, $field); $this->_afterLoad(); $this->setOrigData(); + $this->_hasDataChanges = false; return $this; } @@ -239,6 +242,20 @@ protected function _getEventData() ); } + /** + * Processing object before load data + * + * @return Mage_Core_Model_Abstract + */ + protected function _beforeLoad($id, $field = null) + { + $params = array('object' => $this, 'field' => $field, 'value'=> $id); + Mage::dispatchEvent('model_load_before', $params); + $params = array_merge($params, $this->_getEventData()); + Mage::dispatchEvent($this->_eventPrefix.'_load_before', $params); + return $this; + } + /** * Processing object after load data * @@ -251,6 +268,8 @@ protected function _afterLoad() return $this; } + + /** * Object after load processing. Implemented as public interface for supporting objects after load in collections * @@ -276,6 +295,9 @@ public function save() if ($this->isDeleted()) { return $this->delete(); } + if (!$this->hasDataChanges()) { + return $this; + } $this->_getResource()->beginTransaction(); $dataCommited = false; try { @@ -286,9 +308,11 @@ public function save() } $this->_getResource()->addCommitCallback(array($this, 'afterCommitCallback')) ->commit(); + $this->_hasDataChanges = false; $dataCommited = true; } catch (Exception $e) { $this->_getResource()->rollBack(); + $this->_hasDataChanges = true; throw $e; } if ($dataCommited) { diff --git a/app/code/core/Mage/Core/Model/App.php b/app/code/core/Mage/Core/Model/App.php index 3f5340c8b1..9907a4ce2d 100644 --- a/app/code/core/Mage/Core/Model/App.php +++ b/app/code/core/Mage/Core/Model/App.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -1194,17 +1194,19 @@ public function dispatchEvent($eventName, $args) $observer->setData(array('event'=>$event)); Varien_Profiler::start('OBSERVER: '.$obsName); switch ($obs['type']) { + case 'disabled': + break; case 'object': case 'model': $method = $obs['method']; $observer->addData($args); $object = Mage::getModel($obs['model']); - $object->$method($observer); + $this->_callObserverMethod($object, $method, $observer); break; default: $method = $obs['method']; $observer->addData($args); $object = Mage::getSingleton($obs['model']); - $object->$method($observer); + $this->_callObserverMethod($object, $method, $observer); break; } Varien_Profiler::stop('OBSERVER: '.$obsName); @@ -1213,6 +1215,23 @@ public function dispatchEvent($eventName, $args) return $this; } + /** + * Added not existin observers methods calls protection + * + * @param object $object + * @param string $method + * @param Varien_Event_Observer $observer + */ + protected function _callObserverMethod($object, $method, $observer) + { + if (method_exists($object, $method)) { + $object->$method($observer); + } elseif (Mage::getIsDeveloperMode()) { + Mage::throwException('Method "'.$method.'" is not defined in "'.get_class($object).'"'); + } + return $this; + } + public function setUpdateMode($value) { $this->_updateMode = $value; diff --git a/app/code/core/Mage/Core/Model/App/Area.php b/app/code/core/Mage/Core/Model/App/Area.php index 04a5807f04..98748de802 100644 --- a/app/code/core/Mage/Core/Model/App/Area.php +++ b/app/code/core/Mage/Core/Model/App/Area.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -148,6 +148,9 @@ protected function _initTranslate() protected function _initDesign() { + if (Mage::app()->getRequest()->isStraight()) { + return $this; + } $designPackage = Mage::getSingleton('core/design_package'); if ($designPackage->getArea() != self::AREA_FRONTEND) return; diff --git a/app/code/core/Mage/Core/Model/Cache.php b/app/code/core/Mage/Core/Model/Cache.php index f734e944ed..f581ae7ddf 100644 --- a/app/code/core/Mage/Core/Model/Cache.php +++ b/app/code/core/Mage/Core/Model/Cache.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Config.php b/app/code/core/Mage/Core/Model/Config.php index e758fcafb6..e1ad6d1250 100644 --- a/app/code/core/Mage/Core/Model/Config.php +++ b/app/code/core/Mage/Core/Model/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -615,7 +615,7 @@ public function getNode($path=null, $scope='', $scopeCode=null) } elseif ('websites' == $scope) { $scopeCode = Mage::app()->getWebsite($scopeCode)->getCode(); } else { - Mage::throwException(Mage::helper('core')->__('Unknown scope "%s"', $scope)); + Mage::throwException(Mage::helper('core')->__('Unknown scope "%s".', $scope)); } } $path = $scope . ($scopeCode ? '/' . $scopeCode : '' ) . (empty($path) ? '' : '/' . $path); @@ -755,7 +755,7 @@ protected function _sortModuleDepends($modules) $depends = $moduleProps['depends']; foreach ($moduleProps['depends'] as $depend => $true) { if ($moduleProps['active'] && ((!isset($modules[$depend])) || empty($modules[$depend]['active']))) { - Mage::throwException(Mage::helper('core')->__('Module "%1$s" requires module "%2$s"', $moduleName, $depend)); + Mage::throwException(Mage::helper('core')->__('Module "%1$s" requires module "%2$s".', $moduleName, $depend)); } $depends = array_merge($depends, $modules[$depend]['depends']); } @@ -779,7 +779,7 @@ protected function _sortModuleDepends($modules) foreach ($moduleProp['depends'] as $dependModule => $true) { if (!isset($definedModules[$dependModule])) { Mage::throwException( - Mage::helper('core')->__('Module "%1$s" can not be depended from "%2$s"', $moduleProp['module'], $dependModule) + Mage::helper('core')->__('Module "%1$s" cannot depend on "%2$s".', $moduleProp['module'], $dependModule) ); } } @@ -1207,7 +1207,7 @@ public function getModelInstance($modelClass='', $constructArguments=array()) Varien_Profiler::stop('CORE::create_object_of::'.$className); return $obj; } else { - #throw Mage::exception('Mage_Core', Mage::helper('core')->__('Model class does not exist: %s', $modelClass)); + #throw Mage::exception('Mage_Core', Mage::helper('core')->__('Model class does not exist: %s.', $modelClass)); return false; } } diff --git a/app/code/core/Mage/Core/Model/Config/Base.php b/app/code/core/Mage/Core/Model/Config/Base.php index 206bef6dd9..77b43dd06d 100644 --- a/app/code/core/Mage/Core/Model/Config/Base.php +++ b/app/code/core/Mage/Core/Model/Config/Base.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Config/Data.php b/app/code/core/Mage/Core/Model/Config/Data.php index 217a96677f..28273cb3b0 100644 --- a/app/code/core/Mage/Core/Model/Config/Data.php +++ b/app/code/core/Mage/Core/Model/Config/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -86,12 +86,25 @@ public function getOldValue() $storeCode = $this->getStoreCode(); $websiteCode = $this->getWebsiteCode(); $path = $this->getPath(); - if ($websiteCode) { - return Mage::app()->getWebsite($websiteCode)->getConfig($path); - } + if ($storeCode) { return Mage::app()->getStore($storeCode)->getConfig($path); } + if ($websiteCode) { + return Mage::app()->getWebsite($websiteCode)->getConfig($path); + } return (string) Mage::getConfig()->getNode('default/' . $path); } + + + /** + * Get value by key for new user data from
      /groups//fields/ + * + * @return string + */ + public function getFieldsetDataValue($key) + { + $data = $this->_getData('fieldset_data'); + return (is_array($data) && isset($data[$key])) ? $data[$key] : null; + } } diff --git a/app/code/core/Mage/Core/Model/Config/Element.php b/app/code/core/Mage/Core/Model/Config/Element.php index e5b5293815..553c67969a 100644 --- a/app/code/core/Mage/Core/Model/Config/Element.php +++ b/app/code/core/Mage/Core/Model/Config/Element.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Config/Options.php b/app/code/core/Mage/Core/Model/Config/Options.php index 0863a8cb18..03a47b11f5 100644 --- a/app/code/core/Mage/Core/Model/Config/Options.php +++ b/app/code/core/Mage/Core/Model/Config/Options.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Config/System.php b/app/code/core/Mage/Core/Model/Config/System.php index 7365a799ba..9d9a0a723c 100644 --- a/app/code/core/Mage/Core/Model/Config/System.php +++ b/app/code/core/Mage/Core/Model/Config/System.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Convert.php b/app/code/core/Mage/Core/Model/Convert.php index c5ad74e531..a793b34608 100644 --- a/app/code/core/Mage/Core/Model/Convert.php +++ b/app/code/core/Mage/Core/Model/Convert.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Convert/Adapter/Interactive.php b/app/code/core/Mage/Core/Model/Convert/Adapter/Interactive.php index a8b20bc4dd..29c79e36ff 100644 --- a/app/code/core/Mage/Core/Model/Convert/Adapter/Interactive.php +++ b/app/code/core/Mage/Core/Model/Convert/Adapter/Interactive.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Convert/History.php b/app/code/core/Mage/Core/Model/Convert/History.php index 15a06b1e8b..f1c14589ea 100644 --- a/app/code/core/Mage/Core/Model/Convert/History.php +++ b/app/code/core/Mage/Core/Model/Convert/History.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Convert/Profile.php b/app/code/core/Mage/Core/Model/Convert/Profile.php index 66c64243aa..5ea1fe7189 100644 --- a/app/code/core/Mage/Core/Model/Convert/Profile.php +++ b/app/code/core/Mage/Core/Model/Convert/Profile.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Cookie.php b/app/code/core/Mage/Core/Model/Cookie.php index aaffc82a9f..83c8e90e6c 100644 --- a/app/code/core/Mage/Core/Model/Cookie.php +++ b/app/code/core/Mage/Core/Model/Cookie.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Date.php b/app/code/core/Mage/Core/Model/Date.php index 3fdd2230f7..b93d6a40c7 100644 --- a/app/code/core/Mage/Core/Model/Date.php +++ b/app/code/core/Mage/Core/Model/Date.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Design.php b/app/code/core/Mage/Core/Model/Design.php index c5eb7b3cd8..37957d5a30 100644 --- a/app/code/core/Mage/Core/Model/Design.php +++ b/app/code/core/Mage/Core/Model/Design.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Design/Package.php b/app/code/core/Mage/Core/Model/Design/Package.php index db8f653778..2f3cfda3e0 100644 --- a/app/code/core/Mage/Core/Model/Design/Package.php +++ b/app/code/core/Mage/Core/Model/Design/Package.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Design/Source/Apply.php b/app/code/core/Mage/Core/Model/Design/Source/Apply.php index 1300048ea9..87ba9e88cb 100644 --- a/app/code/core/Mage/Core/Model/Design/Source/Apply.php +++ b/app/code/core/Mage/Core/Model/Design/Source/Apply.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Design/Source/Design.php b/app/code/core/Mage/Core/Model/Design/Source/Design.php index c42092a186..61bf0fddc0 100644 --- a/app/code/core/Mage/Core/Model/Design/Source/Design.php +++ b/app/code/core/Mage/Core/Model/Design/Source/Design.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Email.php b/app/code/core/Mage/Core/Model/Email.php index d233ccf5ad..32040d8c0e 100644 --- a/app/code/core/Mage/Core/Model/Email.php +++ b/app/code/core/Mage/Core/Model/Email.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Email/Template.php b/app/code/core/Mage/Core/Model/Email/Template.php index d99eaaeea1..087404a25b 100644 --- a/app/code/core/Mage/Core/Model/Email/Template.php +++ b/app/code/core/Mage/Core/Model/Email/Template.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -281,10 +281,10 @@ public function getProcessedTemplate(array $variables = array()) ->setVariables($variables); $this->_applyDesignConfig(); - try{ + try { $processedResult = $processor->filter($this->getPreparedTemplateText()); } - catch ( Exception $e) { + catch (Exception $e) { $this->_cancelDesignConfig(); throw $e; } @@ -466,7 +466,7 @@ public function getProcessedTemplateSubject(array $variables) try{ $processedResult = $processor->filter($this->getTemplateSubject()); } - catch ( Exception $e) { + catch (Exception $e) { $this->_cancelDesignConfig(); throw $e; } @@ -638,7 +638,7 @@ protected function _beforeSave() { $code = $this->getTemplateCode(); if (empty($code)) { - Mage::throwException(Mage::helper('core')->__('Template Name must be not empty')); + Mage::throwException(Mage::helper('core')->__('The template Name must not be empty.')); } if($this->_getResource()->checkCodeUsage($this)) { Mage::throwException(Mage::helper('core')->__('Duplicate Of Template Name')); diff --git a/app/code/core/Mage/Core/Model/Email/Template/Filter.php b/app/code/core/Mage/Core/Model/Email/Template/Filter.php index 552a1d21d9..81f6887186 100644 --- a/app/code/core/Mage/Core/Model/Email/Template/Filter.php +++ b/app/code/core/Mage/Core/Model/Email/Template/Filter.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Email/Transport.php b/app/code/core/Mage/Core/Model/Email/Transport.php index 6c8ae16c3f..a491eab9d6 100644 --- a/app/code/core/Mage/Core/Model/Email/Transport.php +++ b/app/code/core/Mage/Core/Model/Email/Transport.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Encryption.php b/app/code/core/Mage/Core/Model/Encryption.php index 7f61a2b874..17b0ca1171 100644 --- a/app/code/core/Mage/Core/Model/Encryption.php +++ b/app/code/core/Mage/Core/Model/Encryption.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Flag.php b/app/code/core/Mage/Core/Model/Flag.php index 9824aad600..b095976a80 100644 --- a/app/code/core/Mage/Core/Model/Flag.php +++ b/app/code/core/Mage/Core/Model/Flag.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Language.php b/app/code/core/Mage/Core/Model/Language.php index 9c74ef76ab..0275cf8b02 100644 --- a/app/code/core/Mage/Core/Model/Language.php +++ b/app/code/core/Mage/Core/Model/Language.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Layout.php b/app/code/core/Mage/Core/Model/Layout.php index 0007be2c26..c9eb72e955 100644 --- a/app/code/core/Mage/Core/Model/Layout.php +++ b/app/code/core/Mage/Core/Model/Layout.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -77,7 +77,7 @@ class Mage_Core_Model_Layout extends Varien_Simplexml_Config protected $_directOutput = false; /** - * Enter description here... + * Class constructor * * @param array $data */ @@ -85,6 +85,7 @@ public function __construct($data=array()) { $this->_elementClass = Mage::getConfig()->getModelClassName('core/layout_element'); $this->setXml(simplexml_load_string('', $this->_elementClass)); + $this->_update = Mage::getModel('core/layout_update'); parent::__construct($data); } @@ -95,9 +96,6 @@ public function __construct($data=array()) */ public function getUpdate() { - if (!$this->_update) { - $this->_update = Mage::getModel('core/layout_update'); - } return $this->_update; } @@ -154,11 +152,11 @@ public function generateXml() { $xml = $this->getUpdate()->asSimplexml(); $removeInstructions = $xml->xpath("//remove"); - if (is_array($removeInstructions)) { foreach ($removeInstructions as $infoNode) { $attributes = $infoNode->attributes(); - if ($blockName = (string)$attributes->name) { + $blockName = (string)$attributes->name; + if ($blockName) { $ignoreNodes = $xml->xpath("//block[@name='".$blockName."']"); if (!is_array($ignoreNodes)) { continue; @@ -182,13 +180,12 @@ public function generateXml() } } } - $this->setXml($xml); return $this; } /** - * Create layout blocks from configuration + * Create layout blocks hierarchy from layout xml configuration * * @param Mage_Core_Layout_Element|null $parent */ @@ -220,7 +217,7 @@ public function generateBlocks($parent=null) } /** - * Enter description here... + * Add block object to layout based on xml node data * * @param Varien_Simplexml_Element $node * @param Varien_Simplexml_Element $parent @@ -228,16 +225,16 @@ public function generateBlocks($parent=null) */ protected function _generateBlock($node, $parent) { - if (!empty($node['class'])) { $className = (string)$node['class']; } else { - $className = Mage::getConfig()->getBlockClassName((string)$node['type']); + $className = (string)$node['type']; } $blockName = (string)$node['name']; $_profilerKey = 'BLOCK: '.$blockName; Varien_Profiler::start($_profilerKey); + $block = $this->addBlock($className, $blockName); if (!$block) { return $this; @@ -360,7 +357,7 @@ protected function _generateAction($node, $parent) * * @param Varien_Simplexml_Element $node * @param array $args - **/ + **/ protected function _translateLayoutNode($node, &$args) { if (isset($node['translate'])) { @@ -423,9 +420,8 @@ public function createBlock($type, $name='', array $attributes = array()) $block->setAnonSuffix(substr($name, 1)); } $name = 'ANONYMOUS_'.sizeof($this->_blocks); - } - elseif (isset($this->_blocks[$name])) { - Mage::throwException(Mage::helper('core')->__('Block with name "%s" already exists', $name)); + } elseif (isset($this->_blocks[$name]) && Mage::getIsDeveloperMode()) { + //Mage::throwException(Mage::helper('core')->__('Block with name "%s" already exists', $name)); } $block->setType($type); @@ -434,7 +430,7 @@ public function createBlock($type, $name='', array $attributes = array()) $block->setLayout($this); $this->_blocks[$name] = $block; - + Mage::dispatchEvent('core_layout_block_create_after', array('block'=>$block)); return $this->_blocks[$name]; } @@ -447,19 +443,16 @@ public function createBlock($type, $name='', array $attributes = array()) */ public function addBlock($block, $blockName) { - try { - $block = $this->_getBlockInstance($block); - } catch (Exception $e) { - return false; - } - - $block->setNameInLayout($blockName); - $block->setLayout($this); - $this->_blocks[$blockName] = $block; - - return $block; + return $this->createBlock($block, $blockName); } + /** + * Create block object instance based on block type + * + * @param string $block + * @param array $attributes + * @return Mage_Core_Block_Abstract + */ protected function _getBlockInstance($block, array $attributes=array()) { if (is_string($block)) { @@ -547,7 +540,8 @@ public function getOutput() */ public function getMessagesBlock() { - if ($block = $this->getBlock('messages')) { + $block = $this->getBlock('messages'); + if ($block) { return $block; } return $this->createBlock('core/messages', 'messages'); @@ -562,7 +556,8 @@ public function getMessagesBlock() public function getBlockSingleton($type) { if (!isset($this->_helpers[$type])) { - if (!$className = Mage::getConfig()->getBlockClassName($type)) { + $className = Mage::getConfig()->getBlockClassName($type); + if (!$className) { Mage::throwException(Mage::helper('core')->__('Invalid block type: %s', $type)); } @@ -605,133 +600,22 @@ public function helper($name) */ public static function findTranslationModuleName(Varien_Simplexml_Element $node) { - if ($result = $node->getAttribute('module')) { + $result = $node->getAttribute('module'); + if ($result) { return (string)$result; } foreach (array_reverse($node->xpath('ancestor::*[@module]')) as $element) { - if ($result = $element->getAttribute('module')) { + $result = $element->getAttribute('module'); + if ($result) { return (string)$result; } } foreach ($node->xpath('ancestor-or-self::*[last()-1]') as $handle) { - if ($name = Mage::getConfig()->determineOmittedNamespace($handle->getName())) { + $name = Mage::getConfig()->determineOmittedNamespace($handle->getName()); + if ($name) { return $name; } } return 'core'; } - - /*public function setBlockCache($frontend='Core', $backend='File', - array $frontendOptions=array(), array $backendOptions=array()) - { - if (empty($frontendOptions['lifetime'])) { - $frontendOptions['lifetime'] = 7200; - } - if (empty($backendOptions['cache_dir'])) { - $backendOptions['cache_dir'] = Mage::getBaseDir('cache_block'); - } - $this->_blockCache = Zend_Cache::factory($frontend, $backend, $frontendOptions, $backendOptions); - return $this; - }*/ - - /*public function getBlockCache() - { - if (empty($this->_blockCache)) { - $this->setBlockCache(); - } - return $this->_blockCache; - }*/ - - - -// public function getCache() -// { -// if (!$this->_cache) { -// $this->_cache = Zend_Cache::factory('Core', 'File', array(), array( -// 'cache_dir'=>Mage::getBaseDir('cache_layout') -// )); -// } -// return $this->_cache; -// } -// -// -// /** -// * Merge layout update to current layout -// * -// * @param string|Mage_Core_Model_Layout_Element $update -// * @return Mage_Core_Model_Layout_Update -// */ -// public function mergeUpdate1($update) -// { -// if (!$update) { -// return $this; -// } -// -// if (is_string($update)) { -// $this->mergeUpdate($this->getPackageLayoutUpdate($update)); -// $this->mergeUpdate($this->getDatabaseLayoutUpdate($update)); -// return $this; -// } -// -// if (!$update instanceof Mage_Core_Model_Layout_Element) { -// throw Mage::exception('Mage_Core', Mage::helper('core')->__('Invalid layout update argument, expected Mage_Core_Model_Layout_Element')); -// } -// foreach ($update->children() as $child) { -// switch ($child->getName()) { -// case 'update': -// $handle = (string)$child['handle']; -// $this->mergeUpdate($this->getPackageLayoutUpdate($handle)); -// break; -// -// case 'remove': -// if (isset($child['method'])) { -// $this->removeAction((string)$child['name'], (string)$child['method']); -// } else { -// $this->removeBlock((string)$child['name']); -// } -// break; -// -// default: -// $this->getNode()->appendChild($child); -// } -// } -// return $this; -// } -// -// public function removeBlock($blockName, $parent=null) -// { -// if (is_null($parent)) { -// $parent = $this->getNode(); -// } -// foreach ($parent->children() as $children) { -// -// for ($i=0, $l=sizeof($children); $i<$l; $i++) { -// $child = $children[$i]; -// if ($child->getName()==='block' && $blockName===(string)$child['name']) { -// unset($parent->block[$i]); -// } -// $this->removeBlock($blockName, $child); -// } -// } -// return $this; -// } -// -// public function removeAction($blockName, $method, $parent=null) -// { -// if (is_null($parent)) { -// $parent = $this->getNode(); -// } -// foreach ($parent->children() as $children) { -// for ($i=0, $l=sizeof($children); $i<$l; $i++) { -// $child = $children[$i]; -// if ($child->getName()==='action' && $blockName===(string)$child['name'] && $method===(string)$child['method']) { -// unset($parent->action[$i]); -// } -// $this->removeAction($blockName, $method, $child); -// } -// } -// return $this; -// } - - } diff --git a/app/code/core/Mage/Core/Model/Layout/Data.php b/app/code/core/Mage/Core/Model/Layout/Data.php index 0c58fcf15c..1b20c2b32d 100644 --- a/app/code/core/Mage/Core/Model/Layout/Data.php +++ b/app/code/core/Mage/Core/Model/Layout/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Layout/Element.php b/app/code/core/Mage/Core/Model/Layout/Element.php index 352a9e87be..ae6095a551 100644 --- a/app/code/core/Mage/Core/Model/Layout/Element.php +++ b/app/code/core/Mage/Core/Model/Layout/Element.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Layout/Update.php b/app/code/core/Mage/Core/Model/Layout/Update.php index e876d03ac1..034b270b69 100644 --- a/app/code/core/Mage/Core/Model/Layout/Update.php +++ b/app/code/core/Mage/Core/Model/Layout/Update.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Locale.php b/app/code/core/Mage/Core/Model/Locale.php index 8b4da2cbb6..2c70899f97 100644 --- a/app/code/core/Mage/Core/Model/Locale.php +++ b/app/code/core/Mage/Core/Model/Locale.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Locale/Config.php b/app/code/core/Mage/Core/Model/Locale/Config.php index 9f682ccc8a..5a10448453 100644 --- a/app/code/core/Mage/Core/Model/Locale/Config.php +++ b/app/code/core/Mage/Core/Model/Locale/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Core_Model_Locale_Config diff --git a/app/code/core/Mage/Core/Model/Log/Adapter.php b/app/code/core/Mage/Core/Model/Log/Adapter.php new file mode 100644 index 0000000000..77916e9ca7 --- /dev/null +++ b/app/code/core/Mage/Core/Model/Log/Adapter.php @@ -0,0 +1,146 @@ + + */ +class Mage_Core_Model_Log_Adapter +{ + + /** + * Store log file name + * + * @var string + */ + protected $_logFileName = ''; + + /** + * Data to log + * + * @var array + */ + protected $_data = array(); + + /** + * Fields that should be replaced in debug data with '***' + * + * @var array + */ + protected $_debugReplacePrivateDataKeys = array(); + + /** + * Set log file name + * + * @param string $fileName + */ + public function __construct($fileName) + { + $this->_logFileName = $fileName; + } + + /** + * Perform forced log data to file + * + * @param mixed $data + * @return Mage_Core_Model_Log_Adapter + */ + public function log($data = null) + { + if ($data === null) { + $data = $this->_data; + } + else { + if (!is_array($data)) { + $data = array($data); + } + } + $data = $this->_filterDebugData($data); + $data['__pid'] = getmypid(); + Mage::log($data, null, $this->_logFileName, true); + return $this; + } + + /** + * Log data setter + * + * @param string|array $key + * @param mixed $value + * @return Mage_Core_Model_Log_Adapter + * @todo replace whole data + */ + public function setData($key, $value = null) + { + if(is_array($key)) { + $this->_data = $key; + } + else { + $this->_data[$key] = $value; + } + return $this; + } + + /** + * Setter for private data keys, that should be replaced in debug data with '***' + * + * @param array $keys + * @return Mage_Core_Model_Log_Adapter + */ + public function setFilterDataKeys($keys) + { + if (!is_array($keys)) { + $keys = array($keys); + } + $this->_debugReplacePrivateDataKeys = $keys; + return $this; + } + + /** + * Recursive filter data by private conventions + * + * @param mixed $debugData + * @return mixed + */ + protected function _filterDebugData($debugData) + { + if (is_array($debugData) && is_array($this->_debugReplacePrivateDataKeys)) { + foreach ($debugData as $key => $value) { + if (in_array($key, $this->_debugReplacePrivateDataKeys)) { + $debugData[$key] = '****'; + } + else { + if (is_array($debugData[$key])) { + $debugData[$key] = $this->_filterDebugData($debugData[$key]); + } + } + } + } + return $debugData; + } +} diff --git a/app/code/core/Mage/Core/Model/Message.php b/app/code/core/Mage/Core/Model/Message.php index 21267ea754..88bd810fb8 100644 --- a/app/code/core/Mage/Core/Model/Message.php +++ b/app/code/core/Mage/Core/Model/Message.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Message/Abstract.php b/app/code/core/Mage/Core/Model/Message/Abstract.php index ddd5c7495e..1347bbfa28 100644 --- a/app/code/core/Mage/Core/Model/Message/Abstract.php +++ b/app/code/core/Mage/Core/Model/Message/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Message/Collection.php b/app/code/core/Mage/Core/Model/Message/Collection.php index 23d901dd46..a830014ce1 100644 --- a/app/code/core/Mage/Core/Model/Message/Collection.php +++ b/app/code/core/Mage/Core/Model/Message/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Message/Error.php b/app/code/core/Mage/Core/Model/Message/Error.php index 3f750850c2..bd6525a264 100644 --- a/app/code/core/Mage/Core/Model/Message/Error.php +++ b/app/code/core/Mage/Core/Model/Message/Error.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Message/Notice.php b/app/code/core/Mage/Core/Model/Message/Notice.php index 94840307c8..544609392e 100644 --- a/app/code/core/Mage/Core/Model/Message/Notice.php +++ b/app/code/core/Mage/Core/Model/Message/Notice.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Message/Success.php b/app/code/core/Mage/Core/Model/Message/Success.php index 8d42140871..2e8722b9d9 100644 --- a/app/code/core/Mage/Core/Model/Message/Success.php +++ b/app/code/core/Mage/Core/Model/Message/Success.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Message/Warning.php b/app/code/core/Mage/Core/Model/Message/Warning.php index ab2e340036..234fd68fcd 100644 --- a/app/code/core/Mage/Core/Model/Message/Warning.php +++ b/app/code/core/Mage/Core/Model/Message/Warning.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Abstract.php b/app/code/core/Mage/Core/Model/Mysql4/Abstract.php index 925b84dce3..6f2aeaf9ae 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Abstract.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -93,6 +93,13 @@ abstract class Mage_Core_Model_Mysql4_Abstract extends Mage_Core_Model_Resource_ */ protected $_isPkAutoIncrement = true; + /** + * Use is object new method for save of object + * + * @var boolean + */ + protected $_useIsObjectNew = false; + /** * Fields List for update in forsedSave * @@ -121,6 +128,21 @@ abstract class Mage_Core_Model_Mysql4_Abstract extends Mage_Core_Model_Resource_ */ protected $_uniqueFields = null; + /** + * Serializable fields declaration + * + * Structure: array( + * => array( + * , + * , + * // optional parameter + * ), + * ) + * + * @var array + */ + protected $_serializableFields = array(); + /** * Standard resource model initialization * @@ -334,6 +356,7 @@ public function load(Mage_Core_Model_Abstract $object, $value, $field=null) } } + $this->unserializeFields($object); $this->_afterLoad($object); return $this; @@ -366,10 +389,11 @@ public function save(Mage_Core_Model_Abstract $object) return $this->delete($object); } + $this->_serializeFields($object); $this->_beforeSave($object); $this->_checkUnique($object); - if (!is_null($object->getId())) { + if (!is_null($object->getId()) && (!$this->_useIsObjectNew || !$object->isObjectNew())) { $condition = $this->_getWriteAdapter()->quoteInto($this->getIdFieldName().'=?', $object->getId()); /** * Not auto increment primary key support @@ -389,8 +413,12 @@ public function save(Mage_Core_Model_Abstract $object) } else { $this->_getWriteAdapter()->insert($this->getMainTable(), $this->_prepareDataForSave($object)); $object->setId($this->_getWriteAdapter()->lastInsertId($this->getMainTable())); + if ($this->_useIsObjectNew) { + $object->isObjectNew(false); + } } + $this->unserializeFields($object); $this->_afterSave($object); return $this; @@ -467,6 +495,19 @@ public function resetUniqueField() return $this; } + /** + * Unserialize serializeable object fields + * + * @param Mage_Core_Model_Abstract $object + */ + public function unserializeFields(Mage_Core_Model_Abstract $object) + { + foreach ($this->_serializableFields as $field => $parameters) { + list($serializeDefault, $unserializeDefault) = $parameters; + $this->_unserializeField($object, $field, $unserializeDefault); + } + } + /** * Initialize unique fields * @@ -518,12 +559,10 @@ protected function _prepareDataForTable(Varien_Object $object, $table) $fieldValue = $object->getData($field); if ($fieldValue instanceof Zend_Db_Expr) { $data[$field] = $fieldValue; - } - else { + } else { if (null !== $fieldValue) { $data[$field] = $this->_prepareValueForSave($fieldValue, $fields[$field]['DATA_TYPE']); - } - elseif (!empty($fields[$field]['NULLABLE'])) { + } elseif (!empty($fields[$field]['NULLABLE'])) { $data[$field] = null; } } @@ -595,10 +634,10 @@ protected function _checkUnique(Mage_Core_Model_Abstract $object) if (!empty($existent)) { if (count($existent) == 1 ) { - $error = Mage::helper('core')->__('%s already exists', $existent[0]); + $error = Mage::helper('core')->__('%s already exists.', $existent[0]); } else { - $error = Mage::helper('core')->__('%s already exist', implode(', ', $existent)); + $error = Mage::helper('core')->__('%s already exist.', implode(', ', $existent)); } Mage::throwException($error); } @@ -660,6 +699,19 @@ protected function _afterDelete(Mage_Core_Model_Abstract $object) return $this; } + /** + * Serialize serializeable fields of the object + * + * @param Mage_Core_Model_Abstract $object + */ + protected function _serializeFields(Mage_Core_Model_Abstract $object) + { + foreach ($this->_serializableFields as $field => $parameters) { + list($serializeDefault, $unserializeDefault) = $parameters; + $this->_serializeField($object, $field, $serializeDefault, isset($parameters[2])); + } + } + /** * Retrieve table checksum * diff --git a/app/code/core/Mage/Core/Model/Mysql4/Cache.php b/app/code/core/Mage/Core/Model/Mysql4/Cache.php index 77497dc7d8..1137d9e98e 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Cache.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Cache.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Collection/Abstract.php b/app/code/core/Mage/Core/Model/Mysql4/Collection/Abstract.php index 044287de77..c641de4683 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Collection/Abstract.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Collection/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -49,6 +49,27 @@ abstract class Mage_Core_Model_Mysql4_Collection_Abstract extends Varien_Data_Co */ protected $_resource; + /** + * Fields to select in query + * + * @var array|null + */ + protected $_fieldsToSelect = null; + + /** + * Fields initial fields to select like id_field + * + * @var array|null + */ + protected $_initialFieldsToSelect = null; + + /** + * Fields to select changed flag + * + * @var booleam + */ + protected $_fieldsToSelectChanged = false; + /** * Store joined tables here * @@ -56,6 +77,13 @@ abstract class Mage_Core_Model_Mysql4_Collection_Abstract extends Varien_Data_Co */ protected $_joinedTables = array(); + /** + * Collection main table + * + * @var string + */ + protected $_mainTable = null; + /** * Collection constructor * @@ -79,9 +107,231 @@ protected function _construct() } + /** + * Retrieve main table + * + * @return string + */ + public function getMainTable() + { + if ($this->_mainTable === null) { + $this->setMainTable($this->getResource()->getMainTable()); + } + + return $this->_mainTable; + } + + /** + * Set main collection table + * + * @param string $table + * @return Mage_Core_Model_Mysql4_Collection_Abstract + */ + public function setMainTable($table) + { + if (strpos($table, '/') !== false) { + $table = $this->getTable($table); + } + + if ($this->_mainTable !== null && $table !== $this->_mainTable && $this->getSelect() !== null) { + $from = $this->getSelect()->getPart(Zend_Db_Select::FROM); + if (isset($from['main_table'])) { + $from['main_table']['tableName'] = $table; + } + $this->getSelect()->setPart(Zend_Db_Select::FROM, $from); + } + + $this->_mainTable = $table; + return $this; + } + + /** + * Init collection select + * + * @return unknown + */ protected function _initSelect() { - $this->getSelect()->from(array('main_table' => $this->getResource()->getMainTable())); + $this->getSelect()->from(array('main_table' => $this->getMainTable())); + return $this; + } + + /** + * Get Zend_Db_Select instance and applies fields to select if needed + * + * @return Varien_Db_Select + */ + public function getSelect() + { + if ($this->_select && $this->_fieldsToSelectChanged) { + $this->_fieldsToSelectChanged = false; + $this->_initSelectFields(); + } + return parent::getSelect(); + } + + /** + * Init fields for select + * + * @return Mage_Core_Model_Mysql4_Collection_Abstract + */ + protected function _initSelectFields() + { + $columns = $this->_select->getPart(Zend_Db_Select::COLUMNS); + $columnsToSelect = array(); + foreach ($columns as $columnEntry) { + list($correlationName, $column, $alias) = $columnEntry; + if ($correlationName !== 'main_table') { // Add joined fields to select + if ($column instanceof Zend_Db_Expr) { + $column = $column->__toString(); + } + $key = ($alias !== null ? $alias : $column); + $columnsToSelect[$key] = $columnEntry; + } + } + + $columns = $columnsToSelect; + + $columnsToSelect = array_keys($columnsToSelect); + + if ($this->_fieldsToSelect !== null) { + $insertIndex = 0; + foreach ($this->_fieldsToSelect as $alias => $field) { + if (!is_string($alias)) { + $alias = null; + } + + if ($field instanceof Zend_Db_Expr) { + $column = $field->__toString(); + } else { + $column = $field; + } + + if (($alias !== null && in_array($alias, $columnsToSelect)) || // If field already joined fron another table + ($alias === null && isset($alias, $columnsToSelect))) { + continue; + } + + $columnEntry = array('main_table', $field, $alias); + array_splice($columns, $insertIndex, 0, array($columnEntry)); // Insert column + $insertIndex ++; + + } + } else { + array_unshift($columns, array('main_table', '*', null)); + } + + $this->_select->setPart(Zend_Db_Select::COLUMNS, $columns); + + return $this; + } + + /** + * Retrieve initial fields to select like id field + * + * @return array + */ + protected function _getInitialFieldsToSelect() + { + if ($this->_initialFieldsToSelect === null) { + $this->_initialFieldsToSelect = array(); + $this->_initInitialFieldsToSelect(); + } + + return $this->_initialFieldsToSelect; + } + + /** + * Initialize initial fields to select like id field + * + * @return Mage_Core_Model_Mysql4_Collection_Abstract + */ + protected function _initInitialFieldsToSelect() + { + $idFieldName = $this->getResource()->getIdFieldName(); + if ($idFieldName) { + $this->_initialFieldsToSelect[] = $idFieldName; + } + return $this; + } + + /** + * Add field to select + * + * @param string|array $field + * @param string|null $alias + * @return Mage_Core_Model_Mysql4_Collection_Abstract + */ + public function addFieldToSelect($field, $alias = null) + { + if ($field === '*') { // If we will select all fields + $this->_fieldsToSelect = null; + $this->_fieldsToSelectChanged = true; + return $this; + } + + if (is_array($field)) { + if ($this->_fieldsToSelect === null) { + $this->_fieldsToSelect = $this->_getInitialFieldsToSelect(); + } + + foreach ($field as $key => $value) { + $this->addFieldToSelect( + $value, + (is_string($key) ? $key : null), + false + ); + } + + $this->_fieldsToSelectChanged = true; + return $this; + } + + if ($alias === null) { + $this->_fieldsToSelect[] = $field; + } else { + $this->_fieldsToSelect[$alias] = $field; + } + + $this->_fieldsToSelectChanged = true; + return $this; + } + + /** + * Removes field from select + * + * @param string|null $field + * @param boolean $isAlias Alias identifier + * @return Mage_Core_Model_Mysql4_Collection_Abstract + */ + public function removeFieldFromSelect($field, $isAlias = false) + { + if ($isAlias) { + if (isset($this->_fieldsToSelect[$field])) { + unset($this->_fieldsToSelect[$field]); + } + } else { + foreach ($this->_fieldsToSelect as $key => $value) { + if ($value === $field) { + unset($this->_fieldsToSelect[$key]); + break; + } + } + } + + $this->_fieldsToSelectChanged = true; + return $this; + } + + /** + * Removes all fields from select + * + * @return Mage_Core_Model_Mysql4_Collection_Abstract + */ + public function removeAllFieldsFromSelect() + { + $this->_fieldsToSelect = $this->_getInitialFieldsToSelect(); + $this->_fieldsToSelectChanged = true; return $this; } @@ -183,16 +433,14 @@ public function join($table, $cond, $cols='*') } /** - * Load data + * Redeclare before load method for adding event * - * @return Varien_Data_Collection_Db + * @return Mage_Core_Model_Mysql4_Collection_Abstract */ - public function load($printQuery = false, $logQuery = false) + protected function _beforeLoad() { - if (!$this->isLoaded()) { - Mage::dispatchEvent('core_collection_abstract_load_before', array('collection' => $this)); - } - parent::load($printQuery, $logQuery); + parent::_beforeLoad(); + Mage::dispatchEvent('core_collection_abstract_load_before', array('collection' => $this)); return $this; } diff --git a/app/code/core/Mage/Core/Model/Mysql4/Config.php b/app/code/core/Mage/Core/Model/Mysql4/Config.php index 66fa80e34e..91fce817c5 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Config.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Config/Data.php b/app/code/core/Mage/Core/Model/Mysql4/Config/Data.php index 356b33004b..fef262eb8f 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Config/Data.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Config/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Config/Data/Collection.php b/app/code/core/Mage/Core/Model/Mysql4/Config/Data/Collection.php index 386a20ed59..0c8db8714e 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Config/Data/Collection.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Config/Data/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Convert/History.php b/app/code/core/Mage/Core/Model/Mysql4/Convert/History.php index 3d527761af..6dd8f23fdb 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Convert/History.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Convert/History.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Convert/History/Collection.php b/app/code/core/Mage/Core/Model/Mysql4/Convert/History/Collection.php index 9d5d58a645..99efbfc193 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Convert/History/Collection.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Convert/History/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Convert/Profile.php b/app/code/core/Mage/Core/Model/Mysql4/Convert/Profile.php index db110c6ead..fa40e9d6db 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Convert/Profile.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Convert/Profile.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Convert/Profile/Collection.php b/app/code/core/Mage/Core/Model/Mysql4/Convert/Profile/Collection.php index b7686eb0d0..bceb1bcf41 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Convert/Profile/Collection.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Convert/Profile/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Design.php b/app/code/core/Mage/Core/Model/Mysql4/Design.php index 21f45f8a7a..51642cf279 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Design.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Design.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -50,7 +50,7 @@ public function _beforeSave(Mage_Core_Model_Abstract $object) } if (!is_null($object->getDateFrom()) && !is_null($object->getDateTo()) && strtotime($object->getDateFrom()) > strtotime($object->getDateTo())){ - Mage::throwException(Mage::helper('core')->__('Start date can\'t be greater than end date')); + Mage::throwException(Mage::helper('core')->__('Start date cannot be greater than end date.')); } $check = $this->_checkIntersection( @@ -61,7 +61,7 @@ public function _beforeSave(Mage_Core_Model_Abstract $object) ); if ($check){ - Mage::throwException(Mage::helper('core')->__('Your design change for the specified store intersects with another one, please specify another date range')); + Mage::throwException(Mage::helper('core')->__('Your design change for the specified store intersects with another one, please specify another date range.')); } if (is_null($object->getDateFrom())) diff --git a/app/code/core/Mage/Core/Model/Mysql4/Design/Collection.php b/app/code/core/Mage/Core/Model/Mysql4/Design/Collection.php index 4eb9e3265e..4544435687 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Design/Collection.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Design/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Design/Package/Collection.php b/app/code/core/Mage/Core/Model/Mysql4/Design/Package/Collection.php index 2ce2389943..1ea417c357 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Design/Package/Collection.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Design/Package/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php b/app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php index b01a43f8f7..d06a82afef 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Email/Template.php b/app/code/core/Mage/Core/Model/Mysql4/Email/Template.php index 52fe6d4356..5c2ccc764d 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Email/Template.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Email/Template.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Email/Template/Collection.php b/app/code/core/Mage/Core/Model/Mysql4/Email/Template/Collection.php index 92e9a4a5bd..161f820f5f 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Email/Template/Collection.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Email/Template/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Flag.php b/app/code/core/Mage/Core/Model/Mysql4/Flag.php index 6d6ef5c7de..87cceef00e 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Flag.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Flag.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/History.php b/app/code/core/Mage/Core/Model/Mysql4/History.php index f83760255f..8ac8fa5043 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/History.php +++ b/app/code/core/Mage/Core/Model/Mysql4/History.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Language.php b/app/code/core/Mage/Core/Model/Mysql4/Language.php index ff2ba4d501..ea0bbc7675 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Language.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Language.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Language/Collection.php b/app/code/core/Mage/Core/Model/Mysql4/Language/Collection.php index 54b172f3ef..ff892aa2ee 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Language/Collection.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Language/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Layout.php b/app/code/core/Mage/Core/Model/Mysql4/Layout.php index fa9f5a2e6b..6ca9903219 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Layout.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Layout.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Resource.php b/app/code/core/Mage/Core/Model/Mysql4/Resource.php index 0921e2b6c1..2874583043 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Resource.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Resource.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Session.php b/app/code/core/Mage/Core/Model/Mysql4/Session.php index 403759872b..18e174a9a2 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Session.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Store.php b/app/code/core/Mage/Core/Model/Mysql4/Store.php index a6c672392d..37c76a6fd0 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Store.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Store.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -50,7 +50,7 @@ protected function _beforeSave(Mage_Core_Model_Abstract $model) { if(!preg_match('/^[a-z]+[a-z0-9_]*$/',$model->getCode())) { Mage::throwException( - Mage::helper('core')->__('Store code should contain only letters (a-z), numbers (0-9) or underscore(_), first character should be a letter')); + Mage::helper('core')->__('The store code may contain only letters (a-z), numbers (0-9) or underscore(_), the first character must be a letter')); } return $this; diff --git a/app/code/core/Mage/Core/Model/Mysql4/Store/Collection.php b/app/code/core/Mage/Core/Model/Mysql4/Store/Collection.php index 2e643d428c..36cd2c1aa9 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Store/Collection.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Store/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Store/Group.php b/app/code/core/Mage/Core/Model/Mysql4/Store/Group.php index 76878d925b..5a524c2791 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Store/Group.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Store/Group.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Store/Group/Collection.php b/app/code/core/Mage/Core/Model/Mysql4/Store/Group/Collection.php index 6ae3486b2a..b8f77fa67d 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Store/Group/Collection.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Store/Group/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Translate.php b/app/code/core/Mage/Core/Model/Mysql4/Translate.php index 1e7d25da29..a2cd5c6674 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Translate.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Translate.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Translate/String.php b/app/code/core/Mage/Core/Model/Mysql4/Translate/String.php index 314dc75f9a..2ef0f47e68 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Translate/String.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Translate/String.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Url/Rewrite.php b/app/code/core/Mage/Core/Model/Mysql4/Url/Rewrite.php index 9d5f14326f..89869ef5fb 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Url/Rewrite.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Url/Rewrite.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -53,11 +53,11 @@ protected function _initUniqueFields() $this->_uniqueFields = array( array( 'field' => array('id_path','store_id','is_system'), - 'title' => Mage::helper('core')->__('Id path for specified store') + 'title' => Mage::helper('core')->__('ID Path for Specified Store') ), array( 'field' => array('request_path','store_id'), - 'title' => Mage::helper('core')->__('Request path for specified store'), + 'title' => Mage::helper('core')->__('Request Path for Specified Store'), ) ); return $this; diff --git a/app/code/core/Mage/Core/Model/Mysql4/Url/Rewrite/Collection.php b/app/code/core/Mage/Core/Model/Mysql4/Url/Rewrite/Collection.php index 31539af2b0..e864d649b8 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Url/Rewrite/Collection.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Url/Rewrite/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Variable.php b/app/code/core/Mage/Core/Model/Mysql4/Variable.php index b60e560c92..063e40104d 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Variable.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Variable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Variable/Collection.php b/app/code/core/Mage/Core/Model/Mysql4/Variable/Collection.php index 4b8366362f..a2accb4856 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Variable/Collection.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Variable/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Mysql4/Website.php b/app/code/core/Mage/Core/Model/Mysql4/Website.php index b36ccfaf20..c4508592a4 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Website.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Website.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -55,7 +55,7 @@ protected function _initUniqueFields() protected function _beforeSave(Mage_Core_Model_Abstract $object) { if(!preg_match('/^[a-z]+[a-z0-9_]*$/', $object->getCode())) { - Mage::throwException(Mage::helper('core')->__('Website code should contain only letters (a-z), numbers (0-9) or underscore(_), first character should be a letter')); + Mage::throwException(Mage::helper('core')->__('Website code may only contain letters (a-z), numbers (0-9) or underscore(_), the first character must be a letter')); } return parent::_beforeSave($object); diff --git a/app/code/core/Mage/Core/Model/Mysql4/Website/Collection.php b/app/code/core/Mage/Core/Model/Mysql4/Website/Collection.php index 97657b1e0c..f8d717ec1a 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Website/Collection.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Website/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Resource.php b/app/code/core/Mage/Core/Model/Resource.php index 0b73adb3ba..1bcddf1ca2 100644 --- a/app/code/core/Mage/Core/Model/Resource.php +++ b/app/code/core/Mage/Core/Model/Resource.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -158,7 +158,7 @@ public function getTableName($modelEntity) if ($entityConfig) { $tableName = (string)$entityConfig->table; } else { - Mage::throwException(Mage::helper('core')->__('Can\'t retrieve entity config: %s', $modelEntity)); + Mage::throwException(Mage::helper('core')->__('Cannot retrieve entity config: %s', $modelEntity)); } } else { $tableName = $modelEntity; diff --git a/app/code/core/Mage/Core/Model/Resource/Abstract.php b/app/code/core/Mage/Core/Model/Resource/Abstract.php index 44110593c6..4a152f118c 100644 --- a/app/code/core/Mage/Core/Model/Resource/Abstract.php +++ b/app/code/core/Mage/Core/Model/Resource/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -156,4 +156,46 @@ public function mktime($str) { return strtotime($str); } + + /** + * Serialize specified field in an object + * + * @param Varien_Object $object + * @param string $field + * @param mixed $defaultValue + * @param bool $unsetEmpty + */ + protected function _serializeField(Varien_Object $object, $field, $defaultValue = null, $unsetEmpty = false) + { + $value = $object->getData($field); + if (empty($value)) { + if ($unsetEmpty) { + $object->unsetData($field); + } else { + if (is_object($defaultValue) || is_array($defaultValue)) { + $defaultValue = serialize($defaultValue); + } + $object->setData($field, $defaultValue); + } + } elseif (is_array($value) || is_object($value)) { + $object->setData($field, serialize($value)); + } + } + + /** + * Unserialize Varien_Object field in an object + * + * @param Mage_Core_Model_Abstract $object + * @param string $field + * @param mixed $defaultValue + */ + protected function _unserializeField(Varien_Object $object, $field, $defaultValue = null) + { + $value = $object->getData($field); + if (empty($value)) { + $object->setData($field, $defaultValue); + } elseif (!is_array($value) && !is_object($value)) { + $object->setData($field, unserialize($value)); + } + } } diff --git a/app/code/core/Mage/Core/Model/Resource/Entity/Abstract.php b/app/code/core/Mage/Core/Model/Resource/Entity/Abstract.php index 1d66204756..f793a2be3f 100644 --- a/app/code/core/Mage/Core/Model/Resource/Entity/Abstract.php +++ b/app/code/core/Mage/Core/Model/Resource/Entity/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Resource/Entity/Table.php b/app/code/core/Mage/Core/Model/Resource/Entity/Table.php index c6f21e4f4e..d63f456cb2 100644 --- a/app/code/core/Mage/Core/Model/Resource/Entity/Table.php +++ b/app/code/core/Mage/Core/Model/Resource/Entity/Table.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Resource/Iterator.php b/app/code/core/Mage/Core/Model/Resource/Iterator.php index c7c6c4e463..113428cf4a 100644 --- a/app/code/core/Mage/Core/Model/Resource/Iterator.php +++ b/app/code/core/Mage/Core/Model/Resource/Iterator.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Resource/Setup.php b/app/code/core/Mage/Core/Model/Resource/Setup.php index 3eef902eea..3f56603e6a 100644 --- a/app/code/core/Mage/Core/Model/Resource/Setup.php +++ b/app/code/core/Mage/Core/Model/Resource/Setup.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -41,6 +41,13 @@ class Mage_Core_Model_Resource_Setup protected $_connectionConfig; protected $_moduleConfig; + /** + * Call afterApplyAllUpdates method flag + * + * @var boolean + */ + protected $_callAfterApplyAllUpdates = false; + /** * Setup Connection * @@ -141,6 +148,7 @@ static public function applyAllUpdates() self::$_hadUpdates = false; $resources = Mage::getConfig()->getNode('global/resources')->children(); + $afterApplyUpdates = array(); foreach ($resources as $resName=>$resource) { if (!$resource->setup) { continue; @@ -151,7 +159,15 @@ static public function applyAllUpdates() } $setupClass = new $className($resName); $setupClass->applyUpdates(); + if ($setupClass->getCallAfterApplyAllUpdates()) { + $afterApplyUpdates[] = $setupClass; + } + } + + foreach ($afterApplyUpdates as $setupClass) { + $setupClass->afterApplyAllUpdates(); } + Mage::app()->setUpdateMode(false); self::$_schemaUpdatesChecked = true; return true; @@ -525,6 +541,14 @@ public function updateTableRow($table, $idField, $id, $field, $value=null, $pare } $this->_conn->query($sql); + if (isset($this->_setupCache[$table][$parentId][$id])) { + if (is_array($field)) { + $this->_setupCache[$table][$parentId][$id] = array_merge($this->_setupCache[$table][$parentId][$id], $field); + } else { + $this->_setupCache[$table][$parentId][$id][$field] = $value; + } + } + return $this; } @@ -631,4 +655,25 @@ public function endSetup() "); return $this; } + + /** + * Check call afterApplyAllUpdates method for setup class + * + * @return boolean + */ + public function getCallAfterApplyAllUpdates() + { + return $this->_callAfterApplyAllUpdates; + } + + /** + * Run each time after applying of all updates, + * if setup model setted $_callAfterApplyAllUpdates flag to true + * + * @return Mage_Core_Model_Resource_Setup + */ + public function afterApplyAllUpdates() + { + return $this; + } } diff --git a/app/code/core/Mage/Core/Model/Resource/Transaction.php b/app/code/core/Mage/Core/Model/Resource/Transaction.php index 20e7e83713..3d13ffbcba 100644 --- a/app/code/core/Mage/Core/Model/Resource/Transaction.php +++ b/app/code/core/Mage/Core/Model/Resource/Transaction.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Resource/Type/Abstract.php b/app/code/core/Mage/Core/Model/Resource/Type/Abstract.php index e0642ea42c..71dbca047b 100644 --- a/app/code/core/Mage/Core/Model/Resource/Type/Abstract.php +++ b/app/code/core/Mage/Core/Model/Resource/Type/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Resource/Type/Db.php b/app/code/core/Mage/Core/Model/Resource/Type/Db.php index 4297bb7f52..0ba41fe922 100644 --- a/app/code/core/Mage/Core/Model/Resource/Type/Db.php +++ b/app/code/core/Mage/Core/Model/Resource/Type/Db.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Resource/Type/Db/Mysqli.php b/app/code/core/Mage/Core/Model/Resource/Type/Db/Mysqli.php index c285a3c4a7..bbd316e4a3 100644 --- a/app/code/core/Mage/Core/Model/Resource/Type/Db/Mysqli.php +++ b/app/code/core/Mage/Core/Model/Resource/Type/Db/Mysqli.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Resource/Type/Db/Mysqli/Setup.php b/app/code/core/Mage/Core/Model/Resource/Type/Db/Mysqli/Setup.php index fd846662f2..8021f3535a 100644 --- a/app/code/core/Mage/Core/Model/Resource/Type/Db/Mysqli/Setup.php +++ b/app/code/core/Mage/Core/Model/Resource/Type/Db/Mysqli/Setup.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Resource/Type/Db/Pdo/Mysql.php b/app/code/core/Mage/Core/Model/Resource/Type/Db/Pdo/Mysql.php index bf546262ca..bbbc74f94c 100644 --- a/app/code/core/Mage/Core/Model/Resource/Type/Db/Pdo/Mysql.php +++ b/app/code/core/Mage/Core/Model/Resource/Type/Db/Pdo/Mysql.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Session.php b/app/code/core/Mage/Core/Model/Session.php index 453b416a0f..3f708da3b1 100644 --- a/app/code/core/Mage/Core/Model/Session.php +++ b/app/code/core/Mage/Core/Model/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Session/Abstract.php b/app/code/core/Mage/Core/Model/Session/Abstract.php index 740bf4ba14..b15dd199dc 100644 --- a/app/code/core/Mage/Core/Model/Session/Abstract.php +++ b/app/code/core/Mage/Core/Model/Session/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php b/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php index 072eb7dbea..5deff72e6e 100644 --- a/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php +++ b/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Session/Abstract/Zend.php b/app/code/core/Mage/Core/Model/Session/Abstract/Zend.php index bc3bf7fc50..31e25ddd40 100644 --- a/app/code/core/Mage/Core/Model/Session/Abstract/Zend.php +++ b/app/code/core/Mage/Core/Model/Session/Abstract/Zend.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Session/Exception.php b/app/code/core/Mage/Core/Model/Session/Exception.php index d2d5f2180b..be6e52ff2c 100644 --- a/app/code/core/Mage/Core/Model/Session/Exception.php +++ b/app/code/core/Mage/Core/Model/Session/Exception.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Source/Email/Variables.php b/app/code/core/Mage/Core/Model/Source/Email/Variables.php index fe64553ebe..f4bbf7834d 100644 --- a/app/code/core/Mage/Core/Model/Source/Email/Variables.php +++ b/app/code/core/Mage/Core/Model/Source/Email/Variables.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Store.php b/app/code/core/Mage/Core/Model/Store.php index c90575e39d..ef0f99ffc3 100644 --- a/app/code/core/Mage/Core/Model/Store.php +++ b/app/code/core/Mage/Core/Model/Store.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Store/Exception.php b/app/code/core/Mage/Core/Model/Store/Exception.php index 5e6bb4f60d..ce5ce66c0c 100644 --- a/app/code/core/Mage/Core/Model/Store/Exception.php +++ b/app/code/core/Mage/Core/Model/Store/Exception.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Store/Group.php b/app/code/core/Mage/Core/Model/Store/Group.php index e0d4d4e78b..34d5c19c27 100644 --- a/app/code/core/Mage/Core/Model/Store/Group.php +++ b/app/code/core/Mage/Core/Model/Store/Group.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Translate.php b/app/code/core/Mage/Core/Model/Translate.php index 946ffa43f9..352fd91b01 100644 --- a/app/code/core/Mage/Core/Model/Translate.php +++ b/app/code/core/Mage/Core/Model/Translate.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -413,10 +413,6 @@ public function translate($args) $result = $translated; } - if ($result === false){ - $result = $translated; - } - if ($this->_translateInline && $this->getTranslateInline()) { if (strpos($result, '{{{')===false || strpos($result, '}}}')===false || strpos($result, '}}{{')===false) { $result = '{{{'.$result.'}}{{'.$translated.'}}{{'.$text.'}}{{'.$module.'}}}'; diff --git a/app/code/core/Mage/Core/Model/Translate/Expr.php b/app/code/core/Mage/Core/Model/Translate/Expr.php index 1ce97c2117..06c9c1a3fb 100644 --- a/app/code/core/Mage/Core/Model/Translate/Expr.php +++ b/app/code/core/Mage/Core/Model/Translate/Expr.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Translate/Inline.php b/app/code/core/Mage/Core/Model/Translate/Inline.php index 0680b95256..c99087498d 100644 --- a/app/code/core/Mage/Core/Model/Translate/Inline.php +++ b/app/code/core/Mage/Core/Model/Translate/Inline.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -69,6 +69,64 @@ class Mage_Core_Model_Translate_Inline */ protected $_isJson = false; + /** + * List of global tags + * + * @var array + */ + protected $_allowedTagsGlobal = array( + 'script' => 'String in Javascript', + 'title' => 'Page title', + ); + + /** + * List of simple tags + * + * @var array + */ + protected $_allowedTagsSimple = array( + 'legend' => 'Caption for the fieldset element', + 'label' => 'Label for an input element.', + 'option' => 'Drop-down list option', + 'button' => 'Push button', + 'a' => 'Link label', + 'b' => 'Bold text', + 'strong' => 'Strong emphasized text', + 'i' => 'Italic text', + 'em' => 'Emphasized text', + 'u' => 'Underlined text', + 'sup' => 'Superscript text', + 'sub' => 'Subscript text', + 'span' => 'Span element', + 'small' => 'Smaller text', + 'big' => 'Bigger text', + 'address' => 'Contact information', + 'blockquote' => 'Long quotation', + 'q' => 'Short quotation', + 'cite' => 'Citation', + 'dt' => 'Item in a definition list', + 'dd' => 'Item description in a definition list.', + 'caption' => 'Table caption', + 'th' => 'Header cell in a table', + 'td' => 'Standard cell in a table', + 'abbr' => 'Abbreviated phrase', + 'acronym' => 'An acronym', + 'var' => 'Variable part of a text', + 'dfn' => 'Term', + 'strike' => 'Strikethrough text', + 'del' => 'Deleted text', + 'ins' => 'Inserted text', + 'h1' => 'Heading level 1', + 'h2' => 'Heading level 2', + 'h3' => 'Heading level 3', + 'h4' => 'Heading level 4', + 'h5' => 'Heading level 5', + 'h6' => 'Heading level 6', + 'p' => 'Paragraph', + 'pre' => 'Preformatted text', + 'center' => 'Centered text' + ); + /** * Is enabled and allowed Inline Translates * @@ -294,15 +352,10 @@ protected function _specialTags() $nextTag = 0; - $location = array( - 'script' => 'String in Javascript', - 'title' => 'Page title', - 'select' => 'Dropdown option', - 'button' => 'Button label', - 'a' => 'Link label', - ); + $location = array_merge($this->_allowedTagsGlobal, $this->_allowedTagsSimple); + $tags = implode('|', array_merge(array_keys($this->_allowedTagsGlobal), array_keys($this->_allowedTagsSimple))); + $tagRegExp = '#<(' . $tags . ')(\s+[^>]*|)(>)#i'; - $tagRegExp = '#<(script|title|select|button|a)(\s+[^>]*|)(>)#i'; $tagMatch = array(); while (preg_match($tagRegExp, $this->_content, $tagMatch, PREG_OFFSET_CAPTURE, $nextTag)) { $tagClosure = ''; @@ -326,33 +379,29 @@ protected function _specialTags() $trArr = array_unique($trArr); $tag = strtolower($tagMatch[1][0]); - switch ($tag) { - case 'script': case 'title': - $tagHtml .= ''.strtoupper($tag).''; - break; + if (in_array($tag, array_keys($this->_allowedTagsGlobal))) { + $tagHtml .= ''.strtoupper($tag).''; } $this->_content = substr_replace($this->_content, $tagHtml, $tagMatch[0][1], $tagLength); - switch ($tag) { - case 'select': case 'button': case 'a': - if (preg_match('# translate='.$quotePatern.'\[(.+?)\]'.$quotePatern.'#i', $tagMatch[0][0], $m, PREG_OFFSET_CAPTURE)) { - foreach ($trArr as $i=>$tr) { - if (strpos($m[1][0], $tr)!==false) { - unset($trArr[$i]); - } + if (in_array($tag, array_keys($this->_allowedTagsSimple))) { + if (preg_match('# translate='.$quotePatern.'\[(.+?)\]'.$quotePatern.'#i', $tagMatch[0][0], $m, PREG_OFFSET_CAPTURE)) { + foreach ($trArr as $i=>$tr) { + if (strpos($m[1][0], $tr)!==false) { + unset($trArr[$i]); } - array_unshift($trArr, $m[1][0]); - $start = $tagMatch[0][1]+$m[0][1]; - $len = strlen($m[0][0]); - } else { - $start = $tagMatch[2][1]; - $len = 0; } + array_unshift($trArr, $m[1][0]); + $start = $tagMatch[0][1]+$m[0][1]; + $len = strlen($m[0][0]); + } else { + $start = $tagMatch[2][1]; + $len = 0; + } - $this->_content = substr_replace($this->_content, - ' translate='.$quoteHtml.'['.join(',', $trArr).']'.$quoteHtml, $start, $len); - break; + $this->_content = substr_replace($this->_content, + ' translate='.$quoteHtml.'['.join(',', $trArr).']'.$quoteHtml, $start, $len); } } @@ -390,7 +439,6 @@ protected function _otherText() { $spanHtml = $m[3][0]; } - $spanHtml = $m[3][0]; $this->_content = substr_replace($this->_content, $spanHtml, $m[2][1], strlen($m[2][0]) ); $next = $m[0][1]; } diff --git a/app/code/core/Mage/Core/Model/Translate/String.php b/app/code/core/Mage/Core/Model/Translate/String.php index dc0548dcc3..2d8a957841 100644 --- a/app/code/core/Mage/Core/Model/Translate/String.php +++ b/app/code/core/Mage/Core/Model/Translate/String.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Url.php b/app/code/core/Mage/Core/Model/Url.php index 61c4d10540..5ae085f86f 100644 --- a/app/code/core/Mage/Core/Model/Url.php +++ b/app/code/core/Mage/Core/Model/Url.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Url/Rewrite.php b/app/code/core/Mage/Core/Model/Url/Rewrite.php index ebdf32e151..03622576cc 100644 --- a/app/code/core/Mage/Core/Model/Url/Rewrite.php +++ b/app/code/core/Mage/Core/Model/Url/Rewrite.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Variable.php b/app/code/core/Mage/Core/Model/Variable.php index 4031d5412c..1c9587bfb8 100644 --- a/app/code/core/Mage/Core/Model/Variable.php +++ b/app/code/core/Mage/Core/Model/Variable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -117,7 +117,7 @@ public function validate() } return true; } - return Mage::helper('core')->__('Validation failed.'); + return Mage::helper('core')->__('Validation has failed.'); } /** diff --git a/app/code/core/Mage/Core/Model/Variable/Config.php b/app/code/core/Mage/Core/Model/Variable/Config.php index b5526f74d9..7b358bb0d4 100644 --- a/app/code/core/Mage/Core/Model/Variable/Config.php +++ b/app/code/core/Mage/Core/Model/Variable/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Variable/Observer.php b/app/code/core/Mage/Core/Model/Variable/Observer.php index 53b148b8cb..8e5d663f4e 100644 --- a/app/code/core/Mage/Core/Model/Variable/Observer.php +++ b/app/code/core/Mage/Core/Model/Variable/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/Model/Website.php b/app/code/core/Mage/Core/Model/Website.php index f4cc38aac7..b1cb54d623 100644 --- a/app/code/core/Mage/Core/Model/Website.php +++ b/app/code/core/Mage/Core/Model/Website.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -196,7 +196,7 @@ public function getConfig($path) { $config = Mage::getConfig()->getNode('websites/'.$this->getCode().'/'.$path); if (!$config) { return false; - #throw Mage::exception('Mage_Core', Mage::helper('core')->__('Invalid websites configuration path: %s', $path)); + #throw Mage::exception('Mage_Core', Mage::helper('core')->__('Invalid website\'s configuration path: %s', $path)); } if ($config->hasChildren()) { $value = array(); diff --git a/app/code/core/Mage/Core/controllers/AjaxController.php b/app/code/core/Mage/Core/controllers/AjaxController.php index 19a1fb4f62..54dd5d0d5a 100644 --- a/app/code/core/Mage/Core/controllers/AjaxController.php +++ b/app/code/core/Mage/Core/controllers/AjaxController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Core_AjaxController extends Mage_Core_Controller_Front_Action diff --git a/app/code/core/Mage/Core/controllers/IndexController.php b/app/code/core/Mage/Core/controllers/IndexController.php index 22c8bde3d4..f5abafff33 100644 --- a/app/code/core/Mage/Core/controllers/IndexController.php +++ b/app/code/core/Mage/Core/controllers/IndexController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Core/etc/config.xml b/app/code/core/Mage/Core/etc/config.xml index 36508fa23c..6c0b842828 100644 --- a/app/code/core/Mage/Core/etc/config.xml +++ b/app/code/core/Mage/Core/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -112,6 +112,11 @@ + + + Zend_Log_Writer_Stream + + diff --git a/app/code/core/Mage/Core/etc/system.xml b/app/code/core/Mage/Core/etc/system.xml index 63a8cc9fa4..4e28a1ba35 100644 --- a/app/code/core/Mage/Core/etc/system.xml +++ b/app/code/core/Mage/Core/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Core - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -42,7 +42,7 @@ - + text adminhtml/system_config_form_fieldset_modules_disableOutput 2 @@ -110,7 +110,7 @@ 1 - + text 4 1 @@ -118,7 +118,7 @@ 1 - + text adminhtml/system_config_backend_email_address validate-email @@ -128,7 +128,7 @@ 1 - + text adminhtml/system_config_backend_email_sender validate-emailSender @@ -140,7 +140,7 @@ - + text 5 1 @@ -148,7 +148,7 @@ 1 - + text adminhtml/system_config_backend_email_address validate-email @@ -158,7 +158,7 @@ 1 - + text adminhtml/system_config_backend_email_sender validate-emailSender @@ -170,7 +170,7 @@ - + text 1 1 @@ -178,7 +178,7 @@ 1 - + text adminhtml/system_config_backend_email_address validate-email @@ -188,7 +188,7 @@ 1 - + text adminhtml/system_config_backend_email_sender validate-emailSender @@ -200,7 +200,7 @@ - + text 2 1 @@ -208,7 +208,7 @@ 1 - + text adminhtml/system_config_backend_email_address validate-email @@ -218,7 +218,7 @@ 1 - + text adminhtml/system_config_backend_email_sender validate-emailSender @@ -230,7 +230,7 @@ - + text 3 1 @@ -238,7 +238,7 @@ 1 - + text adminhtml/system_config_backend_email_address validate-email @@ -248,7 +248,7 @@ 1 - + text adminhtml/system_config_backend_email_sender validate-emailSender @@ -280,7 +280,7 @@ 1 - + text adminhtml/system_config_backend_design_package 1 @@ -397,7 +397,7 @@ - How many Links to display at once + How many links to display at once. text 7 1 @@ -406,7 +406,7 @@ - If the Current Frame Position does not cover Utmost Pages, will render Link to Current Position plus/minus this Value + If the current frame position does not cover utmost pages, will render link to current position plus/minus this value. text 8 1 @@ -415,7 +415,7 @@ - Alternative text for Previous link in pagination menu. If empty, default arrow image will used + Alternative text for previous link in pagination menu. If empty, default arrow image will used. text 9 1 @@ -424,7 +424,7 @@ - Alternative text for Next Link in pagination menu. If empty, default arrow image will used + Alternative text for next link in pagination menu. If empty, default arrow image will used. text 10 1 @@ -459,7 +459,7 @@ 1 1 1 - Leave empty for access from any location + Leave empty for access from any location. @@ -525,7 +525,7 @@ 1 0 0 - Translate cache should be disabled for both Frontend and Admin inline translations + Translate cache should be disabled for both frontend and admin inline translations. @@ -575,7 +575,7 @@ 1 - + select adminhtml/system_config_source_yesno 10 @@ -626,7 +626,7 @@ 1 - + text 1 1 @@ -634,7 +634,7 @@ 1 - + multiselect adminhtml/system_config_source_country 2 @@ -644,7 +644,7 @@ 1 - + select adminhtml/system_config_source_country 1 @@ -655,7 +655,7 @@ - + text 8 1 @@ -756,7 +756,7 @@ 1 - + select adminhtml/system_config_source_yesno 10 @@ -771,7 +771,7 @@ 1 1 1 - For Windows Server Only + For Windows server only. @@ -780,7 +780,7 @@ 1 1 1 - For Windows Server Only + For Windows server only. diff --git a/app/code/core/Mage/Cron/etc/system.xml b/app/code/core/Mage/Cron/etc/system.xml index 364e970b78..dbbe608d6e 100644 --- a/app/code/core/Mage/Cron/etc/system.xml +++ b/app/code/core/Mage/Cron/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Cron - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -39,7 +39,7 @@ For correct URLs generated during cron runs please make sure that Web > Secure and Unsecure Base URLs are explicitly set. - + text 10 1 @@ -47,7 +47,7 @@ 1 - + text 20 1 @@ -55,7 +55,7 @@ 1 - + text 30 1 @@ -63,7 +63,7 @@ 1 - + text 40 1 @@ -71,7 +71,7 @@ 1 - + text 50 1 @@ -79,7 +79,7 @@ 1 - + text 60 1 diff --git a/app/code/core/Mage/Cron/sql/cron_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Cron/sql/cron_setup/mysql4-install-0.7.0.php index febff9116a..484ebb151e 100644 --- a/app/code/core/Mage/Cron/sql/cron_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Cron/sql/cron_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cron - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Cron/sql/cron_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/Cron/sql/cron_setup/mysql4-upgrade-0.7.0-0.7.1.php index 0be0e454db..7d5401cf4d 100644 --- a/app/code/core/Mage/Cron/sql/cron_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/Cron/sql/cron_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Cron - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Account.php b/app/code/core/Mage/Customer/Block/Account.php index ef61be5c80..e4efd2b9c8 100644 --- a/app/code/core/Mage/Customer/Block/Account.php +++ b/app/code/core/Mage/Customer/Block/Account.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Account/Dashboard.php b/app/code/core/Mage/Customer/Block/Account/Dashboard.php index 0a6940b29f..f0c621b515 100644 --- a/app/code/core/Mage/Customer/Block/Account/Dashboard.php +++ b/app/code/core/Mage/Customer/Block/Account/Dashboard.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -92,10 +92,10 @@ public function getManageNewsletterUrl() public function getSubscriptionText() { if($this->getSubscriptionObject()->isSubscribed()) { - return Mage::helper('customer')->__('You are currently subscribed to our newsletter'); + return Mage::helper('customer')->__('You are currently subscribed to our newsletter.'); } - return Mage::helper('customer')->__('You are currently not subscribed to our newsletter'); + return Mage::helper('customer')->__('You are currently not subscribed to our newsletter.'); } public function getPrimaryAddresses() diff --git a/app/code/core/Mage/Customer/Block/Account/Dashboard/Address.php b/app/code/core/Mage/Customer/Block/Account/Dashboard/Address.php index 17519b9c93..63e4e26320 100644 --- a/app/code/core/Mage/Customer/Block/Account/Dashboard/Address.php +++ b/app/code/core/Mage/Customer/Block/Account/Dashboard/Address.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Account/Dashboard/Block.php b/app/code/core/Mage/Customer/Block/Account/Dashboard/Block.php index 7ad52e4b46..8c4fbbebea 100644 --- a/app/code/core/Mage/Customer/Block/Account/Dashboard/Block.php +++ b/app/code/core/Mage/Customer/Block/Account/Dashboard/Block.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Account/Dashboard/Hello.php b/app/code/core/Mage/Customer/Block/Account/Dashboard/Hello.php index 123b8704af..443e784b9d 100644 --- a/app/code/core/Mage/Customer/Block/Account/Dashboard/Hello.php +++ b/app/code/core/Mage/Customer/Block/Account/Dashboard/Hello.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Account/Dashboard/Info.php b/app/code/core/Mage/Customer/Block/Account/Dashboard/Info.php index 63f283c645..8089580750 100644 --- a/app/code/core/Mage/Customer/Block/Account/Dashboard/Info.php +++ b/app/code/core/Mage/Customer/Block/Account/Dashboard/Info.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Account/Dashboard/Newsletter.php b/app/code/core/Mage/Customer/Block/Account/Dashboard/Newsletter.php index 9eb4761196..d0970dbda7 100644 --- a/app/code/core/Mage/Customer/Block/Account/Dashboard/Newsletter.php +++ b/app/code/core/Mage/Customer/Block/Account/Dashboard/Newsletter.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Account/Dashboard/Sidebar.php b/app/code/core/Mage/Customer/Block/Account/Dashboard/Sidebar.php index 05528d8a48..cef5dd0ff0 100644 --- a/app/code/core/Mage/Customer/Block/Account/Dashboard/Sidebar.php +++ b/app/code/core/Mage/Customer/Block/Account/Dashboard/Sidebar.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Account/Forgotpassword.php b/app/code/core/Mage/Customer/Block/Account/Forgotpassword.php index da1584a1d2..6197992b6e 100644 --- a/app/code/core/Mage/Customer/Block/Account/Forgotpassword.php +++ b/app/code/core/Mage/Customer/Block/Account/Forgotpassword.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Account/Navigation.php b/app/code/core/Mage/Customer/Block/Account/Navigation.php index 5ca9831a73..29f370382e 100644 --- a/app/code/core/Mage/Customer/Block/Account/Navigation.php +++ b/app/code/core/Mage/Customer/Block/Account/Navigation.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Address/Book.php b/app/code/core/Mage/Customer/Block/Address/Book.php index a383367b02..4d9030ce5a 100644 --- a/app/code/core/Mage/Customer/Block/Address/Book.php +++ b/app/code/core/Mage/Customer/Block/Address/Book.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Address/Edit.php b/app/code/core/Mage/Customer/Block/Address/Edit.php index b59fb40d34..427a05b39f 100644 --- a/app/code/core/Mage/Customer/Block/Address/Edit.php +++ b/app/code/core/Mage/Customer/Block/Address/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Address/Renderer/Default.php b/app/code/core/Mage/Customer/Block/Address/Renderer/Default.php index e61cec80f2..8d0637f318 100644 --- a/app/code/core/Mage/Customer/Block/Address/Renderer/Default.php +++ b/app/code/core/Mage/Customer/Block/Address/Renderer/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -93,11 +93,24 @@ public function render(Mage_Customer_Model_Address_Abstract $address, $format=nu } } } + + /** + * Remove data that mustn't show + */ + if (!$this->helper('customer/address')->canShowConfig('prefix_show')) { + unset($data['prefix']); + } + if (!$this->helper('customer/address')->canShowConfig('middlename_show')) { + unset($data['middlename']); + } + if (!$this->helper('customer/address')->canShowConfig('suffix_show')) { + unset($data['suffix']); + } + $formater->setVariables(array_merge($data, array('country'=>$address->getCountryModel()->getName()))); $format = !is_null($format) ? $format : $this->getFormat($address); return $formater->filter($format); } - } diff --git a/app/code/core/Mage/Customer/Block/Address/Renderer/Interface.php b/app/code/core/Mage/Customer/Block/Address/Renderer/Interface.php index 0e0b767ca9..9842122b04 100644 --- a/app/code/core/Mage/Customer/Block/Address/Renderer/Interface.php +++ b/app/code/core/Mage/Customer/Block/Address/Renderer/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Form/Edit.php b/app/code/core/Mage/Customer/Block/Form/Edit.php index 5dbf7cecf1..9eadb2f1a6 100644 --- a/app/code/core/Mage/Customer/Block/Form/Edit.php +++ b/app/code/core/Mage/Customer/Block/Form/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Form/Login.php b/app/code/core/Mage/Customer/Block/Form/Login.php index 3a8c9e6a09..fd678eb12b 100644 --- a/app/code/core/Mage/Customer/Block/Form/Login.php +++ b/app/code/core/Mage/Customer/Block/Form/Login.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Form/Register.php b/app/code/core/Mage/Customer/Block/Form/Register.php index 3b0865fd1e..b57bdb262a 100644 --- a/app/code/core/Mage/Customer/Block/Form/Register.php +++ b/app/code/core/Mage/Customer/Block/Form/Register.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Newsletter.php b/app/code/core/Mage/Customer/Block/Newsletter.php index 0edebd88b6..91cca9583f 100644 --- a/app/code/core/Mage/Customer/Block/Newsletter.php +++ b/app/code/core/Mage/Customer/Block/Newsletter.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Widget/Abstract.php b/app/code/core/Mage/Customer/Block/Widget/Abstract.php index 5bef3cfc50..7274d62d3c 100644 --- a/app/code/core/Mage/Customer/Block/Widget/Abstract.php +++ b/app/code/core/Mage/Customer/Block/Widget/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Widget/Dob.php b/app/code/core/Mage/Customer/Block/Widget/Dob.php index a489e2871f..5523293849 100644 --- a/app/code/core/Mage/Customer/Block/Widget/Dob.php +++ b/app/code/core/Mage/Customer/Block/Widget/Dob.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Widget/Gender.php b/app/code/core/Mage/Customer/Block/Widget/Gender.php index 9a65e1f890..f96d2f61cd 100644 --- a/app/code/core/Mage/Customer/Block/Widget/Gender.php +++ b/app/code/core/Mage/Customer/Block/Widget/Gender.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Widget/Name.php b/app/code/core/Mage/Customer/Block/Widget/Name.php index 4b52f32c80..b52edd490c 100644 --- a/app/code/core/Mage/Customer/Block/Widget/Name.php +++ b/app/code/core/Mage/Customer/Block/Widget/Name.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Block/Widget/Taxvat.php b/app/code/core/Mage/Customer/Block/Widget/Taxvat.php index fd3cf25bc3..3599848003 100644 --- a/app/code/core/Mage/Customer/Block/Widget/Taxvat.php +++ b/app/code/core/Mage/Customer/Block/Widget/Taxvat.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Exception.php b/app/code/core/Mage/Customer/Exception.php index 1f3b79942d..dca4d72d5c 100644 --- a/app/code/core/Mage/Customer/Exception.php +++ b/app/code/core/Mage/Customer/Exception.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Helper/Address.php b/app/code/core/Mage/Customer/Helper/Address.php index 29832dd950..2b8f52e31a 100644 --- a/app/code/core/Mage/Customer/Helper/Address.php +++ b/app/code/core/Mage/Customer/Helper/Address.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -89,4 +89,18 @@ public function getFormat($code) $format = Mage::getSingleton('customer/address_config')->getFormatByCode($code); return $format->getRenderer() ? $format->getRenderer()->getFormat() : ''; } + + /** + * Determine if specified address config value can show + * + * @return bool + */ + public function canShowConfig($key) + { + $value = $this->getConfig($key); + if (empty($value)) { + return false; + } + return true; + } } diff --git a/app/code/core/Mage/Customer/Helper/Data.php b/app/code/core/Mage/Customer/Helper/Data.php index 95f360317e..b6ea66e050 100644 --- a/app/code/core/Mage/Customer/Helper/Data.php +++ b/app/code/core/Mage/Customer/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Address.php b/app/code/core/Mage/Customer/Model/Address.php index 4983a771c5..de208366fe 100644 --- a/app/code/core/Mage/Customer/Model/Address.php +++ b/app/code/core/Mage/Customer/Model/Address.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -80,6 +80,18 @@ public function getCustomer() return $this->_customer; } + /** + * Specify address customer + * + * @param Mage_Customer_Model_Customer $customer + */ + public function setCustomer(Mage_Customer_Model_Customer $customer) + { + $this->_customer = $customer; + $this->setCustomerId($customer->getId()); + return $this; + } + /** * Delete customer address * diff --git a/app/code/core/Mage/Customer/Model/Address/Abstract.php b/app/code/core/Mage/Customer/Model/Address/Abstract.php index 4b7d4d2065..e6c822dfdc 100644 --- a/app/code/core/Mage/Customer/Model/Address/Abstract.php +++ b/app/code/core/Mage/Customer/Model/Address/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -47,18 +47,24 @@ class Mage_Customer_Model_Address_Abstract extends Mage_Core_Model_Abstract */ static protected $_regionModels = array(); + /** + * Get full customer name + * + * @return string + */ public function getName() { $name = ''; - if ($this->getPrefix()) { + $helper = Mage::helper('customer/address'); + if ($helper->canShowConfig('prefix_show') && $this->getPrefix()) { $name .= $this->getPrefix() . ' '; } $name .= $this->getFirstname(); - if ($this->getMiddlename()) { + if ($helper->canShowConfig('middlename_show') && $this->getMiddlename()) { $name .= ' ' . $this->getMiddlename(); } $name .= ' ' . $this->getLastname(); - if ($this->getSuffix()) { + if ($helper->canShowConfig('suffix_show')&& $this->getSuffix()) { $name .= ' ' . $this->getSuffix(); } return $name; @@ -296,7 +302,6 @@ public function format($type) || !$formatType->getRenderer()) { return null; } - return $formatType->getRenderer()->render($this); } @@ -328,37 +333,37 @@ public function validate() $helper = Mage::helper('customer'); $this->implodeStreetAddress(); if (!Zend_Validate::is($this->getFirstname(), 'NotEmpty')) { - $errors[] = $helper->__('Please enter first name.'); + $errors[] = $helper->__('Please enter the first name.'); } if (!Zend_Validate::is($this->getLastname(), 'NotEmpty')) { - $errors[] = $helper->__('Please enter last name.'); + $errors[] = $helper->__('Please enter the last name.'); } if (!Zend_Validate::is($this->getStreet(1), 'NotEmpty')) { - $errors[] = $helper->__('Please enter street.'); + $errors[] = $helper->__('Please enter the street.'); } if (!Zend_Validate::is($this->getCity(), 'NotEmpty')) { - $errors[] = $helper->__('Please enter city.'); + $errors[] = $helper->__('Please enter the city.'); } if (!Zend_Validate::is($this->getTelephone(), 'NotEmpty')) { - $errors[] = $helper->__('Please enter telephone.'); + $errors[] = $helper->__('Please enter the telephone number.'); } $_havingOptionalZip = Mage::helper('directory')->getCountriesWithOptionalZip(); if (!in_array($this->getCountryId(), $_havingOptionalZip) && !Zend_Validate::is($this->getPostcode(), 'NotEmpty')) { - $errors[] = $helper->__('Please enter zip/postal code.'); + $errors[] = $helper->__('Please enter the zip/postal code.'); } if (!Zend_Validate::is($this->getCountryId(), 'NotEmpty')) { - $errors[] = $helper->__('Please enter country.'); + $errors[] = $helper->__('Please enter the country.'); } if ($this->getCountryModel()->getRegionCollection()->getSize() && !Zend_Validate::is($this->getRegionId(), 'NotEmpty')) { - $errors[] = $helper->__('Please enter state/province.'); + $errors[] = $helper->__('Please enter the state/province.'); } if (empty($errors) || $this->getShouldIgnoreValidation()) { diff --git a/app/code/core/Mage/Customer/Model/Address/Api.php b/app/code/core/Mage/Customer/Model/Address/Api.php index f4237c7902..b34bb644ce 100644 --- a/app/code/core/Mage/Customer/Model/Address/Api.php +++ b/app/code/core/Mage/Customer/Model/Address/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Address/Api/V2.php b/app/code/core/Mage/Customer/Model/Address/Api/V2.php index 0b186c6a48..6a71fb4a15 100644 --- a/app/code/core/Mage/Customer/Model/Address/Api/V2.php +++ b/app/code/core/Mage/Customer/Model/Address/Api/V2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Address/Config.php b/app/code/core/Mage/Customer/Model/Address/Config.php index a3d79eec2b..38d62fabde 100644 --- a/app/code/core/Mage/Customer/Model/Address/Config.php +++ b/app/code/core/Mage/Customer/Model/Address/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Api/Resource.php b/app/code/core/Mage/Customer/Model/Api/Resource.php index 2f23b744ea..3abec7751f 100644 --- a/app/code/core/Mage/Customer/Model/Api/Resource.php +++ b/app/code/core/Mage/Customer/Model/Api/Resource.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Attribute.php b/app/code/core/Mage/Customer/Model/Attribute.php index f527160c58..ef09171cae 100644 --- a/app/code/core/Mage/Customer/Model/Attribute.php +++ b/app/code/core/Mage/Customer/Model/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Config/Share.php b/app/code/core/Mage/Customer/Model/Config/Share.php index 243247df93..ccea3f3347 100644 --- a/app/code/core/Mage/Customer/Model/Config/Share.php +++ b/app/code/core/Mage/Customer/Model/Config/Share.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -91,7 +91,7 @@ public function _beforeSave() if ($value == self::SHARE_GLOBAL) { if (Mage::getResourceSingleton('customer/customer')->findEmailDuplicates()) { Mage::throwException( - Mage::helper('customer')->__('Can\'t share customer accounts global. Because some customer accounts with same emails exist on multiple websites and cannot be merged.') + Mage::helper('customer')->__('Cannot share customer accounts globally because some customer accounts with the same emails exist on multiple websites and cannot be merged.') ); } } diff --git a/app/code/core/Mage/Customer/Model/Convert/Adapter/Customer.php b/app/code/core/Mage/Customer/Model/Convert/Adapter/Customer.php index 313dceb42f..99ba2eb99b 100644 --- a/app/code/core/Mage/Customer/Model/Convert/Adapter/Customer.php +++ b/app/code/core/Mage/Customer/Model/Convert/Adapter/Customer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -373,10 +373,10 @@ public function save() } foreach ($collections as $storeId=>$collection) { - $this->addException(Mage::helper('customer')->__('Records for "'.$stores[$storeId].'" store found')); + $this->addException(Mage::helper('customer')->__('Records for %s store found.', $stores[$storeId])); if (!$collection instanceof Mage_Customer_Model_Entity_Customer_Collection) { - $this->addException(Mage::helper('customer')->__('Customer collection expected'), Mage_Dataflow_Model_Convert_Exception::FATAL); + $this->addException(Mage::helper('customer')->__('Customer collection expected.'), Mage_Dataflow_Model_Convert_Exception::FATAL); } try { $i = 0; @@ -398,10 +398,10 @@ public function save() } $i++; } - $this->addException(Mage::helper('customer')->__("Saved ".$i." record(s)")); + $this->addException(Mage::helper('customer')->__("Saved %d record(s)", $i)); } catch (Exception $e) { if (!$e instanceof Mage_Dataflow_Model_Convert_Exception) { - $this->addException(Mage::helper('customer')->__('Problem saving the collection, aborting. Error: %s', $e->getMessage()), + $this->addException(Mage::helper('customer')->__('An error occurred while saving the collection, aborting. Error: %s', $e->getMessage()), Mage_Dataflow_Model_Convert_Exception::FATAL); } } @@ -421,18 +421,18 @@ public function saveRow($importData) $customer->setId(null); if (empty($importData['website'])) { - $message = Mage::helper('customer')->__('Skip import row, required field "%s" not defined', 'website'); + $message = Mage::helper('customer')->__('Skipping import row, required field "%s" is not defined.', 'website'); Mage::throwException($message); } $website = $this->getWebsiteByCode($importData['website']); if ($website === false) { - $message = Mage::helper('customer')->__('Skip import row, website "%s" field not exists', $importData['website']); + $message = Mage::helper('customer')->__('Skipping import row, website "%s" field does not exist.', $importData['website']); Mage::throwException($message); } if (empty($importData['email'])) { - $message = Mage::helper('customer')->__('Skip import row, required field "%s" not defined', 'email'); + $message = Mage::helper('customer')->__('Skipping import row, required field "%s" is not defined.', 'email'); Mage::throwException($message); } @@ -445,14 +445,14 @@ public function saveRow($importData) */ if (empty($importData['group_id']) || !isset($customerGroups[$importData['group_id']])) { $value = isset($importData['group_id']) ? $importData['group_id'] : ''; - $message = Mage::helper('catalog')->__('Skip import row, is not valid value "%s" for field "%s"', $value, 'group_id'); + $message = Mage::helper('catalog')->__('Skipping import row, the value "%s" is not valid for the "%s" field.', $value, 'group_id'); Mage::throwException($message); } $customer->setGroupId($customerGroups[$importData['group_id']]); foreach ($this->_requiredFields as $field) { if (!isset($importData[$field])) { - $message = Mage::helper('catalog')->__('Skip import row, required field "%s" for new customer not defined', $field); + $message = Mage::helper('catalog')->__('Skip import row, required field "%s" for the new customer is not defined.', $field); Mage::throwException($message); } } diff --git a/app/code/core/Mage/Customer/Model/Convert/Parser/Customer.php b/app/code/core/Mage/Customer/Model/Convert/Parser/Customer.php index 78be0c793f..71bbfbcd65 100644 --- a/app/code/core/Mage/Customer/Model/Convert/Parser/Customer.php +++ b/app/code/core/Mage/Customer/Model/Convert/Parser/Customer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -119,7 +119,7 @@ public function getStore() $store = Mage::app()->getStore($this->getVar('store')); } catch (Exception $e) { - $this->addException(Mage::helper('catalog')->__('Invalid store specified'), Varien_Convert_Exception::FATAL); + $this->addException(Mage::helper('catalog')->__('An invalid store was specified.'), Varien_Convert_Exception::FATAL); throw $e; } $this->_store = $store; @@ -251,7 +251,7 @@ public function unparse() $option = $attribute->getSource()->getOptionText($value); if ($value && empty($option)) { - $message = Mage::helper('catalog')->__("Invalid option id specified for %s (%s), skipping the record", $field, $value); + $message = Mage::helper('catalog')->__("An invalid option ID is specified for %s (%s), skipping the record.", $field, $value); $this->addException($message, Mage_Dataflow_Model_Convert_Exception::ERROR); continue; } @@ -404,12 +404,12 @@ public function unparse__OLD() // if ($collections instanceof Mage_Eav_Model_Entity_Collection_Abstract) { // $collections = array($collections->getEntity()->getStoreId()=>$collections); // } elseif (!is_array($collections)) { -// $this->addException(Mage::helper('customer')->__("Array of Entity collections is expected"), Varien_Convert_Exception::FATAL); +// $this->addException(Mage::helper('customer')->__("Array of Entity collections is expected."), Varien_Convert_Exception::FATAL); // } // foreach ($collections as $storeId=>$collection) { // if (!$collection instanceof Mage_Eav_Model_Entity_Collection_Abstract) { -// $this->addException(Mage::helper('customer')->__("Entity collection is expected"), Varien_Convert_Exception::FATAL); +// $this->addException(Mage::helper('customer')->__("Entity collection is expected."), Varien_Convert_Exception::FATAL); // } $data = array(); @@ -444,7 +444,7 @@ public function unparse__OLD() $option = $attribute->getSource()->getOptionText($value); if (false===$option) { - $this->addException(Mage::helper('customer')->__("Invalid option id specified for %s (%s), skipping the record", $field, $value), Mage_Dataflow_Model_Convert_Exception::ERROR); + $this->addException(Mage::helper('customer')->__("An invalid option ID is specified for %s (%s), skipping the record.", $field, $value), Mage_Dataflow_Model_Convert_Exception::ERROR); continue; } if (is_array($option)) { @@ -516,7 +516,7 @@ public function parse() // validate SKU if (empty($row['email'])) { - $this->addException(Mage::helper('customer')->__('Missing email, skipping the record'), Varien_Convert_Exception::ERROR); + $this->addException(Mage::helper('customer')->__('Missing email, skipping the record.'), Varien_Convert_Exception::ERROR); continue; } $this->setPosition('Line: '.($i+1).', email: '.$row['email']); @@ -536,7 +536,7 @@ public function parse() // get attribute_set_id, if not throw error $row['attribute_set_id'] = $this->getAttributeSetId($entityTypeId, $row['attribute_set']); if (!$row['attribute_set_id']) { - $this->addException(Mage::helper('customer')->__("Invalid attribute set specified, skipping the record"), Varien_Convert_Exception::ERROR); + $this->addException(Mage::helper('customer')->__("Invalid attribute set specified, skipping the record."), Varien_Convert_Exception::ERROR); continue; } @@ -545,13 +545,13 @@ public function parse() } if (empty($row['firstname'])) { - $this->addException(Mage::helper('customer')->__('Missing firstname, skipping the record'), Varien_Convert_Exception::ERROR); + $this->addException(Mage::helper('customer')->__('Missing firstname, skipping the record.'), Varien_Convert_Exception::ERROR); continue; } //$this->setPosition('Line: '.($i+1).', Firstname: '.$row['firstname']); if (empty($row['lastname'])) { - $this->addException(Mage::helper('customer')->__('Missing lastname, skipping the record'), Varien_Convert_Exception::ERROR); + $this->addException(Mage::helper('customer')->__('Missing lastname, skipping the record.'), Varien_Convert_Exception::ERROR); continue; } //$this->setPosition('Line: '.($i+1).', Lastname: '.$row['lastname']); @@ -560,7 +560,7 @@ public function parse() // get product type_id, if not throw error $row['type_id'] = $this->getProductTypeId($row['type']); if (!$row['type_id']) { - $this->addException(Mage::helper('catalog')->__("Invalid product type specified, skipping the record"), Varien_Convert_Exception::ERROR); + $this->addException(Mage::helper('catalog')->__("Invalid product type specified, skipping the record."), Varien_Convert_Exception::ERROR); continue; } */ @@ -568,7 +568,7 @@ public function parse() // get store ids $storeIds = $this->getStoreIds(isset($row['store']) ? $row['store'] : $this->getVar('store')); if (!$storeIds) { - $this->addException(Mage::helper('customer')->__("Invalid store specified, skipping the record"), Varien_Convert_Exception::ERROR); + $this->addException(Mage::helper('customer')->__("Invalid store specified, skipping the record."), Varien_Convert_Exception::ERROR); continue; } @@ -588,7 +588,7 @@ public function parse() $attribute = $entity->getAttribute($field); if (!$attribute) { continue; - #$this->addException(Mage::helper('catalog')->__("Unknown attribute: %s", $field), Varien_Convert_Exception::ERROR); + #$this->addException(Mage::helper('catalog')->__("Unknown attribute: %s.", $field), Varien_Convert_Exception::ERROR); } @@ -597,7 +597,7 @@ public function parse() $optionId = $this->getSourceOptionId($source, $value); if (is_null($optionId)) { $rowError = true; - $this->addException(Mage::helper('customer')->__("Invalid attribute option specified for attribute %s (%s), skipping the record", $field, $value), Varien_Convert_Exception::ERROR); + $this->addException(Mage::helper('customer')->__("Invalid attribute option specified for attribute %s (%s), skipping the record.", $field, $value), Varien_Convert_Exception::ERROR); continue; } $value = $optionId; @@ -697,7 +697,7 @@ public function parse() } catch (Exception $e) { if (!$e instanceof Mage_Dataflow_Model_Convert_Exception) { - $this->addException(Mage::helper('customer')->__("Error during retrieval of option value: %s", $e->getMessage()), Mage_Dataflow_Model_Convert_Exception::FATAL); + $this->addException(Mage::helper('customer')->__('An error occurred while retrieving the option value: %s.', $e->getMessage()), Mage_Dataflow_Model_Convert_Exception::FATAL); } } } diff --git a/app/code/core/Mage/Customer/Model/Customer.php b/app/code/core/Mage/Customer/Model/Customer.php index 57e03f09ef..f1d40de0bb 100644 --- a/app/code/core/Mage/Customer/Model/Customer.php +++ b/app/code/core/Mage/Customer/Model/Customer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -97,7 +97,6 @@ function _construct() public function getSharingConfig() { return Mage::getSingleton('customer/config_share'); - } /** @@ -179,15 +178,16 @@ public function changePassword($newPassword) public function getName() { $name = ''; - if ($this->getPrefix()) { + $helper = Mage::helper('customer/address'); + if ($helper->canShowConfig('prefix_show') && $this->getPrefix()) { $name .= $this->getPrefix() . ' '; } $name .= $this->getFirstname(); - if ($this->getMiddlename()) { + if ($helper->canShowConfig('middlename_show') && $this->getMiddlename()) { $name .= ' ' . $this->getMiddlename(); } $name .= ' ' . $this->getLastname(); - if ($this->getSuffix()) { + if ($helper->canShowConfig('suffix_show')&& $this->getSuffix()) { $name .= ' ' . $this->getSuffix(); } return $name; @@ -250,8 +250,10 @@ public function getAddressesCollection() if (is_null($this->_addressesCollection)) { $this->_addressesCollection = $this->getAddressCollection() ->setCustomerFilter($this) - ->addAttributeToSelect('*') - ->load(); + ->addAttributeToSelect('*'); + foreach ($this->_addressesCollection as $address) { + $address->setCustomer($this); + } } return $this->_addressesCollection; @@ -628,6 +630,7 @@ public function isInStore($store) else { $storeId = $store; } + $availableStores = $this->getSharedStoreIds(); return in_array($storeId, $availableStores); } @@ -709,42 +712,43 @@ public function setStore(Mage_Core_Model_Store $store) public function validate() { $errors = array(); - + $customerHelper = Mage::helper('customer'); + $addressHelper = Mage::helper('customer/address'); if (!Zend_Validate::is( trim($this->getFirstname()) , 'NotEmpty')) { - $errors[] = Mage::helper('customer')->__('First name can\'t be empty'); + $errors[] = $customerHelper->__('The first name cannot be empty.'); } if (!Zend_Validate::is( trim($this->getLastname()) , 'NotEmpty')) { - $errors[] = Mage::helper('customer')->__('Last name can\'t be empty'); + $errors[] = $customerHelper->__('The last name cannot be empty.'); } if (!Zend_Validate::is($this->getEmail(), 'EmailAddress')) { - $errors[] = Mage::helper('customer')->__('Invalid email address "%s"', $this->getEmail()); + $errors[] = $customerHelper->__('Invalid email address "%s".', $this->getEmail()); } $password = $this->getPassword(); if (!$this->getId() && !Zend_Validate::is($password , 'NotEmpty')) { - $errors[] = Mage::helper('customer')->__('Password can\'t be empty'); + $errors[] = $customerHelper->__('The password cannot be empty.'); } if ($password && !Zend_Validate::is($password, 'StringLength', array(6))) { - $errors[] = Mage::helper('customer')->__('Password minimal length must be more %s', 6); + $errors[] = $customerHelper->__('The minimum password length is %s', 6); } $confirmation = $this->getConfirmation(); if ($password != $confirmation) { - $errors[] = Mage::helper('customer')->__('Please make sure your passwords match.'); + $errors[] = $customerHelper->__('Please make sure your passwords match.'); } - if (('req' === Mage::helper('customer/address')->getConfig('dob_show')) + if (('req' === $addressHelper->getConfig('dob_show')) && '' == trim($this->getDob())) { - $errors[] = Mage::helper('customer')->__('Date of Birth is required.'); + $errors[] = $customerHelper->__('The Date of Birth is required.'); } - if (('req' === Mage::helper('customer/address')->getConfig('taxvat_show')) + if (('req' === $addressHelper->getConfig('taxvat_show')) && '' == trim($this->getTaxvat())) { - $errors[] = Mage::helper('customer')->__('TAX/VAT number is required.'); + $errors[] = $customerHelper->__('The TAX/VAT number is required.'); } - if (('req' === Mage::helper('customer/address')->getConfig('gender_show')) + if (('req' === $addressHelper->getConfig('gender_show')) && '' == trim($this->getGender())) { - $errors[] = Mage::helper('customer')->__('Gender is required.'); + $errors[] = $customerHelper->__('Gender is required.'); } if (empty($errors)) { @@ -772,7 +776,7 @@ public function importFromTextArray(array $row) $website = Mage::getModel('core/website')->load($row['website_code'], 'code'); if (!$website->getId()) { - $this->addError($hlp->__('Invalid website, skipping the record, line: %s', $line)); + $this->addError($hlp->__('Invalid website, skipping the record, line: %s.', $line)); } else { $row['website_id'] = $website->getWebsiteId(); @@ -781,18 +785,18 @@ public function importFromTextArray(array $row) // Validate Email if (empty($row['email'])) { - $this->addError($hlp->__('Missing email, skipping the record, line: %s', $line)); + $this->addError($hlp->__('Missing email, skipping the record, line: %s.', $line)); } else { $this->loadByEmail($row['email']); } if (empty($row['entity_id'])) { if ($this->getData('entity_id')) { - $this->addError($hlp->__('Customer email (%s) already exists, skipping the record , line: %s', $row['email'], $line)); + $this->addError($hlp->__('The customer email (%s) already exists, skipping the record, line: %s.', $row['email'], $line)); } } else { if ($row['entity_id'] != $this->getData('entity_id')) { - $this->addError($hlp->__('CustomerID and email didn\'t match, skipping the record , line: %s', $line)); + $this->addError($hlp->__('The customer ID and email did not match, skipping the record, line: %s.', $line)); } else { $this->unsetData(); $this->load($row['entity_id']); @@ -804,7 +808,7 @@ public function importFromTextArray(array $row) } if (empty($row['website_code'])) { - $this->addError($hlp->__('Missing website, skipping the record, line: %s', $line)); + $this->addError($hlp->__('Missing website, skipping the record, line: %s.', $line)); } if (empty($row['group'])) { @@ -812,10 +816,10 @@ public function importFromTextArray(array $row) } if (empty($row['firstname'])) { - $this->addError($hlp->__('Missing firstname, skipping the record, line: %s', $line)); + $this->addError($hlp->__('Missing first name, skipping the record, line: %s.', $line)); } if (empty($row['lastname'])) { - $this->addError($hlp->__('Missing lastname, skipping the record, line: %s', $line)); + $this->addError($hlp->__('Missing last name, skipping the record, line: %s.', $line)); } if (!empty($row['password_new'])) { @@ -841,7 +845,7 @@ public function importFromTextArray(array $row) // $source = $attribute->getSource(); // $optionId = $config->getSourceOptionId($source, $value); // if (is_null($optionId)) { -// $this->printError($hlp->__("Invalid attribute option specified for attribute attribute %s (%s)", $field, $value), $line); +// $this->printError($hlp->__("Invalid attribute option specified for attribute attribute %s (%s).", $field, $value), $line); // } // $value = $optionId; // } @@ -850,7 +854,7 @@ public function importFromTextArray(array $row) } if (!$this->validateAddress($row, 'billing')) { - $this->printError($hlp->__('Invalid billing address for (%s)', $row['email']), $line); + $this->printError($hlp->__('Invalid billing address for (%s).', $row['email']), $line); } else { // Handling billing address $billingAddress = $this->getPrimaryBillingAddress(); @@ -889,7 +893,7 @@ public function importFromTextArray(array $row) } if (!$this->validateAddress($row, 'shipping')) { - $this->printError($hlp->__('Invalid shipping address for (%s)', $row['email']), $line); + $this->printError($hlp->__('Invalid shipping address for (%s).', $row['email']), $line); } else { // Handling shipping address $shippingAddress = $this->getPrimaryShippingAddress(); diff --git a/app/code/core/Mage/Customer/Model/Customer/Api.php b/app/code/core/Mage/Customer/Model/Customer/Api.php index e75a5bce6d..e290c17661 100644 --- a/app/code/core/Mage/Customer/Model/Customer/Api.php +++ b/app/code/core/Mage/Customer/Model/Customer/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Customer/Api/V2.php b/app/code/core/Mage/Customer/Model/Customer/Api/V2.php index ab0b8f2265..701a24d0f1 100644 --- a/app/code/core/Mage/Customer/Model/Customer/Api/V2.php +++ b/app/code/core/Mage/Customer/Model/Customer/Api/V2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Billing.php b/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Billing.php index 1606de092a..f07b7eb01f 100644 --- a/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Billing.php +++ b/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Billing.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Password.php b/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Password.php index ef3a689ede..b32c679da3 100644 --- a/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Password.php +++ b/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Password.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -38,7 +38,7 @@ public function beforeSave($object) $password = trim($object->getPassword()); if ($password) { if(Mage::helper('core/string')->strlen($password)<6){ - Mage::throwException(Mage::helper('customer')->__('Password must have at least 6 characters. Leading or trailing spaces will be ignored.')); + Mage::throwException(Mage::helper('customer')->__('The password must have at least 6 characters. Leading or trailing spaces will be ignored.')); } $object->setPasswordHash($object->hashPassword($password)); } diff --git a/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Shipping.php b/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Shipping.php index 1166aabff3..d795ff6205 100644 --- a/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Shipping.php +++ b/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Shipping.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Store.php b/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Store.php index ec9f375739..2ff3447038 100644 --- a/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Store.php +++ b/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Store.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Website.php b/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Website.php index 0abac03500..784f0658d5 100644 --- a/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Website.php +++ b/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Website.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Customer/Attribute/Source/Group.php b/app/code/core/Mage/Customer/Model/Customer/Attribute/Source/Group.php index 1e0cf5bb63..31975f002b 100644 --- a/app/code/core/Mage/Customer/Model/Customer/Attribute/Source/Group.php +++ b/app/code/core/Mage/Customer/Model/Customer/Attribute/Source/Group.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Customer/Attribute/Source/Store.php b/app/code/core/Mage/Customer/Model/Customer/Attribute/Source/Store.php index 9b2d90c470..5558210004 100644 --- a/app/code/core/Mage/Customer/Model/Customer/Attribute/Source/Store.php +++ b/app/code/core/Mage/Customer/Model/Customer/Attribute/Source/Store.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Customer/Attribute/Source/Website.php b/app/code/core/Mage/Customer/Model/Customer/Attribute/Source/Website.php index 6a8fc7d1a8..dc35a984a3 100644 --- a/app/code/core/Mage/Customer/Model/Customer/Attribute/Source/Website.php +++ b/app/code/core/Mage/Customer/Model/Customer/Attribute/Source/Website.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Entity/Address.php b/app/code/core/Mage/Customer/Model/Entity/Address.php index 5dbc97e162..2c33a8da5c 100644 --- a/app/code/core/Mage/Customer/Model/Entity/Address.php +++ b/app/code/core/Mage/Customer/Model/Entity/Address.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -44,6 +44,9 @@ public function __construct() protected function _afterSave(Varien_Object $address) { + if ($address->getIsCustomerSaveTransaction()) { + return $this; + } if ($address->getId() && ($address->getIsDefaultBilling() || $address->getIsDefaultShipping())) { $customer = Mage::getModel('customer/customer') ->load($address->getCustomerId()); diff --git a/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Backend/Region.php b/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Backend/Region.php index aa777d5574..7293658d05 100644 --- a/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Backend/Region.php +++ b/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Backend/Region.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Backend/Street.php b/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Backend/Street.php index 0ea9312e34..e89c573489 100644 --- a/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Backend/Street.php +++ b/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Backend/Street.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Collection.php b/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Collection.php index 0be0ac7bae..12e073eff9 100644 --- a/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Collection.php +++ b/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Source/Country.php b/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Source/Country.php index 4188b871d1..9b960a41bb 100644 --- a/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Source/Country.php +++ b/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Source/Country.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Source/Region.php b/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Source/Region.php index 886f368a30..229bc42fa4 100644 --- a/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Source/Region.php +++ b/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Source/Region.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Entity/Address/Collection.php b/app/code/core/Mage/Customer/Model/Entity/Address/Collection.php index 8acbae930e..b97c09027d 100644 --- a/app/code/core/Mage/Customer/Model/Entity/Address/Collection.php +++ b/app/code/core/Mage/Customer/Model/Entity/Address/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Entity/Attribute.php b/app/code/core/Mage/Customer/Model/Entity/Attribute.php index 7efdb5da7d..d09ed738e4 100644 --- a/app/code/core/Mage/Customer/Model/Entity/Attribute.php +++ b/app/code/core/Mage/Customer/Model/Entity/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Entity/Attribute/Collection.php b/app/code/core/Mage/Customer/Model/Entity/Attribute/Collection.php index 00e9cac689..aa24181e20 100644 --- a/app/code/core/Mage/Customer/Model/Entity/Attribute/Collection.php +++ b/app/code/core/Mage/Customer/Model/Entity/Attribute/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Entity/Customer.php b/app/code/core/Mage/Customer/Model/Entity/Customer.php index a1017d004f..66269c7e31 100644 --- a/app/code/core/Mage/Customer/Model/Entity/Customer.php +++ b/app/code/core/Mage/Customer/Model/Entity/Customer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -41,10 +41,7 @@ public function __construct() { $resource = Mage::getSingleton('core/resource'); $this->setType('customer'); - $this->setConnection( - $resource->getConnection('customer_read'), - $resource->getConnection('customer_write') - ); + $this->setConnection('customer_read', 'customer_write'); } /** @@ -77,10 +74,10 @@ protected function _beforeSave(Varien_Object $customer) parent::_beforeSave($customer); if (!$customer->getEmail()) { - Mage::throwException(Mage::helper('customer')->__('Customer email is required')); + Mage::throwException(Mage::helper('customer')->__('Customer email is required.')); } - $select = $this->_getReadAdapter()->select() + $select = $this->_getWriteAdapter()->select() ->from($this->getEntityTable(), array($this->getEntityIdField())) ->where('email=?', $customer->getEmail()); if ($customer->getSharingConfig()->isWebsiteScope()) { @@ -91,7 +88,7 @@ protected function _beforeSave(Varien_Object $customer) } if ($this->_getWriteAdapter()->fetchOne($select)) { - throw Mage::exception('Mage_Core', Mage::helper('customer')->__('Customer email already exists'), + throw Mage::exception('Mage_Core', Mage::helper('customer')->__('This customer email already exists.'), Mage_Customer_Model_Customer::EXCEPTION_EMAIL_EXISTS ); } @@ -145,6 +142,7 @@ protected function _saveAddresses(Mage_Customer_Model_Customer $customer) } else { $address->setParentId($customer->getId()) ->setStoreId($customer->getStoreId()) + ->setIsCustomerSaveTransaction(true) ->save(); if (($address->getIsPrimaryBilling() || $address->getIsDefaultBilling()) && $address->getId() != $defaultBillingId) { @@ -155,12 +153,12 @@ protected function _saveAddresses(Mage_Customer_Model_Customer $customer) $customer->setData('default_shipping', $address->getId()); } } - if ($customer->dataHasChangedFor('default_billing')) { - $this->saveAttribute($customer, 'default_billing'); - } - if ($customer->dataHasChangedFor('default_shipping')) { - $this->saveAttribute($customer, 'default_shipping'); - } + } + if ($customer->dataHasChangedFor('default_billing')) { + $this->saveAttribute($customer, 'default_billing'); + } + if ($customer->dataHasChangedFor('default_shipping')) { + $this->saveAttribute($customer, 'default_shipping'); } return $this; } @@ -198,7 +196,7 @@ public function loadByEmail(Mage_Customer_Model_Customer $customer, $email, $tes ->where('email=:customer_email'); if ($customer->getSharingConfig()->isWebsiteScope()) { if (!$customer->hasData('website_id')) { - Mage::throwException(Mage::helper('customer')->__('Customer website id must be specified, when using website scope.')); + Mage::throwException(Mage::helper('customer')->__('Customer website ID must be specified when using the website scope.')); } $select->where('website_id=?', (int)$customer->getWebsiteId()); } diff --git a/app/code/core/Mage/Customer/Model/Entity/Customer/Collection.php b/app/code/core/Mage/Customer/Model/Entity/Customer/Collection.php index 6ace7f093a..bb79495463 100644 --- a/app/code/core/Mage/Customer/Model/Entity/Customer/Collection.php +++ b/app/code/core/Mage/Customer/Model/Entity/Customer/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Entity/Group.php b/app/code/core/Mage/Customer/Model/Entity/Group.php index 620008d5af..ea93564507 100644 --- a/app/code/core/Mage/Customer/Model/Entity/Group.php +++ b/app/code/core/Mage/Customer/Model/Entity/Group.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -53,7 +53,7 @@ protected function _initUniqueFields() protected function _beforeDelete(Mage_Core_Model_Abstract $group) { if ($group->usesAsDefault()) { - Mage::throwException(Mage::helper('customer')->__('Group "%s" can not be deleted', $group->getCode())); + Mage::throwException(Mage::helper('customer')->__('The group "%s" cannot be deleted.', $group->getCode())); } return parent::_beforeDelete($group); } diff --git a/app/code/core/Mage/Customer/Model/Entity/Group/Collection.php b/app/code/core/Mage/Customer/Model/Entity/Group/Collection.php index 7e8c0741a9..66c707c704 100644 --- a/app/code/core/Mage/Customer/Model/Entity/Group/Collection.php +++ b/app/code/core/Mage/Customer/Model/Entity/Group/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Entity/Setup.php b/app/code/core/Mage/Customer/Model/Entity/Setup.php index cb75988e29..67ce2c15b6 100644 --- a/app/code/core/Mage/Customer/Model/Entity/Setup.php +++ b/app/code/core/Mage/Customer/Model/Entity/Setup.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Entity/Wishlist/Collection.php b/app/code/core/Mage/Customer/Model/Entity/Wishlist/Collection.php index a06946361e..3fd71ddc9c 100644 --- a/app/code/core/Mage/Customer/Model/Entity/Wishlist/Collection.php +++ b/app/code/core/Mage/Customer/Model/Entity/Wishlist/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Group.php b/app/code/core/Mage/Customer/Model/Group.php index 72dea6db23..1316aa2138 100644 --- a/app/code/core/Mage/Customer/Model/Group.php +++ b/app/code/core/Mage/Customer/Model/Group.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Group/Api.php b/app/code/core/Mage/Customer/Model/Group/Api.php index aadf2cc74a..eef004446a 100644 --- a/app/code/core/Mage/Customer/Model/Group/Api.php +++ b/app/code/core/Mage/Customer/Model/Group/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Group/Api/V2.php b/app/code/core/Mage/Customer/Model/Group/Api/V2.php index 220c1f4062..267ea9f5c4 100644 --- a/app/code/core/Mage/Customer/Model/Group/Api/V2.php +++ b/app/code/core/Mage/Customer/Model/Group/Api/V2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Observer.php b/app/code/core/Mage/Customer/Model/Observer.php index 1f1c31bc09..2f0932e6cb 100644 --- a/app/code/core/Mage/Customer/Model/Observer.php +++ b/app/code/core/Mage/Customer/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/Model/Session.php b/app/code/core/Mage/Customer/Model/Session.php index 40d9888149..3f5b461ea7 100644 --- a/app/code/core/Mage/Customer/Model/Session.php +++ b/app/code/core/Mage/Customer/Model/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/controllers/AccountController.php b/app/code/core/Mage/Customer/controllers/AccountController.php index 7bb5c09d5a..14763067be 100644 --- a/app/code/core/Mage/Customer/controllers/AccountController.php +++ b/app/code/core/Mage/Customer/controllers/AccountController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -154,7 +154,7 @@ public function loginPostAction() // Mage::logException($e); // PA DSS violation: this exception log can disclose customer password } } else { - $session->addError($this->__('Login and password are required')); + $session->addError($this->__('Login and password are required.')); } } @@ -303,7 +303,7 @@ public function createPostAction() if ($customer->isConfirmationRequired()) { $customer->sendNewAccountEmail('confirmation', $session->getBeforeAuthUrl()); - $session->addSuccess($this->__('Account confirmation is required. Please, check your e-mail for confirmation link. To resend confirmation email please click here.', Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail()))); + $session->addSuccess($this->__('Account confirmation is required. Please, check your email for the confirmation link. To resend the confirmation email please click here.', Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail()))); $this->_redirectSuccess(Mage::getUrl('*/*/index', array('_secure'=>true))); return; } @@ -329,7 +329,7 @@ public function createPostAction() $session->setCustomerFormData($this->getRequest()->getPost()); if ($e->getCode() === Mage_Customer_Model_Customer::EXCEPTION_EMAIL_EXISTS) { $url = Mage::getUrl('customer/account/forgotpassword'); - $message = $this->__('There is already an account with this emails address. If you are sure that it is your email address, click here to get your password and access your account.', $url); + $message = $this->__('There is already an account with this email address. If you are sure that it is your email address, click here to get your password and access your account.', $url); $session->setEscapeMessages(false); } else { @@ -339,7 +339,7 @@ public function createPostAction() } catch (Exception $e) { $session->setCustomerFormData($this->getRequest()->getPost()) - ->addException($e, $this->__('Can\'t save customer')); + ->addException($e, $this->__('Cannot save the customer.')); } } $this->_redirectError(Mage::getUrl('*/*/create', array('_secure' => true))); @@ -355,7 +355,7 @@ public function createPostAction() */ protected function _welcomeCustomer(Mage_Customer_Model_Customer $customer, $isJustConfirmed = false) { - $this->_getSession()->addSuccess($this->__('Thank you for registering with %s', Mage::app()->getStore()->getFrontendName())); + $this->_getSession()->addSuccess($this->__('Thank you for registering with %s.', Mage::app()->getStore()->getFrontendName())); $customer->sendNewAccountEmail($isJustConfirmed ? 'confirmed' : 'registered'); @@ -449,10 +449,10 @@ public function confirmationAction() } if ($customer->getConfirmation()) { $customer->sendNewAccountEmail('confirmation'); - $this->_getSession()->addSuccess($this->__('Please, check your e-mail for confirmation key.')); + $this->_getSession()->addSuccess($this->__('Please, check your email for confirmation key.')); } else { - $this->_getSession()->addSuccess($this->__('This e-mail does not require confirmation.')); + $this->_getSession()->addSuccess($this->__('This email does not require confirmation.')); } $this->_getSession()->setUsername($email); $this->_redirectSuccess(Mage::getUrl('*/*/index', array('_secure' => true))); @@ -499,7 +499,7 @@ public function forgotPasswordPostAction() if ($email) { if (!Zend_Validate::is($email, 'EmailAddress')) { $this->_getSession()->setForgottenEmail($email); - $this->_getSession()->addError($this->__('Invalid email address')); + $this->_getSession()->addError($this->__('Invalid email address.')); $this->getResponse()->setRedirect(Mage::getUrl('*/*/forgotpassword')); return; } @@ -513,7 +513,7 @@ public function forgotPasswordPostAction() $customer->changePassword($newPassword, false); $customer->sendPasswordReminderEmail(); - $this->_getSession()->addSuccess($this->__('A new password was sent')); + $this->_getSession()->addSuccess($this->__('A new password has been sent.')); $this->getResponse()->setRedirect(Mage::getUrl('*/*')); return; @@ -523,7 +523,7 @@ public function forgotPasswordPostAction() } } else { - $this->_getSession()->addError($this->__('This email address was not found in our records')); + $this->_getSession()->addError($this->__('This email address was not found in our records.')); $this->_getSession()->setForgottenEmail($email); } } else { @@ -602,7 +602,7 @@ public function editPostAction() $confPass = $this->getRequest()->getPost('confirmation'); if (empty($currPass) || empty($newPass) || empty($confPass)) { - $errors[] = $this->__('Password fields can\'t be empty.'); + $errors[] = $this->__('The password fields cannot be empty.'); } if ($newPass != $confPass) { @@ -635,7 +635,7 @@ public function editPostAction() try { $customer->save(); $this->_getSession()->setCustomer($customer) - ->addSuccess($this->__('Account information was successfully saved')); + ->addSuccess($this->__('The account information has been saved.')); $this->_redirect('customer/account'); return; @@ -646,7 +646,7 @@ public function editPostAction() } catch (Exception $e) { $this->_getSession()->setCustomerFormData($this->getRequest()->getPost()) - ->addException($e, $this->__('Can\'t save customer')); + ->addException($e, $this->__('Cannot save the customer.')); } } diff --git a/app/code/core/Mage/Customer/controllers/AddressController.php b/app/code/core/Mage/Customer/controllers/AddressController.php index c5df8fe66f..e70d117612 100644 --- a/app/code/core/Mage/Customer/controllers/AddressController.php +++ b/app/code/core/Mage/Customer/controllers/AddressController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -125,7 +125,7 @@ public function formPostAction() $accressValidation = $address->validate(); if (true === $accressValidation) { $address->save(); - $this->_getSession()->addSuccess($this->__('The address was successfully saved')); + $this->_getSession()->addSuccess($this->__('The address has been saved.')); $this->_redirectSuccess(Mage::getUrl('*/*/index', array('_secure'=>true))); return; } else { @@ -135,7 +135,7 @@ public function formPostAction() $this->_getSession()->addError($errorMessage); } } else { - $this->_getSession()->addError($this->__('Can\'t save address')); + $this->_getSession()->addError($this->__('Cannot save the address.')); } } } @@ -145,7 +145,7 @@ public function formPostAction() } catch (Exception $e) { $this->_getSession()->setAddressFormData($this->getRequest()->getPost()) - ->addException($e, $this->__('Can\'t save address')); + ->addException($e, $this->__('Cannot save address.')); } } $this->_redirectError(Mage::getUrl('*/*/edit', array('id'=>$address->getId()))); @@ -160,17 +160,17 @@ public function deleteAction() // Validate address_id <=> customer_id if ($address->getCustomerId() != $this->_getSession()->getCustomerId()) { - $this->_getSession()->addError($this->__('The address does not belong to this customer')); + $this->_getSession()->addError($this->__('The address does not belong to this customer.')); $this->getResponse()->setRedirect(Mage::getUrl('*/*/index')); return; } try { $address->delete(); - $this->_getSession()->addSuccess($this->__('The address was successfully deleted')); + $this->_getSession()->addSuccess($this->__('The address has been deleted.')); } catch (Exception $e){ - $this->_getSession()->addError($this->__('There was an error while deleting the address')); + $this->_getSession()->addError($this->__('An error occurred while deleting the address.')); } } $this->getResponse()->setRedirect(Mage::getUrl('*/*/index')); diff --git a/app/code/core/Mage/Customer/controllers/ReviewController.php b/app/code/core/Mage/Customer/controllers/ReviewController.php index c441979929..0f288e1034 100644 --- a/app/code/core/Mage/Customer/controllers/ReviewController.php +++ b/app/code/core/Mage/Customer/controllers/ReviewController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/etc/adminhtml.xml b/app/code/core/Mage/Customer/etc/adminhtml.xml index 0c741f4f75..c2c0327e1f 100644 --- a/app/code/core/Mage/Customer/etc/adminhtml.xml +++ b/app/code/core/Mage/Customer/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Customer/etc/api.xml b/app/code/core/Mage/Customer/etc/api.xml index ce4a21e07b..0bbec1f0e3 100644 --- a/app/code/core/Mage/Customer/etc/api.xml +++ b/app/code/core/Mage/Customer/etc/api.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Customer/etc/config.xml b/app/code/core/Mage/Customer/etc/config.xml index d17bb186e2..4494f99b87 100644 --- a/app/code/core/Mage/Customer/etc/config.xml +++ b/app/code/core/Mage/Customer/etc/config.xml @@ -21,14 +21,14 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - 1.4.0.0.6 + 1.4.0.0.7 diff --git a/app/code/core/Mage/Customer/etc/system.xml b/app/code/core/Mage/Customer/etc/system.xml index f98e28ee70..a4b85ea61e 100644 --- a/app/code/core/Mage/Customer/etc/system.xml +++ b/app/code/core/Mage/Customer/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -143,7 +143,7 @@ - This Email will be sent instead of Default Welcome Email, after Account Confirmation. + This email will be sent instead of default welcome email, after account confirmation. select adminhtml/system_config_source_email_template 7 @@ -198,7 +198,7 @@ 1 - + 10 1 1 @@ -206,7 +206,7 @@ Leave empty for default (2). Valid range: 1-4 - + select adminhtml/system_config_source_nooptreq 20 @@ -216,7 +216,7 @@ 0 - + 30 Put semicolon in the beginning for empty first option.
      Leave empty for open text field.]]>
      1 @@ -224,17 +224,17 @@ 0
      - + select adminhtml/system_config_source_yesno - Always optional + Always optional. 40 1 1 0 - + select adminhtml/system_config_source_nooptreq The suffix that goes after name (Jr., Sr., etc.) @@ -244,7 +244,7 @@ 0 - + 60 Put semicolon in the beginning for empty first option.
      Leave empty for open text field.]]>
      1 @@ -252,7 +252,7 @@ 0
      - + select adminhtml/system_config_source_nooptreq 70 @@ -261,7 +261,7 @@ 0 - + select adminhtml/system_config_source_nooptreq 80 @@ -270,7 +270,7 @@ 0 - + select adminhtml/system_config_source_nooptreq 90 @@ -291,7 +291,7 @@ select adminhtml/system_config_source_yesno - Customer will stay on the current page if "No" is selected + Customer will stay on the current page if "No" is selected. 1 1 1 diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-install-0.7.0.php index 145ec4e04b..a3a6a93b3f 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-install-0.8.0.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-install-0.8.0.php index 2e41c29d6e..4b49674928 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-install-0.8.0.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-install-0.8.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-install-1.4.0.0.0.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-install-1.4.0.0.0.php index a9c3ec365f..0d81691813 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-install-1.4.0.0.0.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-install-1.4.0.0.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.6.1-0.7.0.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.6.1-0.7.0.php index 2f2b639cf1..dcce4735b3 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.6.1-0.7.0.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.6.1-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.7.1-0.7.2.php index fe4d5f811f..adaa856ae0 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.7.2-0.7.3.php index 48a93407a2..d92ac830f8 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.7.2-0.7.3.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.7.2-0.7.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.0-0.8.1.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.0-0.8.1.php index 4739858411..cb15d4c1ef 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.0-0.8.1.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.0-0.8.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.10-0.8.11.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.10-0.8.11.php index 16a827df8d..48adb7c63f 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.10-0.8.11.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.10-0.8.11.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.11-0.8.12.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.11-0.8.12.php index ef7f975d3d..686fc690a8 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.11-0.8.12.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.11-0.8.12.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.12-1.4.0.0.0.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.12-1.4.0.0.0.php index 0dfc3805f6..6130c0278e 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.12-1.4.0.0.0.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.12-1.4.0.0.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.4-0.8.5.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.4-0.8.5.php index 8638597b9b..c6797f63bb 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.4-0.8.5.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.4-0.8.5.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.5-0.8.6.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.5-0.8.6.php index b006a7beec..40e71c8c24 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.5-0.8.6.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.5-0.8.6.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.6-0.8.7.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.6-0.8.7.php index 8d6a30f91c..90be6ae921 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.6-0.8.7.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.6-0.8.7.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.7-0.8.8.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.7-0.8.8.php index e964dfcb2c..a002688f0e 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.7-0.8.8.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.7-0.8.8.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.8-0.8.9.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.8-0.8.9.php index 01bd201a15..630d60da7b 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.8-0.8.9.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.8-0.8.9.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.9-0.8.10.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.9-0.8.10.php index ae7363da65..b730819649 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.9-0.8.10.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-0.8.9-0.8.10.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.0-1.4.0.0.1.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.0-1.4.0.0.1.php index 590264db5f..97abb85b90 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.0-1.4.0.0.1.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.0-1.4.0.0.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.1-1.4.0.0.2.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.1-1.4.0.0.2.php index 716666eb8a..2ddac501cf 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.1-1.4.0.0.2.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.1-1.4.0.0.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.2-1.4.0.0.3.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.2-1.4.0.0.3.php index fc9bfc17dc..fb991c746b 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.2-1.4.0.0.3.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.2-1.4.0.0.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.3-1.4.0.0.4.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.3-1.4.0.0.4.php index cc55d396d2..8d58debc1c 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.3-1.4.0.0.4.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.3-1.4.0.0.4.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.5-1.4.0.0.6.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.5-1.4.0.0.6.php index e5c9fcbf63..98cf7fdafd 100644 --- a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.5-1.4.0.0.6.php +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.5-1.4.0.0.6.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Customer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.6-1.4.0.0.7.php b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.6-1.4.0.0.7.php new file mode 100644 index 0000000000..2be926ffec --- /dev/null +++ b/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.6-1.4.0.0.7.php @@ -0,0 +1,29 @@ +updateEntityType('customer_address', 'entity_model', 'customer/address'); diff --git a/app/code/core/Mage/Cybermut/Block/Error.php b/app/code/core/Mage/Cybermut/Block/Error.php new file mode 100644 index 0000000000..88bc7639d0 --- /dev/null +++ b/app/code/core/Mage/Cybermut/Block/Error.php @@ -0,0 +1,37 @@ + +*/ +class Mage_Cybermut_Block_Error extends Mage_Core_Block_Template +{ +} diff --git a/app/code/core/Mage/Cybermut/Block/Form.php b/app/code/core/Mage/Cybermut/Block/Form.php new file mode 100644 index 0000000000..a6125813fe --- /dev/null +++ b/app/code/core/Mage/Cybermut/Block/Form.php @@ -0,0 +1,43 @@ + + */ +class Mage_Cybermut_Block_Form extends Mage_Payment_Block_Form +{ + protected function _construct() + { + $this->setTemplate('cybermut/form.phtml'); + parent::_construct(); + } + +} diff --git a/app/code/core/Mage/Cybermut/Block/Redirect.php b/app/code/core/Mage/Cybermut/Block/Redirect.php new file mode 100644 index 0000000000..edff301f45 --- /dev/null +++ b/app/code/core/Mage/Cybermut/Block/Redirect.php @@ -0,0 +1,63 @@ + + */ +class Mage_Cybermut_Block_Redirect extends Mage_Core_Block_Abstract +{ + + protected function _toHtml() + { + $standard = Mage::getModel('cybermut/payment'); + $form = new Varien_Data_Form(); + $form->setAction($standard->getCybermutUrl()) + ->setId('cybermut_payment_checkout') + ->setName('cybermut_payment_checkout') + ->setMethod('POST') + ->setUseContainer(true); + foreach ($standard->setOrder($this->getOrder())->getStandardCheckoutFormFields() as $field => $value) { + $form->addField($field, 'hidden', array('name' => $field, 'value' => $value)); + } + + $formHTML = $form->toHtml(); + + $html = ''; + $html.= $this->__('You will be redirected to Cybermut in a few seconds.'); + $html.= $formHTML; + $html.= ''; + $html.= ''; + + $standard->debugData(array('request' => $formHTML)); + + return $html; + } +} diff --git a/app/code/core/Mage/Cybermut/Helper/Data.php b/app/code/core/Mage/Cybermut/Helper/Data.php new file mode 100644 index 0000000000..d25b5b6a32 --- /dev/null +++ b/app/code/core/Mage/Cybermut/Helper/Data.php @@ -0,0 +1,38 @@ + + */ +class Mage_Cybermut_Helper_Data extends Mage_Core_Helper_Abstract +{ + +} diff --git a/app/code/core/Mage/Cybermut/Model/Api/Debug.php b/app/code/core/Mage/Cybermut/Model/Api/Debug.php new file mode 100644 index 0000000000..2af8a62014 --- /dev/null +++ b/app/code/core/Mage/Cybermut/Model/Api/Debug.php @@ -0,0 +1,41 @@ + + */ +class Mage_Cybermut_Model_Api_Debug extends Mage_Core_Model_Abstract +{ + protected function _construct() + { + $this->_init('cybermut/api_debug'); + } +} diff --git a/app/code/core/Mage/Cybermut/Model/Mysql4/Api/Debug.php b/app/code/core/Mage/Cybermut/Model/Mysql4/Api/Debug.php new file mode 100644 index 0000000000..a871b91ad5 --- /dev/null +++ b/app/code/core/Mage/Cybermut/Model/Mysql4/Api/Debug.php @@ -0,0 +1,42 @@ + + */ + +class Mage_Cybermut_Model_Mysql4_Api_Debug extends Mage_Core_Model_Mysql4_Abstract +{ + protected function _construct() + { + $this->_init('cybermut/api_debug', 'debug_id'); + } +} diff --git a/app/code/core/Mage/Cybermut/Model/Mysql4/Api/Debug/Collection.php b/app/code/core/Mage/Cybermut/Model/Mysql4/Api/Debug/Collection.php new file mode 100644 index 0000000000..eefa80ea10 --- /dev/null +++ b/app/code/core/Mage/Cybermut/Model/Mysql4/Api/Debug/Collection.php @@ -0,0 +1,41 @@ + + */ +class Mage_Cybermut_Model_Mysql4_Api_Debug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract +{ + protected function _construct() + { + $this->_init('cybermut/api_debug'); + } +} diff --git a/app/code/core/Mage/Cybermut/Model/Mysql4/Setup.php b/app/code/core/Mage/Cybermut/Model/Mysql4/Setup.php new file mode 100644 index 0000000000..97a08dcc0f --- /dev/null +++ b/app/code/core/Mage/Cybermut/Model/Mysql4/Setup.php @@ -0,0 +1,39 @@ + + */ + +class Mage_Cybermut_Model_Mysql4_Setup extends Mage_Sales_Model_Mysql4_Setup +{ + +} diff --git a/app/code/core/Mage/Cybermut/Model/Payment.php b/app/code/core/Mage/Cybermut/Model/Payment.php new file mode 100644 index 0000000000..44dad8ce17 --- /dev/null +++ b/app/code/core/Mage/Cybermut/Model/Payment.php @@ -0,0 +1,378 @@ + + */ + +class Mage_Cybermut_Model_Payment extends Mage_Payment_Model_Method_Abstract +{ + protected $_code = 'cybermut_payment'; + protected $_formBlockType = 'cybermut/form'; + + // Cybermut return codes of payment + const RETURN_CODE_ACCEPTED = 'paiement'; + const RETURN_CODE_TEST_ACCEPTED = 'payetest'; + const RETURN_CODE_ERROR = 'Annulation'; + + // Payment configuration + protected $_isGateway = false; + protected $_canAuthorize = true; + protected $_canCapture = true; + protected $_canCapturePartial = false; + protected $_canRefund = false; + protected $_canVoid = false; + protected $_canUseInternal = false; + protected $_canUseCheckout = true; + protected $_canUseForMultishipping = false; + + // Order instance + protected $_order = null; + + /** + * Return CyberMut protocol version + * + * @return string Protocol version + */ + protected function getVersion() + { + return '1.2open'; + } + + /** + * Returns Target URL + * + * @return string Target URL + */ + public function getCybermutUrl() + { + $url = ''; + switch ($this->getConfigData('bank')) + { + default: + case 'mutuel': + $url = $this->getConfigData('test_mode') + ? 'https://paiement.creditmutuel.fr/test/paiement.cgi' + : 'https://paiement.creditmutuel.fr/paiement.cgi'; + break; + case 'cic': + $url = $this->getConfigData('test_mode') + ? 'https://ssl.paiement.cic-banques.fr/test/paiement.cgi' + : 'https://ssl.paiement.cic-banques.fr/paiement.cgi'; + break; + case 'obc': + $url = $this->getConfigData('test_mode') + ? 'https://ssl.paiement.banque-obc.fr/test/paiement.cgi' + : 'https://ssl.paiement.banque-obc.fr/paiement.cgi'; + break; + } + return $url; + } + + /** + * Return back URL + * + * @return string URL + */ + protected function getReturnURL() + { + return $this->getSuccessURL(); + } + + /** + * Return URL for Cybermut success response + * + * @return string URL + */ + protected function getSuccessURL() + { + return Mage::getUrl('cybermut/payment/success', array('_secure' => true)); + } + + /** + * Return URL for Cybermut failure response + * + * @return string URL + */ + protected function getErrorURL() + { + return Mage::getUrl('cybermut/payment/error', array('_secure' => true)); + } + + /** + * Capture payment + * + * @param Varien_Object $orderPayment + * @return Mage_Payment_Model_Abstract + */ + public function capture(Varien_Object $payment, $amount) + { + $payment->setStatus(self::STATUS_APPROVED) + ->setLastTransId($this->getTransactionId()); + + return $this; + } + + /** + * Form block description + * + * @return object + */ + public function createFormBlock($name) + { + $block = $this->getLayout()->createBlock('cybermut/form_payment', $name); + $block->setMethod($this->_code); + $block->setPayment($this->getPayment()); + + return $block; + } + + /** + * Return Order Place Redirect URL + * + * @return string Order Redirect URL + */ + public function getOrderPlaceRedirectUrl() + { + return Mage::getUrl('cybermut/payment/redirect'); + } + + /** + * Return Standard Checkout Form Fields for request to Cybermut + * + * @return array Array of hidden form fields + */ + public function getStandardCheckoutFormFields() + { + $order = $this->getOrder(); + if (!($order instanceof Mage_Sales_Model_Order)) { + Mage::throwException($this->_getHelper()->__('Cannot retrieve order object')); + } + + $description = $this->getConfigData('description') + ? $this->getConfigData('description') + : Mage::helper('cybermut')->__('Order #%s', $order->getRealOrderId()); + + $fields = array( + 'version' => $this->getVersion(), + 'TPE' => $this->getConfigData('tpe_no'), + 'date' => date('d/m/Y:H:i:s'), + 'montant' => sprintf('%.2f', $order->getBaseGrandTotal()) . $order->getBaseCurrencyCode(), + 'reference' => $order->getRealOrderId(), + 'texte-libre' => $description, + 'lgue' => $this->getConfigData('language'), + 'societe' => $this->getConfigData('site_code'), + 'url_retour' => $this->getReturnURL(), + 'url_retour_ok' => $this->getSuccessURL(), + 'url_retour_err' => $this->getErrorURL(), + 'bouton' => 'ButtonLabel' + ); + + $fields['MAC'] = $this->_getMAC($fields); + + return $fields; + } + + /** + * Prepare string for MAC generation + * + * @param array $data + * @return string MAC string + */ + protected function _getMAC($data) + { + $string = sprintf('%s*%s*%s*%s*%s*%s*%s*%s*', + $data['TPE'], + $data['date'], + $data['montant'], + $data['reference'], + $data['texte-libre'], + $data['version'], + $data['lgue'], + $data['societe'] + ); + + return $this->_CMCIC_hmac($string); + } + + /** + * Return SHA key + * + * @return string SHA key + */ + protected function _getSHAKey() + { + return $this->getConfigData('sha_key'); + } + + /** + * Return merchant key + * + * @return string Merchant key + */ + protected function _getKey() + { + return $this->getConfigData('key'); + } + + /** + * Return MAC string for payment authentification + * + * @param string $string + * @return string MAC + */ + protected function _CMCIC_hmac($string) + { + $pass = $this->_getSHAKey(); + $k1 = pack("H*",sha1($this->_getSHAKey())); + $l1 = strlen($k1); + $k2 = pack("H*", $this->_getKey()); + $l2 = strlen($k2); + if ($l1 > $l2) { + $k2 = str_pad($k2, $l1, chr(0x00)); + } elseif ($l2 > $l1) { + $k1 = str_pad($k1, $l2, chr(0x00)); + } + return strtolower($this->_hmacSHA1($k1 ^ $k2, $string)); + } + + /** + * MAC generation algorithm + * + * @param string $key + * @param string $string + * @return string MAC + */ + protected function _hmacSHA1($key, $string) + { + $length = 64; // block length for SHA1 + if (strlen($key) > $length) { + $key = pack("H*",sha1($key)); + } + $key = str_pad($key, $length, chr(0x00)); + $ipad = str_pad('', $length, chr(0x36)); + $opad = str_pad('', $length, chr(0x5c)); + $k_ipad = $key ^ $ipad ; + $k_opad = $key ^ $opad; + + return sha1($k_opad . pack("H*",sha1($k_ipad . $string))); + } + + /** + * Return MAC string on basis of Cybermut response data + * + * @param array $data + * @return string MAC + */ + public function getResponseMAC($data) + { + $string = sprintf('%s%s+%s+%s+%s+%s+%s+%s+', + $data['retourPLUS'], + $data['TPE'], + $data['date'], + $data['montant'], + $data['reference'], + $data['texte-libre'], + $this->getVersion(), + $data['code-retour'] + ); + return strtoupper($this->_CMCIC_hmac($string)); + } + + /** + * Transaction successful or not + * + * @param string $returnCode + * @return boolean + */ + public function isSuccessfulPayment($returnCode) + { + return in_array($returnCode, array(self::RETURN_CODE_ACCEPTED, self::RETURN_CODE_TEST_ACCEPTED)); + } + + /** + * Output success response and stop the script + */ + public function generateSuccessResponse() + { + die($this->getSuccessResponse()); + } + + /** + * Output failure response and stop the script + */ + public function generateErrorResponse() + { + die($this->getErrorResponse()); + } + + /** + * Return response for Cybermut success payment + * + * @return string Success response string + */ + public function getSuccessResponse() + { + $response = array( + 'Pragma: no-cache', + 'Content-type : text/plain', + 'Version: 1', + 'OK' + ); + return implode("\n", $response) . "\n"; + } + + /** + * Return response for Cybermut failure payment + * + * @return string Failure response string + */ + public function getErrorResponse() + { + $response = array( + 'Pragma: no-cache', + 'Content-type : text/plain', + 'Version: 1', + 'Document falsifie' + ); + return implode("\n", $response) . "\n"; + } + + /** + * Define if debugging is enabled + * + * @return bool + */ + public function getDebugFlag() + { + return $this->getConfigData('debug_flag'); + } +} diff --git a/app/code/core/Mage/Cybermut/Model/Source/Bank.php b/app/code/core/Mage/Cybermut/Model/Source/Bank.php new file mode 100644 index 0000000000..cc79558244 --- /dev/null +++ b/app/code/core/Mage/Cybermut/Model/Source/Bank.php @@ -0,0 +1,49 @@ + + */ + +class Mage_Cybermut_Model_Source_Bank +{ + public function toOptionArray() + { + return array( + array('value' => 'mutuel', 'label' => Mage::helper('cybermut')->__('Credit Mutuel')), + array('value' => 'cic', 'label' => Mage::helper('cybermut')->__('Groupe CIC')), + array('value' => 'obc', 'label' => Mage::helper('cybermut')->__('OBC')), + ); + } +} + + + diff --git a/app/code/core/Mage/Cybermut/Model/Source/Language.php b/app/code/core/Mage/Cybermut/Model/Source/Language.php new file mode 100644 index 0000000000..ac4a4d7d9d --- /dev/null +++ b/app/code/core/Mage/Cybermut/Model/Source/Language.php @@ -0,0 +1,52 @@ + + */ + +class Mage_Cybermut_Model_Source_Language +{ + public function toOptionArray() + { + return array( + array('value' => 'EN', 'label' => Mage::helper('cybermut')->__('English')), + array('value' => 'FR', 'label' => Mage::helper('cybermut')->__('French')), + array('value' => 'DE', 'label' => Mage::helper('cybermut')->__('German')), + array('value' => 'IT', 'label' => Mage::helper('cybermut')->__('Italian')), + array('value' => 'ES', 'label' => Mage::helper('cybermut')->__('Spain')), + array('value' => 'NL', 'label' => Mage::helper('cybermut')->__('Dutch')), + ); + } +} + + + diff --git a/app/code/core/Mage/Cybermut/controllers/PaymentController.php b/app/code/core/Mage/Cybermut/controllers/PaymentController.php new file mode 100644 index 0000000000..fc8e4402a3 --- /dev/null +++ b/app/code/core/Mage/Cybermut/controllers/PaymentController.php @@ -0,0 +1,203 @@ + + */ +class Mage_Cybermut_PaymentController extends Mage_Core_Controller_Front_Action +{ + /** + * Order instance + */ + protected $_order; + + /** + * Get order + * + * @return Mage_Sales_Model_Order + */ + public function getOrder() + { + if ($this->_order == null) { + $session = Mage::getSingleton('checkout/session'); + $this->_order = Mage::getModel('sales/order'); + $this->_order->loadByIncrementId($session->getLastRealOrderId()); + } + return $this->_order; + } + + /** + * When a customer chooses Cybermut on Checkout/Payment page + * + */ + public function redirectAction() + { + $session = Mage::getSingleton('checkout/session'); + $session->setCybermutPaymentQuoteId($session->getQuoteId()); + + $order = $this->getOrder(); + + if (!$order->getId()) { + $this->norouteAction(); + return; + } + + $order->addStatusToHistory( + $order->getStatus(), + Mage::helper('cybermut')->__('Customer was redirected to Cybermut') + ); + $order->save(); + + $this->getResponse() + ->setBody($this->getLayout() + ->createBlock('cybermut/redirect') + ->setOrder($order) + ->toHtml()); + + $session->unsQuoteId(); + } + + /** + * Cybermut response router + * + */ + public function notifyAction() + { + $model = Mage::getModel('cybermut/payment'); + + if (!$this->getRequest()->isPost()) { + $model->generateErrorResponse(); + } + + $postData = $this->getRequest()->getPost(); + $returnedMAC = $this->getRequest()->getPost('MAC'); + $correctMAC = $model->getResponseMAC($postData); + + $model->debugData(array('result' => $postData)); + + $order = Mage::getModel('sales/order') + ->loadByIncrementId($this->getRequest()->getPost('reference')); + + if (!$order->getId()) { + $model->generateErrorResponse(); + } + + if ($returnedMAC == $correctMAC && $model->isSuccessfulPayment($this->getRequest()->getPost('code-retour'))) { + $order->addStatusToHistory($model->getConfigData('order_status')); + $order->sendNewOrderEmail(); + if ($this->saveInvoice($order)) { +// $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true); + } + $order->save(); + $model->generateSuccessResponse(); + } else { + $order->addStatusToHistory( + $order->getStatus(), + Mage::helper('cybermut')->__('Returned MAC is invalid. Order cancelled.') + ); + $order->cancel(); + $order->save(); + $model->generateErrorResponse(); + } + } + + /** + * Save invoice for order + * + * @param Mage_Sales_Model_Order $order + * @return boolean Can save invoice or not + */ + protected function saveInvoice(Mage_Sales_Model_Order $order) + { + if ($order->canInvoice()) { + $invoice = $order->prepareInvoice(); + $invoice->register()->capture(); + Mage::getModel('core/resource_transaction') + ->addObject($invoice) + ->addObject($invoice->getOrder()) + ->save(); + return true; + } + + return false; + } + + /** + * Success payment page + */ + public function successAction() + { + $session = Mage::getSingleton('checkout/session'); + $session->setQuoteId($session->getCybermutPaymentQuoteId()); + $session->unsCybermutPaymentQuoteId(); + + $order = $this->getOrder(); + + if (!$order->getId()) { + $this->norouteAction(); + return; + } + + $order->addStatusToHistory( + $order->getStatus(), + Mage::helper('cybermut')->__('The customer successfully returned from Cybermut.') + ); + + $order->save(); + $this->_redirect('checkout/onepage/success'); + } + + /** + * Failure payment page + */ + public function errorAction() + { + $errorMsg = Mage::helper('cybermut')->__(' There was an error occurred during paying process.'); + + $order = $this->getOrder(); + + if (!$order->getId()) { + $this->norouteAction(); + return; + } + if ($order instanceof Mage_Sales_Model_Order && $order->getId()) { + $order->addStatusToHistory( + $order->getStatus(), + Mage::helper('cybermut')->__('Customer has returned from Cybermut.') . $errorMsg + ); + $order->cancel(); + $order->save(); + } + + $this->loadLayout(); + $this->renderLayout(); + Mage::getSingleton('checkout/session')->unsLastRealOrderId(); + } +} diff --git a/app/code/core/Mage/Cybermut/etc/config.xml b/app/code/core/Mage/Cybermut/etc/config.xml new file mode 100644 index 0000000000..8dd0d81bdd --- /dev/null +++ b/app/code/core/Mage/Cybermut/etc/config.xml @@ -0,0 +1,110 @@ + + + + + + 0.1.0 + + + + + + Mage_Cybermut_Model + cybermut_mysql4 + + + Mage_Cybermut_Model_Mysql4 + + cybermut_api_debug
      +
      +
      +
      + + + + Mage_Cybermut + Mage_Cybermut_Model_Mysql4_Setup + + + + + Mage_Cybermut_Block + +
      + + + /cybermut/payment + + + + standard + + Mage_Cybermut + cybermut + + + + + + + + Mage_Cybermut.csv + + + + + + + + cybermut.xml + + + + + + + + + + Mage_Cybermut.csv + + + + + + + + + cybermut/payment + CyberMUT-P@iement + 0 + O + + + +
      diff --git a/app/code/core/Mage/Cybermut/etc/system.xml b/app/code/core/Mage/Cybermut/etc/system.xml new file mode 100644 index 0000000000..38746f9494 --- /dev/null +++ b/app/code/core/Mage/Cybermut/etc/system.xml @@ -0,0 +1,174 @@ + + + + + + + + + text + 300 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 1 + 1 + 1 + 0 + + + <label>Title</label> + <frontend_type>text</frontend_type> + <sort_order>2</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + text + 3 + 1 + 1 + 0 + + + + text + 4 + 1 + 1 + 0 + + + + text + 5 + 1 + 1 + 0 + + + + text + 6 + 1 + 1 + 0 + + + + select + cybermut/source_bank + 7 + 1 + 1 + 0 + + + + Order number will be used if left empty. + text + 8 + 1 + 1 + 0 + + + + select + cybermut/source_language + 9 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 10 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 11 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_order_status + 12 + 1 + 1 + 0 + + + + allowspecific + 13 + adminhtml/system_config_source_payment_allspecificcountries + 1 + 1 + 0 + + + + multiselect + 14 + adminhtml/system_config_source_country + 1 + 1 + 0 + + + + text + 15 + 1 + 1 + 0 + + + + + + + diff --git a/app/code/core/Mage/Cybermut/sql/cybermut_setup/mysql4-install-0.1.0.php b/app/code/core/Mage/Cybermut/sql/cybermut_setup/mysql4-install-0.1.0.php new file mode 100644 index 0000000000..1aad9275d2 --- /dev/null +++ b/app/code/core/Mage/Cybermut/sql/cybermut_setup/mysql4-install-0.1.0.php @@ -0,0 +1,45 @@ +startSetup(); + +$installer->run(" +CREATE TABLE `{$this->getTable('cybermut_api_debug')}` ( + `debug_id` int(10) unsigned NOT NULL auto_increment, + `debug_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `request_body` text, + `response_body` text, + PRIMARY KEY (`debug_id`), + KEY `debug_at` (`debug_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + "); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Cybersource/Block/Form.php b/app/code/core/Mage/Cybersource/Block/Form.php new file mode 100644 index 0000000000..e847e7fa9e --- /dev/null +++ b/app/code/core/Mage/Cybersource/Block/Form.php @@ -0,0 +1,96 @@ +setTemplate('cybersource/form.phtml'); + } + + protected function _getConfig() + { + return Mage::getSingleton('cybersource/config'); + } + + /** + * Retrieve availables credit card types + * + * @return array + */ + public function getCcAvailableTypes() + { + $types = $this->_getConfig()->getCcTypes(); + if ($method = $this->getMethod()) { + $availableTypes = $method->getConfigData('cctypes'); + if ($availableTypes) { + $availableTypes = explode(',', $availableTypes); + foreach ($types as $code=>$name) { + if (!in_array($code, $availableTypes)) { + unset($types[$code]); + } + } + } + } + return $types; + } + + + /* + * solo/switch card start year + * @return array + */ + public function getSsStartYears() + { + $years = array(); + $first = date("Y"); + + for ($index=5; $index>=0; $index--) { + $year = $first - $index; + $years[$year] = $year; + } + $years = array(0=>$this->__('Year'))+$years; + return $years; + } + + /* + * switch/solo card type available + */ + public function hasSsCardType() + { + $availableTypes =$this->getMethod()->getConfigData('cctypes'); + if ($availableTypes) { + $availableTypes = explode(',', $availableTypes); + if (in_array('SS', $availableTypes)) { + return true; + } + } + return false; + } + +} diff --git a/app/code/core/Mage/Cybersource/Block/Info.php b/app/code/core/Mage/Cybersource/Block/Info.php new file mode 100644 index 0000000000..8f8053c802 --- /dev/null +++ b/app/code/core/Mage/Cybersource/Block/Info.php @@ -0,0 +1,75 @@ +setTemplate('cybersource/info.phtml'); + } + + protected function _getConfig() + { + return Mage::getSingleton('cybersource/config'); + } + + + /** + * Retrieve credit card type name + * + * @return string + */ + public function getCcTypeName() + { + $types = $this->_getConfig()->getCcTypes(); + if (isset($types[$this->getInfo()->getCcType()])) { + return $types[$this->getInfo()->getCcType()]; + } + return $this->getInfo()->getCcType(); + } + + /** + * Retrieve CC start month for switch/solo card + * + * @return string + */ + public function getCcStartMonth() + { + $month = $this->getInfo()->getCcSsStartMonth(); + if ($month<10) { + $month = '0'.$month; + } + return $month; + } + + public function toPdf() + { + $this->setTemplate('cybersource/pdf/info.phtml'); + return $this->toHtml(); + } +} diff --git a/app/code/core/Mage/Cybersource/Helper/Data.php b/app/code/core/Mage/Cybersource/Helper/Data.php new file mode 100644 index 0000000000..d9abf1addb --- /dev/null +++ b/app/code/core/Mage/Cybersource/Helper/Data.php @@ -0,0 +1,33 @@ + */ -class Mage_Paypal_Model_Mysql4_Api_Debug extends Mage_Core_Model_Mysql4_Abstract +class Mage_Cybersource_Model_Api_Debug extends Mage_Core_Model_Abstract { protected function _construct() { - $this->_init('paypal/api_debug', 'debug_id'); + $this->_init('cybersource/api_debug'); } } diff --git a/app/code/core/Mage/Cybersource/Model/Api/ExtendedSoapClient.php b/app/code/core/Mage/Cybersource/Model/Api/ExtendedSoapClient.php new file mode 100644 index 0000000000..faadfe8828 --- /dev/null +++ b/app/code/core/Mage/Cybersource/Model/Api/ExtendedSoapClient.php @@ -0,0 +1,117 @@ +_storeId = $storeId; + return $this; + } + + /** + * Store Id getter + * + * @return int + */ + public function getStoreId() + { + return $this->_storeId; + } + + /** + * XPaths that should be replaced in debug with '***' + * + * @var array + */ + protected $_debugReplacePrivateDataXPaths = array( + '//*[contains(name(),\'merchantID\')]/text()', + '//*[contains(name(),\'card\')]/*/text()', + '//*[contains(name(),\'UsernameToken\')]/*/text()' + ); + + public function __construct($wsdl, $options = array()) + { + parent::__construct($wsdl, $options); + } + + protected function getBaseApi() + { + return Mage::getSingleton('cybersource/soap'); + } + + public function __doRequest($request, $location, $action, $version) + { + $api = $this->getBaseApi(); + $user = $api->getConfigData('merchant_id', $this->getStoreId()); + $password = $api->getConfigData('security_key', $this->getStoreId()); + $soapHeader = "$user$password"; + + $requestDOM = new DOMDocument('1.0'); + $soapHeaderDOM = new DOMDocument('1.0'); + $requestDOM->loadXML($request); + $soapHeaderDOM->loadXML($soapHeader); + + $node = $requestDOM->importNode($soapHeaderDOM->firstChild, true); + $requestDOM->firstChild->insertBefore( + $node, $requestDOM->firstChild->firstChild); + + $request = $requestDOM->saveXML(); + $requestDOMXPath = new DOMXPath($requestDOM); + foreach ($this->_debugReplacePrivateDataXPaths as $xPath) { + foreach ($requestDOMXPath->query($xPath) as $element) { + $element->data = '***'; + } + } + + $debugData = array('request' => $requestDOM->saveXML()); + try { + $response = parent::__doRequest($request, $location, $action, $version); + } + catch (Exception $e) { + $debugData['result'] = array('error' => $e->getMessage(), 'code' => $e->getCode()); + $api->debugData($debugData); + throw $e; + } + + $debugData['result'] = $response; + $api->debugData($debugData); + + return $response; + } +} diff --git a/app/code/core/Mage/Cybersource/Model/Config.php b/app/code/core/Mage/Cybersource/Model/Config.php new file mode 100644 index 0000000000..261c37ac74 --- /dev/null +++ b/app/code/core/Mage/Cybersource/Model/Config.php @@ -0,0 +1,62 @@ +_ccTypes = array(); + $added = false; + foreach ($pTypes as $code => $name) { + if ($code=='OT') { + $added = true; + $this->addExtraCcTypes(); + } + $this->_ccTypes[$code] = $name; + } + if (!$added) { + $this->addExtraCcTypes(); + } + return $this->_ccTypes; + } + + public function addExtraCcTypes() + { + $this->_ccTypes['JCB'] = Mage::helper('cybersource')->__('JCB'); + $this->_ccTypes['LASER'] = Mage::helper('cybersource')->__('Laser'); + $this->_ccTypes['UATP'] = Mage::helper('cybersource')->__('UATP'); + $this->_ccTypes['MCI'] = Mage::helper('cybersource')->__('Maestro (International)'); + $this->_ccTypes[Mage_Cybersource_Model_Soap::CC_CARDTYPE_SS] = Mage::helper('cybersource')->__('Maestro/Solo(UK Domestic)'); + + } + +} diff --git a/app/code/core/Mage/Cybersource/Model/Mysql4/Api/Debug.php b/app/code/core/Mage/Cybersource/Model/Mysql4/Api/Debug.php new file mode 100644 index 0000000000..0dbff5b8f8 --- /dev/null +++ b/app/code/core/Mage/Cybersource/Model/Mysql4/Api/Debug.php @@ -0,0 +1,39 @@ + + */ +class Mage_Cybersource_Model_Mysql4_Api_Debug extends Mage_Core_Model_Mysql4_Abstract +{ + protected function _construct() + { + $this->_init('cybersource/api_debug', 'debug_id'); + } +} diff --git a/app/code/core/Mage/Cybersource/Model/Mysql4/Api/Debug/Collection.php b/app/code/core/Mage/Cybersource/Model/Mysql4/Api/Debug/Collection.php new file mode 100644 index 0000000000..413078a908 --- /dev/null +++ b/app/code/core/Mage/Cybersource/Model/Mysql4/Api/Debug/Collection.php @@ -0,0 +1,39 @@ + + */ +class Mage_Cybersource_Model_Mysql4_Api_Debug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract +{ + protected function _construct() + { + $this->_init('cybersource/api_debug'); + } +} diff --git a/app/code/core/Mage/Cybersource/Model/Mysql4/Setup.php b/app/code/core/Mage/Cybersource/Model/Mysql4/Setup.php new file mode 100644 index 0000000000..ce538d8be2 --- /dev/null +++ b/app/code/core/Mage/Cybersource/Model/Mysql4/Setup.php @@ -0,0 +1,38 @@ +getInfoInstance(); + + if ($data->getCcType()==self::CC_CARDTYPE_SS) { + $info->setCcSsIssue($data->getCcSsIssue()) + ->setCcSsStartMonth($data->getCcSsStartMonth()) + ->setCcSsStartYear($data->getCcSsStartYear()) + ; + } + return $this; + } + + /** + * Validate payment method information object + * + * @param Mage_Payment_Model_Info $info + * @return Mage_Payment_Model_Abstract + */ + public function validate() + { + if (!extension_loaded('soap')) { + Mage::throwException(Mage::helper('cybersource')->__('SOAP extension is not enabled. Please contact us.')); + } + /** + * to validate paymene method is allowed for billing country or not + */ + $paymentInfo = $this->getInfoInstance(); + if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) { + $billingCountry = $paymentInfo->getOrder()->getBillingAddress()->getCountryId(); + } else { + $billingCountry = $paymentInfo->getQuote()->getBillingAddress()->getCountryId(); + } + if (!$this->canUseForCountry($billingCountry)) { + Mage::throwException($this->_getHelper()->__('Selected payment type is not allowed for billing country.')); + } + + $info = $this->getInfoInstance(); + $errorMsg = false; + $availableTypes = explode(',',$this->getConfigData('cctypes')); + + $ccNumber = $info->getCcNumber(); + + // remove credit card number delimiters such as "-" and space + $ccNumber = preg_replace('/[\-\s]+/', '', $ccNumber); + $info->setCcNumber($ccNumber); + + $ccType = ''; + + if (!$this->_validateExpDate($info->getCcExpYear(), $info->getCcExpMonth())) { + $errorCode = 'ccsave_expiration,ccsave_expiration_yr'; + $errorMsg = $this->_getHelper()->__('Incorrect credit card expiration date.'); + } + + if (in_array($info->getCcType(), $availableTypes)){ + if ($this->validateCcNum($ccNumber) + // Other credit card type number validation + || ($this->OtherCcType($info->getCcType()) && $this->validateCcNumOther($ccNumber))) { + + $ccType = 'OT'; + $ccTypeRegExpList = array( + 'VI' => '/^4[0-9]{12}([0-9]{3})?$/', // Visa + 'MC' => '/^5[1-5][0-9]{14}$/', // Master Card + 'AE' => '/^3[47][0-9]{13}$/', // American Express + 'DI' => '/^6011[0-9]{12}$/', // Discovery + 'JCB' => '/^(3[0-9]{15}|(2131|1800)[0-9]{12})$/', // JCB + 'LASER' => '/^(6304|6706|6771|6709)[0-9]{12}([0-9]{3})?$/' // LASER + ); + + foreach ($ccTypeRegExpList as $ccTypeMatch=>$ccTypeRegExp) { + if (preg_match($ccTypeRegExp, $ccNumber)) { + $ccType = $ccTypeMatch; + break; + } + } + + if (!$this->OtherCcType($info->getCcType()) && $ccType!=$info->getCcType()) { + $errorCode = 'ccsave_cc_type,ccsave_cc_number'; + $errorMsg = $this->_getHelper()->__('Credit card number mismatch with credit card type.'); + } + } + else { + $errorCode = 'ccsave_cc_number'; + $errorMsg = $this->_getHelper()->__('Invalid Credit Card Number'); + } + + } + else { + $errorCode = 'ccsave_cc_type'; + $errorMsg = $this->_getHelper()->__('Credit card type is not allowed for this payment method.'); + } + + //validate credit card verification number + if ($errorMsg === false && $this->hasVerification()) { + $verifcationRegEx = $this->getVerificationRegEx(); + $regExp = isset($verifcationRegEx[$info->getCcType()]) ? $verifcationRegEx[$info->getCcType()] : ''; + if (!$info->getCcCid() || !$regExp || !preg_match($regExp ,$info->getCcCid())){ + $errorMsg = $this->_getHelper()->__('Please enter a valid credit card verification number.'); + } + } + + if($errorMsg){ + Mage::throwException($errorMsg); + } + return $this; + } + + /** + * Getting Soap Api object + * + * @param array $options + * @return Mage_Cybersource_Model_Api_ExtendedSoapClient + */ + protected function getSoapApi($options = array()) + { + $wsdl = $this->getConfigData('test') ? self::WSDL_URL_TEST : self::WSDL_URL_LIVE; + $_api = new Mage_Cybersource_Model_Api_ExtendedSoapClient($wsdl, $options); + $_api->setStoreId($this->getStore()); + return $_api; + } + + /** + * Initializing soap header + */ + protected function iniRequest() + { + $this->_request = new stdClass(); + $this->_request->merchantID = $this->getConfigData('merchant_id'); + $this->_request->merchantReferenceCode = $this->_generateReferenceCode(); + + $this->_request->clientLibrary = "PHP"; + $this->_request->clientLibraryVersion = phpversion(); + $this->_request->clientEnvironment = php_uname(); + } + + /** + * Random generator for merchant referenc code + * + * @return random number + */ + protected function _generateReferenceCode() + { + return Mage::helper('core')->uniqHash(); + } + + /** + * Getting customer IP address + * + * @return IP address string + */ + protected function getIpAddress() + { + return Mage::helper('core/http')->getRemoteAddr(); + } + + /** + * Assigning billing address to soap + * + * @param Varien_Object $billing + * @param String $email + */ + protected function addBillingAddress($billing, $email) + { + if (!$email) { + $email = Mage::getSingleton('checkout/session')->getQuote()->getBillingAddress()->getEmail(); + } + $billTo = new stdClass(); + $billTo->firstName = $billing->getFirstname(); + $billTo->lastName = $billing->getLastname(); + $billTo->company = $billing->getCompany(); + $billTo->street1 = $billing->getStreet(1); + $billTo->street2 = $billing->getStreet(2); + $billTo->city = $billing->getCity(); + $billTo->state = $billing->getRegion(); + $billTo->postalCode = $billing->getPostcode(); + $billTo->country = $billing->getCountry(); + $billTo->phoneNumber = $billing->getTelephone(); + $billTo->email = ($email ? $email : Mage::getStoreConfig('trans_email/ident_general/email')); + $billTo->ipAddress = $this->getIpAddress(); + $this->_request->billTo = $billTo; + } + + /** + * Assigning shipping address to soap object + * + * @param Varien_Object $shipping + */ + protected function addShippingAddress($shipping) + { + //checking if we have shipping address, in case of virtual order we will not have it + if ($shipping) { + $shipTo = new stdClass(); + $shipTo->firstName = $shipping->getFirstname(); + $shipTo->lastName = $shipping->getLastname(); + $shipTo->company = $shipping->getCompany(); + $shipTo->street1 = $shipping->getStreet(1); + $shipTo->street2 = $shipping->getStreet(2); + $shipTo->city = $shipping->getCity(); + $shipTo->state = $shipping->getRegion(); + $shipTo->postalCode = $shipping->getPostcode(); + $shipTo->country = $shipping->getCountry(); + $shipTo->phoneNumber = $shipping->getTelephone(); + $this->_request->shipTo = $shipTo; + } + } + + /** + * Assigning credit card information + * + * @param Mage_Model_Order_Payment $payment + */ + protected function addCcInfo($payment) + { + $card = new stdClass(); + $card->fullName = $payment->getCcOwner(); + $card->accountNumber = $payment->getCcNumber(); + $card->expirationMonth = $payment->getCcExpMonth(); + $card->expirationYear = $payment->getCcExpYear(); + if ($payment->hasCcCid()) { + $card->cvNumber = $payment->getCcCid(); + } + if ($payment->getCcType()==self::CC_CARDTYPE_SS && $payment->hasCcSsIssue()) { + $card->issueNumber = $payment->getCcSsIssue(); + } + if ($payment->getCcType()==self::CC_CARDTYPE_SS && $payment->hasCcSsStartYear()) { + $card->startMonth = $payment->getCcSsStartMonth(); + $card->startYear = $payment->getCcSsStartYear(); + } + $this->_request->card = $card; + } + + /** + * Authorizing payment + * + * @param Varien_Object $payment + * @param float $amount + * @return Mage_Cybersource_Model_Soap + */ + public function authorize(Varien_Object $payment, $amount) + { + $error = false; + + $soapClient = $this->getSoapApi(); + + $this->iniRequest(); + + $ccAuthService = new stdClass(); + $ccAuthService->run = "true"; + $this->_request->ccAuthService = $ccAuthService; + $this->addBillingAddress($payment->getOrder()->getBillingAddress(), $payment->getOrder()->getCustomerEmail()); + $this->addShippingAddress($payment->getOrder()->getShippingAddress()); + $this->addCcInfo($payment); + + $purchaseTotals = new stdClass(); + $purchaseTotals->currency = $payment->getOrder()->getBaseCurrencyCode(); + $purchaseTotals->grandTotalAmount = $amount; + $this->_request->purchaseTotals = $purchaseTotals; + + try { + $result = $soapClient->runTransaction($this->_request); + if ($result->reasonCode==self::RESPONSE_CODE_SUCCESS) { + $payment->setLastTransId($result->requestID) + ->setCcTransId($result->requestID) + ->setTransactionId($result->requestID) + ->setIsTransactionClosed(0) + ->setCybersourceToken($result->requestToken) + ->setCcAvsStatus($result->ccAuthReply->avsCode); + /* + * checking if we have cvCode in response bc + * if we don't send cvn we don't get cvCode in response + */ + if (isset($result->ccAuthReply->cvCode)) { + $payment->setCcCidStatus($result->ccAuthReply->cvCode); + } + } else { + $error = Mage::helper('cybersource')->__('There is an error in processing the payment. Please try again or contact us.'); + } + } catch (Exception $e) { + Mage::throwException( + Mage::helper('cybersource')->__('Gateway request error: %s', $e->getMessage()) + ); + } + + if ($error !== false) { + Mage::throwException($error); + } + return $this; + } + + /** + * Capturing payment + * + * @param Varien_Object $payment + * @param float $amount + * @return Mage_Cybersource_Model_Soap + */ + public function capture(Varien_Object $payment, $amount) + { + $error = false; + $soapClient = $this->getSoapApi(); + $this->iniRequest(); + + if ($payment->getParentTransactionId() && $payment->getCybersourceToken()) { + $ccCaptureService = new stdClass(); + $ccCaptureService->run = "true"; + $ccCaptureService->authRequestToken = $payment->getCybersourceToken(); + $ccCaptureService->authRequestID = $payment->getParentTransactionId(); + $this->_request->ccCaptureService = $ccCaptureService; + + $item0 = new stdClass(); + $item0->unitPrice = $amount; + $item0->id = 0; + $this->_request->item = array($item0); + } else { + $ccAuthService = new stdClass(); + $ccAuthService->run = "true"; + $this->_request->ccAuthService = $ccAuthService; + + $ccCaptureService = new stdClass(); + $ccCaptureService->run = "true"; + $this->_request->ccCaptureService = $ccCaptureService; + + $this->addBillingAddress($payment->getOrder()->getBillingAddress(), $payment->getOrder()->getCustomerEmail()); + $this->addShippingAddress($payment->getOrder()->getShippingAddress()); + $this->addCcInfo($payment); + + $purchaseTotals = new stdClass(); + $purchaseTotals->currency = $payment->getOrder()->getBaseCurrencyCode(); + $purchaseTotals->grandTotalAmount = $amount; + $this->_request->purchaseTotals = $purchaseTotals; + } + try { + $result = $soapClient->runTransaction($this->_request); + if ($result->reasonCode==self::RESPONSE_CODE_SUCCESS) { + /* + for multiple capture we need to use the latest capture transaction id + */ + $payment->setLastTransId($result->requestID) + ->setLastCybersourceToken($result->requestToken) + ->setCcTransId($result->requestID) + ->setTransactionId($result->requestID) + ->setCybersourceToken($result->requestToken) + ; + } else { + $error = Mage::helper('cybersource')->__('There is an error in processing the payment. Please try again or contact us.'); + } + } catch (Exception $e) { + Mage::throwException( + Mage::helper('cybersource')->__('Gateway request error: %s', $e->getMessage()) + ); + } + if ($error !== false) { + Mage::throwException($error); + } + return $this; + } + + /** + * To assign transaction id and token after capturing payment + * + * @param Mage_Sale_Model_Order_Invoice $invoice + * @param Mage_Sale_Model_Order_Payment $payment + * @return Mage_Cybersource_Model_Soap + */ + public function processInvoice($invoice, $payment) + { + parent::processInvoice($invoice, $payment); + $invoice->setTransactionId($payment->getLastTransId()); + $invoice->setCybersourceToken($payment->getLastCybersourceToken()); + return $this; + } + + /** + * To assign transaction id and token before voiding the transaction + * + * @param Mage_Sale_Model_Order_Invoice $invoice + * @param Mage_Sale_Order_Payment $payment + * @return Mage_Cybersource_Model_Soap + */ + public function processBeforeVoid($invoice, $payment) + { + parent::processBeforeVoid($invoice, $payment); + $payment->setVoidTransactionId($invoice->getTransactionId()); + $payment->setVoidCybersourceToken($invoice->getCybersourceToken()); + return $this; + } + + /** + * Void the payment transaction + * + * @param Mage_Sale_Model_Order_Payment $payment + * @return Mage_Cybersource_Model_Soap + */ + public function void(Varien_Object $payment) + { + $error = false; + if ($payment->getParentTransactionId() && $payment->getVoidCybersourceToken()) { + $soapClient = $this->getSoapApi(); + $this->iniRequest(); + $voidService = new stdClass(); + $voidService->run = "true"; + $voidService->voidRequestToken = $payment->getVoidCybersourceToken(); + $voidService->voidRequestID = $payment->getParentTransactionId(); + $this->_request->voidService = $voidService; + try { + $result = $soapClient->runTransaction($this->_request); + if ($result->reasonCode==self::RESPONSE_CODE_SUCCESS) { + $payment->setTransactionId($result->requestID) + ->setCybersourceToken($result->requestToken) + ->setIsTransactionClosed(1); + } else { + $error = Mage::helper('cybersource')->__('There is an error in processing the payment. Please try again or contact us.'); + } + } catch (Exception $e) { + Mage::throwException( + Mage::helper('cybersource')->__('Gateway request error: %s', $e->getMessage()) + ); + } + }else{ + $error = Mage::helper('cybersource')->__('Invalid transaction id or token'); + } + if ($error !== false) { + Mage::throwException($error); + } + return $this; + } + + /** + * To assign correct transaction id and token before refund + * + * @param Mage_Sale_Model_Order_Invoice $invoice + * @param Mage_Sale_Model_Order_Payment $payment + * @return Mage_Cybersource_Model_Soap + */ + public function processBeforeRefund($invoice, $payment) + { + parent::processBeforeRefund($invoice, $payment); + $payment->setRefundTransactionId($invoice->getTransactionId()); + $payment->setRefundCybersourceToken($invoice->getCybersourceToken()); + return $this; + } + + /** + * Refund the payment transaction + * + * @param Mage_Sale_Model_Order_Payment $payment + * @param flaot $amount + * @return Mage_Cybersource_Model_Soap + */ + public function refund(Varien_Object $payment, $amount) + { + $error = false; + if ($payment->getParentTransactionId() && $payment->getRefundCybersourceToken() && $amount>0) { + $soapClient = $this->getSoapApi(); + $this->iniRequest(); + $ccCreditService = new stdClass(); + $ccCreditService->run = "true"; + $ccCreditService->captureRequestToken = $payment->getCybersourceToken(); + $ccCreditService->captureRequestID = $payment->getParentTransactionId(); + $this->_request->ccCreditService = $ccCreditService; + + $purchaseTotals = new stdClass(); + $purchaseTotals->grandTotalAmount = $amount; + $this->_request->purchaseTotals = $purchaseTotals; + + try { + $result = $soapClient->runTransaction($this->_request); + if ($result->reasonCode==self::RESPONSE_CODE_SUCCESS) { + $payment->setTransactionId($result->requestID) + ->setIsTransactionClosed(1) + ->setLastCybersourceToken($result->requestToken) + ; + } else { + $error = Mage::helper('cybersource')->__('There is an error in processing the payment. Please try again or contact us.'); + } + } catch (Exception $e) { + Mage::throwException( + Mage::helper('cybersource')->__('Gateway request error: %s', $e->getMessage()) + ); + } + } else { + $error = Mage::helper('cybersource')->__('Error in refunding the payment.'); + } + if ($error !== false) { + Mage::throwException($error); + } + return $this; + } + + + /** + * To assign correct transaction id and token after refund + * + * @param Mage_Sale_Model_Order_Creditmemo $creditmemo + * @param Mage_Sale_Model_Order_Payment $payment + * @return Mage_Cybersource_Model_Soap + */ + public function processCreditmemo($creditmemo, $payment) + { + parent::processCreditmemo($creditmemo, $payment); + $creditmemo->setTransactionId($payment->getLastTransId()); + $creditmemo->setCybersourceToken($payment->getLastCybersourceToken()); + return $this; + } +} diff --git a/app/code/core/Mage/Cybersource/Model/Source/Cctype.php b/app/code/core/Mage/Cybersource/Model/Source/Cctype.php new file mode 100644 index 0000000000..99c87e053d --- /dev/null +++ b/app/code/core/Mage/Cybersource/Model/Source/Cctype.php @@ -0,0 +1,33 @@ + + */ +class Mage_Cybersource_Model_Source_PaymentAction +{ + public function toOptionArray() + { + return array( + array('value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE, 'label' => Mage::helper('cybersource')->__('Authorization')), + array('value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE, 'label' => Mage::helper('cybersource')->__('Sale')), + ); + } +} diff --git a/app/code/core/Mage/Cybersource/etc/config.xml b/app/code/core/Mage/Cybersource/etc/config.xml new file mode 100644 index 0000000000..7380872e5b --- /dev/null +++ b/app/code/core/Mage/Cybersource/etc/config.xml @@ -0,0 +1,123 @@ + + + + + + 0.7.0 + + + + + + Mage_Cybersource_Model + cybersource_mysql4 + + + Mage_Cybersource_Model_Mysql4 + + cybersource_api_debug
      +
      +
      +
      + + + + Mage_Cybersource + Mage_Cybersource_Model_Mysql4_Setup + + + + + Mage_Cybersource_Block + + + + + + LASER + Laser + 51 + + + UATP + UATP + 52 + + + + +
      + + + /cybersource/soap + + + + standard + + Mage_Cybersource + cybersource + + + + + + + + Mage_Cybersource.csv + + + + + + + + + + + Mage_Cybersource.csv + + + + + + + + + + authorize + Credit Card (Cybersource) + processing + AE,VI,MC,DI + cybersource/soap + + + + + +
      diff --git a/app/code/core/Mage/Cybersource/etc/system.xml b/app/code/core/Mage/Cybersource/etc/system.xml new file mode 100644 index 0000000000..e8a50cf66c --- /dev/null +++ b/app/code/core/Mage/Cybersource/etc/system.xml @@ -0,0 +1,160 @@ + + + + + + + + + text + 500 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 1 + 1 + 1 + 0 + + + <label>Title</label> + <frontend_type>text</frontend_type> + <sort_order>2</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + adminhtml/system_config_backend_encrypted + obscure + 3 + 1 + 1 + 0 + + + + adminhtml/system_config_backend_encrypted + obscure + 4 + 1 + 1 + 0 + + + + select + cybersource/source_paymentAction + 5 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_order_status_processing + 6 + 1 + 1 + 0 + + + + multiselect + cybersource/source_cctype + 15 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 16 + 1 + 1 + 0 + + + + allowspecific + 50 + adminhtml/system_config_source_payment_allspecificcountries + 1 + 1 + 0 + + + + multiselect + 51 + adminhtml/system_config_source_country + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 55 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 56 + 1 + 1 + 0 + + + + text + 100 + 1 + 1 + 0 + + + + + + + diff --git a/app/code/core/Mage/Cybersource/sql/cybersource_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Cybersource/sql/cybersource_setup/mysql4-install-0.7.0.php new file mode 100644 index 0000000000..fe4661bf67 --- /dev/null +++ b/app/code/core/Mage/Cybersource/sql/cybersource_setup/mysql4-install-0.7.0.php @@ -0,0 +1,54 @@ +startSetup(); + +$installer->run(" + +-- DROP TABLE IF EXISTS `{$this->getTable('cybersource_api_debug')}`; +CREATE TABLE `{$this->getTable('cybersource_api_debug')}` ( + `debug_id` int(10) unsigned NOT NULL auto_increment, + `debug_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `action` varchar(255), + `request_body` text, + `response_body` text, + PRIMARY KEY (`debug_id`), + KEY `debug_at` (`debug_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + "); + +$installer->endSetup(); + +$installer->addAttribute('quote_payment', 'cybersource_token', array()); +$installer->addAttribute('order_payment', 'cybersource_token', array()); +$installer->addAttribute('invoice', 'cybersource_token', array()); +$installer->addAttribute('creditmemo', 'cybersource_token', array()); + diff --git a/app/code/core/Mage/Dataflow/Helper/Data.php b/app/code/core/Mage/Dataflow/Helper/Data.php index b78ed5fe78..1996735cb2 100644 --- a/app/code/core/Mage/Dataflow/Helper/Data.php +++ b/app/code/core/Mage/Dataflow/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Batch.php b/app/code/core/Mage/Dataflow/Model/Batch.php index 45e96dfb34..a247005f27 100644 --- a/app/code/core/Mage/Dataflow/Model/Batch.php +++ b/app/code/core/Mage/Dataflow/Model/Batch.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Batch/Abstract.php b/app/code/core/Mage/Dataflow/Model/Batch/Abstract.php index eda0973ae0..aac87ebeba 100644 --- a/app/code/core/Mage/Dataflow/Model/Batch/Abstract.php +++ b/app/code/core/Mage/Dataflow/Model/Batch/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Batch/Export.php b/app/code/core/Mage/Dataflow/Model/Batch/Export.php index dde6bd7ad1..ae63405789 100644 --- a/app/code/core/Mage/Dataflow/Model/Batch/Export.php +++ b/app/code/core/Mage/Dataflow/Model/Batch/Export.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Batch/Import.php b/app/code/core/Mage/Dataflow/Model/Batch/Import.php index 5e655cce11..e0d3d62762 100644 --- a/app/code/core/Mage/Dataflow/Model/Batch/Import.php +++ b/app/code/core/Mage/Dataflow/Model/Batch/Import.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Batch/Io.php b/app/code/core/Mage/Dataflow/Model/Batch/Io.php index 4c756ecdb0..5def0fde8a 100644 --- a/app/code/core/Mage/Dataflow/Model/Batch/Io.php +++ b/app/code/core/Mage/Dataflow/Model/Batch/Io.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert.php b/app/code/core/Mage/Dataflow/Model/Convert.php index a8f21ac733..1e383a25e8 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert.php +++ b/app/code/core/Mage/Dataflow/Model/Convert.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Action.php b/app/code/core/Mage/Dataflow/Model/Convert/Action.php index 558e27fb57..d532084743 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Action.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Action/Abstract.php b/app/code/core/Mage/Dataflow/Model/Convert/Action/Abstract.php index 52b86d0ead..ca2562255b 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Action/Abstract.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Action/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Action/Interface.php b/app/code/core/Mage/Dataflow/Model/Convert/Action/Interface.php index 233b604363..8c818914dd 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Action/Interface.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Action/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Abstract.php b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Abstract.php index 6abb821677..b4405077f1 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Abstract.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Db/Table.php b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Db/Table.php index 73c17b4170..49c2b50c0c 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Db/Table.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Db/Table.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Http.php b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Http.php index f1ffc38dee..2c8b92a871 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Http.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Http.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Http/Curl.php b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Http/Curl.php index b1c8ddcfc2..1b8fc242aa 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Http/Curl.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Http/Curl.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Interface.php b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Interface.php index f62f240998..bae88268f3 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Interface.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Io.php b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Io.php index bf39d78449..693aa6de1d 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Io.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Io.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -64,16 +64,16 @@ public function getResource($forWrite = false) $realPath = realpath($path); if (!$isError && $realPath === false) { - $message = Mage::helper('dataflow')->__('Destination folder "%s" does not exist or not access to create', $ioConfig['path']); + $message = Mage::helper('dataflow')->__('The destination folder "%s" does not exist or there is no access to create it.', $ioConfig['path']); Mage::throwException($message); } elseif (!$isError && !is_dir($realPath)) { - $message = Mage::helper('dataflow')->__('Destination folder "%s" is not a directory', $realPath); + $message = Mage::helper('dataflow')->__('Destination folder "%s" is not a directory.', $realPath); Mage::throwException($message); } elseif (!$isError) { if ($forWrite && !is_writeable($realPath)) { - $message = Mage::helper('dataflow')->__('Destination folder "%s" is not a writeable', $realPath); + $message = Mage::helper('dataflow')->__('Destination folder "%s" is not writable.', $realPath); Mage::throwException($message); } else { @@ -86,7 +86,7 @@ public function getResource($forWrite = false) // $basePath = $this->_resource->getCleanPath($baseDir); // // if (strpos($path, $basePath) !== 0) { -// $message = Mage::helper('dataflow')->__('Access denied to destination folder "%s"', $path); +// $message = Mage::helper('dataflow')->__('Access denied to destination folder "%s".', $path); // Mage::throwException($message); // } else { // $this->_resource->checkAndCreateFolder($path); @@ -94,16 +94,16 @@ public function getResource($forWrite = false) // // $realPath = realpath($path); // if (!$isError && $realPath === false) { -// $message = Mage::helper('dataflow')->__('Destination folder "%s" does not exist or not access to create', $ioConfig['path']); +// $message = Mage::helper('dataflow')->__('Destination folder "%s" does not exist or there is no access to create it.', $ioConfig['path']); // Mage::throwException($message); // } // elseif (!$isError && !is_dir($realPath)) { -// $message = Mage::helper('dataflow')->__('Destination folder "%s" is not a directory', $realPath); +// $message = Mage::helper('dataflow')->__('Destination folder "%s" is not a directory.', $realPath); // Mage::throwException($message); // } // elseif (!$isError) { // if ($forWrite && !is_writeable($realPath)) { -// $message = Mage::helper('dataflow')->__('Destination folder "%s" is not a writeable', $realPath); +// $message = Mage::helper('dataflow')->__('Destination folder "%s" is not writable.', $realPath); // Mage::throwException($message); // } // else { @@ -122,7 +122,7 @@ public function getResource($forWrite = false) try { $this->_resource->open($ioConfig); } catch (Exception $e) { - $message = Mage::helper('dataflow')->__('Error occured during file opening: "%s"', $e->getMessage()); + $message = Mage::helper('dataflow')->__('An error occurred while opening file: "%s".', $e->getMessage()); Mage::throwException($message); } } @@ -146,10 +146,10 @@ public function load() $result = $this->getResource()->read($this->getVar('filename'), $destFile); $filename = $this->getResource()->pwd() . '/' . $this->getVar('filename'); if (false === $result) { - $message = Mage::helper('dataflow')->__('Could not load file: "%s"', $filename); + $message = Mage::helper('dataflow')->__('Could not load file: "%s".', $filename); Mage::throwException($message); } else { - $message = Mage::helper('dataflow')->__('Loaded successfully: "%s"', $filename); + $message = Mage::helper('dataflow')->__('Loaded successfully: "%s".', $filename); $this->addException($message); } @@ -177,10 +177,10 @@ public function save() $result = $this->getResource()->write($filename, $dataFile, 0777); if (false === $result) { - $message = Mage::helper('dataflow')->__('Could not save file: %s', $filename); + $message = Mage::helper('dataflow')->__('Could not save file: %s.', $filename); Mage::throwException($message); } else { - $message = Mage::helper('dataflow')->__('Saved successfully: "%s" [%d byte(s)]', $filename, $batchModel->getIoAdapter()->getFileSize()); + $message = Mage::helper('dataflow')->__('Saved successfully: "%s" [%d byte(s)].', $filename, $batchModel->getIoAdapter()->getFileSize()); if ($this->getVar('link')) { $message .= Mage::helper('dataflow')->__('Link', $this->getVar('link')); } diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Soap.php b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Soap.php index 2278963fa8..b5c6e6c8bd 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Soap.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Soap.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Std.php b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Std.php index 44792dcfb7..302726f1d8 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Std.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Std.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Zend/Cache.php b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Zend/Cache.php index 3b421423ed..7bdc41c699 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Zend/Cache.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Zend/Cache.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Zend/Db.php b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Zend/Db.php index 773021e2a2..27c798321c 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Zend/Db.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Zend/Db.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Container/Abstract.php b/app/code/core/Mage/Dataflow/Model/Convert/Container/Abstract.php index 00a90af337..a3af1ef180 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Container/Abstract.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Container/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Container/Collection.php b/app/code/core/Mage/Dataflow/Model/Convert/Container/Collection.php index 75a9c272e1..29bf0c3790 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Container/Collection.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Container/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Container/Generic.php b/app/code/core/Mage/Dataflow/Model/Convert/Container/Generic.php index df8efbc048..3378eb911a 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Container/Generic.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Container/Generic.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Container/Interface.php b/app/code/core/Mage/Dataflow/Model/Convert/Container/Interface.php index d36dd8b3d4..d614b29d22 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Container/Interface.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Container/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Exception.php b/app/code/core/Mage/Dataflow/Model/Convert/Exception.php index 5f56a88c63..136347071e 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Exception.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Exception.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Iterator.php b/app/code/core/Mage/Dataflow/Model/Convert/Iterator.php index 62aa5f8078..2cc4437b75 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Iterator.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Iterator.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Dataflow_Model_Session_Adapter_Iterator extends Mage_Dataflow_Model_Convert_Adapter_Abstract @@ -94,7 +94,7 @@ function updateProgress(sessionId, idx, time, memory) { public function updateProgress($args) { $memory = !empty($args['memory']) ? $args['memory'] : ''; - echo ''; + echo ''; echo '
    • '.$memory.'
    • '; return array(); diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Iterator/File/Csv.php b/app/code/core/Mage/Dataflow/Model/Convert/Iterator/File/Csv.php index d1329b6c87..5a460f1332 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Iterator/File/Csv.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Iterator/File/Csv.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Dataflow_Model_Convert_Iterator_File_Csv extends Mage_Dataflow_Model_Convert_Parser_Abstract diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Iterator/Http.php b/app/code/core/Mage/Dataflow/Model/Convert/Iterator/Http.php index 6376437fd3..fc38b04326 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Iterator/Http.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Iterator/Http.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Iterator/Interface.php b/app/code/core/Mage/Dataflow/Model/Convert/Iterator/Interface.php index 9f67749efc..9b84cd833e 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Iterator/Interface.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Iterator/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Mapper/Abstract.php b/app/code/core/Mage/Dataflow/Model/Convert/Mapper/Abstract.php index cc1277fa1d..7ba068f0f9 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Mapper/Abstract.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Mapper/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Mapper/Column.php b/app/code/core/Mage/Dataflow/Model/Convert/Mapper/Column.php index 93bf51458e..553a97ede7 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Mapper/Column.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Mapper/Column.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -128,7 +128,7 @@ public function map() ->setBatchId($this->getBatchModel()->getId()) ->deleteCollection(); - throw new Exception(Mage::helper('dataflow')->__('Error field mapping! Fields list for mapping is not defined')); + throw new Exception(Mage::helper('dataflow')->__('Error in field mapping: field list for mapping is not defined.')); } foreach ($batchExportIds as $batchExportId) { diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Mapper/Interface.php b/app/code/core/Mage/Dataflow/Model/Convert/Mapper/Interface.php index 9f99c9bba0..237821631c 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Mapper/Interface.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Mapper/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Parser/Abstract.php b/app/code/core/Mage/Dataflow/Model/Convert/Parser/Abstract.php index 1d1027d449..c3f6f3efe8 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Parser/Abstract.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Parser/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -109,7 +109,7 @@ protected function _copy($file) { $ioAdapter = new Varien_Io_File(); if (!$ioAdapter->fileExists($file)) { - Mage::throwException(Mage::helper('dataflow')->__('File "%s" don\'t exist', $file)); + Mage::throwException(Mage::helper('dataflow')->__('File "%s" does not exist.', $file)); } $ioAdapter->setAllowCreateFolders(true); diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php b/app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php index 06911634e8..cdc72e98d7 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -53,7 +53,7 @@ public function parse() $adapterMethod = $this->getVar('method', 'saveRow'); if (!$adapterName || !$adapterMethod) { - $message = Mage::helper('dataflow')->__('Please declare "adapter" and "method" node first'); + $message = Mage::helper('dataflow')->__('Please declare "adapter" and "method" nodes first.'); $this->addException($message, Mage_Dataflow_Model_Convert_Exception::FATAL); return $this; } @@ -62,13 +62,13 @@ public function parse() $adapter = Mage::getModel($adapterName); } catch (Exception $e) { - $message = Mage::helper('dataflow')->__('Declared adapter %s not found', $adapterName); + $message = Mage::helper('dataflow')->__('Declared adapter %s was not found.', $adapterName); $this->addException($message, Mage_Dataflow_Model_Convert_Exception::FATAL); return $this; } if (!is_callable(array($adapter, $adapterMethod))) { - $message = Mage::helper('dataflow')->__('Method "%s" not defined in adapter %s', $adapterMethod, $adapterName); + $message = Mage::helper('dataflow')->__('Method "%s" not defined in adapter %s.', $adapterMethod, $adapterName); $this->addException($message, Mage_Dataflow_Model_Convert_Exception::FATAL); return $this; } @@ -116,7 +116,7 @@ public function parse() ->save(); } - $this->addException(Mage::helper('dataflow')->__('Found %d rows', $countRows)); + $this->addException(Mage::helper('dataflow')->__('Found %d rows.', $countRows)); $this->addException(Mage::helper('dataflow')->__('Starting %s :: %s', $adapterName, $adapterMethod)); $batchModel->setParams($this->getVars()) diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Parser/Interface.php b/app/code/core/Mage/Dataflow/Model/Convert/Parser/Interface.php index 0dfee06d83..8e1bc3dbf6 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Parser/Interface.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Parser/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Parser/Serialize.php b/app/code/core/Mage/Dataflow/Model/Convert/Parser/Serialize.php index cc2279ebf2..8daaf2ce1e 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Parser/Serialize.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Parser/Serialize.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Parser/Xml/Excel.php b/app/code/core/Mage/Dataflow/Model/Convert/Parser/Xml/Excel.php index b5dcc52e1b..4349a8d9af 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Parser/Xml/Excel.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Parser/Xml/Excel.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -54,7 +54,7 @@ public function parse() $adapterMethod = $this->getVar('method', 'saveRow'); if (!$adapterName || !$adapterMethod) { - $message = Mage::helper('dataflow')->__('Please declare "adapter" and "method" node first'); + $message = Mage::helper('dataflow')->__('Please declare "adapter" and "method" nodes first.'); $this->addException($message, Mage_Dataflow_Model_Convert_Exception::FATAL); return $this; } @@ -63,13 +63,13 @@ public function parse() $adapter = Mage::getModel($adapterName); } catch (Exception $e) { - $message = Mage::helper('dataflow')->__('Declared adapter %s not found', $adapterName); + $message = Mage::helper('dataflow')->__('Declared adapter %s was not found.', $adapterName); $this->addException($message, Mage_Dataflow_Model_Convert_Exception::FATAL); return $this; } if (!is_callable(array($adapter, $adapterMethod))) { - $message = Mage::helper('dataflow')->__('Method "%s" not defined in adapter %s', $adapterMethod, $adapterName); + $message = Mage::helper('dataflow')->__('Method "%s" was not defined in adapter %s.', $adapterMethod, $adapterName); $this->addException($message, Mage_Dataflow_Model_Convert_Exception::FATAL); return $this; } @@ -154,7 +154,7 @@ public function parse() } } - $this->addException(Mage::helper('dataflow')->__('Found %d rows', $this->_countRows)); + $this->addException(Mage::helper('dataflow')->__('Found %d rows.', $this->_countRows)); $this->addException(Mage::helper('dataflow')->__('Starting %s :: %s', $adapterName, $adapterMethod)); $batchModel->setParams($this->getVars()) diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Profile.php b/app/code/core/Mage/Dataflow/Model/Convert/Profile.php index 1bf7c3077c..aabf9a6f8c 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Profile.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Profile.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Profile/Abstract.php b/app/code/core/Mage/Dataflow/Model/Convert/Profile/Abstract.php index 25225866fe..1fd4f92f8f 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Profile/Abstract.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Profile/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Profile/Collection.php b/app/code/core/Mage/Dataflow/Model/Convert/Profile/Collection.php index d231690e45..1c9f17f4b6 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Profile/Collection.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Profile/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Profile/Interface.php b/app/code/core/Mage/Dataflow/Model/Convert/Profile/Interface.php index 820ae6e67c..739faa35ab 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Profile/Interface.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Profile/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Validator/Abstract.php b/app/code/core/Mage/Dataflow/Model/Convert/Validator/Abstract.php index b1dd15b95a..785e158f2a 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Validator/Abstract.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Validator/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Validator/Column.php b/app/code/core/Mage/Dataflow/Model/Convert/Validator/Column.php index eec300e830..6b312989b2 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Validator/Column.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Validator/Column.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Validator/Dryrun.php b/app/code/core/Mage/Dataflow/Model/Convert/Validator/Dryrun.php index 91102887af..07541cdf0a 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Validator/Dryrun.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Validator/Dryrun.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -40,7 +40,7 @@ class Mage_Dataflow_Model_Convert_Validator_Dryrun extends Mage_Dataflow_Model_C public function validate() { if ($this->getVar('dry_run') || $this->getProfile()->getDryRun()) { - $this->addException(Mage::helper('dataflow')->__("Dry run set, stopping execution"), Mage_Dataflow_Model_Convert_Exceptin::FATAL); + $this->addException(Mage::helper('dataflow')->__("Dry run set, stopping execution."), Mage_Dataflow_Model_Convert_Exceptin::FATAL); } return $this; } diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Validator/Interface.php b/app/code/core/Mage/Dataflow/Model/Convert/Validator/Interface.php index 5d45e7faf1..5939e22a16 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Validator/Interface.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Validator/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Import.php b/app/code/core/Mage/Dataflow/Model/Import.php index 1d0678e076..1b58e965e5 100644 --- a/app/code/core/Mage/Dataflow/Model/Import.php +++ b/app/code/core/Mage/Dataflow/Model/Import.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Mysql4/Batch.php b/app/code/core/Mage/Dataflow/Model/Mysql4/Batch.php index be7535df48..2544df8a0c 100644 --- a/app/code/core/Mage/Dataflow/Model/Mysql4/Batch.php +++ b/app/code/core/Mage/Dataflow/Model/Mysql4/Batch.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Mysql4/Batch/Abstract.php b/app/code/core/Mage/Dataflow/Model/Mysql4/Batch/Abstract.php index 7183126e0b..2fc816bda3 100644 --- a/app/code/core/Mage/Dataflow/Model/Mysql4/Batch/Abstract.php +++ b/app/code/core/Mage/Dataflow/Model/Mysql4/Batch/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Mysql4/Batch/Collection.php b/app/code/core/Mage/Dataflow/Model/Mysql4/Batch/Collection.php index 7bad96540b..39a2373e01 100755 --- a/app/code/core/Mage/Dataflow/Model/Mysql4/Batch/Collection.php +++ b/app/code/core/Mage/Dataflow/Model/Mysql4/Batch/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Mysql4/Batch/Export.php b/app/code/core/Mage/Dataflow/Model/Mysql4/Batch/Export.php index f1c47e9e2a..38ececd33b 100644 --- a/app/code/core/Mage/Dataflow/Model/Mysql4/Batch/Export.php +++ b/app/code/core/Mage/Dataflow/Model/Mysql4/Batch/Export.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Mysql4/Batch/Import.php b/app/code/core/Mage/Dataflow/Model/Mysql4/Batch/Import.php index 4825e777a4..4d2c535481 100644 --- a/app/code/core/Mage/Dataflow/Model/Mysql4/Batch/Import.php +++ b/app/code/core/Mage/Dataflow/Model/Mysql4/Batch/Import.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Mysql4/Catalogold.php b/app/code/core/Mage/Dataflow/Model/Mysql4/Catalogold.php index 3114c3386b..84a847b14e 100644 --- a/app/code/core/Mage/Dataflow/Model/Mysql4/Catalogold.php +++ b/app/code/core/Mage/Dataflow/Model/Mysql4/Catalogold.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Mysql4/Import.php b/app/code/core/Mage/Dataflow/Model/Mysql4/Import.php index bc727566e3..3b4d88894a 100644 --- a/app/code/core/Mage/Dataflow/Model/Mysql4/Import.php +++ b/app/code/core/Mage/Dataflow/Model/Mysql4/Import.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Mysql4/Import/Collection.php b/app/code/core/Mage/Dataflow/Model/Mysql4/Import/Collection.php index aa97ca547d..41bfded2f0 100644 --- a/app/code/core/Mage/Dataflow/Model/Mysql4/Import/Collection.php +++ b/app/code/core/Mage/Dataflow/Model/Mysql4/Import/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Mysql4/Profile.php b/app/code/core/Mage/Dataflow/Model/Mysql4/Profile.php index 7a8f13a741..49e0f4e8ff 100644 --- a/app/code/core/Mage/Dataflow/Model/Mysql4/Profile.php +++ b/app/code/core/Mage/Dataflow/Model/Mysql4/Profile.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Mysql4/Profile/Collection.php b/app/code/core/Mage/Dataflow/Model/Mysql4/Profile/Collection.php index 8521c90558..530e88b923 100644 --- a/app/code/core/Mage/Dataflow/Model/Mysql4/Profile/Collection.php +++ b/app/code/core/Mage/Dataflow/Model/Mysql4/Profile/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Mysql4/Profile/History.php b/app/code/core/Mage/Dataflow/Model/Mysql4/Profile/History.php index 591733329d..5a5508bebe 100644 --- a/app/code/core/Mage/Dataflow/Model/Mysql4/Profile/History.php +++ b/app/code/core/Mage/Dataflow/Model/Mysql4/Profile/History.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Mysql4/Profile/History/Collection.php b/app/code/core/Mage/Dataflow/Model/Mysql4/Profile/History/Collection.php index def546bac3..1d70a155a8 100644 --- a/app/code/core/Mage/Dataflow/Model/Mysql4/Profile/History/Collection.php +++ b/app/code/core/Mage/Dataflow/Model/Mysql4/Profile/History/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Mysql4/Session.php b/app/code/core/Mage/Dataflow/Model/Mysql4/Session.php index 691e59802e..56b9419d3a 100644 --- a/app/code/core/Mage/Dataflow/Model/Mysql4/Session.php +++ b/app/code/core/Mage/Dataflow/Model/Mysql4/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Profile.php b/app/code/core/Mage/Dataflow/Model/Profile.php index 7d569bcba8..3f68e0a23b 100644 --- a/app/code/core/Mage/Dataflow/Model/Profile.php +++ b/app/code/core/Mage/Dataflow/Model/Profile.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -82,7 +82,7 @@ protected function _beforeSave() } if ($this->_getResource()->isProfileExists($this->getName(), $this->getId())) { - Mage::throwException(Mage::helper("dataflow")->__("Profile with such name already exists.")); + Mage::throwException(Mage::helper("dataflow")->__("Profile with the same name already exists.")); } } diff --git a/app/code/core/Mage/Dataflow/Model/Profile/History.php b/app/code/core/Mage/Dataflow/Model/Profile/History.php index 59d46f7184..347876abaf 100644 --- a/app/code/core/Mage/Dataflow/Model/Profile/History.php +++ b/app/code/core/Mage/Dataflow/Model/Profile/History.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Session.php b/app/code/core/Mage/Dataflow/Model/Session.php index d6cdb185bb..e65eac0f6b 100644 --- a/app/code/core/Mage/Dataflow/Model/Session.php +++ b/app/code/core/Mage/Dataflow/Model/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Session/Adapter/Http.php b/app/code/core/Mage/Dataflow/Model/Session/Adapter/Http.php index 9bff11cdc6..72b1cdce3a 100644 --- a/app/code/core/Mage/Dataflow/Model/Session/Adapter/Http.php +++ b/app/code/core/Mage/Dataflow/Model/Session/Adapter/Http.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/Model/Session/Parser/Csv.php b/app/code/core/Mage/Dataflow/Model/Session/Parser/Csv.php index 3871c5f870..0d8ef121d7 100644 --- a/app/code/core/Mage/Dataflow/Model/Session/Parser/Csv.php +++ b/app/code/core/Mage/Dataflow/Model/Session/Parser/Csv.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/etc/config.xml b/app/code/core/Mage/Dataflow/etc/config.xml index 053a41bddb..bcd4af6314 100644 --- a/app/code/core/Mage/Dataflow/etc/config.xml +++ b/app/code/core/Mage/Dataflow/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-install-0.7.0.php index 8139790187..5186e591eb 100644 --- a/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-upgrade-0.7.0-0.7.1.php index eb32118ae2..4ed37a99b7 100644 --- a/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $this->startSetup()->run(" diff --git a/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-upgrade-0.7.1-0.7.2.php index 9deabb042f..e9a17d470c 100755 --- a/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $this->startSetup()->run(" diff --git a/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-upgrade-0.7.2-0.7.3.php index fd5f75c09e..341d5f9b72 100644 --- a/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-upgrade-0.7.2-0.7.3.php +++ b/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-upgrade-0.7.2-0.7.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-upgrade-0.7.3-0.7.4.php b/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-upgrade-0.7.3-0.7.4.php index 1c032055e7..2d6088455a 100644 --- a/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-upgrade-0.7.3-0.7.4.php +++ b/app/code/core/Mage/Dataflow/sql/dataflow_setup/mysql4-upgrade-0.7.3-0.7.4.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Dataflow - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Block/Adminhtml/Frontend/Currency/Base.php b/app/code/core/Mage/Directory/Block/Adminhtml/Frontend/Currency/Base.php index 53b3b5c06c..8b939ccbb4 100644 --- a/app/code/core/Mage/Directory/Block/Adminhtml/Frontend/Currency/Base.php +++ b/app/code/core/Mage/Directory/Block/Adminhtml/Frontend/Currency/Base.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Block/Adminhtml/Frontend/Region/Updater.php b/app/code/core/Mage/Directory/Block/Adminhtml/Frontend/Region/Updater.php index fbd11a5471..8baf84cbee 100644 --- a/app/code/core/Mage/Directory/Block/Adminhtml/Frontend/Region/Updater.php +++ b/app/code/core/Mage/Directory/Block/Adminhtml/Frontend/Region/Updater.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Block/Currency.php b/app/code/core/Mage/Directory/Block/Currency.php index 83fb8359b5..440fa7080f 100644 --- a/app/code/core/Mage/Directory/Block/Currency.php +++ b/app/code/core/Mage/Directory/Block/Currency.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Block/Data.php b/app/code/core/Mage/Directory/Block/Data.php index 635026f9c3..a0bb33f7aa 100644 --- a/app/code/core/Mage/Directory/Block/Data.php +++ b/app/code/core/Mage/Directory/Block/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Exception.php b/app/code/core/Mage/Directory/Exception.php index a14e660c0f..ab6db418d2 100644 --- a/app/code/core/Mage/Directory/Exception.php +++ b/app/code/core/Mage/Directory/Exception.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Helper/Data.php b/app/code/core/Mage/Directory/Helper/Data.php index c06df2977e..86950b4edd 100644 --- a/app/code/core/Mage/Directory/Helper/Data.php +++ b/app/code/core/Mage/Directory/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Helper/Url.php b/app/code/core/Mage/Directory/Helper/Url.php index aee192f9b2..b0ee56e5b0 100644 --- a/app/code/core/Mage/Directory/Helper/Url.php +++ b/app/code/core/Mage/Directory/Helper/Url.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Model/Country.php b/app/code/core/Mage/Directory/Model/Country.php index ff95bbcf37..1591f79a96 100644 --- a/app/code/core/Mage/Directory/Model/Country.php +++ b/app/code/core/Mage/Directory/Model/Country.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Model/Country/Api.php b/app/code/core/Mage/Directory/Model/Country/Api.php index d448aeb161..857ebbd908 100644 --- a/app/code/core/Mage/Directory/Model/Country/Api.php +++ b/app/code/core/Mage/Directory/Model/Country/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Model/Country/Api/V2.php b/app/code/core/Mage/Directory/Model/Country/Api/V2.php index 150377ee3c..7329199883 100644 --- a/app/code/core/Mage/Directory/Model/Country/Api/V2.php +++ b/app/code/core/Mage/Directory/Model/Country/Api/V2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Model/Country/Format.php b/app/code/core/Mage/Directory/Model/Country/Format.php index 65c1aff148..cebebbd89e 100644 --- a/app/code/core/Mage/Directory/Model/Country/Format.php +++ b/app/code/core/Mage/Directory/Model/Country/Format.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Model/Currency.php b/app/code/core/Mage/Directory/Model/Currency.php index 32ec1c145c..197994bc14 100644 --- a/app/code/core/Mage/Directory/Model/Currency.php +++ b/app/code/core/Mage/Directory/Model/Currency.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -119,7 +119,7 @@ public function getRate($toCurrency) } elseif ($toCurrency instanceof Mage_Directory_Model_Currency) { $code = $toCurrency->getCurrencyCode(); } else { - throw Mage::exception('Mage_Directory', Mage::helper('directory')->__('Invalid target currency')); + throw Mage::exception('Mage_Directory', Mage::helper('directory')->__('Invalid target currency.')); } $rates = $this->getRates(); if (!isset($rates[$code])) { @@ -142,7 +142,7 @@ public function getAnyRate($toCurrency) } elseif ($toCurrency instanceof Mage_Directory_Model_Currency) { $code = $toCurrency->getCurrencyCode(); } else { - throw Mage::exception('Mage_Directory', Mage::helper('directory')->__('Invalid target currency')); + throw Mage::exception('Mage_Directory', Mage::helper('directory')->__('Invalid target currency.')); } $rates = $this->getRates(); if (!isset($rates[$code])) { @@ -168,7 +168,7 @@ public function convert($price, $toCurrency=null) return $price*$rate; } - throw new Exception(Mage::helper('directory')->__('Undefined rate from "%s-%s"', $this->getCode(), $toCurrency->getCode())); + throw new Exception(Mage::helper('directory')->__('Undefined rate from "%s-%s".', $this->getCode(), $toCurrency->getCode())); } /** diff --git a/app/code/core/Mage/Directory/Model/Currency/Filter.php b/app/code/core/Mage/Directory/Model/Currency/Filter.php index da992a4009..c1e85d3cea 100644 --- a/app/code/core/Mage/Directory/Model/Currency/Filter.php +++ b/app/code/core/Mage/Directory/Model/Currency/Filter.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Model/Currency/Import/Abstract.php b/app/code/core/Mage/Directory/Model/Currency/Import/Abstract.php index ad2e6c254d..1d49b17b1e 100644 --- a/app/code/core/Mage/Directory/Model/Currency/Import/Abstract.php +++ b/app/code/core/Mage/Directory/Model/Currency/Import/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Model/Currency/Import/Webservicex.php b/app/code/core/Mage/Directory/Model/Currency/Import/Webservicex.php index aad48557f9..bcfeb4f66e 100644 --- a/app/code/core/Mage/Directory/Model/Currency/Import/Webservicex.php +++ b/app/code/core/Mage/Directory/Model/Currency/Import/Webservicex.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -62,7 +62,7 @@ protected function _convert($currencyFrom, $currencyTo, $retry=0) $xml = simplexml_load_string($response, null, LIBXML_NOERROR); if( !$xml ) { - $this->_messages[] = Mage::helper('directory')->__('Cannot retrieve rate from %s', $url); + $this->_messages[] = Mage::helper('directory')->__('Cannot retrieve rate from %s.', $url); return null; } return (float) $xml; @@ -71,7 +71,7 @@ protected function _convert($currencyFrom, $currencyTo, $retry=0) if( $retry == 0 ) { $this->_convert($currencyFrom, $currencyTo, 1); } else { - $this->_messages[] = Mage::helper('directory')->__('Cannot retrieve rate from %s', $url); + $this->_messages[] = Mage::helper('directory')->__('Cannot retrieve rate from %s.', $url); } } } diff --git a/app/code/core/Mage/Directory/Model/Mysql4/Country.php b/app/code/core/Mage/Directory/Model/Mysql4/Country.php index 52ea430a41..61ed31d44d 100644 --- a/app/code/core/Mage/Directory/Model/Mysql4/Country.php +++ b/app/code/core/Mage/Directory/Model/Mysql4/Country.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Model/Mysql4/Country/Collection.php b/app/code/core/Mage/Directory/Model/Mysql4/Country/Collection.php index d378f3d1bc..f24650cfb5 100644 --- a/app/code/core/Mage/Directory/Model/Mysql4/Country/Collection.php +++ b/app/code/core/Mage/Directory/Model/Mysql4/Country/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Model/Mysql4/Country/Format.php b/app/code/core/Mage/Directory/Model/Mysql4/Country/Format.php index c4ade781fc..f146649682 100644 --- a/app/code/core/Mage/Directory/Model/Mysql4/Country/Format.php +++ b/app/code/core/Mage/Directory/Model/Mysql4/Country/Format.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Model/Mysql4/Country/Format/Collection.php b/app/code/core/Mage/Directory/Model/Mysql4/Country/Format/Collection.php index cbe843f0b1..336253bf66 100644 --- a/app/code/core/Mage/Directory/Model/Mysql4/Country/Format/Collection.php +++ b/app/code/core/Mage/Directory/Model/Mysql4/Country/Format/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Model/Mysql4/Currency.php b/app/code/core/Mage/Directory/Model/Mysql4/Currency.php index 5b55d9796b..1c4a5e57cb 100644 --- a/app/code/core/Mage/Directory/Model/Mysql4/Currency.php +++ b/app/code/core/Mage/Directory/Model/Mysql4/Currency.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Model/Mysql4/Currency/Collection.php b/app/code/core/Mage/Directory/Model/Mysql4/Currency/Collection.php index 2068fbb5de..fe528e85ba 100644 --- a/app/code/core/Mage/Directory/Model/Mysql4/Currency/Collection.php +++ b/app/code/core/Mage/Directory/Model/Mysql4/Currency/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Model/Mysql4/Region.php b/app/code/core/Mage/Directory/Model/Mysql4/Region.php index 201fa95475..3e69477d9c 100644 --- a/app/code/core/Mage/Directory/Model/Mysql4/Region.php +++ b/app/code/core/Mage/Directory/Model/Mysql4/Region.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Model/Mysql4/Region/Collection.php b/app/code/core/Mage/Directory/Model/Mysql4/Region/Collection.php index fd1d8c77f8..74f32dd4cd 100644 --- a/app/code/core/Mage/Directory/Model/Mysql4/Region/Collection.php +++ b/app/code/core/Mage/Directory/Model/Mysql4/Region/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Model/Observer.php b/app/code/core/Mage/Directory/Model/Observer.php index b00134b838..d698b06e4a 100644 --- a/app/code/core/Mage/Directory/Model/Observer.php +++ b/app/code/core/Mage/Directory/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -48,13 +48,13 @@ public function scheduledUpdateCurrencyRates($schedule) $service = Mage::getStoreConfig(self::IMPORT_SERVICE); if( !$service ) { - $importWarnings[] = Mage::helper('directory')->__('FATAL ERROR:') . ' ' . Mage::helper('directory')->__('Invalid Import Service Specified'); + $importWarnings[] = Mage::helper('directory')->__('FATAL ERROR:') . ' ' . Mage::helper('directory')->__('Invalid Import Service specified.'); } try { $importModel = Mage::getModel(Mage::getConfig()->getNode('global/currency/import/services/' . $service . '/model')->asArray()); } catch (Exception $e) { - $importWarnings[] = Mage::helper('directory')->__('FATAL ERROR:') . ' ' . Mage::throwException(Mage::helper('directory')->__('Unable to initialize import model')); + $importWarnings[] = Mage::helper('directory')->__('FATAL ERROR:') . ' ' . Mage::throwException(Mage::helper('directory')->__('Unable to initialize the import model.')); } $rates = $importModel->fetchRates(); diff --git a/app/code/core/Mage/Directory/Model/Region.php b/app/code/core/Mage/Directory/Model/Region.php index 5ea0f8cdba..bae411665c 100644 --- a/app/code/core/Mage/Directory/Model/Region.php +++ b/app/code/core/Mage/Directory/Model/Region.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Model/Region/Api.php b/app/code/core/Mage/Directory/Model/Region/Api.php index 848b59229d..519ca54719 100644 --- a/app/code/core/Mage/Directory/Model/Region/Api.php +++ b/app/code/core/Mage/Directory/Model/Region/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/Model/Region/Api/V2.php b/app/code/core/Mage/Directory/Model/Region/Api/V2.php index ac873481bb..43abc39b56 100644 --- a/app/code/core/Mage/Directory/Model/Region/Api/V2.php +++ b/app/code/core/Mage/Directory/Model/Region/Api/V2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/controllers/CurrencyController.php b/app/code/core/Mage/Directory/controllers/CurrencyController.php index 432a1bbbea..05ba315adb 100644 --- a/app/code/core/Mage/Directory/controllers/CurrencyController.php +++ b/app/code/core/Mage/Directory/controllers/CurrencyController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/etc/api.xml b/app/code/core/Mage/Directory/etc/api.xml index 0eb939c9ec..344ead0708 100644 --- a/app/code/core/Mage/Directory/etc/api.xml +++ b/app/code/core/Mage/Directory/etc/api.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Directory/etc/config.xml b/app/code/core/Mage/Directory/etc/config.xml index 1388284ebb..13a3042563 100644 --- a/app/code/core/Mage/Directory/etc/config.xml +++ b/app/code/core/Mage/Directory/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Directory/etc/system.xml b/app/code/core/Mage/Directory/etc/system.xml index ea046f1694..dbc7d41529 100644 --- a/app/code/core/Mage/Directory/etc/system.xml +++ b/app/code/core/Mage/Directory/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -43,19 +43,19 @@ 1 - + select directory/adminhtml_frontend_currency_base adminhtml/system_config_source_currency adminhtml/system_config_backend_currency_base 1 - Currency will be used for all online payment transactions + "Price" > "Catalog Price Scope").]]> 1 1 0 - + select adminhtml/system_config_source_currency adminhtml/system_config_backend_currency_default @@ -65,7 +65,7 @@ 1 - + multiselect adminhtml/system_config_source_currency adminhtml/system_config_backend_currency_allow @@ -85,7 +85,7 @@ 0 - + text 0 1 diff --git a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-install-0.7.0.php index 59fe48d421..045ecaf3cb 100644 --- a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-install-0.8.0.php b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-install-0.8.0.php index fef123648a..f3f799084d 100644 --- a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-install-0.8.0.php +++ b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-install-0.8.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.7.0-0.7.1.php index 0874804133..d910b8ce9c 100644 --- a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.7.1-0.7.2.php index 46c82f8870..620915519e 100644 --- a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.0-0.8.1.php b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.0-0.8.1.php index 004fc2a981..0a17f1d886 100644 --- a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.0-0.8.1.php +++ b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.0-0.8.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.1-0.8.2.php b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.1-0.8.2.php index ba7de18916..bb22cf4bb8 100644 --- a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.1-0.8.2.php +++ b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.1-0.8.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.2-0.8.3.php b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.2-0.8.3.php index 5ca9296e2d..5581605e7a 100644 --- a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.2-0.8.3.php +++ b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.2-0.8.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.3-0.8.4.php b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.3-0.8.4.php index a250256667..9336461239 100644 --- a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.3-0.8.4.php +++ b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.3-0.8.4.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.4-0.8.5.php b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.4-0.8.5.php index ff93cc2f40..b2b14d4cc1 100644 --- a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.4-0.8.5.php +++ b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.4-0.8.5.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.5-0.8.6.php b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.5-0.8.6.php index b14149526e..0fe67ecb0e 100644 --- a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.5-0.8.6.php +++ b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.5-0.8.6.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.6-0.8.7.php b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.6-0.8.7.php index e633189d19..bd1f2bc1dd 100644 --- a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.6-0.8.7.php +++ b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.6-0.8.7.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.7-0.8.8.php b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.7-0.8.8.php index 03733b0488..e20b21381d 100644 --- a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.7-0.8.8.php +++ b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.7-0.8.8.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.8-0.8.9.php b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.8-0.8.9.php index 232f84f61d..8c9fa0f98e 100644 --- a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.8-0.8.9.php +++ b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.8-0.8.9.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.9-0.8.10.php b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.9-0.8.10.php index 44c7cbd676..755bb3a197 100644 --- a/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.9-0.8.10.php +++ b/app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-0.8.9-0.8.10.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Directory - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php b/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php index c966ecb608..af4459219a 100644 --- a/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php +++ b/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php b/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php index 240220334b..177bac7617 100644 --- a/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php +++ b/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php b/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php index a896639ea0..85755a1925 100644 --- a/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php +++ b/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Block/Adminhtml/Sales/Items/Column/Downloadable/Name.php b/app/code/core/Mage/Downloadable/Block/Adminhtml/Sales/Items/Column/Downloadable/Name.php index 97eac571ec..1bb9f5aa50 100644 --- a/app/code/core/Mage/Downloadable/Block/Adminhtml/Sales/Items/Column/Downloadable/Name.php +++ b/app/code/core/Mage/Downloadable/Block/Adminhtml/Sales/Items/Column/Downloadable/Name.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Block/Catalog/Product/Links.php b/app/code/core/Mage/Downloadable/Block/Catalog/Product/Links.php index 7fd8061515..29beac019f 100644 --- a/app/code/core/Mage/Downloadable/Block/Catalog/Product/Links.php +++ b/app/code/core/Mage/Downloadable/Block/Catalog/Product/Links.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Block/Catalog/Product/Samples.php b/app/code/core/Mage/Downloadable/Block/Catalog/Product/Samples.php index 7d5ef1662e..7fc32362a4 100644 --- a/app/code/core/Mage/Downloadable/Block/Catalog/Product/Samples.php +++ b/app/code/core/Mage/Downloadable/Block/Catalog/Product/Samples.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Block/Catalog/Product/View/Type.php b/app/code/core/Mage/Downloadable/Block/Catalog/Product/View/Type.php index babc4219b1..6ab31b97f0 100644 --- a/app/code/core/Mage/Downloadable/Block/Catalog/Product/View/Type.php +++ b/app/code/core/Mage/Downloadable/Block/Catalog/Product/View/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Block/Checkout/Cart/Item/Renderer.php b/app/code/core/Mage/Downloadable/Block/Checkout/Cart/Item/Renderer.php index 644db79cb1..a9c2f5c087 100644 --- a/app/code/core/Mage/Downloadable/Block/Checkout/Cart/Item/Renderer.php +++ b/app/code/core/Mage/Downloadable/Block/Checkout/Cart/Item/Renderer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Block/Checkout/Success.php b/app/code/core/Mage/Downloadable/Block/Checkout/Success.php index 05efa6f9e2..86c609662c 100644 --- a/app/code/core/Mage/Downloadable/Block/Checkout/Success.php +++ b/app/code/core/Mage/Downloadable/Block/Checkout/Success.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Block/Customer/Products/List.php b/app/code/core/Mage/Downloadable/Block/Customer/Products/List.php index ed2bd7ff43..a0282e9771 100644 --- a/app/code/core/Mage/Downloadable/Block/Customer/Products/List.php +++ b/app/code/core/Mage/Downloadable/Block/Customer/Products/List.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php b/app/code/core/Mage/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php index 45c4b8771b..0ca0b7a60b 100644 --- a/app/code/core/Mage/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php +++ b/app/code/core/Mage/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Block/Sales/Order/Email/Items/Order/Downloadable.php b/app/code/core/Mage/Downloadable/Block/Sales/Order/Email/Items/Order/Downloadable.php index 836aa343c9..496ced9355 100644 --- a/app/code/core/Mage/Downloadable/Block/Sales/Order/Email/Items/Order/Downloadable.php +++ b/app/code/core/Mage/Downloadable/Block/Sales/Order/Email/Items/Order/Downloadable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php b/app/code/core/Mage/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php index 40637de665..c88f253271 100644 --- a/app/code/core/Mage/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php +++ b/app/code/core/Mage/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Helper/Data.php b/app/code/core/Mage/Downloadable/Helper/Data.php index 997852314c..d14c08ceff 100644 --- a/app/code/core/Mage/Downloadable/Helper/Data.php +++ b/app/code/core/Mage/Downloadable/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Helper/Download.php b/app/code/core/Mage/Downloadable/Helper/Download.php index 06d663f6ba..f21f717046 100644 --- a/app/code/core/Mage/Downloadable/Helper/Download.php +++ b/app/code/core/Mage/Downloadable/Helper/Download.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -88,7 +88,7 @@ class Mage_Downloadable_Helper_Download extends Mage_Core_Helper_Abstract protected function _getHandle() { if (!$this->_resourceFile) { - Mage::throwException(Mage::helper('downloadable')->__('Please set resource file and link type')); + Mage::throwException(Mage::helper('downloadable')->__('Please set resource file and link type.')); } if (is_null($this->_handle)) { @@ -100,10 +100,10 @@ protected function _getHandle() */ $urlProp = parse_url($this->_resourceFile); if (!isset($urlProp['scheme']) || strtolower($urlProp['scheme'] != 'http')) { - Mage::throwException(Mage::helper('downloadable')->__('Invalid download URL scheme')); + Mage::throwException(Mage::helper('downloadable')->__('Invalid download URL scheme.')); } if (!isset($urlProp['host'])) { - Mage::throwException(Mage::helper('downloadable')->__('Invalid download URL host')); + Mage::throwException(Mage::helper('downloadable')->__('Invalid download URL host.')); } $hostname = $urlProp['host']; @@ -128,7 +128,7 @@ protected function _getHandle() } if ($this->_handle === false) { - Mage::throwException(Mage::helper('downloadable')->__('Can\'t connect to remote host, error: %s', $errstr)); + Mage::throwException(Mage::helper('downloadable')->__('Cannot connect to remote host, error: %s.', $errstr)); } $headers = 'GET ' . $path . $query . ' HTTP/1.0' . "\r\n" @@ -160,19 +160,19 @@ protected function _getHandle() } if (!isset($this->_urlHeaders['code']) || $this->_urlHeaders['code'] != 200) { - Mage::throwException(Mage::helper('downloadable')->__('Sorry, the was an error getting requested content. Please contact store owner.')); + Mage::throwException(Mage::helper('downloadable')->__('An error occurred while getting the requested content. Please contact the store owner.')); } } elseif ($this->_linkType == self::LINK_TYPE_FILE) { $this->_handle = new Varien_Io_File(); $this->_handle->open(array('path'=>Mage::getBaseDir('var'))); if (!$this->_handle->fileExists($this->_resourceFile, true)) { - Mage::throwException(Mage::helper('downloadable')->__('File does not exists')); + Mage::throwException(Mage::helper('downloadable')->__('The file does not exist.')); } $this->_handle->streamOpen($this->_resourceFile, 'r'); } else { - Mage::throwException(Mage::helper('downloadable')->__('Invalid download link type')); + Mage::throwException(Mage::helper('downloadable')->__('Invalid download link type.')); } } return $this->_handle; diff --git a/app/code/core/Mage/Downloadable/Helper/File.php b/app/code/core/Mage/Downloadable/Helper/File.php index 340617f318..c5c4978b08 100644 --- a/app/code/core/Mage/Downloadable/Helper/File.php +++ b/app/code/core/Mage/Downloadable/Helper/File.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/CatalogIndex/Data/Downloadable.php b/app/code/core/Mage/Downloadable/Model/CatalogIndex/Data/Downloadable.php index 791d9c854d..b46d6665d6 100644 --- a/app/code/core/Mage/Downloadable/Model/CatalogIndex/Data/Downloadable.php +++ b/app/code/core/Mage/Downloadable/Model/CatalogIndex/Data/Downloadable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/Link.php b/app/code/core/Mage/Downloadable/Model/Link.php index ea8599d3e7..715db82168 100644 --- a/app/code/core/Mage/Downloadable/Model/Link.php +++ b/app/code/core/Mage/Downloadable/Model/Link.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/Link/Purchased.php b/app/code/core/Mage/Downloadable/Model/Link/Purchased.php index 9f454bc571..8cd043ffbf 100644 --- a/app/code/core/Mage/Downloadable/Model/Link/Purchased.php +++ b/app/code/core/Mage/Downloadable/Model/Link/Purchased.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/Link/Purchased/Item.php b/app/code/core/Mage/Downloadable/Model/Link/Purchased/Item.php index f696d9e143..93e9b2f25e 100644 --- a/app/code/core/Mage/Downloadable/Model/Link/Purchased/Item.php +++ b/app/code/core/Mage/Downloadable/Model/Link/Purchased/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/Mysql4/Indexer/Price.php b/app/code/core/Mage/Downloadable/Model/Mysql4/Indexer/Price.php index dd39df9d96..e472b75519 100644 --- a/app/code/core/Mage/Downloadable/Model/Mysql4/Indexer/Price.php +++ b/app/code/core/Mage/Downloadable/Model/Mysql4/Indexer/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,6 +42,7 @@ class Mage_Downloadable_Model_Mysql4_Indexer_Price */ public function reindexAll() { + $this->useIdxTable(true); $this->_prepareFinalPriceData(); $this->_applyCustomOption(); $this->_applyDownloadableLink(); @@ -74,7 +75,10 @@ public function reindexEntity($entityIds) */ protected function _getDownloadableLinkPriceTable() { - return $this->getIdxTable($this->getMainTable() . '_downloadable'); + if ($this->useIdxTable()) { + return $this->getTable('downloadable/product_price_indexer_idx'); + } + return $this->getTable('downloadable/product_price_indexer_tmp'); } /** @@ -84,23 +88,7 @@ protected function _getDownloadableLinkPriceTable() */ protected function _prepareDownloadableLinkPriceTable() { - $write = $this->_getWriteAdapter(); - $table = $this->_getDownloadableLinkPriceTable(); - - $query = sprintf('DROP TABLE IF EXISTS %s', $write->quoteIdentifier($table)); - $write->query($query); - - $query = sprintf('CREATE TABLE %s (' - . ' `entity_id` INT(10) UNSIGNED NOT NULL,' - . ' `customer_group_id` SMALLINT(5) UNSIGNED NOT NULL,' - . ' `website_id` SMALLINT(5) UNSIGNED NOT NULL,' - . ' `min_price` DECIMAL(12,4) DEFAULT NULL,' - . ' `max_price` DECIMAL(12,4) DEFAULT NULL,' - . ' PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`)' - . ') ENGINE=MYISAM DEFAULT CHARSET=utf8', - $write->quoteIdentifier($table)); - $write->query($query); - + $this->_getWriteAdapter()->delete($this->_getDownloadableLinkPriceTable()); return $this; } @@ -164,7 +152,12 @@ protected function _applyDownloadableLink() $query = $select->crossUpdateFromSelect(array('i' => $this->_getDefaultFinalPriceTable())); $write->query($query); - $write->truncate($table); + if ($this->useIdxTable()) { + $write->truncate($table); + } + else { + $write->delete($table); + } return $this; } diff --git a/app/code/core/Mage/Downloadable/Model/Mysql4/Link.php b/app/code/core/Mage/Downloadable/Model/Mysql4/Link.php index 9be6e46ead..3d06da1bf7 100644 --- a/app/code/core/Mage/Downloadable/Model/Mysql4/Link.php +++ b/app/code/core/Mage/Downloadable/Model/Mysql4/Link.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Collection.php b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Collection.php index d744cc61bb..2f62807570 100644 --- a/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Collection.php +++ b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased.php b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased.php index 8287918934..33f27f9064 100644 --- a/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased.php +++ b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Collection.php b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Collection.php index 61b4359574..f5757fbbc2 100644 --- a/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Collection.php +++ b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Item.php b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Item.php index 27b7924408..e3c1f529a7 100644 --- a/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Item.php +++ b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Item/Collection.php b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Item/Collection.php index 679834cc15..514478942d 100644 --- a/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Item/Collection.php +++ b/app/code/core/Mage/Downloadable/Model/Mysql4/Link/Purchased/Item/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/Mysql4/Sample.php b/app/code/core/Mage/Downloadable/Model/Mysql4/Sample.php index 0628065c5d..39c5ce04ac 100644 --- a/app/code/core/Mage/Downloadable/Model/Mysql4/Sample.php +++ b/app/code/core/Mage/Downloadable/Model/Mysql4/Sample.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/Mysql4/Sample/Collection.php b/app/code/core/Mage/Downloadable/Model/Mysql4/Sample/Collection.php index dfde419768..07f1fae143 100644 --- a/app/code/core/Mage/Downloadable/Model/Mysql4/Sample/Collection.php +++ b/app/code/core/Mage/Downloadable/Model/Mysql4/Sample/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/Observer.php b/app/code/core/Mage/Downloadable/Model/Observer.php index 5a15f10063..7f4f873382 100644 --- a/app/code/core/Mage/Downloadable/Model/Observer.php +++ b/app/code/core/Mage/Downloadable/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -62,12 +62,18 @@ public function prepareProductSave($observer) public function saveDownloadableOrderItem($observer) { $orderItem = $observer->getEvent()->getItem(); + $product = $orderItem->getProduct(); + if ($product && $product->getTypeId() != Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE) { + return $this; + } if (Mage::getModel('downloadable/link_purchased')->load($orderItem->getId(), 'order_item_id')->getId()) { return $this; } - $product = Mage::getModel('catalog/product') - ->setStoreId($orderItem->getOrder()->getStoreId()) - ->load($orderItem->getProductId()); + if (!$product) { + $product = Mage::getModel('catalog/product') + ->setStoreId($orderItem->getOrder()->getStoreId()) + ->load($orderItem->getProductId()); + } if ($product->getTypeId() == Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE) { $links = $product->getTypeInstance(true)->getLinks($product); if ($linkIds = $orderItem->getProductOptionByCode('links')) { diff --git a/app/code/core/Mage/Downloadable/Model/Product/Price.php b/app/code/core/Mage/Downloadable/Model/Product/Price.php index 6ecb5be455..e3f44d5f32 100644 --- a/app/code/core/Mage/Downloadable/Model/Product/Price.php +++ b/app/code/core/Mage/Downloadable/Model/Product/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/Product/Type.php b/app/code/core/Mage/Downloadable/Model/Product/Type.php index 6e9e00a9df..e8810a25b2 100644 --- a/app/code/core/Mage/Downloadable/Model/Product/Type.php +++ b/app/code/core/Mage/Downloadable/Model/Product/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Abstract.php b/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Abstract.php index a3769a52a8..dbbd3d987b 100644 --- a/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Abstract.php +++ b/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php b/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php index e8b2c9c582..e003c32b46 100644 --- a/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php +++ b/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php b/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php index 596a1d1cfc..069c06fdfc 100644 --- a/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php +++ b/app/code/core/Mage/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/Sample.php b/app/code/core/Mage/Downloadable/Model/Sample.php index e0e17a48d1..76f15d54b0 100644 --- a/app/code/core/Mage/Downloadable/Model/Sample.php +++ b/app/code/core/Mage/Downloadable/Model/Sample.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/System/Config/Source/Contentdisposition.php b/app/code/core/Mage/Downloadable/Model/System/Config/Source/Contentdisposition.php index 99fe0edd41..a67c63615b 100644 --- a/app/code/core/Mage/Downloadable/Model/System/Config/Source/Contentdisposition.php +++ b/app/code/core/Mage/Downloadable/Model/System/Config/Source/Contentdisposition.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/Model/System/Config/Source/Orderitemstatus.php b/app/code/core/Mage/Downloadable/Model/System/Config/Source/Orderitemstatus.php index 67c3eda1e0..234cbb8c93 100644 --- a/app/code/core/Mage/Downloadable/Model/System/Config/Source/Orderitemstatus.php +++ b/app/code/core/Mage/Downloadable/Model/System/Config/Source/Orderitemstatus.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/controllers/CustomerController.php b/app/code/core/Mage/Downloadable/controllers/CustomerController.php index 9c0d8ff62d..652e703cc0 100644 --- a/app/code/core/Mage/Downloadable/controllers/CustomerController.php +++ b/app/code/core/Mage/Downloadable/controllers/CustomerController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/controllers/DownloadController.php b/app/code/core/Mage/Downloadable/controllers/DownloadController.php index 7b93f1b0ae..cbb040fc21 100644 --- a/app/code/core/Mage/Downloadable/controllers/DownloadController.php +++ b/app/code/core/Mage/Downloadable/controllers/DownloadController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -112,7 +112,7 @@ public function sampleAction() $this->_processDownload($resource, $resourceType); exit(0); } catch (Mage_Core_Exception $e) { - $this->_getSession()->addError(Mage::helper('downloadable')->__('Sorry, there was an error getting requested content. Please contact store owner.')); + $this->_getSession()->addError(Mage::helper('downloadable')->__('An error occurred while getting requested content. Please contact the store owner.')); } } return $this->_redirectReferer(); @@ -142,7 +142,7 @@ public function linkSampleAction() $this->_processDownload($resource, $resourceType); exit(0); } catch (Mage_Core_Exception $e) { - $this->_getCustomerSession()->addError(Mage::helper('downloadable')->__('Sorry, there was an error getting requested content. Please contact store owner.')); + $this->_getCustomerSession()->addError(Mage::helper('downloadable')->__('An error occurred while getting requested content. Please contact the store owner.')); } } return $this->_redirectReferer(); @@ -156,7 +156,7 @@ public function linkAction() $id = $this->getRequest()->getParam('id', 0); $linkPurchasedItem = Mage::getModel('downloadable/link_purchased_item')->load($id, 'link_hash'); if (! $linkPurchasedItem->getId() ) { - $this->_getCustomerSession()->addNotice(Mage::helper('downloadable')->__("Requested link doesn't exist.")); + $this->_getCustomerSession()->addNotice(Mage::helper('downloadable')->__("Requested link does not exist.")); return $this->_redirect('*/customer/products'); } if (!Mage::helper('downloadable')->getIsShareable($linkPurchasedItem)) { @@ -178,7 +178,7 @@ public function linkAction() } $linkPurchased = Mage::getModel('downloadable/link_purchased')->load($linkPurchasedItem->getPurchasedId()); if ($linkPurchased->getCustomerId() != $customerId) { - $this->_getCustomerSession()->addNotice(Mage::helper('downloadable')->__("Requested link doesn't exist.")); + $this->_getCustomerSession()->addNotice(Mage::helper('downloadable')->__("Requested link does not exist.")); return $this->_redirect('*/customer/products'); } } @@ -210,16 +210,16 @@ public function linkAction() } catch (Exception $e) { $this->_getCustomerSession()->addError( - Mage::helper('downloadable')->__('Sorry, there was an error getting requested content. Please contact store owner.') + Mage::helper('downloadable')->__('An error occurred while getting the requested content. Please contact the store owner.') ); } } elseif ($linkPurchasedItem->getStatus() == Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_EXPIRED) { - $this->_getCustomerSession()->addNotice(Mage::helper('downloadable')->__('Link has expired.')); + $this->_getCustomerSession()->addNotice(Mage::helper('downloadable')->__('The link has expired.')); } elseif ($linkPurchasedItem->getStatus() == Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_PENDING) { - $this->_getCustomerSession()->addNotice(Mage::helper('downloadable')->__('Link is not available.')); + $this->_getCustomerSession()->addNotice(Mage::helper('downloadable')->__('The link is not available.')); } else { $this->_getCustomerSession()->addError( - Mage::helper('downloadable')->__('Sorry, there was an error getting requested content. Please contact store owner.') + Mage::helper('downloadable')->__('An error occurred while getting the requested content. Please contact the store owner.') ); } return $this->_redirect('*/customer/products'); diff --git a/app/code/core/Mage/Downloadable/controllers/FileController.php b/app/code/core/Mage/Downloadable/controllers/FileController.php index 495518c481..e9b0b2fd65 100644 --- a/app/code/core/Mage/Downloadable/controllers/FileController.php +++ b/app/code/core/Mage/Downloadable/controllers/FileController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/controllers/Product/EditController.php b/app/code/core/Mage/Downloadable/controllers/Product/EditController.php index 68c52aab6e..c96337e08b 100644 --- a/app/code/core/Mage/Downloadable/controllers/Product/EditController.php +++ b/app/code/core/Mage/Downloadable/controllers/Product/EditController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -121,7 +121,7 @@ public function linkAction() try { $this->_processDownload($resource, $resourceType); } catch (Mage_Core_Exception $e) { - $this->_getCustomerSession()->addError(Mage::helper('downloadable')->__('Sorry, there was an error getting requested content')); + $this->_getCustomerSession()->addError(Mage::helper('downloadable')->__('An error occurred while getting the requested content.')); } } } diff --git a/app/code/core/Mage/Downloadable/etc/adminhtml.xml b/app/code/core/Mage/Downloadable/etc/adminhtml.xml index 1a50c750ed..f7e6a7e7c8 100644 --- a/app/code/core/Mage/Downloadable/etc/adminhtml.xml +++ b/app/code/core/Mage/Downloadable/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Downloadable/etc/config.xml b/app/code/core/Mage/Downloadable/etc/config.xml index 777697868e..b0e0e5981b 100644 --- a/app/code/core/Mage/Downloadable/etc/config.xml +++ b/app/code/core/Mage/Downloadable/etc/config.xml @@ -21,14 +21,14 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - 0.1.16 + 1.4.0.1 @@ -94,6 +94,12 @@ downloadable_link_purchased_item
      + + catalog_product_index_price_downlod_idx
      +
      + + catalog_product_index_price_downlod_tmp
      +
      diff --git a/app/code/core/Mage/Downloadable/etc/system.xml b/app/code/core/Mage/Downloadable/etc/system.xml index 85a457ff8d..f0918e1150 100644 --- a/app/code/core/Mage/Downloadable/etc/system.xml +++ b/app/code/core/Mage/Downloadable/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -38,7 +38,7 @@ 1 - + select downloadable/system_config_source_orderitemstatus 100 @@ -98,14 +98,14 @@ 1 - + select adminhtml/system_config_source_yesno 800 1 1 0 - Guest checkout will only work with shareable + Guest checkout will only work with shareable. diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-install-0.1.0.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-install-0.1.0.php index 955322a54c..a6121095f2 100644 --- a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-install-0.1.0.php +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-install-0.1.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-install-1.4.0.0.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-install-1.4.0.0.php new file mode 100644 index 0000000000..339d1323ff --- /dev/null +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-install-1.4.0.0.php @@ -0,0 +1,262 @@ +startSetup(); + +$installer->run(" +CREATE TABLE `{$installer->getTable('downloadable_link')}` ( + `link_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `product_id` int(10) unsigned NOT NULL DEFAULT '0', + `sort_order` int(10) unsigned NOT NULL DEFAULT '0', + `number_of_downloads` int(10) unsigned DEFAULT NULL, + `is_shareable` smallint(1) unsigned NOT NULL DEFAULT '0', + `link_url` varchar(255) NOT NULL DEFAULT '', + `link_file` varchar(255) NOT NULL DEFAULT '', + `link_type` varchar(20) NOT NULL DEFAULT '', + `sample_url` varchar(255) NOT NULL DEFAULT '', + `sample_file` varchar(255) NOT NULL DEFAULT '', + `sample_type` varchar(20) NOT NULL DEFAULT '', + PRIMARY KEY (`link_id`), + KEY `DOWNLODABLE_LINK_PRODUCT` (`product_id`), + KEY `DOWNLODABLE_LINK_PRODUCT_SORT_ORDER` (`product_id`,`sort_order`), + CONSTRAINT `FK_DOWNLODABLE_LINK_PRODUCT` FOREIGN KEY (`product_id`) + REFERENCES `{$installer->getTable('catalog_product_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('downloadable_link_price')}` ( + `price_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `link_id` int(10) unsigned NOT NULL DEFAULT '0', + `website_id` smallint(5) unsigned NOT NULL DEFAULT '0', + `price` decimal(12,4) NOT NULL DEFAULT '0.0000', + PRIMARY KEY (`price_id`), + KEY `DOWNLOADABLE_LINK_PRICE_LINK` (`link_id`), + KEY `DOWNLOADABLE_LINK_PRICE_WEBSITE` (`website_id`), + CONSTRAINT `FK_DOWNLOADABLE_LINK_PRICE_WEBSITE` FOREIGN KEY (`website_id`) + REFERENCES `{$installer->getTable('core_website')}` (`website_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `FK_DOWNLOADABLE_LINK_PRICE_LINK` FOREIGN KEY (`link_id`) + REFERENCES `{$installer->getTable('downloadable_link')}` (`link_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('downloadable_link_purchased')}` ( + `purchased_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `order_id` int(10) unsigned NOT NULL DEFAULT '0', + `order_increment_id` varchar(50) NOT NULL DEFAULT '', + `order_item_id` int(10) unsigned NOT NULL DEFAULT '0', + `created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `customer_id` int(10) unsigned NOT NULL DEFAULT '0', + `product_name` varchar(255) NOT NULL DEFAULT '', + `product_sku` varchar(255) NOT NULL DEFAULT '', + `link_section_title` varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (`purchased_id`), + KEY `DOWNLOADABLE_ORDER_ID` (`order_id`), + KEY `DOWNLOADABLE_CUSTOMER_ID` (`customer_id`), + KEY `KEY_DOWNLOADABLE_ORDER_ITEM_ID` (`order_item_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('downloadable_link_purchased_item')}` ( + `item_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `purchased_id` int(10) unsigned NOT NULL DEFAULT '0', + `order_item_id` int(10) unsigned NOT NULL DEFAULT '0', + `product_id` int(10) unsigned DEFAULT '0', + `link_hash` varchar(255) NOT NULL DEFAULT '', + `number_of_downloads_bought` int(10) unsigned NOT NULL DEFAULT '0', + `number_of_downloads_used` int(10) unsigned NOT NULL DEFAULT '0', + `link_id` int(20) unsigned NOT NULL DEFAULT '0', + `link_title` varchar(255) NOT NULL DEFAULT '', + `is_shareable` smallint(1) unsigned NOT NULL DEFAULT '0', + `link_url` varchar(255) NOT NULL DEFAULT '', + `link_file` varchar(255) NOT NULL DEFAULT '', + `link_type` varchar(255) NOT NULL DEFAULT '', + `status` varchar(50) NOT NULL DEFAULT '', + `created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`item_id`), + KEY `DOWNLOADABLE_LINK_PURCHASED_ID` (`purchased_id`), + KEY `DOWNLOADABLE_ORDER_ITEM_ID` (`order_item_id`), + KEY `DOWNLOADALBE_LINK_HASH` (`link_hash`), + CONSTRAINT `FK_DOWNLOADABLE_LINK_PURCHASED_ID` FOREIGN KEY (`purchased_id`) + REFERENCES `{$installer->getTable('downloadable_link_purchased')}` (`purchased_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('downloadable_link_title')}` ( + `title_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `link_id` int(10) unsigned NOT NULL DEFAULT '0', + `store_id` smallint(5) unsigned NOT NULL DEFAULT '0', + `title` varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (`title_id`), + UNIQUE KEY `UNQ_LINK_TITLE_STORE` (`link_id`,`store_id`), + KEY `DOWNLOADABLE_LINK_TITLE_LINK` (`link_id`), + KEY `DOWNLOADABLE_LINK_TITLE_STORE` (`store_id`), + CONSTRAINT `FK_DOWNLOADABLE_LINK_TITLE_LINK` FOREIGN KEY (`link_id`) + REFERENCES `{$installer->getTable('downloadable_link')}` (`link_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `FK_DOWNLOADABLE_LINK_TITLE_STORE` FOREIGN KEY (`store_id`) + REFERENCES `{$installer->getTable('core_store')}` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('downloadable_sample')}` ( + `sample_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `product_id` int(10) unsigned NOT NULL DEFAULT '0', + `sample_url` varchar(255) NOT NULL DEFAULT '', + `sample_file` varchar(255) NOT NULL DEFAULT '', + `sample_type` varchar(20) NOT NULL DEFAULT '', + `sort_order` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`sample_id`), + KEY `DOWNLODABLE_SAMPLE_PRODUCT` (`product_id`), + CONSTRAINT `FK_DOWNLODABLE_SAMPLE_PRODUCT` FOREIGN KEY (`product_id`) + REFERENCES `{$installer->getTable('catalog_product_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('downloadable_sample_title')}` ( + `title_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `sample_id` int(10) unsigned NOT NULL DEFAULT '0', + `store_id` smallint(5) unsigned NOT NULL DEFAULT '0', + `title` varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (`title_id`), + UNIQUE KEY `UNQ_SAMPLE_TITLE_STORE` (`sample_id`,`store_id`), + KEY `DOWNLOADABLE_SAMPLE_TITLE_SAMPLE` (`sample_id`), + KEY `DOWNLOADABLE_SAMPLE_TITLE_STORE` (`store_id`), + CONSTRAINT `FK_DOWNLOADABLE_SAMPLE_TITLE_SAMPLE` FOREIGN KEY (`sample_id`) + REFERENCES `{$installer->getTable('downloadable_sample')}` (`sample_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `FK_DOWNLOADABLE_SAMPLE_TITLE_STORE` FOREIGN KEY (`store_id`) + REFERENCES `{$installer->getTable('core_store')}` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + + +$fieldList = array( + 'price', + 'special_price', + 'special_from_date', + 'special_to_date', + 'minimal_price', + 'cost', + 'tier_price', + 'tax_class_id' +); + +// make these attributes applicable to downloadable products +foreach ($fieldList as $field) { + $applyTo = explode(',', $installer->getAttribute('catalog_product', $field, 'apply_to')); + if (!in_array('downloadable', $applyTo)) { + $applyTo[] = 'downloadable'; + $installer->updateAttribute('catalog_product', $field, 'apply_to', join(',', $applyTo)); + } +} + +$installer->addAttribute('catalog_product', 'links_purchased_separately', array( + 'type' => 'int', + 'backend' => '', + 'frontend' => '', + 'label' => 'Links can be purchased separately', + 'input' => '', + 'class' => '', + 'source' => '', + 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, + 'visible' => false, + 'required' => true, + 'user_defined' => false, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'unique' => false, + 'apply_to' => 'downloadable', + 'is_configurable' => false +)); + +$installer->addAttribute('catalog_product', 'samples_title', array( + 'type' => 'varchar', + 'backend' => '', + 'frontend' => '', + 'label' => 'Samples title', + 'input' => '', + 'class' => '', + 'source' => '', + 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, + 'visible' => false, + 'required' => true, + 'user_defined' => false, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'unique' => false, + 'apply_to' => 'downloadable', + 'is_configurable' => false +)); + +$installer->addAttribute('catalog_product', 'links_title', array( + 'type' => 'varchar', + 'backend' => '', + 'frontend' => '', + 'label' => 'Links title', + 'input' => '', + 'class' => '', + 'source' => '', + 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, + 'visible' => false, + 'required' => true, + 'user_defined' => false, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'unique' => false, + 'apply_to' => 'downloadable', + 'is_configurable' => false +)); + +$installer->addAttribute('catalog_product', 'links_exist', array( + 'type' => 'int', + 'backend' => '', + 'frontend' => '', + 'label' => '', + 'input' => '', + 'class' => '', + 'source' => '', + 'global' => true, + 'visible' => false, + 'required' => false, + 'user_defined' => false, + 'default' => '0', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'unique' => false, + 'apply_to' => 'downloadable', + 'is_configurable' => false, + 'used_in_product_listing' => 1 +)); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.0-0.1.1.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.0-0.1.1.php index f1032f9463..4edd26c0bf 100644 --- a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.0-0.1.1.php +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.0-0.1.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.1-0.1.2.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.1-0.1.2.php index 58231e1f10..769658b438 100644 --- a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.1-0.1.2.php +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.1-0.1.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.10-0.1.11.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.10-0.1.11.php index ad43746b91..5959f16948 100644 --- a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.10-0.1.11.php +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.10-0.1.11.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.11-0.1.12.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.11-0.1.12.php index 7052a26d8b..a34186dba9 100644 --- a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.11-0.1.12.php +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.11-0.1.12.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.12-0.1.13.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.12-0.1.13.php index f759efbae2..08310f0311 100644 --- a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.12-0.1.13.php +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.12-0.1.13.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.13-0.1.14.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.13-0.1.14.php index 846457a75d..a47ef4ff26 100644 --- a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.13-0.1.14.php +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.13-0.1.14.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.14-0.1.15.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.14-0.1.15.php index 456ce7706d..42453fb815 100644 --- a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.14-0.1.15.php +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.14-0.1.15.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.15-0.1.16.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.15-0.1.16.php index c67bb66ff6..470ad0606d 100644 --- a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.15-0.1.16.php +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.15-0.1.16.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.2-0.1.3.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.2-0.1.3.php index fa133af509..eabc4d88cc 100644 --- a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.2-0.1.3.php +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.2-0.1.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.3-0.1.4.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.3-0.1.4.php index a3068f464e..e23bc997dc 100644 --- a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.3-0.1.4.php +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.3-0.1.4.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.4-0.1.5.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.4-0.1.5.php index 1eb67c3a67..51e0bb455b 100644 --- a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.4-0.1.5.php +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.4-0.1.5.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.5-0.1.6.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.5-0.1.6.php index 5a09b60604..40ece3d566 100644 --- a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.5-0.1.6.php +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.5-0.1.6.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.6-0.1.7.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.6-0.1.7.php index 12e1c034a9..cd9bf09909 100644 --- a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.6-0.1.7.php +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.6-0.1.7.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.7-0.1.8.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.7-0.1.8.php index 75147cc052..3318a261ff 100644 --- a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.7-0.1.8.php +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.7-0.1.8.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.8-0.1.9.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.8-0.1.9.php index 14d67203e2..c8ef9926e8 100644 --- a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.8-0.1.9.php +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.8-0.1.9.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.9-0.1.10.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.9-0.1.10.php index 1953f5d98c..7defd31f33 100644 --- a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.9-0.1.10.php +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-0.1.9-0.1.10.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Downloadable - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-1.3.9-1.4.0.0.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-1.3.9-1.4.0.0.php new file mode 100644 index 0000000000..726341622b --- /dev/null +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-1.3.9-1.4.0.0.php @@ -0,0 +1,49 @@ +startSetup(); + +// Remove sales foreign keys +$installer->getConnection()->dropForeignKey( + $installer->getTable('downloadable_link_purchased'), + 'FK_DOWNLOADABLE_ORDER_ID' +); + +$installer->getConnection()->dropForeignKey( + $installer->getTable('downloadable_link_purchased'), + 'FK_DOWNLOADABLE_PURCHASED_ORDER_ITEM_ID' +); + +$installer->getConnection()->dropForeignKey( + $installer->getTable('downloadable_link_purchased_item'), + 'FK_DOWNLOADABLE_ORDER_ITEM_ID' +); + + +$installer->endSetup(); diff --git a/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php new file mode 100644 index 0000000000..5b0ef6c29c --- /dev/null +++ b/app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php @@ -0,0 +1,53 @@ +startSetup(); +$installer->run(" +DROP TABLE IF EXISTS `{$installer->getTable('catalog/product_index_price')}_downloadable_idx`; + +CREATE TABLE `{$installer->getTable('downloadable/product_price_indexer_idx')}` ( + `entity_id` int(10) unsigned NOT NULL, + `customer_group_id` smallint(5) unsigned NOT NULL, + `website_id` smallint(5) unsigned NOT NULL, + `min_price` decimal(12,4) default NULL, + `max_price` decimal(12,4) default NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('downloadable/product_price_indexer_tmp')}` ( + `entity_id` int(10) unsigned NOT NULL, + `customer_group_id` smallint(5) unsigned NOT NULL, + `website_id` smallint(5) unsigned NOT NULL, + `min_price` decimal(12,4) default NULL, + `max_price` decimal(12,4) default NULL, + PRIMARY KEY (`entity_id`,`customer_group_id`,`website_id`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8; + +"); +$installer->endSetup(); diff --git a/app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Js.php b/app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Js.php index 01b584bc2b..a4360e61f0 100644 --- a/app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Js.php +++ b/app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Js.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Main/Abstract.php b/app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Main/Abstract.php index 68ff057750..82274a240b 100644 --- a/app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Main/Abstract.php +++ b/app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Main/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -99,15 +99,15 @@ protected function _prepareForm() $fieldset->addField('default_value_text', 'text', array( 'name' => 'default_value_text', - 'label' => Mage::helper('eav')->__('Default value'), - 'title' => Mage::helper('eav')->__('Default value'), + 'label' => Mage::helper('eav')->__('Default Value'), + 'title' => Mage::helper('eav')->__('Default Value'), 'value' => $attributeObject->getDefaultValue(), )); $fieldset->addField('default_value_yesno', 'select', array( 'name' => 'default_value_yesno', - 'label' => Mage::helper('eav')->__('Default value'), - 'title' => Mage::helper('eav')->__('Default value'), + 'label' => Mage::helper('eav')->__('Default Value'), + 'title' => Mage::helper('eav')->__('Default Value'), 'values' => $yesno, 'value' => $attributeObject->getDefaultValue(), )); @@ -115,8 +115,8 @@ protected function _prepareForm() $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT); $fieldset->addField('default_value_date', 'date', array( 'name' => 'default_value_date', - 'label' => Mage::helper('eav')->__('Default value'), - 'title' => Mage::helper('eav')->__('Default value'), + 'label' => Mage::helper('eav')->__('Default Value'), + 'title' => Mage::helper('eav')->__('Default Value'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'value' => $attributeObject->getDefaultValue(), 'format' => $dateFormatIso @@ -124,8 +124,8 @@ protected function _prepareForm() $fieldset->addField('default_value_textarea', 'textarea', array( 'name' => 'default_value_textarea', - 'label' => Mage::helper('eav')->__('Default value'), - 'title' => Mage::helper('eav')->__('Default value'), + 'label' => Mage::helper('eav')->__('Default Value'), + 'title' => Mage::helper('eav')->__('Default Value'), 'value' => $attributeObject->getDefaultValue(), )); diff --git a/app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Options/Abstract.php b/app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Options/Abstract.php index ef78e45705..0df6153f14 100644 --- a/app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Options/Abstract.php +++ b/app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Options/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Grid/Abstract.php b/app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Grid/Abstract.php index 717f293c4b..1c0432c1d1 100644 --- a/app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Grid/Abstract.php +++ b/app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Grid/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Exception.php b/app/code/core/Mage/Eav/Exception.php index 92253aba09..04092a3b6a 100644 --- a/app/code/core/Mage/Eav/Exception.php +++ b/app/code/core/Mage/Eav/Exception.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Helper/Data.php b/app/code/core/Mage/Eav/Helper/Data.php index d166d909b3..4d777a32cf 100644 --- a/app/code/core/Mage/Eav/Helper/Data.php +++ b/app/code/core/Mage/Eav/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -59,7 +59,7 @@ protected function _getDefaultFrontendClasses() ), array( 'value' => 'validate-url', - 'label' => Mage::helper('eav')->__('Url') + 'label' => Mage::helper('eav')->__('URL') ), array( 'value' => 'validate-alpha', @@ -67,7 +67,7 @@ protected function _getDefaultFrontendClasses() ), array( 'value' => 'validate-alphanum', - 'label' => Mage::helper('eav')->__('Letters(a-zA-Z) or Numbers(0-9)') + 'label' => Mage::helper('eav')->__('Letters (a-z, A-Z) or Numbers (0-9)') ) ); } diff --git a/app/code/core/Mage/Eav/Model/Adminhtml/System/Config/Source/Inputtype.php b/app/code/core/Mage/Eav/Model/Adminhtml/System/Config/Source/Inputtype.php index d116ad3ba3..a134bee807 100644 --- a/app/code/core/Mage/Eav/Model/Adminhtml/System/Config/Source/Inputtype.php +++ b/app/code/core/Mage/Eav/Model/Adminhtml/System/Config/Source/Inputtype.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Eav_Model_Adminhtml_System_Config_Source_Inputtype diff --git a/app/code/core/Mage/Eav/Model/Config.php b/app/code/core/Mage/Eav/Model/Config.php index 638a7d961d..ee224c9988 100644 --- a/app/code/core/Mage/Eav/Model/Config.php +++ b/app/code/core/Mage/Eav/Model/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -354,7 +354,7 @@ protected function _initAttributes($entityType) Varien_Profiler::start('EAV: '.__METHOD__); $attributesInfo = Mage::getResourceModel('eav/entity_attribute_collection') - ->setEntityTypeFilter($entityType->getId()) + ->setEntityTypeFilter($entityType) // ->addSetInfo() ->getData(); @@ -434,6 +434,11 @@ public function getAttribute($entityType, $code) } if ($attribute) { + $entity = $entityType->getEntity(); + if ($entity && in_array($attribute->getAttributeCode(), $entity->getDefaultAttributes())) { + $attribute->setBackendType(Mage_Eav_Model_Entity_Attribute_Abstract::TYPE_STATIC) + ->setIsGlobal(1); + } $attribute->setEntityType($entityType) ->setEntityTypeId($entityType->getId()); $this->_addAttributeReference($attribute->getId(), $attribute->getAttributeCode(), $entityTypeCode); @@ -469,7 +474,7 @@ public function getEntityAttributeCodes($entityType, $object=null) if ($attributeSetId) { $attributesInfo = Mage::getResourceModel('eav/entity_attribute_collection') - ->setEntityTypeFilter($entityType->getId()) + ->setEntityTypeFilter($entityType) ->setAttributeSetFilter($attributeSetId) // ->addSetInfo() ->addStoreLabel($storeId) @@ -519,7 +524,7 @@ public function preloadAttributes($entityType, $attributes) Varien_Profiler::start('EAV: '.__METHOD__ . ':'.$entityTypeCode); $attributesInfo = Mage::getResourceModel('eav/entity_attribute_collection') - ->setEntityTypeFilter($entityType->getId()) + ->setEntityTypeFilter($entityType) ->setCodeFilter($attributes) // ->addSetInfo() ->getData(); @@ -533,7 +538,7 @@ public function preloadAttributes($entityType, $attributes) $codes = array(); foreach ($attributesInfo as $attribute) { - if (!isset($attribute['attribute_model'])) { + if (empty($attribute['attribute_model'])) { $attribute['attribute_model'] = $entityType->getAttributeModel(); } @@ -612,7 +617,7 @@ public function loadCollectionAttributes($entityType, $attributes) $attributeCollection = $entityType->getEntityAttributeCollection(); $attributesInfo = Mage::getResourceModel($attributeCollection) ->useLoadDataFields() - ->setEntityTypeFilter($entityType->getId()) + ->setEntityTypeFilter($entityType) ->setCodeFilter($attributes) ->getData(); @@ -646,7 +651,7 @@ protected function _createAttribute($entityType, $attributeData) } } - if (isset($attributeData['attribute_model'])) { + if (!empty($attributeData['attribute_model'])) { $model = $attributeData['attribute_model']; } else { diff --git a/app/code/core/Mage/Eav/Model/Convert/Adapter/Entity.php b/app/code/core/Mage/Eav/Model/Convert/Adapter/Entity.php index d6484732ab..638b146ac3 100644 --- a/app/code/core/Mage/Eav/Model/Convert/Adapter/Entity.php +++ b/app/code/core/Mage/Eav/Model/Convert/Adapter/Entity.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -299,13 +299,13 @@ public function save() { $collection = $this->getData(); if ($collection instanceof Mage_Eav_Model_Entity_Collection_Abstract) { - $this->addException(Mage::helper('eav')->__('Entity collections expected'), Varien_Convert_Exception::FATAL); + $this->addException(Mage::helper('eav')->__('Entity collections expected.'), Varien_Convert_Exception::FATAL); } $this->addException($collection->getSize().' records found.'); if (!$collection instanceof Mage_Eav_Model_Entity_Collection_Abstract) { - $this->addException(Mage::helper('eav')->__('Entity collection expected'), Varien_Convert_Exception::FATAL); + $this->addException(Mage::helper('eav')->__('Entity collection expected.'), Varien_Convert_Exception::FATAL); } try { $i = 0; @@ -313,7 +313,7 @@ public function save() $model->save(); $i++; } - $this->addException(Mage::helper('eav')->__("Saved ".$i." record(s)")); + $this->addException(Mage::helper('eav')->__("Saved %d record(s).", $i)); } catch (Varien_Convert_Exception $e) { throw $e; diff --git a/app/code/core/Mage/Eav/Model/Convert/Adapter/Grid.php b/app/code/core/Mage/Eav/Model/Convert/Adapter/Grid.php index 6cf8166f6e..81a4bd0b13 100644 --- a/app/code/core/Mage/Eav/Model/Convert/Adapter/Grid.php +++ b/app/code/core/Mage/Eav/Model/Convert/Adapter/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -48,7 +48,7 @@ public function load() $collection = Mage::getResourceModel($this->getEntity().'_collection'); $collection->load(); } catch (Exception $e) { - $this->addException(Mage::helper('eav')->__('Problem loading the collection, aborting. Error: %s', $e->getMessage()), Varien_Convert_Exception::FATAL); + $this->addException(Mage::helper('eav')->__('An error occurred while loading the collection, aborting. Error: %s', $e->getMessage()), Varien_Convert_Exception::FATAL); } $data = array(); @@ -69,17 +69,17 @@ public function save() $entity->load($row['entity_id']); $this->setPosition('Line: '.$i.(isset($row['entity_id']) ? ', entity_id: '.$row['entity_id'] : '')); } catch (Exception $e) { - $this->addException(Mage::helper('eav')->__('Problem loading a record, aborting. Error: %s', $e->getMessage()), Varien_Convert_Exception::FATAL); + $this->addException(Mage::helper('eav')->__('An error occurred while loading a record, aborting. Error: %s', $e->getMessage()), Varien_Convert_Exception::FATAL); } if (!$entity->getId()) { - $this->addException(Mage::helper('eav')->__('Invalid entity_id, skipping the record'), Varien_Convert_Exception::ERROR); + $this->addException(Mage::helper('eav')->__('Invalid entity_id, skipping the record.'), Varien_Convert_Exception::ERROR); continue; } } try { $entity->addData($row)->save(); } catch (Exception $e) { - $this->addException(Mage::helper('eav')->__('Problem saving a record, aborting. Error: ', $e->getMessage()), Varien_Convert_Exception::FATAL); + $this->addException(Mage::helper('eav')->__('An error occurred while saving a record, aborting. Error: ', $e->getMessage()), Varien_Convert_Exception::FATAL); } } return $this; diff --git a/app/code/core/Mage/Eav/Model/Convert/Parser/Abstract.php b/app/code/core/Mage/Eav/Model/Convert/Parser/Abstract.php index a43100a983..2b9969b68a 100644 --- a/app/code/core/Mage/Eav/Model/Convert/Parser/Abstract.php +++ b/app/code/core/Mage/Eav/Model/Convert/Parser/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity.php b/app/code/core/Mage/Eav/Model/Entity.php index 1b421051fe..e233d63f7f 100644 --- a/app/code/core/Mage/Eav/Model/Entity.php +++ b/app/code/core/Mage/Eav/Model/Entity.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Abstract.php b/app/code/core/Mage/Eav/Model/Entity/Abstract.php index d7ed44188a..7c5a6b30e3 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Abstract.php +++ b/app/code/core/Mage/Eav/Model/Entity/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -158,11 +158,11 @@ abstract class Mage_Eav_Model_Entity_Abstract /** * Set connections for entity operations * - * @param Zend_Db_Adapter_Abstract $read - * @param Zend_Db_Adapter_Abstract $write + * @param Zend_Db_Adapter_Abstract|string $read + * @param Zend_Db_Adapter_Abstract|string|null $write * @return Mage_Eav_Model_Entity_Abstract */ - public function setConnection(Zend_Db_Adapter_Abstract $read, Zend_Db_Adapter_Abstract $write=null) + public function setConnection($read, $write=null) { $this->_read = $read; $this->_write = $write ? $write : $read; @@ -184,6 +184,9 @@ protected function _construct() */ protected function _getReadAdapter() { + if (is_string($this->_read)) { + $this->_read = Mage::getSingleton('core/resource')->getConnection($this->_read); + } return $this->_read; } @@ -194,6 +197,9 @@ protected function _getReadAdapter() */ protected function _getWriteAdapter() { + if (is_string($this->_write)) { + $this->_write = Mage::getSingleton('core/resource')->getConnection($this->_write); + } return $this->_write; } @@ -261,7 +267,7 @@ public function setType($type) public function getEntityType() { if (empty($this->_type)) { - throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Entity is not initialized')); + throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Entity is not initialized.')); } return $this->_type; } @@ -309,7 +315,7 @@ public function unsetAttributes($attributes=null) } if (!is_array($attributes)) { - throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Unknown parameter')); + throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Unknown parameter.')); } foreach ($attributes as $attrCode) { @@ -474,7 +480,8 @@ public function loadAllAttributes($object=null) } else { $attribute = Mage::getModel($this->getEntityType()->getAttributeModel()); $attribute->setAttributeCode($attributeCode) - ->setBackendType('static') + ->setBackendType(Mage_Eav_Model_Entity_Attribute_Abstract::TYPE_STATIC) + ->setIsGlobal(1) ->setEntityType($this->getEntityType()) ->setEntityTypeId($this->getEntityType()->getId()); $this->addAttribute($attribute); @@ -784,11 +791,17 @@ public function checkAttributeUniqueValue(Mage_Eav_Model_Entity_Attribute_Abstra ->where('entity_type_id=?', $this->getTypeId()) ->where($attribute->getAttributeCode().'=?', $object->getData($attribute->getAttributeCode())); } else { + $value = $object->getData($attribute->getAttributeCode()); + if ($attribute->getBackend()->getType() == 'datetime'){ + $date = new Zend_Date($value); + $value = $date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT); + } + $select = $this->_getWriteAdapter()->select() ->from($attribute->getBackend()->getTable(), $attribute->getBackend()->getEntityIdField()) ->where('entity_type_id=?', $this->getTypeId()) ->where('attribute_id=?', $attribute->getId()) - ->where('value=?', $object->getData($attribute->getAttributeCode())); + ->where('value=?', $value); } $data = $this->_getWriteAdapter()->fetchCol($select); @@ -846,14 +859,17 @@ public function load($object, $entityId, $attributes=array()) * Load data for entity attributes */ Varien_Profiler::start('__EAV_LOAD_MODEL_ATTRIBUTES__'); + $selects = array(); foreach ($this->getAttributesByTable() as $table=>$attributes) { - $select = $this->_getLoadAttributesSelect($object, $table); - $values = $this->_getReadAdapter()->fetchAll($select); - + $selects[] = $this->_getLoadAttributesSelect($object, $table); + } + if (!empty($selects)) { + $values = $this->_getReadAdapter()->fetchAll(implode(' UNION ', $selects)); foreach ($values as $valueRow) { $this->_setAttribteValue($object, $valueRow); } } + Varien_Profiler::stop('__EAV_LOAD_MODEL_ATTRIBUTES__'); $object->setOrigData(); @@ -874,7 +890,7 @@ public function load($object, $entityId, $attributes=array()) */ protected function _getLoadRowSelect($object, $rowId) { - $select = $this->_read->select() + $select = $this->_getReadAdapter()->select() ->from($this->getEntityTable()) ->where($this->getEntityIdField()."=?", $rowId); @@ -890,7 +906,7 @@ protected function _getLoadRowSelect($object, $rowId) */ protected function _getLoadAttributesSelect($object, $table) { - $select = $this->_read->select() + $select = $this->_getReadAdapter()->select() ->from($table) ->where($this->getEntityIdField() . '=?', $object->getId()); return $select; @@ -1339,7 +1355,7 @@ public function saveAttribute(Varien_Object $object, $attributeCode) $whereArr = array(); foreach ($row as $field => $value) { - $whereArr[] = $this->_read->quoteInto("$field=?", $value); + $whereArr[] = $this->_getReadAdapter()->quoteInto("$field=?", $value); } $where = '('.join(') AND (', $whereArr).')'; diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute.php b/app/code/core/Mage/Eav/Model/Entity/Attribute.php index 0fa1231ae1..cbea42e9c7 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -98,7 +98,7 @@ protected function _beforeSave() // prevent overriding product data if (isset($this->_data['attribute_code']) && Mage::getModel('catalog/product')->isReservedAttribute($this)) { - Mage::throwException(Mage::helper('eav')->__('The attribute code \'%s\' is reserved by system. Please, try another attribute code.', $this->_data['attribute_code'])); + Mage::throwException(Mage::helper('eav')->__('The attribute code \'%s\' is reserved by system. Please try another attribute code.', $this->_data['attribute_code'])); } if ($this->getBackendType() == 'datetime') { @@ -117,7 +117,7 @@ protected function _beforeSave() $defaultValue = Mage::app()->getLocale()->date($defaultValue, $format, null, false)->toValue(); $this->setDefaultValue($defaultValue); } catch (Exception $e) { - throw new Exception("Invalid default date."); + throw new Exception('Invalid default date.'); } } } @@ -141,7 +141,7 @@ protected function _afterSave() protected function _beforeDelete() { if ($this->_getResource()->isUsedBySuperProducts($this)) { - Mage::throwException(Mage::helper('eav')->__('Attribute used in configurable products.')); + Mage::throwException(Mage::helper('eav')->__('This attribute is used in configurable products.')); } return parent::_beforeDelete(); } diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php index 0bb782f1f1..7bf1188da1 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -113,7 +113,7 @@ public function loadByCode($entityType, $code) $entityTypeId = $entityType->getId(); } if (empty($entityTypeId)) { - throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid entity supplied')); + throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid entity supplied.')); } $this->_getResource()->loadByCode($this, $entityTypeId, $code); $this->_afterLoad(); diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Abstract.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Abstract.php index a05e50496e..972545aca8 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Abstract.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -188,7 +188,7 @@ public function validate($object) if ($this->getAttribute()->getIsUnique()) { if (!$this->getAttribute()->getEntity()->checkAttributeUniqueValue($this->getAttribute(), $object)) { $label = $this->getAttribute()->getFrontend()->getLabel(); - Mage::throwException(Mage::helper('eav')->__('Value of attribute "%s" must be unique', $label)); + Mage::throwException(Mage::helper('eav')->__('The value of attribute "%s" must be unique.', $label)); } } return true; diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Array.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Array.php index 5363318d43..25066c883c 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Array.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Array.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Datetime.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Datetime.php index 2a9b1397f4..c9a80fd218 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Datetime.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Datetime.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Default.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Default.php index bcc21a1cac..e0e66616e6 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Default.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Increment.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Increment.php index ca6cb94701..6a5080d20c 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Increment.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Increment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Interface.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Interface.php index 4272fa62e1..9fd9405785 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Interface.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Serialized.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Serialized.php new file mode 100644 index 0000000000..352f5d63ac --- /dev/null +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Serialized.php @@ -0,0 +1,81 @@ +getAttribute()->getAttributeCode(); + if ($object->hasData($attrCode)) { + $object->setData($attrCode, serialize($object->getData($attrCode))); + } + } + + /** + * Unserialize after saving + * @param Varien_Object $object + */ + public function afterSave($object) + { + parent::afterSave($object); + $this->_unserialize($object); + } + + /** + * Unserialize after loading + * @param Varien_Object $object + */ + public function afterLoad($object) + { + parent::afterLoad($object); + $this->_unserialize($object); + } + + /** + * Try to unserialize the attribute value + * @param Varien_Object $object + */ + protected function _unserialize(Varien_Object $object) + { + $attrCode = $this->getAttribute()->getAttributeCode(); + if ($object->getData($attrCode)) { + try { + $unserialized = unserialize($object->getData($attrCode)); + $object->setData($attrCode, $unserialized); + } catch (Exception $e) { + $object->unsetData($attrCode); + } + } + } +} diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Store.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Store.php index b5aea37680..794ab9184b 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Store.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Store.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php index b9c39f2fa2..1c790cde78 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Updated.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Updated.php index 8f87f55985..b6b3121dee 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Updated.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Updated.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Exception.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Exception.php index 1fd040e573..320084c558 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Exception.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Exception.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Abstract.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Abstract.php index b3e6b97408..5d538cec13 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Abstract.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Datetime.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Datetime.php index e0265ff57e..9088199b48 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Datetime.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Datetime.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Default.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Default.php index a6d9a6fbd7..6e2e1b372f 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Default.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Interface.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Interface.php index 64cba0406d..c86be29745 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Interface.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Group.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Group.php index d78e8242cd..5c7487f11c 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Group.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Group.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Interface.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Interface.php index 4b01d6e359..98be883193 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Interface.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Option.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Option.php index 20a93314e1..c5c2e64a75 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Option.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Option.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Set.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Set.php index 6dc6b64c44..6af8c1485b 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Set.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Set.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -168,7 +168,7 @@ public function validate() { if (!$this->_getResource()->validate($this, $this->getAttributeSetName())) { Mage::throwException( - Mage::helper('eav')->__('Attribute set with the "%s" name already exists', $this->getAttributeSetName()) + Mage::helper('eav')->__('Attribute set with the "%s" name already exists.', $this->getAttributeSetName()) ); } return true; diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Abstract.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Abstract.php index 7285b2f519..814c42e743 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Abstract.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Boolean.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Boolean.php index 4cc3869c1f..22cbdd0a7a 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Boolean.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Boolean.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Config.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Config.php index 72dcbb65dd..54914e6d27 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Config.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Interface.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Interface.php index 0395cddbb5..94f8ffcacf 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Interface.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Store.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Store.php index 9171ad393f..a3f8f89cab 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Store.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Store.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Table.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Table.php index 864153e94e..3850cd7165 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Table.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Table.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Collection.php b/app/code/core/Mage/Eav/Model/Entity/Collection.php index 26fccfed68..87134fc7d0 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Collection.php +++ b/app/code/core/Mage/Eav/Model/Entity/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php b/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php index f4309c29c3..889005f3b3 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php +++ b/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -175,7 +175,7 @@ public function setEntity($entity) } elseif (is_string($entity) || $entity instanceof Mage_Core_Model_Config_Element) { $this->_entity = Mage::getModel('eav/entity')->setType($entity); } else { - Mage::throwException(Mage::helper('eav')->__('Invalid entity supplied: %s', print_r($entity,1))); + Mage::throwException(Mage::helper('eav')->__('Invalid entity supplied: %s.', print_r($entity,1))); } return $this; } @@ -188,7 +188,7 @@ public function setEntity($entity) public function getEntity() { if (empty($this->_entity)) { - throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Entity is not initialized')); + throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Entity is not initialized.')); } return $this->_entity; } @@ -231,7 +231,7 @@ public function setObject($object=null) public function addItem(Varien_Object $object) { if (get_class($object)!== $this->_itemObjectClass) { - throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Attempt to add an invalid object')); + throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Attempt to add an invalid object.')); } return parent::addItem($object); } @@ -432,7 +432,7 @@ public function addExpressionAttributeToSelect($alias, $expression, $attribute) { // validate alias if (isset($this->_joinFields[$alias])) { - throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Joined field or attribute expression with this alias is already declared')); + throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Joint field or attribute expression with this alias is already declared.')); } if(!is_array($attribute)) { $attribute = array($attribute); @@ -536,7 +536,7 @@ public function joinAttribute($alias, $attribute, $bind, $filter=null, $joinType { // validate alias if (isset($this->_joinAttributes[$alias])) { - throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid alias, already exists in joined attributes')); + throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid alias, already exists in joint attributes.')); } // validate bind attribute @@ -545,7 +545,7 @@ public function joinAttribute($alias, $attribute, $bind, $filter=null, $joinType } if (!$bindAttribute || (!$bindAttribute->isStatic() && !$bindAttribute->getId())) { - throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid foreign key')); + throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid foreign key.')); } // try to explode combined entity/attribute if supplied @@ -569,7 +569,7 @@ public function joinAttribute($alias, $attribute, $bind, $filter=null, $joinType } } if (!$entity || !$entity->getTypeId()) { - throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid entity type')); + throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid entity type.')); } // cache entity @@ -582,7 +582,7 @@ public function joinAttribute($alias, $attribute, $bind, $filter=null, $joinType $attribute = $entity->getAttribute($attribute); } if (!$attribute) { - throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid attribute type')); + throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid attribute type.')); } if (empty($filter)) { @@ -621,7 +621,7 @@ public function joinField($alias, $table, $field, $bind, $cond=null, $joinType=' { // validate alias if (isset($this->_joinFields[$alias])) { - throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Joined field with this alias is already declared')); + throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Joined field with this alias is already declared.')); } // validate table @@ -699,11 +699,11 @@ public function joinTable($table, $bind, $fields=null, $cond=null, $joinType='in // validate fields and aliases if (!$fields) { - throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid joined fields')); + throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid joint fields.')); } foreach ($fields as $alias=>$field) { if (isset($this->_joinFields[$alias])) { - throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Joined field with this alias (%s) is already declared', $alias)); + throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('A joint field with this alias (%s) is already declared.', $alias)); } $this->_joinFields[$alias] = array( 'table' => $tableAlias, @@ -987,16 +987,23 @@ public function _loadAttributes($printQuery = false, $logQuery = false) $tableAttributes = array(); foreach ($this->_selectAttributes as $attributeCode => $attributeId) { + if (!$attributeId) { + continue; + } $attribute = Mage::getSingleton('eav/config')->getCollectionAttribute($entity->getType(), $attributeCode); if ($attribute && !$attribute->isStatic()) { $tableAttributes[$attribute->getBackendTable()][] = $attributeId; } } + $selects = array(); foreach ($tableAttributes as $table=>$attributes) { - $select = $this->_getLoadAttributesSelect($table); + $selects[] = $this->_getLoadAttributesSelect($table, $attributes); + } + if (!empty($selects)) { try { - $values = $this->_fetchAll($select, $attributes); + $select = implode(' UNION ', $selects); + $values = $this->_fetchAll($select); } catch (Exception $e) { Mage::printException($e, $select); $this->printLogQuery(true, true, $select); @@ -1007,7 +1014,6 @@ public function _loadAttributes($printQuery = false, $logQuery = false) $this->_setItemAttributeValue($value); } } - return $this; } @@ -1045,7 +1051,7 @@ protected function _setItemAttributeValue($valueInfo) $entityId = $valueInfo[$entityIdField]; if (!isset($this->_itemsById[$entityId])) { Mage::throwException('Mage_Eav', - Mage::helper('eav')->__('Data integrity: No header row found for attribute') + Mage::helper('eav')->__('Data integrity: No header row found for attribute.') ); } $attributeCode = array_search($valueInfo['attribute_id'], $this->_selectAttributes); @@ -1089,7 +1095,7 @@ protected function _getAttributeFieldName($attributeCode) $attribute = $this->getAttribute($attributeCode); if (!$attribute) { - throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid attribute name: %s', $attributeCode)); + throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid attribute name: %s.', $attributeCode)); } if ($attribute->isStatic()) { @@ -1146,7 +1152,7 @@ protected function _addAttributeJoin($attributeCode, $joinType='inner') } if (!$attribute) { - throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid attribute name: %s', $attributeCode)); + throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid attribute name: %s.', $attributeCode)); } if ($attribute->getBackend()->isStatic()) { @@ -1208,6 +1214,7 @@ protected function _joinAttributeToSelect($method, $attribute, $tableAlias, $con * @see self::_getConditionSql * @param string $attribute * @param mixed $condition + * @param string $joinType * @return string */ protected function _getAttributeConditionSql($attribute, $condition, $joinType='inner') diff --git a/app/code/core/Mage/Eav/Model/Entity/Increment/Abstract.php b/app/code/core/Mage/Eav/Model/Entity/Increment/Abstract.php index d236460151..ca1e59c17e 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Increment/Abstract.php +++ b/app/code/core/Mage/Eav/Model/Entity/Increment/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Increment/Alphanum.php b/app/code/core/Mage/Eav/Model/Entity/Increment/Alphanum.php index ac8bab5a7f..81ae74440a 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Increment/Alphanum.php +++ b/app/code/core/Mage/Eav/Model/Entity/Increment/Alphanum.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Increment/Interface.php b/app/code/core/Mage/Eav/Model/Entity/Increment/Interface.php index ac80f2eab3..ef51d8dd40 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Increment/Interface.php +++ b/app/code/core/Mage/Eav/Model/Entity/Increment/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Increment/Numeric.php b/app/code/core/Mage/Eav/Model/Entity/Increment/Numeric.php index ee535d3fb9..99e29b4f9b 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Increment/Numeric.php +++ b/app/code/core/Mage/Eav/Model/Entity/Increment/Numeric.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Interface.php b/app/code/core/Mage/Eav/Model/Entity/Interface.php index bcb40c7158..7572807083 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Interface.php +++ b/app/code/core/Mage/Eav/Model/Entity/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Setup.php b/app/code/core/Mage/Eav/Model/Entity/Setup.php index 6fc3bc3d84..baae8ca516 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Setup.php +++ b/app/code/core/Mage/Eav/Model/Entity/Setup.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -158,7 +158,7 @@ public function getEntityTypeId($entityTypeId) $entityTypeId = $this->getEntityType($entityTypeId, 'entity_type_id'); } if (!is_numeric($entityTypeId)) { - throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Wrong entity ID')); + throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Wrong entity ID.')); } return $entityTypeId; } @@ -278,7 +278,7 @@ public function getAttributeSetId($entityTypeId, $setId) $setId = $this->getAttributeSet($entityTypeId, $setId, 'attribute_set_id'); } if (!is_numeric($setId)) { - throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Wrong attribute set ID')); + throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Wrong attribute set ID.')); } return $setId; } @@ -464,7 +464,7 @@ public function getAttributeGroupId($entityTypeId, $setId, $groupId) } if (!is_numeric($groupId)) { - throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Wrong attribute group ID')); + throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Wrong attribute group ID.')); } return $groupId; } @@ -639,7 +639,7 @@ public function addAttributeOption($option) // Default value if (!isset($values[0])) { - Mage::throwException(Mage::helper('eav')->__('Default option value is not defined')); + Mage::throwException(Mage::helper('eav')->__('Default option value is not defined.')); } $this->_conn->delete($optionValueTable, $this->_conn->quoteInto('option_id=?', $intOptionId)); @@ -818,7 +818,7 @@ public function getAttributeId($entityTypeId, $id) $id = $this->getAttribute($entityTypeId, $id, 'attribute_id'); } if (!is_numeric($id)) { - //throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Wrong attribute ID')); + //throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Wrong attribute ID.')); return false; } return $id; diff --git a/app/code/core/Mage/Eav/Model/Entity/Store.php b/app/code/core/Mage/Eav/Model/Entity/Store.php index 142b53a313..28447c0664 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Store.php +++ b/app/code/core/Mage/Eav/Model/Entity/Store.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Entity/Type.php b/app/code/core/Mage/Eav/Model/Entity/Type.php index bca739b455..16302ad01d 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Type.php +++ b/app/code/core/Mage/Eav/Model/Entity/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -89,14 +89,14 @@ public function getAttributeCollection($setId = null) if (is_null($setId)) { if (is_null($this->_attributes)) { $this->_attributes = $this->_getAttributeCollection() - ->setEntityTypeFilter($this->getId()); + ->setEntityTypeFilter($this); } $collection = $this->_attributes; } else { if (!isset($this->_attributesBySet[$setId])) { $this->_attributesBySet[$setId] = $this->_getAttributeCollection() - ->setEntityTypeFilter($this->getId()) + ->setEntityTypeFilter($this) ->setAttributeSetFilter($setId); } $collection = $this->_attributesBySet[$setId]; @@ -152,7 +152,7 @@ public function fetchNewIncrementId($storeId=null) * store_id null we can have for entity from removed store */ $storeId = 0; - //throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Valid store_id is expected!')); + //throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Valid store_id is expected.')); } // Start transaction to run SELECT ... FOR UPDATE diff --git a/app/code/core/Mage/Eav/Model/Form/Element.php b/app/code/core/Mage/Eav/Model/Form/Element.php index 99d582db9f..462cd7842c 100644 --- a/app/code/core/Mage/Eav/Model/Form/Element.php +++ b/app/code/core/Mage/Eav/Model/Form/Element.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -79,10 +79,10 @@ public function getCollection() protected function _beforeSave() { if (!$this->getTypeId()) { - Mage::throwException(Mage::helper('eav')->__('Invalid form type')); + Mage::throwException(Mage::helper('eav')->__('Invalid form type.')); } if (!$this->getAttributeId()) { - Mage::throwException(Mage::helper('eav')->__('Invalid EAV attribute')); + Mage::throwException(Mage::helper('eav')->__('Invalid EAV attribute.')); } return parent::_beforeSave(); diff --git a/app/code/core/Mage/Eav/Model/Form/Fieldset.php b/app/code/core/Mage/Eav/Model/Form/Fieldset.php index f5b8b8eb58..34916219e1 100644 --- a/app/code/core/Mage/Eav/Model/Form/Fieldset.php +++ b/app/code/core/Mage/Eav/Model/Form/Fieldset.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -79,7 +79,7 @@ public function getCollection() protected function _beforeSave() { if (!$this->getTypeId()) { - Mage::throwException(Mage::helper('eav')->__('Invalid form type')); + Mage::throwException(Mage::helper('eav')->__('Invalid form type.')); } if (!$this->getStoreId() && $this->getLabel()) { $this->setStoreLabel($this->getStoreId(), $this->getLabel()); diff --git a/app/code/core/Mage/Eav/Model/Form/Type.php b/app/code/core/Mage/Eav/Model/Form/Type.php index f65acb4a24..cc8cec4ce3 100644 --- a/app/code/core/Mage/Eav/Model/Form/Type.php +++ b/app/code/core/Mage/Eav/Model/Form/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Config.php b/app/code/core/Mage/Eav/Model/Mysql4/Config.php index cba3bf2d38..3eee79da6c 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Config.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute.php b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute.php index 3671b94c7e..bbe93f8b93 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -166,7 +166,7 @@ protected function _beforeSave(Mage_Core_Model_Abstract $object) $frontendLabel = $object->getFrontendLabel(); if (is_array($frontendLabel)) { if (!isset($frontendLabel[0]) || is_null($frontendLabel[0]) || $frontendLabel[0]=='') { - Mage::throwException(Mage::helper('eav')->__('Frontend label is not defined')); + Mage::throwException(Mage::helper('eav')->__('Frontend label is not defined.')); } $object->setFrontendLabel($frontendLabel[0]); $object->setStoreLabels($frontendLabel); @@ -357,7 +357,7 @@ protected function _saveOption(Mage_Core_Model_Abstract $object) // Default value if (!isset($values[0])) { - Mage::throwException(Mage::helper('eav')->__('Default option value is not defined')); + Mage::throwException(Mage::helper('eav')->__('Default option value is not defined.')); } $write->delete($optionValueTable, $write->quoteInto('option_id=?', $intOptionId)); diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Collection.php b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Collection.php index 14dfdb638f..67d26f7b2d 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Collection.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -84,13 +84,20 @@ public function useLoadDataFields() /** * Specify attribute entity type filter * - * @param int $typeId + * @param Mage_Eav_Model_Entity_Type | int $type * @return Mage_Eav_Model_Mysql4_Entity_Attribute_Collection */ - public function setEntityTypeFilter($typeId) + public function setEntityTypeFilter($type) { - $this->getSelect()->where('main_table.entity_type_id=?', $typeId); - if ($additionalTable = $this->getResource()->getAdditionalAttributeTable($typeId)) { + if ($type instanceof Mage_Eav_Model_Entity_Type) { + $additionalTable = $type->getAdditionalAttributeTable(); + $id = $type->getId(); + } else { + $additionalTable = $this->getResource()->getAdditionalAttributeTable($type); + $id = $type; + } + $this->getSelect()->where('main_table.entity_type_id=?', $id); + if ($additionalTable) { $this->getSelect()->join( array('additional_table' => $this->getTable($additionalTable)), 'additional_table.attribute_id=main_table.attribute_id' diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Group.php b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Group.php index 7e8d0ae0a4..0a441110c9 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Group.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Group.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Group/Collection.php b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Group/Collection.php index 8ee97a2c92..38252181cc 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Group/Collection.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Group/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Option.php b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Option.php index ea983c5d05..af0438c219 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Option.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Option.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Option/Collection.php b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Option/Collection.php index b73e1aa02e..3cfa99482c 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Option/Collection.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Option/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Set.php b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Set.php index f6e333fbfc..d9dc8d7c2e 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Set.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Set.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Set/Collection.php b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Set/Collection.php index dfc4b1d888..375714c2bd 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Set/Collection.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Attribute/Set/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Store.php b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Store.php index 19d8fc0b2f..93fb2ec69d 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Store.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Store.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Type.php b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Type.php index b5d9527186..70eb6d2f8d 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Type.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Type/Collection.php b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Type/Collection.php index 81bc915256..5328e8f985 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Entity/Type/Collection.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Entity/Type/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Form/Element.php b/app/code/core/Mage/Eav/Model/Mysql4/Form/Element.php index 6f204cb747..100d3b9db2 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Form/Element.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Form/Element.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Form/Element/Collection.php b/app/code/core/Mage/Eav/Model/Mysql4/Form/Element/Collection.php index 60b91bb09f..5a4485e20d 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Form/Element/Collection.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Form/Element/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Form/Fieldset.php b/app/code/core/Mage/Eav/Model/Mysql4/Form/Fieldset.php index e0d603d35d..a4fd6566eb 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Form/Fieldset.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Form/Fieldset.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Form/Fieldset/Collection.php b/app/code/core/Mage/Eav/Model/Mysql4/Form/Fieldset/Collection.php index 4218e3b445..6757b3a379 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Form/Fieldset/Collection.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Form/Fieldset/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Form/Type.php b/app/code/core/Mage/Eav/Model/Mysql4/Form/Type.php index 0afc6b3de9..b8d762f676 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Form/Type.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Form/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/Model/Mysql4/Form/Type/Collection.php b/app/code/core/Mage/Eav/Model/Mysql4/Form/Type/Collection.php index 25039f229d..594d7212ef 100644 --- a/app/code/core/Mage/Eav/Model/Mysql4/Form/Type/Collection.php +++ b/app/code/core/Mage/Eav/Model/Mysql4/Form/Type/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/etc/config.xml b/app/code/core/Mage/Eav/etc/config.xml index 982f891a5a..127c0f3e97 100644 --- a/app/code/core/Mage/Eav/etc/config.xml +++ b/app/code/core/Mage/Eav/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-install-0.7.0.php index 045f3204fe..34af6a6c57 100644 --- a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.0-0.7.1.php index 3581a22d7e..96575be691 100644 --- a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.1-0.7.2.php index 245f0b1ca6..0c72862972 100644 --- a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.10-0.7.11.php b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.10-0.7.11.php index 0e80346bea..c4a1bfee12 100644 --- a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.10-0.7.11.php +++ b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.10-0.7.11.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.11-0.7.12.php b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.11-0.7.12.php index cede725b37..728143818b 100644 --- a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.11-0.7.12.php +++ b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.11-0.7.12.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.12-0.7.13.php b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.12-0.7.13.php index 44b56d5b98..a88736136e 100644 --- a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.12-0.7.13.php +++ b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.12-0.7.13.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.13-0.7.14.php b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.13-0.7.14.php index 675c4c56d3..532d32ac9a 100644 --- a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.13-0.7.14.php +++ b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.13-0.7.14.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.14-0.7.15.php b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.14-0.7.15.php index 99fe7ae27b..4ad3ad5436 100644 --- a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.14-0.7.15.php +++ b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.14-0.7.15.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.2-0.7.3.php index 01885fe264..173305dd97 100644 --- a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.2-0.7.3.php +++ b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.2-0.7.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.3-0.7.4.php b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.3-0.7.4.php index 008a26a3ec..2d09f04084 100644 --- a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.3-0.7.4.php +++ b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.3-0.7.4.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.4-0.7.5.php b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.4-0.7.5.php index 746833a8fa..86726da2ec 100644 --- a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.4-0.7.5.php +++ b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.4-0.7.5.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.5-0.7.6.php b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.5-0.7.6.php index 69d00b3cb1..27ce586947 100644 --- a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.5-0.7.6.php +++ b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.5-0.7.6.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.6-0.7.7.php b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.6-0.7.7.php index 22a1e63574..1392365457 100644 --- a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.6-0.7.7.php +++ b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.6-0.7.7.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.7-0.7.8.php b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.7-0.7.8.php index 2c37771c47..ab9a23fd8f 100644 --- a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.7-0.7.8.php +++ b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.7-0.7.8.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.8-0.7.9.php b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.8-0.7.9.php index b7ba6509d9..409d0a603f 100644 --- a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.8-0.7.9.php +++ b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.8-0.7.9.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.9-0.7.10.php b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.9-0.7.10.php index 5f63770e40..5041677a0b 100644 --- a/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.9-0.7.10.php +++ b/app/code/core/Mage/Eav/sql/eav_setup/mysql4-upgrade-0.7.9-0.7.10.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Eav - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Eway/Block/Form.php b/app/code/core/Mage/Eway/Block/Form.php new file mode 100644 index 0000000000..ea9e7678a9 --- /dev/null +++ b/app/code/core/Mage/Eway/Block/Form.php @@ -0,0 +1,42 @@ + + */ +class Mage_Eway_Block_Form extends Mage_Payment_Block_Form_Cc +{ + protected function _construct() + { + parent::_construct(); + $this->setTemplate('eway/form.phtml'); + } + +} diff --git a/app/code/core/Mage/Eway/Block/Info.php b/app/code/core/Mage/Eway/Block/Info.php new file mode 100644 index 0000000000..2f86c53e0a --- /dev/null +++ b/app/code/core/Mage/Eway/Block/Info.php @@ -0,0 +1,48 @@ + + */ +class Mage_Eway_Block_Info extends Mage_Payment_Block_Info_Cc +{ + protected function _construct() + { + parent::_construct(); + $this->setTemplate('eway/info.phtml'); + } + + public function toPdf() + { + $this->setTemplate('eway/pdf/info.phtml'); + return $this->toHtml(); + } + +} diff --git a/app/code/core/Mage/Eway/Block/Secure/Failure.php b/app/code/core/Mage/Eway/Block/Secure/Failure.php new file mode 100644 index 0000000000..6da24e9f25 --- /dev/null +++ b/app/code/core/Mage/Eway/Block/Secure/Failure.php @@ -0,0 +1,53 @@ + + */ + +class Mage_Eway_Block_Secure_Failure extends Mage_Core_Block_Template +{ + /** + * Return Error message + * + * @return string + */ + public function getErrorMessage () + { + return Mage::getSingleton('checkout/session')->getEwayErrorMessage(); + } + + /** + * Get continue shopping url + */ + public function getContinueShoppingUrl() + { + return Mage::getUrl('checkout/cart'); + } +} diff --git a/app/code/core/Mage/Eway/Block/Secure/Form.php b/app/code/core/Mage/Eway/Block/Secure/Form.php new file mode 100644 index 0000000000..e4e1833701 --- /dev/null +++ b/app/code/core/Mage/Eway/Block/Secure/Form.php @@ -0,0 +1,41 @@ + + */ +class Mage_Eway_Block_Secure_Form extends Mage_Payment_Block_Form +{ + protected function _construct() + { + $this->setTemplate('eway/secure/form.phtml'); + parent::_construct(); + } +} diff --git a/app/code/core/Mage/Eway/Block/Secure/Redirect.php b/app/code/core/Mage/Eway/Block/Secure/Redirect.php new file mode 100644 index 0000000000..851fbbc352 --- /dev/null +++ b/app/code/core/Mage/Eway/Block/Secure/Redirect.php @@ -0,0 +1,57 @@ + + */ +class Mage_Eway_Block_Secure_Redirect extends Mage_Core_Block_Abstract +{ + protected function _toHtml() + { + $secure = $this->getOrder()->getPayment()->getMethodInstance(); + + $form = new Varien_Data_Form(); + $form->setAction($secure->getEwaySecureUrl()) + ->setId('eway_secure_checkout') + ->setName('eway_secure_checkout') + ->setMethod('POST') + ->setUseContainer(true); + foreach ($secure->getFormFields() as $field=>$value) { + $form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value)); + } + $html = ''; + $html.= $this->__('You will be redirected to eWAY 3D-Secure in a few seconds.'); + $html.= $form->toHtml(); + $html.= ''; + $html.= ''; + + return $html; + } +} diff --git a/app/code/core/Mage/Eway/Block/Shared/Failure.php b/app/code/core/Mage/Eway/Block/Shared/Failure.php new file mode 100644 index 0000000000..75f1792038 --- /dev/null +++ b/app/code/core/Mage/Eway/Block/Shared/Failure.php @@ -0,0 +1,55 @@ + + */ + +class Mage_Eway_Block_Shared_Failure extends Mage_Core_Block_Template +{ + /** + * Return Error message + * + * @return string + */ + public function getErrorMessage () + { + $msg = Mage::getSingleton('checkout/session')->getEwayErrorMessage(); + Mage::getSingleton('checkout/session')->unsEwayErrorMessage(); + return $msg; + } + + /** + * Get continue shopping url + */ + public function getContinueShoppingUrl() + { + return Mage::getUrl('checkout/cart'); + } +} diff --git a/app/code/core/Mage/Eway/Block/Shared/Form.php b/app/code/core/Mage/Eway/Block/Shared/Form.php new file mode 100644 index 0000000000..8ff3648fa7 --- /dev/null +++ b/app/code/core/Mage/Eway/Block/Shared/Form.php @@ -0,0 +1,42 @@ + + */ +class Mage_Eway_Block_Shared_Form extends Mage_Payment_Block_Form +{ + protected function _construct() + { + $this->setTemplate('eway/shared/form.phtml'); + parent::_construct(); + } +} diff --git a/app/code/core/Mage/Eway/Block/Shared/Redirect.php b/app/code/core/Mage/Eway/Block/Shared/Redirect.php new file mode 100644 index 0000000000..8913304739 --- /dev/null +++ b/app/code/core/Mage/Eway/Block/Shared/Redirect.php @@ -0,0 +1,58 @@ + + */ +class Mage_Eway_Block_Shared_Redirect extends Mage_Core_Block_Abstract +{ + protected function _toHtml() + { + $shared = $this->getOrder()->getPayment()->getMethodInstance(); + + $form = new Varien_Data_Form(); + $form->setAction($shared->getEwaySharedUrl()) + ->setId('eway_shared_checkout') + ->setName('eway_shared_checkout') + ->setMethod('POST') + ->setUseContainer(true); + foreach ($shared->getFormFields() as $field=>$value) { + $form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value)); + } + + $html = ''; + $html.= $this->__('You will be redirected to eWAY in a few seconds.'); + $html.= $form->toHtml(); + $html.= ''; + $html.= ''; + + return $html; + } +} diff --git a/app/code/core/Mage/Eway/Controller/Abstract.php b/app/code/core/Mage/Eway/Controller/Abstract.php new file mode 100644 index 0000000000..111f7fb942 --- /dev/null +++ b/app/code/core/Mage/Eway/Controller/Abstract.php @@ -0,0 +1,178 @@ + + */ +abstract class Mage_Eway_Controller_Abstract extends Mage_Core_Controller_Front_Action +{ + protected function _expireAjax() + { + if (!$this->getCheckout()->getQuote()->hasItems()) { + $this->getResponse()->setHeader('HTTP/1.1','403 Session Expired'); + exit; + } + } + + /** + * Redirect Block + * need to be redeclared + */ + protected $_redirectBlockType; + + /** + * Get singleton of Checkout Session Model + * + * @return Mage_Checkout_Model_Session + */ + public function getCheckout() + { + return Mage::getSingleton('checkout/session'); + } + + /** + * when customer select eWay payment method + */ + public function redirectAction() + { + $session = $this->getCheckout(); + $session->setEwayQuoteId($session->getQuoteId()); + $session->setEwayRealOrderId($session->getLastRealOrderId()); + + $order = Mage::getModel('sales/order'); + $order->loadByIncrementId($session->getLastRealOrderId()); + $order->addStatusToHistory($order->getStatus(), Mage::helper('eway')->__('Customer was redirected to eWAY.')); + $order->save(); + + $this->getResponse()->setBody( + $this->getLayout() + ->createBlock($this->_redirectBlockType) + ->setOrder($order) + ->toHtml() + ); + + $session->unsQuoteId(); + } + + /** + * eWay returns POST variables to this action + */ + public function successAction() + { + $status = $this->_checkReturnedPost(); + + $session = $this->getCheckout(); + + $session->unsEwayRealOrderId(); + $session->setQuoteId($session->getEwayQuoteId(true)); + $session->getQuote()->setIsActive(false)->save(); + + $order = Mage::getModel('sales/order'); + $order->load($this->getCheckout()->getLastOrderId()); + if($order->getId()) { + $order->sendNewOrderEmail(); + } + + if ($status) { + $this->_redirect('checkout/onepage/success'); + } else { + $this->_redirect('*/*/failure'); + } + } + + /** + * Display failure page if error + * + */ + public function failureAction() + { + if (!$this->getCheckout()->getEwayErrorMessage()) { + $this->norouteAction(); + return; + } + + $this->getCheckout()->clear(); + + $this->loadLayout(); + $this->renderLayout(); + } + + /** + * Checking POST variables. + * Creating invoice if payment was successfull or cancel order if payment was declined + */ + protected function _checkReturnedPost() + { + if (!$this->getRequest()->isPost()) { + $this->norouteAction(); + return; + } + $status = true; + $response = $this->getRequest()->getPost(); + + if ($this->getCheckout()->getEwayRealOrderId() != $response['ewayTrxnNumber'] || + $this->getCheckout()->getEwayRealOrderId() != Mage::helper('core')->decrypt($response['eWAYoption2'])) { + $this->norouteAction(); + return; + } + + $order = Mage::getModel('sales/order'); + $order->loadByIncrementId($response['ewayTrxnNumber']); + + $paymentInst = $order->getPayment()->getMethodInstance(); + $paymentInst->setResponse($response); + + if ($paymentInst->parseResponse()) { + + if ($order->canInvoice()) { + $invoice = $order->prepareInvoice(); + $invoice->register()->capture(); + Mage::getModel('core/resource_transaction') + ->addObject($invoice) + ->addObject($invoice->getOrder()) + ->save(); + + $paymentInst->setTransactionId($response['ewayTrxnReference']); + $order->addStatusToHistory($order->getStatus(), Mage::helper('eway')->__('The customer has successfully returned from eWAY.')); + } + } else { + $paymentInst->setTransactionId($response['ewayTrxnReference']); + $order->cancel(); + $order->addStatusToHistory($order->getStatus(), Mage::helper('eway')->__('The customer was rejected by eWAY.')); + $status = false; + $this->getCheckout()->setEwayErrorMessage($response['eWAYresponseText']); + } + + $order->save(); + + return $status; + } + +} diff --git a/app/code/core/Mage/Paygate/Model/Payflow/Pro/Result.php b/app/code/core/Mage/Eway/Helper/Data.php similarity index 79% rename from app/code/core/Mage/Paygate/Model/Payflow/Pro/Result.php rename to app/code/core/Mage/Eway/Helper/Data.php index 9b709d8963..f1fbbab595 100644 --- a/app/code/core/Mage/Paygate/Model/Payflow/Pro/Result.php +++ b/app/code/core/Mage/Eway/Helper/Data.php @@ -19,20 +19,19 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Mage - * @package Mage_Paygate - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @package Mage_Eway + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Payflow Pro Result Model + * eWay Data Helper * * @category Mage - * @package Mage_Paygate + * @package Mage_Eway * @author Magento Core Team */ - -class Mage_Paygate_Model_Payflow_Pro_Result extends Varien_Object +class Mage_Eway_Helper_Data extends Mage_Core_Helper_Abstract { } diff --git a/app/code/core/Mage/Eway/Model/Api/Debug.php b/app/code/core/Mage/Eway/Model/Api/Debug.php new file mode 100644 index 0000000000..2300772fc3 --- /dev/null +++ b/app/code/core/Mage/Eway/Model/Api/Debug.php @@ -0,0 +1,40 @@ + + */ +class Mage_Eway_Model_Api_Debug extends Mage_Core_Model_Abstract +{ + protected function _construct() + { + $this->_init('eway/api_debug'); + } +} diff --git a/app/code/core/Mage/Eway/Model/Direct.php b/app/code/core/Mage/Eway/Model/Direct.php new file mode 100644 index 0000000000..764827b92c --- /dev/null +++ b/app/code/core/Mage/Eway/Model/Direct.php @@ -0,0 +1,309 @@ + + */ +class Mage_Eway_Model_Direct extends Mage_Payment_Model_Method_Cc +{ + protected $_code = 'eway_direct'; + + protected $_isGateway = true; + protected $_canAuthorize = false; + protected $_canCapture = true; + protected $_canCapturePartial = false; + protected $_canRefund = false; + protected $_canVoid = false; + protected $_canUseInternal = true; + protected $_canUseCheckout = true; + protected $_canUseForMultishipping = true; + protected $_canSaveCc = true; + + protected $_formBlockType = 'eway/form'; + protected $_infoBlockType = 'eway/info'; + + /** + * @deprecated after 1.4.1.0 + * + * @return string + */ + public function getDebug() + { + return $this->getDebugFlag(); + } + + /** + * Get flag to use CCV or not + * + * @return string + */ + public function getUseccv() + { + return Mage::getStoreConfig('payment/eway_direct/useccv'); + } + + /** + * Get api url of eWAY Direct payment + * + * @return string + */ + public function getApiGatewayUrl() + { + $value = Mage::getStoreConfig('payment/eway_direct/api_url'); + if (!$value || $value === false) { + return 'https://www.eway.com.au/gateway/xmlpayment.asp'; + } + return $value; + } + + /** + * Get Customer Id + * + * @return string + */ + public function getCustomerId() + { + return Mage::getStoreConfig('payment/eway_direct/customer_id'); + } + + /** + * Get currency that accepted by eWAY account + * + * @return string + */ + public function getAccepteCurrency() + { + return Mage::getStoreConfig('payment/' . $this->getCode() . '/currency'); + } + + public function validate() + { + parent::validate(); + $paymentInfo = $this->getInfoInstance(); + if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) { + $currency_code = $paymentInfo->getOrder()->getBaseCurrencyCode(); + } else { + $currency_code = $paymentInfo->getQuote()->getBaseCurrencyCode(); + } + if ($currency_code != $this->getAccepteCurrency()) { + Mage::throwException(Mage::helper('eway')->__('Selected currency code (%s) is not compatible with eWAY.', $currency_code)); + } + return $this; + } + + public function capture(Varien_Object $payment, $amount) + { + $this->setAmount($amount) + ->setPayment($payment); + + $result = $this->callDoDirectPayment($payment)!==false; + + if ($result) { + $payment->setStatus(self::STATUS_APPROVED) + ->setTransactionId($this->getTransactionId()) + ->setIsTransactionClosed(0); + } else { + $e = $this->getError(); + if (isset($e['message'])) { + $message = Mage::helper('eway')->__('There has been an error processing your payment.') . $e['message']; + } else { + $message = Mage::helper('eway')->__('There has been an error processing your payment. Please try later or contact us for help.'); + } + Mage::throwException($message); + } + return $this; + } + + public function cancel(Varien_Object $payment) + { + $payment->setStatus(self::STATUS_DECLINED) + ->setIsTransactionClosed(1); + return $this; + } + + /** + * prepare params to send to gateway + * + * @return bool | array + */ + public function callDoDirectPayment() + { + $payment = $this->getPayment(); + $billing = $payment->getOrder()->getBillingAddress(); + + $invoiceDesc = ''; + $lengs = 0; + foreach ($payment->getOrder()->getAllItems() as $item) { + if ($item->getParentItem()) { + continue; + } + if (Mage::helper('core/string')->strlen($invoiceDesc.$item->getName()) > 10000) { + break; + } + $invoiceDesc .= $item->getName() . ', '; + } + $invoiceDesc = Mage::helper('core/string')->substr($invoiceDesc, 0, -2); + + $address = clone $billing; + $address->unsFirstname(); + $address->unsLastname(); + $address->unsPostcode(); + $formatedAddress = ''; + $tmpAddress = explode(' ', str_replace("\n", ' ', trim($address->format('text')))); + foreach ($tmpAddress as $part) { + if (strlen($part) > 0) $formatedAddress .= $part . ' '; + } +// $this->getQuote()->reserveOrderId(); + $xml = ""; + $xml .= "" . $this->getCustomerId() . ""; + $xml .= "" . ($this->getAmount()*100) . ""; + $xml .= "" . htmlentities(trim($payment->getCcOwner()), ENT_QUOTES, 'UTF-8') . ""; + $xml .= "" . $payment->getCcNumber() . ""; + $xml .= "" . $payment->getCcExpMonth() . ""; + $xml .= "" . $payment->getCcExpYear() . ""; + $xml .= "" . '' . ""; + $xml .= "" . htmlentities(trim($invoiceDesc), ENT_QUOTES, 'UTF-8') . ""; + $xml .= "" . htmlentities(trim($billing->getFirstname()), ENT_QUOTES, 'UTF-8') . ""; + $xml .= "" . htmlentities(trim($billing->getLastname()), ENT_QUOTES, 'UTF-8') . ""; + $xml .= "" . htmlentities(trim($payment->getOrder()->getCustomerEmail()), ENT_QUOTES, 'UTF-8') . ""; + $xml .= "" . htmlentities(trim($formatedAddress), ENT_QUOTES, 'UTF-8') . ""; + $xml .= "" . htmlentities(trim($billing->getPostcode()), ENT_QUOTES, 'UTF-8') . ""; +// $xml .= "" . $this->getQuote()->getReservedOrderId() . ""; + $xml .= "" . '' . ""; + + if ($this->getUseccv()) { + $xml .= "" . $payment->getCcCid() . ""; + } + + $xml .= "" . '' . ""; + $xml .= "" . '' . ""; + $xml .= "" . '' . ""; + + + if (Mage::getStoreConfig('payment/eway_direct/use_anti_fraud')) { + $xml .= "". Mage::helper('core/http')->getRemoteAddr() .""; + $xml .= "". $billing->getCountryId() .""; + } + + $xml .= ""; + + $resultArr = $this->call($xml); + + if ($resultArr === false) { + return false; + } + + $this->setTransactionId($resultArr['ewayTrxnNumber']); + + return $resultArr; + } + + /** + * Send params to gateway + * + * @param string $xml + * @return bool | array + */ + public function call($xml) + { + $debugData = array('request' => $xml); + try { + $http = new Varien_Http_Adapter_Curl(); + $config = array('timeout' => 30); + + $http->setConfig($config); + $http->write(Zend_Http_Client::POST, $this->getApiGatewayUrl(), '1.1', array(), $xml); + $response = $http->read(); + + $response = preg_split('/^\r?$/m', $response, 2); + $response = trim($response[1]); + $debugData['result'] = $response; + } + catch (Exception $e) { + $debugData['result'] = array('error' => $e->getMessage(), 'code' => $e->getCode()); + $this->_debug($debugData); + throw $e; + } + + $this->_debug($debugData); + + if ($http->getErrno()) { + $http->close(); + $this->setError(array( + 'message' => $http->getError() + )); + return false; + } + $http->close(); + + $parsedResArr = $this->parseXmlResponse($response); + + if ($parsedResArr['ewayTrxnStatus'] == 'True') { + $this->unsError(); + return $parsedResArr; + } + + if (isset($parsedResArr['ewayTrxnError'])) { + $this->setError(array( + 'message' => $parsedResArr['ewayTrxnError'] + )); + } + + return false; + } + + /** + * parse response of gateway + * + * @param string $xmlResponse + * @return array + */ + public function parseXmlResponse($xmlResponse) + { + $xmlObj = simplexml_load_string($xmlResponse); + $newResArr = array(); + foreach ($xmlObj as $key => $val) { + $newResArr[$key] = (string)$val; + } + + return $newResArr; + } + + /** + * Define if debugging is enabled + * + * @return bool + */ + public function getDebugFlag() + { + return $this->getConfigData('debug_flag'); + } + +} diff --git a/app/code/core/Mage/Eway/Model/Mysql4/Api/Debug.php b/app/code/core/Mage/Eway/Model/Mysql4/Api/Debug.php new file mode 100644 index 0000000000..350b2cb71e --- /dev/null +++ b/app/code/core/Mage/Eway/Model/Mysql4/Api/Debug.php @@ -0,0 +1,40 @@ + + */ +class Mage_Eway_Model_Mysql4_Api_Debug extends Mage_Core_Model_Mysql4_Abstract +{ + protected function _construct() + { + $this->_init('eway/api_debug', 'debug_id'); + } +} diff --git a/app/code/core/Mage/Eway/Model/Mysql4/Api/Debug/Collection.php b/app/code/core/Mage/Eway/Model/Mysql4/Api/Debug/Collection.php new file mode 100644 index 0000000000..20bc2a8cdc --- /dev/null +++ b/app/code/core/Mage/Eway/Model/Mysql4/Api/Debug/Collection.php @@ -0,0 +1,40 @@ + + */ +class Mage_Eway_Model_Mysql4_Api_Debug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract +{ + protected function _construct() + { + $this->_init('eway/api_debug'); + } +} diff --git a/app/code/core/Mage/Eway/Model/Mysql4/Setup.php b/app/code/core/Mage/Eway/Model/Mysql4/Setup.php new file mode 100644 index 0000000000..645bacc993 --- /dev/null +++ b/app/code/core/Mage/Eway/Model/Mysql4/Setup.php @@ -0,0 +1,38 @@ + + */ +class Mage_Eway_Model_Mysql4_Setup extends Mage_Sales_Model_Mysql4_Setup +{ + +} diff --git a/app/code/core/Mage/Eway/Model/Secure.php b/app/code/core/Mage/Eway/Model/Secure.php new file mode 100644 index 0000000000..a243ecb81e --- /dev/null +++ b/app/code/core/Mage/Eway/Model/Secure.php @@ -0,0 +1,54 @@ + + */ +class Mage_Eway_Model_Secure extends Mage_Eway_Model_Shared +{ + protected $_code = 'eway_secure'; + + protected $_formBlockType = 'eway/secure_form'; + protected $_paymentMethod = 'secure'; + + /** + * Get url of eWAY 3D-Secure Payment + * + * @return string + */ + public function getEwaySecureUrl() + { + if (!$url = Mage::getStoreConfig('payment/' . $this->getCode() . '/api_url')) { + $url = 'https://www.eway.com.au/gateway_3d/payment.asp'; + } + return $url; + } + +} diff --git a/app/code/core/Mage/Eway/Model/Shared.php b/app/code/core/Mage/Eway/Model/Shared.php new file mode 100644 index 0000000000..21615f5cfc --- /dev/null +++ b/app/code/core/Mage/Eway/Model/Shared.php @@ -0,0 +1,254 @@ + + */ +class Mage_Eway_Model_Shared extends Mage_Payment_Model_Method_Abstract +{ + protected $_code = 'eway_shared'; + + protected $_isGateway = false; + protected $_canAuthorize = false; + protected $_canCapture = true; + protected $_canCapturePartial = false; + protected $_canRefund = false; + protected $_canVoid = false; + protected $_canUseInternal = false; + protected $_canUseCheckout = true; + protected $_canUseForMultishipping = false; + + protected $_formBlockType = 'eway/shared_form'; + protected $_paymentMethod = 'shared'; + + protected $_order; + + /** + * Get order model + * + * @return Mage_Sales_Model_Order + */ + public function getOrder() + { + if (!$this->_order) { + $paymentInfo = $this->getInfoInstance(); + $this->_order = Mage::getModel('sales/order') + ->loadByIncrementId($paymentInfo->getOrder()->getRealOrderId()); + } + return $this->_order; + } + + /** + * Get Customer Id + * + * @return string + */ + public function getCustomerId() + { + return Mage::getStoreConfig('payment/' . $this->getCode() . '/customer_id'); + } + + /** + * Get currency that accepted by eWAY account + * + * @return string + */ + public function getAccepteCurrency() + { + return Mage::getStoreConfig('payment/' . $this->getCode() . '/currency'); + } + + public function validate() + { + parent::validate(); + $paymentInfo = $this->getInfoInstance(); + if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) { + $currency_code = $paymentInfo->getOrder()->getBaseCurrencyCode(); + } else { + $currency_code = $paymentInfo->getQuote()->getBaseCurrencyCode(); + } + if ($currency_code != $this->getAccepteCurrency()) { + Mage::throwException(Mage::helper('eway')->__('Selected currency code (%s) is not compatible with eWAY.', $currency_code)); + } + return $this; + } + + public function getOrderPlaceRedirectUrl() + { + return Mage::getUrl('eway/' . $this->_paymentMethod . '/redirect'); + } + + /** + * prepare params array to send it to gateway page via POST + * + * @return array + */ + public function getFormFields() + { + $billing = $this->getOrder()->getBillingAddress(); + $fieldsArr = array(); + $invoiceDesc = ''; + $lengs = 0; + foreach ($this->getOrder()->getAllItems() as $item) { + if ($item->getParentItem()) { + continue; + } + if (Mage::helper('core/string')->strlen($invoiceDesc.$item->getName()) > 10000) { + break; + } + $invoiceDesc .= $item->getName() . ', '; + } + $invoiceDesc = Mage::helper('core/string')->substr($invoiceDesc, 0, -2); + + $address = clone $billing; + $address->unsFirstname(); + $address->unsLastname(); + $address->unsPostcode(); + $formatedAddress = ''; + $tmpAddress = explode(' ', str_replace("\n", ' ', trim($address->format('text')))); + foreach ($tmpAddress as $part) { + if (strlen($part) > 0) $formatedAddress .= $part . ' '; + } + $paymentInfo = $this->getInfoInstance(); + $fieldsArr['ewayCustomerID'] = $this->getCustomerId(); + $fieldsArr['ewayTotalAmount'] = ($this->getOrder()->getBaseGrandTotal()*100); + $fieldsArr['ewayCustomerFirstName'] = $billing->getFirstname(); + $fieldsArr['ewayCustomerLastName'] = $billing->getLastname(); + $fieldsArr['ewayCustomerEmail'] = $this->getOrder()->getCustomerEmail(); + $fieldsArr['ewayCustomerAddress'] = trim($formatedAddress); + $fieldsArr['ewayCustomerPostcode'] = $billing->getPostcode(); +// $fieldsArr['ewayCustomerInvoiceRef'] = ''; + $fieldsArr['ewayCustomerInvoiceDescription'] = $invoiceDesc; + $fieldsArr['eWAYSiteTitle '] = Mage::app()->getStore()->getFrontendName(); + $fieldsArr['eWAYAutoRedirect'] = 1; + $fieldsArr['ewayURL'] = Mage::getUrl('eway/' . $this->_paymentMethod . '/success', array('_secure' => true)); + $fieldsArr['eWAYTrxnNumber'] = $paymentInfo->getOrder()->getRealOrderId(); + $fieldsArr['ewayOption1'] = ''; + $fieldsArr['ewayOption2'] = Mage::helper('core')->encrypt($fieldsArr['eWAYTrxnNumber']); + $fieldsArr['ewayOption3'] = ''; + + $request = ''; + foreach ($fieldsArr as $k=>$v) { + $request .= '<' . $k . '>' . $v . ''; + } + + $this->_debug(array('request' => $request)); + + return $fieldsArr; + } + + /** + * Get url of eWAY Shared Payment + * + * @return string + */ + public function getEwaySharedUrl() + { + if (!$url = Mage::getStoreConfig('payment/eway_shared/api_url')) { + $url = 'https://www.eway.com.au/gateway/payment.asp'; + } + return $url; + } + + /** + * @deprecated after 1.4.1.0 + * + * @return string + */ + public function getDebug() + { + return $this->getDebugFlag(); + } + + public function capture(Varien_Object $payment, $amount) + { + $payment->setStatus(self::STATUS_APPROVED) + ->setTransactionId($this->getTransactionId()) + ->setIsTransactionClosed(0); + + return $this; + } + + public function cancel(Varien_Object $payment) + { + $payment->setStatus(self::STATUS_DECLINED) + ->setTransactionId($this->getTransactionId()) + ->setIsTransactionClosed(1); + + return $this; + } + + /** + * parse response POST array from gateway page and return payment status + * + * @return bool + */ + public function parseResponse() + { + $response = $this->getResponse(); + + $this->_debug(array('result' => $response)); + + if ($response['ewayTrxnStatus'] == 'True') { + return true; + } + return false; + } + + /** + * Return redirect block type + * + * @return string + */ + public function getRedirectBlockType() + { + return $this->_redirectBlockType; + } + + /** + * Return payment method type string + * + * @return string + */ + public function getPaymentMethodType() + { + return $this->_paymentMethod; + } + + /** + * Define if debugging is enabled + * + * @return bool + */ + public function getDebugFlag() + { + return $this->getConfigData('debug_flag'); + } +} diff --git a/app/code/core/Mage/Paygate/Model/Payflow/Source/Cctype.php b/app/code/core/Mage/Eway/Model/Source/Cctype.php similarity index 75% rename from app/code/core/Mage/Paygate/Model/Payflow/Source/Cctype.php rename to app/code/core/Mage/Eway/Model/Source/Cctype.php index 1d2658c885..a1d4f545b2 100644 --- a/app/code/core/Mage/Paygate/Model/Payflow/Source/Cctype.php +++ b/app/code/core/Mage/Eway/Model/Source/Cctype.php @@ -19,22 +19,22 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Mage - * @package Mage_Paygate - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @package Mage_Eway + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Payflow Payment CC Types Source Model + * eWAY CC Types Source Model * * @category Mage - * @package Mage_Paygate + * @package Mage_Eway * @author Magento Core Team */ -class Mage_Paygate_Model_Payflow_Source_Cctype extends Mage_Payment_Model_Source_Cctype +class Mage_Eway_Model_Source_Cctype extends Mage_Payment_Model_Source_Cctype { public function getAllowedTypes() { - return array('VI', 'MC', 'AE', 'DI', 'OT'); + return array('VI', 'MC', 'AE', 'DICL', 'JCB'); } } diff --git a/app/code/core/Mage/Eway/controllers/SecureController.php b/app/code/core/Mage/Eway/controllers/SecureController.php new file mode 100644 index 0000000000..0c5a758088 --- /dev/null +++ b/app/code/core/Mage/Eway/controllers/SecureController.php @@ -0,0 +1,42 @@ + + */ +class Mage_Eway_SecureController extends Mage_Eway_Controller_Abstract +{ + /** + * Redirect Block Type + * + * @var string + */ + protected $_redirectBlockType = 'eway/secure_redirect'; +} diff --git a/app/code/core/Mage/Eway/controllers/SharedController.php b/app/code/core/Mage/Eway/controllers/SharedController.php new file mode 100644 index 0000000000..4fd9e219f7 --- /dev/null +++ b/app/code/core/Mage/Eway/controllers/SharedController.php @@ -0,0 +1,42 @@ + + */ +class Mage_Eway_SharedController extends Mage_Eway_Controller_Abstract +{ + /** + * Redirect Block Type + * + * @var string + */ + protected $_redirectBlockType = 'eway/shared_redirect'; +} diff --git a/app/code/core/Mage/Eway/etc/config.xml b/app/code/core/Mage/Eway/etc/config.xml new file mode 100644 index 0000000000..bba366fb7e --- /dev/null +++ b/app/code/core/Mage/Eway/etc/config.xml @@ -0,0 +1,142 @@ + + + + + + 0.1.0 + + + + + + Mage_Eway_Model + eway_mysql4 + + + Mage_Eway_Model_Mysql4 + + eway_api_debug
      +
      +
      +
      + + + + Mage_Eway + Mage_Eway_Model_Mysql4_Setup + + + + + Mage_Eway_Block + + + + + + DICL + Diners Club + 60 + + + + +
      + + + /eway/shared + + + + standard + + Mage_Eway + eway + + + + + + + + Mage_Eway.csv + + + + + + + + eway.xml + + + + + + + + + + Mage_Eway.csv + + + + + + + + + + AUD + authorize_capture + eway/direct + eWAY Direct + processing + AE,VI,MC,DICL,JCB + 0 + 0 + + + + AUD + eway/shared + eWAY Shared + processing + 0 + + + + AUD + eway/secure + eWAY 3D-Secure + processing + 0 + + + +
      diff --git a/app/code/core/Mage/Eway/etc/system.xml b/app/code/core/Mage/Eway/etc/system.xml new file mode 100644 index 0000000000..bc66fc4535 --- /dev/null +++ b/app/code/core/Mage/Eway/etc/system.xml @@ -0,0 +1,354 @@ + + + + + + + + + text + 201 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 1 + 1 + 1 + 0 + + + <label>Title</label> + <frontend_type>text</frontend_type> + <sort_order>2</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + obscure + adminhtml/system_config_backend_encrypted + 3 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_currency + 4 + 1 + 1 + 0 + + + + Set the Beagle anti-fraud gateway URL. + select + adminhtml/system_config_source_yesno + 4 + 1 + 1 + 0 + + + + text + 5 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 6 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_order_status_processing + 7 + 1 + 1 + 0 + + + + multiselect + eway/source_cctype + 8 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 9 + 1 + 1 + 0 + + + + allowspecific + 10 + adminhtml/system_config_source_payment_allspecificcountries + 1 + 1 + 0 + + + + multiselect + 11 + adminhtml/system_config_source_country + 1 + 1 + 0 + + + + text + 12 + 1 + 1 + 0 + + + + + + text + 202 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 1 + 1 + 1 + 0 + + + <label>Title</label> + <frontend_type>text</frontend_type> + <sort_order>2</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + obscure + adminhtml/system_config_backend_encrypted + 3 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_currency + 4 + 1 + 1 + 0 + + + + text + 5 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 6 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_order_status_processing + 7 + 1 + 1 + 0 + + + + allowspecific + 8 + adminhtml/system_config_source_payment_allspecificcountries + 1 + 1 + 0 + + + + multiselect + 9 + adminhtml/system_config_source_country + 1 + 1 + 0 + + + + text + 10 + 1 + 1 + 0 + + + + + + text + 203 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 1 + 1 + 1 + 0 + + + <label>Title</label> + <frontend_type>text</frontend_type> + <sort_order>2</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + obscure + adminhtml/system_config_backend_encrypted + 3 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_currency + 4 + 1 + 1 + 0 + + + + text + 5 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 6 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_order_status_processing + 7 + 1 + 1 + 0 + + + + allowspecific + 8 + adminhtml/system_config_source_payment_allspecificcountries + 1 + 1 + 0 + + + + multiselect + 9 + adminhtml/system_config_source_country + 1 + 1 + 0 + + + + text + 10 + 1 + 1 + 0 + + + + + + + diff --git a/app/code/core/Mage/Eway/sql/eway_setup/mysql4-install-0.1.0.php b/app/code/core/Mage/Eway/sql/eway_setup/mysql4-install-0.1.0.php new file mode 100644 index 0000000000..d48e43bbe7 --- /dev/null +++ b/app/code/core/Mage/Eway/sql/eway_setup/mysql4-install-0.1.0.php @@ -0,0 +1,46 @@ +startSetup(); + +$installer->run(" + +-- DROP TABLE IF EXISTS `{$this->getTable('eway/api_debug')}`; +CREATE TABLE `{$this->getTable('eway/api_debug')}` ( + `debug_id` int(10) unsigned NOT NULL auto_increment, + `debug_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `request_body` text, + `response_body` text, + PRIMARY KEY (`debug_id`), + KEY `debug_at` (`debug_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + "); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Flo2Cash/Block/Form.php b/app/code/core/Mage/Flo2Cash/Block/Form.php new file mode 100644 index 0000000000..db5b2d74a4 --- /dev/null +++ b/app/code/core/Mage/Flo2Cash/Block/Form.php @@ -0,0 +1,41 @@ + + */ +class Mage_Flo2Cash_Block_Form extends Mage_Payment_Block_Form_Cc +{ + protected function _construct() + { + parent::_construct(); + $this->setTemplate('flo2cash/form.phtml'); + } +} diff --git a/app/code/core/Mage/Flo2Cash/Block/Info.php b/app/code/core/Mage/Flo2Cash/Block/Info.php new file mode 100644 index 0000000000..5a5d313906 --- /dev/null +++ b/app/code/core/Mage/Flo2Cash/Block/Info.php @@ -0,0 +1,48 @@ + + */ +class Mage_Flo2Cash_Block_Info extends Mage_Payment_Block_Info_Cc +{ + protected function _construct() + { + parent::_construct(); + $this->setTemplate('flo2cash/info.phtml'); + } + + public function toPdf() + { + $this->setTemplate('flo2cash/pdf/info.phtml'); + return $this->toHtml(); + } + +} diff --git a/app/code/core/Mage/Flo2Cash/Helper/Data.php b/app/code/core/Mage/Flo2Cash/Helper/Data.php new file mode 100644 index 0000000000..fa61513a63 --- /dev/null +++ b/app/code/core/Mage/Flo2Cash/Helper/Data.php @@ -0,0 +1,37 @@ + + */ +class Mage_Flo2Cash_Helper_Data extends Mage_Core_Helper_Abstract +{ + +} diff --git a/app/code/core/Mage/Flo2Cash/Model/Api/Debug.php b/app/code/core/Mage/Flo2Cash/Model/Api/Debug.php new file mode 100644 index 0000000000..4f11c641f0 --- /dev/null +++ b/app/code/core/Mage/Flo2Cash/Model/Api/Debug.php @@ -0,0 +1,40 @@ + + */ +class Mage_Flo2Cash_Model_Api_Debug extends Mage_Core_Model_Abstract +{ + protected function _construct() + { + $this->_init('flo2cash/api_debug'); + } +} diff --git a/app/code/core/Mage/Flo2Cash/Model/Mysql4/Api/Debug.php b/app/code/core/Mage/Flo2Cash/Model/Mysql4/Api/Debug.php new file mode 100644 index 0000000000..b46b2bcba8 --- /dev/null +++ b/app/code/core/Mage/Flo2Cash/Model/Mysql4/Api/Debug.php @@ -0,0 +1,40 @@ + + */ +class Mage_Flo2Cash_Model_Mysql4_Api_Debug extends Mage_Core_Model_Mysql4_Abstract +{ + protected function _construct() + { + $this->_init('flo2cash/api_debug', 'debug_id'); + } +} diff --git a/app/code/core/Mage/Flo2Cash/Model/Mysql4/Api/Debug/Collection.php b/app/code/core/Mage/Flo2Cash/Model/Mysql4/Api/Debug/Collection.php new file mode 100644 index 0000000000..50548162b8 --- /dev/null +++ b/app/code/core/Mage/Flo2Cash/Model/Mysql4/Api/Debug/Collection.php @@ -0,0 +1,40 @@ + + */ +class Mage_Flo2Cash_Model_Mysql4_Api_Debug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract +{ + protected function _construct() + { + $this->_init('flo2cash/api_debug'); + } +} diff --git a/app/code/core/Mage/Flo2Cash/Model/Mysql4/Setup.php b/app/code/core/Mage/Flo2Cash/Model/Mysql4/Setup.php new file mode 100644 index 0000000000..a4614f3159 --- /dev/null +++ b/app/code/core/Mage/Flo2Cash/Model/Mysql4/Setup.php @@ -0,0 +1,37 @@ + + */ +class Mage_Flo2Cash_Model_Mysql4_Setup extends Mage_Sales_Model_Mysql4_Setup +{ + +} diff --git a/app/code/core/Mage/Flo2Cash/Model/Source/Cctype.php b/app/code/core/Mage/Flo2Cash/Model/Source/Cctype.php new file mode 100644 index 0000000000..a707fc0df9 --- /dev/null +++ b/app/code/core/Mage/Flo2Cash/Model/Source/Cctype.php @@ -0,0 +1,40 @@ + + */ +class Mage_Flo2Cash_Model_Source_Cctype extends Mage_Payment_Model_Source_Cctype +{ + public function getAllowedTypes() + { + return array('VI', 'MC', 'AE', 'DICL'); + } +} diff --git a/app/code/core/Mage/Paygate/Model/Payflow/Source/PaymentAction.php b/app/code/core/Mage/Flo2Cash/Model/Source/PaymentAction.php similarity index 65% rename from app/code/core/Mage/Paygate/Model/Payflow/Source/PaymentAction.php rename to app/code/core/Mage/Flo2Cash/Model/Source/PaymentAction.php index 8192bcd665..8ebc52e105 100644 --- a/app/code/core/Mage/Paygate/Model/Payflow/Source/PaymentAction.php +++ b/app/code/core/Mage/Flo2Cash/Model/Source/PaymentAction.php @@ -19,29 +19,30 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Mage - * @package Mage_Paygate - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @package Mage_Flo2Cash + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** + * Flo2Cash Payment Action Dropdown source * - * Payflow Payment Action Dropdown source - * + * @category Mage + * @package Mage_Flo2Cash * @author Magento Core Team */ -class Mage_Paygate_Model_Payflow_Source_PaymentAction +class Mage_Flo2Cash_Model_Source_PaymentAction { public function toOptionArray() { return array( array( - 'value' => Mage_Paygate_Model_Payflow_Pro::ACTION_AUTHORIZE, - 'label' => Mage::helper('paygate')->__('Authorize Only') + 'value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE, + 'label' => Mage::helper('flo2cash')->__('Authorize') ), array( - 'value' => Mage_Paygate_Model_Payflow_Pro::ACTION_AUTHORIZE_CAPTURE, - 'label' => Mage::helper('paypal')->__('Authorize and Capture') + 'value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE, + 'label' => Mage::helper('flo2cash')->__('Purchase') ), ); } diff --git a/app/code/core/Mage/Flo2Cash/Model/Web.php b/app/code/core/Mage/Flo2Cash/Model/Web.php new file mode 100644 index 0000000000..308b195672 --- /dev/null +++ b/app/code/core/Mage/Flo2Cash/Model/Web.php @@ -0,0 +1,304 @@ + + */ +class Mage_Flo2Cash_Model_Web extends Mage_Payment_Model_Method_Cc +{ + const WSDL_URL_DEMO = 'http://demo.flo2cash.co.nz/ws/paynzws.asmx?wsdl'; + const WSDL_URL_LIVE = 'https://secure.flo2cash.co.nz/ws/paynzws.asmx?wsdl'; + + protected $_code = 'flo2cash_web'; + + protected $_allowCurrencyCode = array('NZD'); + + /** + * Availability options + */ + protected $_isGateway = true; + protected $_canAuthorize = true; + protected $_canCapture = true; + protected $_canCapturePartial = true; + protected $_canRefund = true; + protected $_canVoid = false; + protected $_canUseInternal = true; + protected $_canUseCheckout = true; + protected $_canUseForMultishipping = true; + protected $_canSaveCc = false; + + protected $_ccTypesConvert = array( + 'VI' => 'VISA', + 'MC' => 'MC', + 'DICL' => 'DINERS', + 'AE' => 'AMEX' + ); + + const TRANSACTION_TYPE_PURCHASE = 1; + const TRANSACTION_TYPE_REFUND = 2; + const TRANSACTION_TYPE_AUTHORISE = 3; + const TRANSACTION_TYPE_CAPTURE = 4; + + const TRANSACTION_STATUS_ACCEPTED = 1; + const TRANSACTION_STATUS_DECLINED = 2; + + protected $_formBlockType = 'flo2cash/form'; + protected $_infoBlockType = 'flo2cash/info'; + + /** + * Get Account Id for selected payment action + * + * @return string + */ + public function getAccountId() + { + if ($this->getConfigData('payment_action') == self::ACTION_AUTHORIZE_CAPTURE) { + $acountId = $this->getConfigData('payzn_purchase_account_id'); + } else { + $acountId = $this->getConfigData('payzn_account_id'); + } + return $acountId; + } + + /** + * validate the currency code is avaialable to use for Flo2Cash Basic or not + * + * @return bool + */ + public function validate() + { + parent::validate(); + $paymentInfo = $this->getInfoInstance(); + if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) { + $currency_code = $paymentInfo->getOrder()->getBaseCurrencyCode(); + } else { + $currency_code = $paymentInfo->getQuote()->getBaseCurrencyCode(); + } + if (!in_array($currency_code, $this->_allowCurrencyCode)) { + Mage::throwException(Mage::helper('flo2cash')->__('Selected currency code (%s) is not compatible with Flo2Cash', $currency_code)); + } + return $this; + } + + public function authorize(Varien_Object $payment, $amount) + { + $txnDetails = $this->_prepareTxnDetails($payment, $amount); + + $response = $this->_sendRequest($txnDetails); + + if ($response['txn_status'] == self::TRANSACTION_STATUS_DECLINED) { + Mage::throwException(Mage::helper('flo2cash')->__('Payment transaction has been declined.')); + } + + $payment->setStatus(self::STATUS_APPROVED) + ->setCcTransId($response['transaction_id']) + ->setTransactionId($response['transaction_id']) + ->setIsTransactionClosed(1) + ->setFlo2cashAccountId($response['paynz_account_id']); + + return $this; + } + + public function capture(Varien_Object $payment, $amount) + { + $txnDetails = $this->_prepareTxnDetails($payment, $amount); + + $response = $this->_sendRequest($txnDetails); + + if ($response['txn_status'] == self::TRANSACTION_STATUS_DECLINED) { + Mage::throwException(Mage::helper('flo2cash')->__('Payment transaction has been declined.')); + } + + $payment->setStatus(self::STATUS_APPROVED) + ->setTransactionId($response['transaction_id']) + ->setFlo2cashAccountId($response['paynz_account_id']); + + return $this; + } + + public function void(Varien_Object $payment) + { + $payment->setStatus(self::STATUS_SUCCESS ); + return $this; + } + + public function refund(Varien_Object $payment, $amount) + { + if ($payment->getParentTransactionId() && $amount>0) { + + $transId = $payment->getParentTransactionId(); + + $txnDetails = array( + 'txn_type' => self::TRANSACTION_TYPE_REFUND, + 'refund_transaction_id' => $transId, + 'paynz_account_id' => $payment->getFlo2cashAccountId(), + 'amount' => sprintf('%.2f', $amount) + ); + } else { + Mage::throwException(Mage::helper('flo2cash')->__('Error in refunding the payment.')); + } + + $response = $this->_sendRequest($txnDetails); + + if ($response['txn_status'] == self::TRANSACTION_STATUS_DECLINED) { + Mage::throwException(Mage::helper('flo2cash')->__('Payment transaction has been declined.')); + } + + $payment->setTransactionId($response['transaction_id']) + ->setIsTransactionClosed(1); + + return $this; + } + + /** + * Sending SOAP request to gateway + * + * @param array $txnDetails + * @return void + */ + protected function _sendRequest($txnDetails) + { + if ($this->getConfigData('demo_mode')) { + $url = self::WSDL_URL_DEMO; + } else { + $url = self::WSDL_URL_LIVE; + } + + $client = new SoapClient($url); + + $parameters = array( + 'username' => $this->getConfigData('username'), + 'password' => $this->getConfigData('password'), + 'txn_details' => $txnDetails + ); + + $debugData = array('request' => $parameters); + try { + $response = $client->ProcessPayment($parameters); + + $debugData['result'] = $response; + $this->_debug($debugData); + + return (array)$response->ProcessPaymentResult; + } + catch (SoapFault $e) { + + $debugData['result'] = array('error' => $e->getMessage(), 'code' => $e->getCode()); + $this->_debug($debugData); + + if (strpos($e->getMessage(), ' ---> ') !== FALSE) { + list($title, $error) = explode(' ---> ', $e->getMessage()); + } + else { + $error = $e->getMessage(); + } + + Mage::throwException(Mage::helper('flo2cash')->__('Gateway returned an error message: %s', $error)); + } + } + + /** + * Preapare basic paramters for transaction + * + * @param Varien_Object $payment + * @param decimal $amount + * @return array + */ + protected function _prepareTxnDetails(Varien_Object $payment, $amount) + { + if ($payment->getParentTransactionId()) { + $txnDetails = array( + 'txn_type' => self::TRANSACTION_TYPE_CAPTURE, + 'capture_transaction_id' => $payment->getParentTransactionId() + ); + } else { + $billingAddress = $payment->getOrder()->getBillingAddress(); + + if ($payment->getOrder()->getCustomerEmail()) { + $customerEmail = $payment->getOrder()->getCustomerEmail(); + } elseif ($billingAddress->getEmail()) { + $customerEmail = $billingAddress->getEmail(); + } else { + $customerEmail = ''; + } + + $txnDetails = array( + 'card_holder_name' => $payment->getCcOwner(), + 'card_number' => $payment->getCcNumber(), + 'card_type' => $this->_convertCcType($payment->getCcType()), + 'card_expiry' => sprintf('%02d', $payment->getCcExpMonth()).substr($payment->getCcExpYear(), 2, 2), + 'card_csc' => $payment->getCcCid(), + 'customer_email' => $customerEmail + ); + + if ($this->getConfigData('payment_action') == self::ACTION_AUTHORIZE) { + $txnDetails['txn_type'] = self::TRANSACTION_TYPE_AUTHORISE; + } else { + $txnDetails['txn_type'] = self::TRANSACTION_TYPE_PURCHASE; + } + } + + $accountId = $payment->getFlo2cashAccountId(); + //if transaction type is authorize & capture or only authorize + if (is_null($accountId)) { + $accountId = $this->getAccountId(); + } + + $txnDetails = array_merge($txnDetails, array( + //'txn_reference' => $payment->getOrder()->getIncrementId(), + 'merchant_reference' => $payment->getOrder()->getIncrementId(), + 'paynz_account_id' => $accountId, + 'amount' => sprintf('%.2f', $amount), + )); + + return $txnDetails; + } + + /** + * Converst CC Types Code from Magento to Flo2Cash + * + * @param string $magentoCcType + * @return string + */ + protected function _convertCcType($magentoCcType = 'VI') + { + return $this->_ccTypesConvert[$magentoCcType]; + } + + /** + * Define if debugging is enabled + * + * @return bool + */ + public function getDebugFlag() + { + return $this->getConfigData('debug_flag'); + } +} diff --git a/app/code/core/Mage/Flo2Cash/etc/config.xml b/app/code/core/Mage/Flo2Cash/etc/config.xml new file mode 100644 index 0000000000..544d9b997a --- /dev/null +++ b/app/code/core/Mage/Flo2Cash/etc/config.xml @@ -0,0 +1,121 @@ + + + + + + 0.1.1 + + + + + + Mage_Flo2Cash_Model + flo2cash_mysql4 + + + Mage_Flo2Cash_Model_Mysql4 + + flo2cash_api_debug
      +
      +
      +
      + + + + Mage_Flo2Cash + Mage_Flo2Cash_Model_Mysql4_Setup + + + + + Mage_Flo2Cash_Block + + + Mage_Flo2Cash_Helper + + + + + + DICL + Diners Club + 60 + + + + +
      + + + + standard + + Mage_Flo2Cash + flo2cash + + + + + + + + Mage_Flo2Cash.csv + + + + + + + + flo2cash.xml + + + + + + + + + + Mage_Flo2Cash.csv + + + + + + + + + Flo2Cash Web Service + AE,VI,MC,DICL + 0 + flo2cash/web + + + +
      diff --git a/app/code/core/Mage/Flo2Cash/etc/system.xml b/app/code/core/Mage/Flo2Cash/etc/system.xml new file mode 100644 index 0000000000..94d59152dd --- /dev/null +++ b/app/code/core/Mage/Flo2Cash/etc/system.xml @@ -0,0 +1,176 @@ + + + + + + + + + text + 501 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 0 + 1 + 1 + 0 + + + <label>Title</label> + <frontend_type>text</frontend_type> + <sort_order>10</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + text + 20 + 1 + 1 + 0 + + + + text + 30 + 1 + 1 + 0 + + + + For "Authorize" or "Capture" transactions only. + text + 31 + 1 + 1 + 0 + + + + For "Purchase" transactions only. + text + 32 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 33 + 1 + 1 + 0 + + + + select + flo2cash/source_paymentAction + 40 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_order_status_processing + 50 + 1 + 1 + 0 + + + + multiselect + flo2cash/source_cctype + 60 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 70 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 75 + 1 + 1 + 0 + + + + allowspecific + 80 + adminhtml/system_config_source_payment_allspecificcountries + 1 + 1 + 0 + + + + multiselect + 90 + adminhtml/system_config_source_country + 1 + 1 + 0 + + + + text + 100 + 1 + 1 + 0 + + + + + + + diff --git a/app/code/core/Mage/Flo2Cash/sql/flo2cash_setup/mysql4-install-0.1.0.php b/app/code/core/Mage/Flo2Cash/sql/flo2cash_setup/mysql4-install-0.1.0.php new file mode 100644 index 0000000000..fb92f87e16 --- /dev/null +++ b/app/code/core/Mage/Flo2Cash/sql/flo2cash_setup/mysql4-install-0.1.0.php @@ -0,0 +1,47 @@ +startSetup(); + +$installer->run(" + +DROP TABLE IF EXISTS `{$this->getTable('flo2cash/api_debug')}`; +CREATE TABLE `{$this->getTable('flo2cash/api_debug')}` ( + `debug_id` int(10) unsigned NOT NULL auto_increment, + `debug_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `request_body` text, + `response_body` text, + `exception` text, + PRIMARY KEY (`debug_id`), + KEY `debug_at` (`debug_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + "); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Flo2Cash/sql/flo2cash_setup/mysql4-upgrade-0.1.0-0.1.1.php b/app/code/core/Mage/Flo2Cash/sql/flo2cash_setup/mysql4-upgrade-0.1.0-0.1.1.php new file mode 100644 index 0000000000..9992c3bc46 --- /dev/null +++ b/app/code/core/Mage/Flo2Cash/sql/flo2cash_setup/mysql4-upgrade-0.1.0-0.1.1.php @@ -0,0 +1,32 @@ +startSetup(); + +$installer->addAttribute('order_payment', 'flo2cash_account_id', array()); + +$installer->endSetup(); diff --git a/app/code/core/Mage/GiftMessage/Block/Message/Form.php b/app/code/core/Mage/GiftMessage/Block/Message/Form.php index 0bf8950a4c..c1eb92d611 100644 --- a/app/code/core/Mage/GiftMessage/Block/Message/Form.php +++ b/app/code/core/Mage/GiftMessage/Block/Message/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GiftMessage/Block/Message/Helper.php b/app/code/core/Mage/GiftMessage/Block/Message/Helper.php index 7646799b2b..eca0208226 100644 --- a/app/code/core/Mage/GiftMessage/Block/Message/Helper.php +++ b/app/code/core/Mage/GiftMessage/Block/Message/Helper.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GiftMessage/Block/Message/Inline.php b/app/code/core/Mage/GiftMessage/Block/Message/Inline.php index d1671e3881..e0784ecb63 100644 --- a/app/code/core/Mage/GiftMessage/Block/Message/Inline.php +++ b/app/code/core/Mage/GiftMessage/Block/Message/Inline.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GiftMessage/Helper/Data.php b/app/code/core/Mage/GiftMessage/Helper/Data.php index fb360320d2..41de72d412 100644 --- a/app/code/core/Mage/GiftMessage/Helper/Data.php +++ b/app/code/core/Mage/GiftMessage/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GiftMessage/Helper/Message.php b/app/code/core/Mage/GiftMessage/Helper/Message.php index e24afadb67..560293e92d 100644 --- a/app/code/core/Mage/GiftMessage/Helper/Message.php +++ b/app/code/core/Mage/GiftMessage/Helper/Message.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GiftMessage/Helper/Url.php b/app/code/core/Mage/GiftMessage/Helper/Url.php index 30ff381309..24886b6543 100644 --- a/app/code/core/Mage/GiftMessage/Helper/Url.php +++ b/app/code/core/Mage/GiftMessage/Helper/Url.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Backend/Boolean/Config.php b/app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Backend/Boolean/Config.php index f013a01855..32f90e8807 100644 --- a/app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Backend/Boolean/Config.php +++ b/app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Backend/Boolean/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -59,4 +59,20 @@ public function beforeSave($object) } } + /** + * Validate attribute data + * + * @param Varien_Object $object + * @return boolean + */ + public function validate($object) + { + // all attribute's options + $optionsAllowed = array('0', '1', '2'); + + $value = $object->getData($this->getAttribute()->getAttributeCode()); + + return in_array($value, $optionsAllowed)? true : false; + } + } diff --git a/app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Source/Boolean/Config.php b/app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Source/Boolean/Config.php index 9f3a754a3a..ffc42f6c95 100644 --- a/app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Source/Boolean/Config.php +++ b/app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Source/Boolean/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GiftMessage/Model/Message.php b/app/code/core/Mage/GiftMessage/Model/Message.php index a7c2857137..ede384ba09 100644 --- a/app/code/core/Mage/GiftMessage/Model/Message.php +++ b/app/code/core/Mage/GiftMessage/Model/Message.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GiftMessage/Model/Mysql4/Message.php b/app/code/core/Mage/GiftMessage/Model/Mysql4/Message.php index 845688e631..a09156a948 100644 --- a/app/code/core/Mage/GiftMessage/Model/Mysql4/Message.php +++ b/app/code/core/Mage/GiftMessage/Model/Mysql4/Message.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GiftMessage/Model/Mysql4/Message/Collection.php b/app/code/core/Mage/GiftMessage/Model/Mysql4/Message/Collection.php index f0163dd043..2aaae1592b 100644 --- a/app/code/core/Mage/GiftMessage/Model/Mysql4/Message/Collection.php +++ b/app/code/core/Mage/GiftMessage/Model/Mysql4/Message/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GiftMessage/Model/Mysql4/Setup.php b/app/code/core/Mage/GiftMessage/Model/Mysql4/Setup.php index 78182dd362..611d9aea3b 100644 --- a/app/code/core/Mage/GiftMessage/Model/Mysql4/Setup.php +++ b/app/code/core/Mage/GiftMessage/Model/Mysql4/Setup.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GiftMessage/Model/Observer.php b/app/code/core/Mage/GiftMessage/Model/Observer.php index 99d5b5ccd2..9d001beac8 100644 --- a/app/code/core/Mage/GiftMessage/Model/Observer.php +++ b/app/code/core/Mage/GiftMessage/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -43,9 +43,10 @@ class Mage_GiftMessage_Model_Observer extends Varien_Object */ public function salesEventConvertQuoteItemToOrderItem($observer) { - $observer->getEvent()->getOrderItem() - ->setGiftMessageId($observer->getEvent()->getItem()->getGiftMessageId()) - ->setGiftMessageAvailable($this->_getAvailable($observer->getEvent()->getItem()->getProductId())); + $orderItem = $observer->getEvent()->getOrderItem(); + $quoteItem = $observer->getEvent()->getItem(); + $orderItem->setGiftMessageId($quoteItem->getGiftMessageId()) + ->setGiftMessageAvailable($this->_getAvailable($quoteItem->getProduct())); return $this; } diff --git a/app/code/core/Mage/GiftMessage/controllers/IndexController.php b/app/code/core/Mage/GiftMessage/controllers/IndexController.php index 342d58d658..5b66657856 100644 --- a/app/code/core/Mage/GiftMessage/controllers/IndexController.php +++ b/app/code/core/Mage/GiftMessage/controllers/IndexController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GiftMessage/etc/config.xml b/app/code/core/Mage/GiftMessage/etc/config.xml index 1b0edfd368..e7388f0f84 100644 --- a/app/code/core/Mage/GiftMessage/etc/config.xml +++ b/app/code/core/Mage/GiftMessage/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/GiftMessage/etc/system.xml b/app/code/core/Mage/GiftMessage/etc/system.xml index 3ab12f0cfc..6d0a298acd 100644 --- a/app/code/core/Mage/GiftMessage/etc/system.xml +++ b/app/code/core/Mage/GiftMessage/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/GiftMessage/sql/giftmessage_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/GiftMessage/sql/giftmessage_setup/mysql4-install-0.7.0.php index 07fcd7ceab..ebbde8890b 100644 --- a/app/code/core/Mage/GiftMessage/sql/giftmessage_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/GiftMessage/sql/giftmessage_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GiftMessage/sql/giftmessage_setup/mysql4-upgrade-0.1.3-0.7.0.php b/app/code/core/Mage/GiftMessage/sql/giftmessage_setup/mysql4-upgrade-0.1.3-0.7.0.php index 511cc1ed02..12263e2ace 100644 --- a/app/code/core/Mage/GiftMessage/sql/giftmessage_setup/mysql4-upgrade-0.1.3-0.7.0.php +++ b/app/code/core/Mage/GiftMessage/sql/giftmessage_setup/mysql4-upgrade-0.1.3-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $this->startSetup() diff --git a/app/code/core/Mage/GiftMessage/sql/giftmessage_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/GiftMessage/sql/giftmessage_setup/mysql4-upgrade-0.7.0-0.7.1.php index f6e67f1c68..19124d8851 100644 --- a/app/code/core/Mage/GiftMessage/sql/giftmessage_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/GiftMessage/sql/giftmessage_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GiftMessage/sql/giftmessage_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/GiftMessage/sql/giftmessage_setup/mysql4-upgrade-0.7.1-0.7.2.php index 62844eb507..a7a23d8433 100644 --- a/app/code/core/Mage/GiftMessage/sql/giftmessage_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/GiftMessage/sql/giftmessage_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftMessage - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GiftRegistry/Model/Gift.php b/app/code/core/Mage/GiftRegistry/Model/Gift.php index 29d935828d..571f4fdf50 100644 --- a/app/code/core/Mage/GiftRegistry/Model/Gift.php +++ b/app/code/core/Mage/GiftRegistry/Model/Gift.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftRegistry - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GiftRegistry/Model/Mysql4/Gift.php b/app/code/core/Mage/GiftRegistry/Model/Mysql4/Gift.php index 0ca5521afb..193b9c1e12 100644 --- a/app/code/core/Mage/GiftRegistry/Model/Mysql4/Gift.php +++ b/app/code/core/Mage/GiftRegistry/Model/Mysql4/Gift.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftRegistry - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GiftRegistry/Model/Mysql4/Gift/Collection.php b/app/code/core/Mage/GiftRegistry/Model/Mysql4/Gift/Collection.php index dcd855341b..4075c99be6 100644 --- a/app/code/core/Mage/GiftRegistry/Model/Mysql4/Gift/Collection.php +++ b/app/code/core/Mage/GiftRegistry/Model/Mysql4/Gift/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GiftRegistry - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GiftRegistry/etc/config.xml b/app/code/core/Mage/GiftRegistry/etc/config.xml index 5daf735c5a..32e8f97fd1 100644 --- a/app/code/core/Mage/GiftRegistry/etc/config.xml +++ b/app/code/core/Mage/GiftRegistry/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_GiftRegistry - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/GoogleAnalytics/Block/Ga.php b/app/code/core/Mage/GoogleAnalytics/Block/Ga.php index b4dba8dd52..5d2219a1af 100644 --- a/app/code/core/Mage/GoogleAnalytics/Block/Ga.php +++ b/app/code/core/Mage/GoogleAnalytics/Block/Ga.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleAnalytics - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -177,6 +177,7 @@ protected function _toHtml() (document.getElementsByTagName(\'head\')[0] || document.getElementsByTagName(\'body\')[0]).appendChild(ga); })(); + var _gaq = _gaq || []; _gaq.push(["_setAccount", "' . $this->getAccount() . '"]); _gaq.push(["_trackPageview", "'.$this->getPageName().'"]); //]]> diff --git a/app/code/core/Mage/GoogleAnalytics/Helper/Data.php b/app/code/core/Mage/GoogleAnalytics/Helper/Data.php index d671d6b33d..e0bc92aeb0 100644 --- a/app/code/core/Mage/GoogleAnalytics/Helper/Data.php +++ b/app/code/core/Mage/GoogleAnalytics/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleAnalytics - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleAnalytics/Model/Observer.php b/app/code/core/Mage/GoogleAnalytics/Model/Observer.php index 65e7ffad5d..8ef59e8796 100644 --- a/app/code/core/Mage/GoogleAnalytics/Model/Observer.php +++ b/app/code/core/Mage/GoogleAnalytics/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleAnalytics - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -56,7 +56,11 @@ public function setGoogleAnalyticsOnOrderSuccessPageView(Varien_Event_Observer $ $analyticsBlock = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('google_analytics'); if ($quoteId && ($analyticsBlock instanceof Mage_Core_Block_Abstract)) { $quote = Mage::getModel('sales/quote')->load($quoteId); - $analyticsBlock->setQuote($quote); + if ($quoteId == $quote->getId()) { + $analyticsBlock->setQuote($quote); + } else { + $analyticsBlock->setQuote($quoteId); + } } } } diff --git a/app/code/core/Mage/GoogleAnalytics/etc/adminhtml.xml b/app/code/core/Mage/GoogleAnalytics/etc/adminhtml.xml index 9630768c7c..1aa3054727 100644 --- a/app/code/core/Mage/GoogleAnalytics/etc/adminhtml.xml +++ b/app/code/core/Mage/GoogleAnalytics/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_GoogleAnalytics - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/GoogleAnalytics/etc/config.xml b/app/code/core/Mage/GoogleAnalytics/etc/config.xml index 9112321580..2b02fbc80a 100644 --- a/app/code/core/Mage/GoogleAnalytics/etc/config.xml +++ b/app/code/core/Mage/GoogleAnalytics/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_GoogleAnalytics - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/GoogleAnalytics/etc/system.xml b/app/code/core/Mage/GoogleAnalytics/etc/system.xml index 7f84df0426..c18a717b54 100644 --- a/app/code/core/Mage/GoogleAnalytics/etc/system.xml +++ b/app/code/core/Mage/GoogleAnalytics/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_GoogleAnalytics - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -54,7 +54,7 @@ 1 - + text 20 1 diff --git a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Captcha.php b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Captcha.php index aecb519dcc..71c7bfaaec 100644 --- a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Captcha.php +++ b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Captcha.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items.php b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items.php index 661dc2bd58..065e5c88a7 100644 --- a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items.php +++ b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items/Item.php b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items/Item.php index 87ac62c8d4..f17a9a5004 100644 --- a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items/Item.php +++ b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items/Product.php b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items/Product.php index 9f01502bff..9ff9cde58c 100644 --- a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items/Product.php +++ b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items/Renderer/Id.php b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items/Renderer/Id.php index d29e9603ac..f00ccf8888 100644 --- a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items/Renderer/Id.php +++ b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Items/Renderer/Id.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Store/Switcher.php b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Store/Switcher.php index 319718a40a..6f1f31bf56 100644 --- a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Store/Switcher.php +++ b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Store/Switcher.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types.php b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types.php index eb54ba0f52..6596942f8e 100644 --- a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types.php +++ b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Edit.php b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Edit.php index d3feb975fe..b6806131fd 100644 --- a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Edit.php +++ b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Edit/Attributes.php b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Edit/Attributes.php index 7499723495..d1e0df64e7 100644 --- a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Edit/Attributes.php +++ b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Edit/Attributes.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Edit/Form.php b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Edit/Form.php index 9fef5e6329..674d1ed389 100644 --- a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Edit/Form.php +++ b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -99,7 +99,7 @@ protected function _prepareForm() } $fieldset->addField('attributes_box', 'note', array( - 'label' => $this->__('Attributes mapping'), + 'label' => $this->__('Attributes Mapping'), 'text' => '
      ' . $attributesBlock->toHtml() . '
      ', )); diff --git a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Grid.php b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Grid.php index 38ab3574f2..21dafa21f0 100644 --- a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Grid.php +++ b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Renderer/Country.php b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Renderer/Country.php index 0573e8556b..094ba9261f 100644 --- a/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Renderer/Country.php +++ b/app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Renderer/Country.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Helper/Data.php b/app/code/core/Mage/GoogleBase/Helper/Data.php index 18373a805f..0f1c16fe85 100644 --- a/app/code/core/Mage/GoogleBase/Helper/Data.php +++ b/app/code/core/Mage/GoogleBase/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Model/Attribute.php b/app/code/core/Mage/GoogleBase/Model/Attribute.php index 50af152f9a..54beb4b16c 100644 --- a/app/code/core/Mage/GoogleBase/Model/Attribute.php +++ b/app/code/core/Mage/GoogleBase/Model/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Model/Config.php b/app/code/core/Mage/GoogleBase/Model/Config.php index 3157e6aed2..75bb59270e 100644 --- a/app/code/core/Mage/GoogleBase/Model/Config.php +++ b/app/code/core/Mage/GoogleBase/Model/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Model/Item.php b/app/code/core/Mage/GoogleBase/Model/Item.php index d7da07c486..590dc54b2a 100644 --- a/app/code/core/Mage/GoogleBase/Model/Item.php +++ b/app/code/core/Mage/GoogleBase/Model/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Model/Mysql4/Attribute.php b/app/code/core/Mage/GoogleBase/Model/Mysql4/Attribute.php index d06f772186..35202d181f 100644 --- a/app/code/core/Mage/GoogleBase/Model/Mysql4/Attribute.php +++ b/app/code/core/Mage/GoogleBase/Model/Mysql4/Attribute.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Model/Mysql4/Attribute/Collection.php b/app/code/core/Mage/GoogleBase/Model/Mysql4/Attribute/Collection.php index f7ba575ef3..4fbe21bc51 100644 --- a/app/code/core/Mage/GoogleBase/Model/Mysql4/Attribute/Collection.php +++ b/app/code/core/Mage/GoogleBase/Model/Mysql4/Attribute/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Model/Mysql4/Item.php b/app/code/core/Mage/GoogleBase/Model/Mysql4/Item.php index 22b2d23c59..8cd8f9de9a 100644 --- a/app/code/core/Mage/GoogleBase/Model/Mysql4/Item.php +++ b/app/code/core/Mage/GoogleBase/Model/Mysql4/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Model/Mysql4/Item/Collection.php b/app/code/core/Mage/GoogleBase/Model/Mysql4/Item/Collection.php index 27803d9906..0fb92947c9 100644 --- a/app/code/core/Mage/GoogleBase/Model/Mysql4/Item/Collection.php +++ b/app/code/core/Mage/GoogleBase/Model/Mysql4/Item/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Model/Mysql4/Type.php b/app/code/core/Mage/GoogleBase/Model/Mysql4/Type.php index 5644ce3ae5..6e61d1ac8e 100644 --- a/app/code/core/Mage/GoogleBase/Model/Mysql4/Type.php +++ b/app/code/core/Mage/GoogleBase/Model/Mysql4/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Model/Mysql4/Type/Collection.php b/app/code/core/Mage/GoogleBase/Model/Mysql4/Type/Collection.php index 786e5fad0a..e0eec59a38 100644 --- a/app/code/core/Mage/GoogleBase/Model/Mysql4/Type/Collection.php +++ b/app/code/core/Mage/GoogleBase/Model/Mysql4/Type/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Model/Observer.php b/app/code/core/Mage/GoogleBase/Model/Observer.php index dd59fd1674..327fbd8021 100644 --- a/app/code/core/Mage/GoogleBase/Model/Observer.php +++ b/app/code/core/Mage/GoogleBase/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Model/Service.php b/app/code/core/Mage/GoogleBase/Model/Service.php index 8a8976cb3b..bdda5dfafd 100644 --- a/app/code/core/Mage/GoogleBase/Model/Service.php +++ b/app/code/core/Mage/GoogleBase/Model/Service.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Model/Service/Feed.php b/app/code/core/Mage/GoogleBase/Model/Service/Feed.php index 735eba7989..76d202b019 100644 --- a/app/code/core/Mage/GoogleBase/Model/Service/Feed.php +++ b/app/code/core/Mage/GoogleBase/Model/Service/Feed.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Model/Service/Item.php b/app/code/core/Mage/GoogleBase/Model/Service/Item.php index 55ac08b5a2..bfc0d81986 100644 --- a/app/code/core/Mage/GoogleBase/Model/Service/Item.php +++ b/app/code/core/Mage/GoogleBase/Model/Service/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -217,7 +217,7 @@ protected function _prepareEnrtyForSave() { $object = $this->getObject(); if (!($object instanceof Varien_Object)) { - Mage::throwException(Mage::helper('googlebase')->__('Object model is not specified to save Google Base entry')); + Mage::throwException(Mage::helper('googlebase')->__('Object model is not specified to save Google Base entry.')); } $this->_setUniversalData(); @@ -385,7 +385,7 @@ protected function _getItemType() protected function _checkItem() { if (!($this->getItem() instanceof Mage_GoogleBase_Model_Item)) { - Mage::throwException(Mage::helper('googlebase')->__('Item model is not specified to delete Google Base entry')); + Mage::throwException(Mage::helper('googlebase')->__('Item model is not specified to delete Google Base entry.')); } } diff --git a/app/code/core/Mage/GoogleBase/Model/Source/Accounttype.php b/app/code/core/Mage/GoogleBase/Model/Source/Accounttype.php index 8f5acc2e2c..ac6ca4136a 100644 --- a/app/code/core/Mage/GoogleBase/Model/Source/Accounttype.php +++ b/app/code/core/Mage/GoogleBase/Model/Source/Accounttype.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Model/Source/Authtype.php b/app/code/core/Mage/GoogleBase/Model/Source/Authtype.php index 5be114e735..a569d254ec 100644 --- a/app/code/core/Mage/GoogleBase/Model/Source/Authtype.php +++ b/app/code/core/Mage/GoogleBase/Model/Source/Authtype.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Model/Source/Country.php b/app/code/core/Mage/GoogleBase/Model/Source/Country.php index 2156d636dc..de8e40c2a4 100644 --- a/app/code/core/Mage/GoogleBase/Model/Source/Country.php +++ b/app/code/core/Mage/GoogleBase/Model/Source/Country.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Model/Source/Statuses.php b/app/code/core/Mage/GoogleBase/Model/Source/Statuses.php index de53290d31..3ed4ff7611 100644 --- a/app/code/core/Mage/GoogleBase/Model/Source/Statuses.php +++ b/app/code/core/Mage/GoogleBase/Model/Source/Statuses.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/Model/Type.php b/app/code/core/Mage/GoogleBase/Model/Type.php index b728d87658..f4da8b8baa 100644 --- a/app/code/core/Mage/GoogleBase/Model/Type.php +++ b/app/code/core/Mage/GoogleBase/Model/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/controllers/ItemsController.php b/app/code/core/Mage/GoogleBase/controllers/ItemsController.php index 6c1601db00..9fc0494ef5 100644 --- a/app/code/core/Mage/GoogleBase/controllers/ItemsController.php +++ b/app/code/core/Mage/GoogleBase/controllers/ItemsController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -119,10 +119,10 @@ public function massAddAction() if ($totalAdded > 0) { $this->_getSession()->addSuccess( - $this->__('Total of %d product(s) were successfully added to Google Base', $totalAdded) + $this->__('Total of %d product(s) have been added to Google Base.', $totalAdded) ); } elseif (is_null($productIds)) { - $this->_getSession()->addError($this->__('Session expired during export. Please, revise exported products and repeat a process if necessary')); + $this->_getSession()->addError($this->__('Session expired during export. Please revise exported products and repeat the process if necessary.')); } else { $this->_getSession()->addError($this->__('No products were added to Google Base')); } @@ -157,7 +157,7 @@ public function massDeleteAction() } if ($totalDeleted > 0) { $this->_getSession()->addSuccess( - $this->__('Total of %d items(s) were successfully removed from Google Base', $totalDeleted) + $this->__('Total of %d items(s) have been removed from Google Base.', $totalDeleted) ); } else { $this->_getSession()->addError($this->__('No items were deleted from Google Base')); @@ -192,7 +192,7 @@ public function massPublishAction() } if ($totalPublished > 0) { $this->_getSession()->addSuccess( - $this->__('Total of %d items(s) were successfully published', $totalPublished) + $this->__('Total of %d items(s) have been published.', $totalPublished) ); } else { $this->_getSession()->addError($this->__('No items were published')); @@ -227,10 +227,10 @@ public function massHideAction() } if ($totalHidden > 0) { $this->_getSession()->addSuccess( - $this->__('Total of %d items(s) were successfully saved as Inactive items', $totalHidden) + $this->__('Total of %d items(s) have been saved as inactive items.', $totalHidden) ); } else { - $this->_getSession()->addError($this->__('No items were saved as Inactive items')); + $this->_getSession()->addError($this->__('No items were saved as inactive items')); } } catch (Zend_Gdata_App_CaptchaRequiredException $e) { $this->_getSession()->addError($e->getMessage()); @@ -279,7 +279,7 @@ public function refreshAction() } $this->_getSession()->addSuccess( - $this->__('Total of %d items(s) were successfully deleted, Total of %d items(s) were successfully updated', $totalDeleted, $totalUpdated) + $this->__('Total of %d items(s) have been deleted; total of %d items(s) have been updated.', $totalDeleted, $totalUpdated) ); } catch (Zend_Gdata_App_CaptchaRequiredException $e) { @@ -304,7 +304,7 @@ public function confirmCaptchaAction() Mage::helper('core')->urlDecode($this->getRequest()->getParam('captcha_token')), $this->getRequest()->getParam('user_confirm') ); - $this->_getSession()->addSuccess($this->__('Captcha confirmed successfully')); + $this->_getSession()->addSuccess($this->__('Captcha has been confirmed.')); } catch (Zend_Gdata_App_CaptchaRequiredException $e) { $this->_getSession()->addError($this->__('Captcha confirmation error: %s', $e->getMessage())); @@ -344,7 +344,7 @@ public function _getStore() { $store = Mage::app()->getStore((int)$this->getRequest()->getParam('store', 0)); if ((!$store) || 0 == $store->getId()) { - Mage::throwException($this->__('Unable to select a Store View')); + Mage::throwException($this->__('Unable to select a Store View.')); } return $store; } diff --git a/app/code/core/Mage/GoogleBase/controllers/SelectionController.php b/app/code/core/Mage/GoogleBase/controllers/SelectionController.php index 08991a8528..4a4770b72d 100644 --- a/app/code/core/Mage/GoogleBase/controllers/SelectionController.php +++ b/app/code/core/Mage/GoogleBase/controllers/SelectionController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/controllers/TypesController.php b/app/code/core/Mage/GoogleBase/controllers/TypesController.php index 56914a104a..32b4281186 100644 --- a/app/code/core/Mage/GoogleBase/controllers/TypesController.php +++ b/app/code/core/Mage/GoogleBase/controllers/TypesController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -49,7 +49,7 @@ public function postDispatch() protected function _initItemType() { $this->_title($this->__('Catalog')) - ->_title($this->__('Google base')) + ->_title($this->__('Google Base')) ->_title($this->__('Manage Attributes')); Mage::register('current_item_type', Mage::getModel('googlebase/type')); @@ -181,7 +181,7 @@ public function saveAction() } } - Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('googlebase')->__('Item type was successfully saved')); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('googlebase')->__('The item type has been saved.')); } catch (Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); } diff --git a/app/code/core/Mage/GoogleBase/etc/adminhtml.xml b/app/code/core/Mage/GoogleBase/etc/adminhtml.xml index bd9066f18a..e1f5435f69 100644 --- a/app/code/core/Mage/GoogleBase/etc/adminhtml.xml +++ b/app/code/core/Mage/GoogleBase/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/GoogleBase/etc/config.xml b/app/code/core/Mage/GoogleBase/etc/config.xml index 05af802eae..df6b797f7b 100644 --- a/app/code/core/Mage/GoogleBase/etc/config.xml +++ b/app/code/core/Mage/GoogleBase/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/GoogleBase/etc/system.xml b/app/code/core/Mage/GoogleBase/etc/system.xml index 7ac81405fc..8646a14f9c 100644 --- a/app/code/core/Mage/GoogleBase/etc/system.xml +++ b/app/code/core/Mage/GoogleBase/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -38,7 +38,7 @@ 1 - + text 1 1 @@ -46,7 +46,7 @@ 1 - + password 2 1 @@ -72,7 +72,7 @@ 1 - + select adminhtml/system_config_source_yesno 100 diff --git a/app/code/core/Mage/GoogleBase/sql/googlebase_setup/mysql4-install-0.1.0.php b/app/code/core/Mage/GoogleBase/sql/googlebase_setup/mysql4-install-0.1.0.php index 40bf3555ce..e432455b3c 100644 --- a/app/code/core/Mage/GoogleBase/sql/googlebase_setup/mysql4-install-0.1.0.php +++ b/app/code/core/Mage/GoogleBase/sql/googlebase_setup/mysql4-install-0.1.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleBase/sql/googlebase_setup/mysql4-upgrade-0.1.0-0.1.1.php b/app/code/core/Mage/GoogleBase/sql/googlebase_setup/mysql4-upgrade-0.1.0-0.1.1.php index eca999f156..8e73996420 100644 --- a/app/code/core/Mage/GoogleBase/sql/googlebase_setup/mysql4-upgrade-0.1.0-0.1.1.php +++ b/app/code/core/Mage/GoogleBase/sql/googlebase_setup/mysql4-upgrade-0.1.0-0.1.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleBase - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleCheckout/Block/Adminhtml/Shipping/Applicable/Countries.php b/app/code/core/Mage/GoogleCheckout/Block/Adminhtml/Shipping/Applicable/Countries.php index fd2900f5c8..350417eefa 100644 --- a/app/code/core/Mage/GoogleCheckout/Block/Adminhtml/Shipping/Applicable/Countries.php +++ b/app/code/core/Mage/GoogleCheckout/Block/Adminhtml/Shipping/Applicable/Countries.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleCheckout - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -41,7 +41,7 @@ protected function _appendJs($element) { $elId = $element->getHtmlId(); $childId = str_replace('sallowspecific', 'specificcountry', $elId); - $html = "' . $attributeHtml . ''; + $attributeHtml = '' . $attributeHtml . ''; } return $attributeHtml; } diff --git a/app/code/core/Mage/GoogleOptimizer/Model/Adminhtml/System/Config/Source/Googleoptimizer/Conversionpages.php b/app/code/core/Mage/GoogleOptimizer/Model/Adminhtml/System/Config/Source/Googleoptimizer/Conversionpages.php index 0bd46d89b6..03153619a2 100644 --- a/app/code/core/Mage/GoogleOptimizer/Model/Adminhtml/System/Config/Source/Googleoptimizer/Conversionpages.php +++ b/app/code/core/Mage/GoogleOptimizer/Model/Adminhtml/System/Config/Source/Googleoptimizer/Conversionpages.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleOptimizer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleOptimizer/Model/Code.php b/app/code/core/Mage/GoogleOptimizer/Model/Code.php index 9232d0014c..137c99c2d4 100644 --- a/app/code/core/Mage/GoogleOptimizer/Model/Code.php +++ b/app/code/core/Mage/GoogleOptimizer/Model/Code.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleOptimizer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleOptimizer/Model/Code/Category.php b/app/code/core/Mage/GoogleOptimizer/Model/Code/Category.php index bbfac6b0a1..7f93fe1c06 100644 --- a/app/code/core/Mage/GoogleOptimizer/Model/Code/Category.php +++ b/app/code/core/Mage/GoogleOptimizer/Model/Code/Category.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleOptimizer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleOptimizer/Model/Code/Page.php b/app/code/core/Mage/GoogleOptimizer/Model/Code/Page.php index f0f54eef2f..46cc5d0cd5 100644 --- a/app/code/core/Mage/GoogleOptimizer/Model/Code/Page.php +++ b/app/code/core/Mage/GoogleOptimizer/Model/Code/Page.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleOptimizer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleOptimizer/Model/Code/Product.php b/app/code/core/Mage/GoogleOptimizer/Model/Code/Product.php index c6301851e9..ad059502d7 100644 --- a/app/code/core/Mage/GoogleOptimizer/Model/Code/Product.php +++ b/app/code/core/Mage/GoogleOptimizer/Model/Code/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleOptimizer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleOptimizer/Model/Mysql4/Code.php b/app/code/core/Mage/GoogleOptimizer/Model/Mysql4/Code.php index 56652d5bbc..9b66cd356f 100644 --- a/app/code/core/Mage/GoogleOptimizer/Model/Mysql4/Code.php +++ b/app/code/core/Mage/GoogleOptimizer/Model/Mysql4/Code.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleOptimizer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleOptimizer/Model/Mysql4/Code/Collection.php b/app/code/core/Mage/GoogleOptimizer/Model/Mysql4/Code/Collection.php index 5624f9d71b..dae57d0619 100644 --- a/app/code/core/Mage/GoogleOptimizer/Model/Mysql4/Code/Collection.php +++ b/app/code/core/Mage/GoogleOptimizer/Model/Mysql4/Code/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleOptimizer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleOptimizer/Model/Observer.php b/app/code/core/Mage/GoogleOptimizer/Model/Observer.php index d47e915706..8548f07464 100644 --- a/app/code/core/Mage/GoogleOptimizer/Model/Observer.php +++ b/app/code/core/Mage/GoogleOptimizer/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleOptimizer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleOptimizer/controllers/IndexController.php b/app/code/core/Mage/GoogleOptimizer/controllers/IndexController.php index c4f6284ff7..b0b83954a1 100644 --- a/app/code/core/Mage/GoogleOptimizer/controllers/IndexController.php +++ b/app/code/core/Mage/GoogleOptimizer/controllers/IndexController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleOptimizer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleOptimizer/etc/config.xml b/app/code/core/Mage/GoogleOptimizer/etc/config.xml index c7cfc6311c..1931c564ba 100644 --- a/app/code/core/Mage/GoogleOptimizer/etc/config.xml +++ b/app/code/core/Mage/GoogleOptimizer/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_GoogleOptimizer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/GoogleOptimizer/etc/system.xml b/app/code/core/Mage/GoogleOptimizer/etc/system.xml index 15bb9ac633..c57deff9ae 100644 --- a/app/code/core/Mage/GoogleOptimizer/etc/system.xml +++ b/app/code/core/Mage/GoogleOptimizer/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_GoogleOptimizer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/GoogleOptimizer/sql/googleoptimizer_setup/mysql4-install-0.1.0.php b/app/code/core/Mage/GoogleOptimizer/sql/googleoptimizer_setup/mysql4-install-0.1.0.php index 6212c7fbc2..0fee1211cb 100644 --- a/app/code/core/Mage/GoogleOptimizer/sql/googleoptimizer_setup/mysql4-install-0.1.0.php +++ b/app/code/core/Mage/GoogleOptimizer/sql/googleoptimizer_setup/mysql4-install-0.1.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleOptimizer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleOptimizer/sql/googleoptimizer_setup/mysql4-upgrade-0.1.0-0.1.1.php b/app/code/core/Mage/GoogleOptimizer/sql/googleoptimizer_setup/mysql4-upgrade-0.1.0-0.1.1.php index 414347c6d9..5fbd488621 100644 --- a/app/code/core/Mage/GoogleOptimizer/sql/googleoptimizer_setup/mysql4-upgrade-0.1.0-0.1.1.php +++ b/app/code/core/Mage/GoogleOptimizer/sql/googleoptimizer_setup/mysql4-upgrade-0.1.0-0.1.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleOptimizer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/GoogleOptimizer/sql/googleoptimizer_setup/mysql4-upgrade-0.1.1-0.1.2.php b/app/code/core/Mage/GoogleOptimizer/sql/googleoptimizer_setup/mysql4-upgrade-0.1.1-0.1.2.php index 199186061e..964877f2f0 100644 --- a/app/code/core/Mage/GoogleOptimizer/sql/googleoptimizer_setup/mysql4-upgrade-0.1.1-0.1.2.php +++ b/app/code/core/Mage/GoogleOptimizer/sql/googleoptimizer_setup/mysql4-upgrade-0.1.1-0.1.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_GoogleOptimizer - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Ideal/Block/Advanced/Failure.php b/app/code/core/Mage/Ideal/Block/Advanced/Failure.php new file mode 100644 index 0000000000..f5b27ae3b3 --- /dev/null +++ b/app/code/core/Mage/Ideal/Block/Advanced/Failure.php @@ -0,0 +1,55 @@ + + */ + +class Mage_Ideal_Block_Advanced_Failure extends Mage_Core_Block_Template +{ + /** + * Returns error from session and clears it + * + * @return string + */ + public function getErrorMessage () + { + $error = Mage::getSingleton('checkout/session')->getIdealErrorMessage(); + Mage::getSingleton('checkout/session')->unsIdealErrorMessage(); + return $error; + } + + /** + * Get continue shopping url + */ + public function getContinueShoppingUrl() + { + return Mage::getUrl('checkout/cart'); + } +} diff --git a/app/code/core/Mage/Ideal/Block/Advanced/Form.php b/app/code/core/Mage/Ideal/Block/Advanced/Form.php new file mode 100755 index 0000000000..3b96d8e629 --- /dev/null +++ b/app/code/core/Mage/Ideal/Block/Advanced/Form.php @@ -0,0 +1,52 @@ + + */ + +class Mage_Ideal_Block_Advanced_Form extends Mage_Payment_Block_Form +{ + protected function _construct() + { + $this->setTemplate('ideal/advanced/form.phtml'); + parent::_construct(); + } + + /** + * Return array that contains issuer list + * + * @return array + */ + public function getIssuerList() + { + return $this->getMethod()->getIssuerList(); + } +} diff --git a/app/code/core/Mage/Ideal/Block/Advanced/Info.php b/app/code/core/Mage/Ideal/Block/Advanced/Info.php new file mode 100644 index 0000000000..6faf947ad6 --- /dev/null +++ b/app/code/core/Mage/Ideal/Block/Advanced/Info.php @@ -0,0 +1,63 @@ + + */ +class Mage_Ideal_Block_Advanced_Info extends Mage_Payment_Block_Info +{ + protected function _construct() + { + parent::_construct(); + $this->setTemplate('ideal/advanced/info.phtml'); + } + + public function toPdf() + { + $this->setTemplate('ideal/advanced/pdf/info.phtml'); + return $this->toHtml(); + } + + /** + * Gets Issuer Title from Payment Attribute + * + * @return string + */ + public function getIssuerTitle() + { + if ($this->getInfo() instanceof Mage_Sales_Model_Quote_Payment) { + $issuerList = unserialize($this->getInfo()->getIdealIssuerList()); + return $issuerList[$this->getInfo()->getIdealIssuerId()]; + } else { + return $this->getInfo()->getIdealIssuerTitle(); + } + } + +} diff --git a/app/code/core/Mage/Ideal/Block/Advanced/Redirect.php b/app/code/core/Mage/Ideal/Block/Advanced/Redirect.php new file mode 100755 index 0000000000..879d42ea34 --- /dev/null +++ b/app/code/core/Mage/Ideal/Block/Advanced/Redirect.php @@ -0,0 +1,45 @@ + + */ + +class Mage_Ideal_Block_Advanced_Redirect extends Mage_Core_Block_Abstract +{ + protected function _toHtml() + { + $html = ''; + $html.= $this->getMessage(); + $html.= ''; + $html.= ''; + return $html; + } +} diff --git a/app/code/core/Mage/Ideal/Block/Basic/Failure.php b/app/code/core/Mage/Ideal/Block/Basic/Failure.php new file mode 100644 index 0000000000..a36cbb7109 --- /dev/null +++ b/app/code/core/Mage/Ideal/Block/Basic/Failure.php @@ -0,0 +1,55 @@ + + */ + +class Mage_Ideal_Block_Basic_Failure extends Mage_Core_Block_Template +{ + /** + * Returns error from session and clears it + * + * @return string + */ + public function getErrorMessage () + { + $error = Mage::getSingleton('checkout/session')->getIdealErrorMessage(); + Mage::getSingleton('checkout/session')->unsIdealErrorMessage(); + return $error; + } + + /** + * Get continue shopping url + */ + public function getContinueShoppingUrl() + { + return Mage::getUrl('checkout/cart'); + } +} diff --git a/app/code/core/Mage/Ideal/Block/Basic/Form.php b/app/code/core/Mage/Ideal/Block/Basic/Form.php new file mode 100755 index 0000000000..57f6f6415a --- /dev/null +++ b/app/code/core/Mage/Ideal/Block/Basic/Form.php @@ -0,0 +1,42 @@ + + */ + +class Mage_Ideal_Block_Basic_Form extends Mage_Payment_Block_Form +{ + protected function _construct() + { + $this->setTemplate('ideal/basic/form.phtml'); + parent::_construct(); + } +} diff --git a/app/code/core/Mage/Ideal/Block/Basic/Redirect.php b/app/code/core/Mage/Ideal/Block/Basic/Redirect.php new file mode 100755 index 0000000000..27079b9de3 --- /dev/null +++ b/app/code/core/Mage/Ideal/Block/Basic/Redirect.php @@ -0,0 +1,59 @@ + + */ + +class Mage_Ideal_Block_Basic_Redirect extends Mage_Core_Block_Abstract +{ + protected function _toHtml() + { + $basic = $this->getOrder()->getPayment()->getMethodInstance(); + + $form = new Varien_Data_Form(); + $form->setAction($basic->getApiUrl()) + ->setId('ideal_basic_checkout') + ->setName('ideal_basic_checkout') + ->setMethod('POST') + ->setUseContainer(true); + + foreach ($basic->getBasicCheckoutFormFields() as $field=>$value) { + $form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value)); + } + + $html = ''; + $html.= $this->__('You will be redirected to iDEAL in a few seconds.'); + $html.= $form->toHtml(); + $html.= ''; + $html.= ''; + return $html; + } +} diff --git a/app/code/core/Mage/Ideal/Helper/Data.php b/app/code/core/Mage/Ideal/Helper/Data.php new file mode 100755 index 0000000000..cb7bba06d7 --- /dev/null +++ b/app/code/core/Mage/Ideal/Helper/Data.php @@ -0,0 +1,46 @@ + + */ + +class Mage_Ideal_Helper_Data extends Mage_Core_Helper_Abstract +{ + public function encrypt($token) + { + return bin2hex(base64_decode(Mage::helper('core')->encrypt($token))); + } + + public function decrypt($token) + { + return Mage::helper('core')->decrypt(base64_encode(pack('H*', $token))); + } +} diff --git a/app/code/core/Mage/Ideal/Model/Advanced.php b/app/code/core/Mage/Ideal/Model/Advanced.php new file mode 100755 index 0000000000..8dfe84fe70 --- /dev/null +++ b/app/code/core/Mage/Ideal/Model/Advanced.php @@ -0,0 +1,237 @@ + + */ + +class Mage_Ideal_Model_Advanced extends Mage_Payment_Model_Method_Abstract +{ + protected $_code = 'ideal_advanced'; + protected $_formBlockType = 'ideal/advanced_form'; + protected $_infoBlockType = 'ideal/advanced_info'; + protected $_allowCurrencyCode = array('EUR', 'GBP', 'USD', 'CAD', 'SHR', 'NOK', 'SEK', 'DKK'); + + protected $_isGateway = false; + protected $_canAuthorize = false; + protected $_canCapture = true; + protected $_canCapturePartial = false; + protected $_canRefund = false; + protected $_canVoid = false; + protected $_canUseInternal = false; + protected $_canUseCheckout = true; + protected $_canUseForMultishipping = false; + + protected $_issuersList = null; + + public function canUseCheckout() + { + if ($this->getIssuerList() && parent::canUseCheckout()) { + return true; + } else { + return false; + } + } + + public function getOrderPlaceRedirectUrl() + { + return Mage::getUrl('ideal/advanced/redirect', array('_secure' => true)); + } + + /** + * Get iDEAL API Model + * + * @return Mage_Ideal_Api_Advanced + */ + public function getApi() + { + return Mage::getSingleton('ideal/api_advanced')->setPaymentModel($this); + } + + public function getIssuerList($saveAttrbute = false) + { + if ($this->_issuersList == null) { + $request = new Mage_Ideal_Model_Api_Advanced_DirectoryRequest(); + $response = $this->getApi()->processRequest($request, $this->getDebugFlag()); + if ($response) { + $this->_issuersList = $response->getIssuerList(); + return $this->_issuersList; + } else { + $this->_issuersList = null; + $this->setError($this->getApi()->getError()); + return false; + } + } else { + $this->getInfoInstance() + ->setIdealIssuerList(serialize($this->_issuersList)) + ->save(); + return $this->_issuersList; + } + } + + /** + * validate the currency code is avaialable to use for iDEAL Advanced or not + * + * @return bool + */ + public function validate() + { + parent::validate(); + $paymentInfo = $this->getInfoInstance(); + if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) { + $currency_code = $paymentInfo->getOrder()->getBaseCurrencyCode(); + } else { + $currency_code = $paymentInfo->getQuote()->getBaseCurrencyCode(); + } + + if (!in_array($currency_code,$this->_allowCurrencyCode)) { + Mage::throwException(Mage::helper('ideal')->__('Selected currency code (%s) is not compatible with iDEAL.', $currency_code)); + } + + return $this; + } + + /** + * Preapre and send transaction request + * + * @param Mage_Sales_Model_Order $order + * @param string $issuerId + * @return Mage_Ideal_Model_Api_Advanced_AcquirerTrxResponse + */ + public function sendTransactionRequest(Mage_Sales_Model_Order $order, $issuerId) + { + $request = new Mage_Ideal_Model_Api_Advanced_AcquirerTrxRequest(); + $request->setIssuerId($issuerId); + $request->setPurchaseId($order->getIncrementId()); + $request->setEntranceCode(Mage::helper('ideal')->encrypt($order->getIncrementId())); + //we need to be sure that we sending number without decimal part + $request->setAmount(floor($order->getBaseGrandTotal()*100)); + $response = $this->getApi()->processRequest($request, $this->getDebugFlag()); + return $response; + } + + /** + * Prepare and send transaction status request + * + * @param string $transactionId + * @return Mage_Ideal_Model_Api_Advanced_AcquirerStatusResponse + */ + public function getTransactionStatus($transactionId) + { + $request = new Mage_Ideal_Model_Api_Advanced_AcquirerStatusRequest(); + $request->setTransactionId($transactionId); + $response = $this->getApi()->processRequest($request, $this->getDebugFlag()); + return $response; + } + + public function capture(Varien_Object $payment, $amount) + { + $payment->setStatus(self::STATUS_APPROVED) + ->setTransactionId($this->getTransactionId()); + + return $this; + } + + public function cancel(Varien_Object $payment) + { + $payment->setStatus(self::STATUS_DECLINED); + + return $this; + } + + /** + * Executes by cron and check transactions status + * for every iDEAL order that was created in last hour + */ + public function transactionStatusCheck($shedule = null) + { + $gmtStamp = Mage::getModel('core/date')->gmtTimestamp(); + $to = $this->getConfigData('cron_start') > 0?$this->getConfigData('cron_start'):1; + $to = date('Y-m-d H:i:s', $gmtStamp - $to * 3600); + + $from = $this->getConfigData('cron_end') > 0?$this->getConfigData('cron_end'):1; + $from = date('Y-m-d H:i:s', $gmtStamp - $from * 86400); + + $paymentCollection = Mage::getModel('sales/order_payment')->getCollection() + ->addAttributeToFilter('last_trans_id', array('neq' => '')) + ->addAttributeToFilter('method', $this->_code) + ->addAttributeToFilter('created_at', array('from' => $from, 'to' => $to, 'datetime' => true)) + ->addAttributeToFilter('ideal_transaction_checked', array('neq' => '1')); + + $order = Mage::getModel('sales/order'); + foreach($paymentCollection->getItems() as $item) { + $order->reset(); + $order->load($item->getParentId()); + $response = $this->getTransactionStatus($item->getLastTransId()); + + if ($response->getTransactionStatus() == Mage_Ideal_Model_Api_Advanced::STATUS_SUCCESS) { + if ($order->canInvoice()) { + $invoice = $order->prepareInvoice(); + $invoice->register()->capture(); + Mage::getModel('core/resource_transaction') + ->addObject($invoice) + ->addObject($invoice->getOrder()) + ->save(); + + $order->addStatusToHistory($order->getStatus(), Mage::helper('ideal')->__('Transaction Status Update: finished successfully.')); + } + } else if ($response->getTransactionStatus() == Mage_Ideal_Model_Api_Advanced::STATUS_CANCELLED) { + $order->cancel(); + $order->addStatusToHistory($order->getStatus(), Mage::helper('ideal')->__('Transaction Status Update: canceled by the customer.')); + } else { + $order->cancel(); + $order->addStatusToHistory($order->getStatus(), Mage::helper('ideal')->__('Transaction Status Update: rejected by iDEAL.')); + } + + $order->getPayment()->setIdealTransactionChecked(1); + $order->save(); + } + } + + /** + * @deprecated after 1.4.1.0 + * + * @return boolean + */ + public function getDebug() + { + return $this->getDebugFlag(); + } + + /** + * Define if debugging is enabled + * + * @return bool + */ + public function getDebugFlag() + { + return $this->getConfigData('debug_flag'); + } +} diff --git a/app/code/core/Mage/Ideal/Model/Api/Advanced.php b/app/code/core/Mage/Ideal/Model/Api/Advanced.php new file mode 100755 index 0000000000..5301ff0405 --- /dev/null +++ b/app/code/core/Mage/Ideal/Model/Api/Advanced.php @@ -0,0 +1,507 @@ + + */ + +class Mage_Ideal_Model_Api_Advanced extends Varien_Object +{ + /** + * Transaction status returned in Status Request + */ + const STATUS_OPEN = 'Open'; + const STATUS_EXPIRED = 'Expired'; + const STATUS_SUCCESS = 'Success'; + const STATUS_CANCELLED = 'Cancelled'; + const STATUS_FAILED = 'Failed'; + + /** + * @var Mage_Ideal_Model_Api_Advanced_Security + */ + protected $_security; + + /** + * array with configuration values + * + * @var array() + */ + protected $_conf; + + /** + * @var Varien_Http_Adapter_Curl + */ + protected $_http; + + public function __construct() + { + $this->_http = new Varien_Http_Adapter_Curl(); + $this->_security = new Mage_Ideal_Model_Api_Advanced_Security(); + + if ($this->getConfigData('test_flag') == 1) { + $acquirerUrl = 'https://idealtest.secure-ing.com/ideal/iDeal'; + } else { + $acquirerUrl = 'https://ideal.secure-ing.com/ideal/iDeal'; + } + + if (!($description = $this->getConfigData('description'))) { + $description = Mage::app()->getStore()->getFrontendName() . ' payment'; + } + + $this->_conf = array( + 'PRIVATEKEY' => $this->getConfigData('private_key'), + 'PRIVATEKEYPASS' => $this->getConfigData('private_keypass'), + 'PRIVATECERT' => $this->getConfigData('private_cert'), + 'AUTHENTICATIONTYPE' => 'SHA1_RSA', + 'CERTIFICATE0' => $this->getConfigData('certificate'), + 'ACQUIRERURL' => $acquirerUrl, + 'ACQUIRERTIMEOUT' => '10', + 'MERCHANTID' => $this->getConfigData('merchant_id'), + 'SUBID' => '0', + 'MERCHANTRETURNURL' => Mage::getUrl('ideal/advanced/result', array('_secure' => true)), + 'CURRENCY' => 'EUR', + 'EXPIRATIONPERIOD' => 'PT10M', + 'LANGUAGE' => 'nl', + 'DESCRIPTION' => $description, + 'ENTRANCECODE' => '' + ); + + if ((int)$this->getConfigData('expire_period') >= 1 && $this->getConfigData('expire_period') < 60) { + $this->_conf['EXPIRATIONPERIOD'] = 'PT' . $this->getConfigData('expire_period') . 'M'; + } else if ($this->getConfigData('description') == 60) { + $this->_conf['EXPIRATIONPERIOD'] = 'PT1H'; + } + } + + /** + * Getting config parametrs + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function getConfigData($key, $default=false) + { + if (!$this->hasData($key)) { + $value = Mage::getStoreConfig('payment/ideal_advanced/'.$key); + if (is_null($value) || false===$value) { + $value = $default; + } + $this->setData($key, $value); + } + return $this->getData($key); + } + + /** + * this method processes a request regardless of the type. + */ + + public function processRequest($requestType, $debug = false) + { + if($requestType instanceof Mage_Ideal_Model_Api_Advanced_DirectoryRequest) { + $response = $this->processDirRequest($requestType); + } else if($requestType instanceof Mage_Ideal_Model_Api_Advanced_AcquirerStatusRequest) { + $response = $this->processStatusRequest($requestType); + } else if($requestType instanceof Mage_Ideal_Model_Api_Advanced_AcquirerTrxRequest) { + $response = $this->processTrxRequest($requestType); + } + + if ($debug && $this->getPaymentModel()) { + + if ($response === false) { + $responseData = $this->getError(); + } else { + $responseData = $response->getData(); + } + + $this->getPaymentModel()->debugData(array( + 'request' => $requestType->getData(), + 'result' => $responseData + )); + } + + return $response; + } + + /** + * This method sends HTTP XML DirectoryRequest to the Acquirer system. + * Befor calling, all mandatory properties have to be set in the Request object + * by calling the associated setter methods. + * If the request was successful, the response Object is returned. + * @param Request Object filled with necessary data for the XML Request + * @return Response Object with the data of the XML response. + */ + public function processDirRequest($request) + { + if ($request->getMerchantId() == "") { + $request->setMerchantId($this->_conf["MERCHANTID"]); + } + + if ($request->getSubId() == "") { + $request->setSubId($this->_conf["SUBID"]); + } + + if ($request->getAuthentication() == "") { + $request->setAuthentication($this->_conf["AUTHENTICATIONTYPE"]); + } + + $res = new Mage_Ideal_Model_Api_Advanced_DirectoryResponse(); + + if (!$request->checkMandatory()) { + $res->setError(Mage::helper('ideal')->__('Required fields are missing.')); + return $res; + } + + // build concatenated string + $timestamp = $this->getGMTTimeMark(); + $token = ""; + $tokenCode = ""; + + if ("SHA1_RSA" == $request->getAuthentication()) { + $message = $timestamp . $request->getMerchantId() . $request->getSubId(); + $message = $this->_strip($message); + + //build fingerprint of your own certificate + $token = $this->_security->createCertFingerprint($this->_conf["PRIVATECERT"]); + + //sign the part of the message that need to be signed + $tokenCode = $this->_security->signMessage($this->_conf["PRIVATEKEY"], $this->_conf["PRIVATEKEYPASS"], $message); + + //encode with base64 + $tokenCode = base64_encode($tokenCode); + } + + $reqMsg = "\n" + . "\n" + . "" . utf8_encode( $timestamp ) . "\n" + . "\n" + . "" . utf8_encode( htmlspecialchars( $request->getMerchantId() ) ) . "\n" + . "" . utf8_encode( $request->getSubId() ) . "\n" + . "" . utf8_encode( $request->getAuthentication() ) . "\n" + . "" . utf8_encode( $token ) . "\n" + . "" . utf8_encode( $tokenCode ) . "\n" + . "\n" + . ""; + + $response = $this->_post($this->_conf["ACQUIRERURL"], $this->_conf["ACQUIRERTIMEOUT"], $reqMsg); + + if ($response === false) { + return false; + } + + $xml = new SimpleXMLElement($response); + + if(!$xml->Error) { + $res->setOk(true); + $res->setAcquirer($xml->Acquirer->acquirerID); + $issuerArray = array(); + foreach ($xml->Directory->Issuer as $issuer) { + $issuerArray[(string)$issuer->issuerID] = (string)$issuer->issuerName; + } + $res->setIssuerList($issuerArray); + return $res; + } else { + $this->setError($xml->Error->consumerMessage); + return false; + } + } + + /** + * This method sends HTTP XML AcquirerTrxRequest to the Acquirer system. + * Befor calling, all mandatory properties have to be set in the Request object + * by calling the associated setter methods. + * If the request was successful, the response Object is returned. + * @param Request Object filled with necessary data for the XML Request + * @return Response Object with the data of the XML response. + */ + public function processTrxRequest($request) { + + if ($request->getMerchantId() == "") + $request->setMerchantId($this->_conf["MERCHANTID"]); + if ($request->getSubId() == "") + $request->setSubId($this->_conf["SUBID"]); + if ($request->getAuthentication() == "") + $request->setAuthentication($this->_conf["AUTHENTICATIONTYPE"]); + if ($request->getMerchantReturnUrl() == "") + $request->setMerchantReturnUrl($this->_conf["MERCHANTRETURNURL"]); + if ($request->getCurrency() == "") + $request->setCurrency($this->_conf["CURRENCY"]); + if ($request->getExpirationPeriod() == "") + $request->setExpirationPeriod($this->_conf["EXPIRATIONPERIOD"]); + if ($request->getLanguage() == "") + $request->setLanguage($this->_conf["LANGUAGE"]); + if ($request->getEntranceCode() == "") + $request->setEntranceCode($this->_conf["ENTRANCECODE"]); + if ($request->getDescription() == "") + $request->setDescription($this->_conf["DESCRIPTION"]); + + $res = new Mage_Ideal_Model_Api_Advanced_AcquirerTrxResponse(); + + if (!$request->checkMandatory()) { + $res->setError(Mage::helper('ideal')->__('Required fields are missing.')); + return $res; + } + + // build concatenated string + $timestamp = $this->getGMTTimeMark(); + $token = ""; + $tokenCode = ""; + if ( "SHA1_RSA" == $request->getAuthentication() ) { + $message = $timestamp + . $request->getIssuerId() + . $request->getMerchantId() + . $request->getSubId() + . $request->getMerchantReturnUrl() + . $request->getPurchaseId() + . $request->getAmount() + . $request->getCurrency() + . $request->getLanguage() + . $request->getDescription() + . $request->getEntranceCode(); + $message = $this->_strip($message); + + //create fingerprint so the receiver knows what certificate to use + $token = $this->_security->createCertFingerprint($this->_conf["PRIVATECERT"]); + + //sign the message + $tokenCode = $this->_security->signMessage($this->_conf["PRIVATEKEY"], $this->_conf["PRIVATEKEYPASS"], $message); + //encode it with base64 + $tokenCode = base64_encode($tokenCode); + } + + $reqMsg = "\n" + . "\n" + . "" . utf8_encode($timestamp) . "\n" + . "" . "" . utf8_encode(htmlspecialchars($request->getIssuerId())) . "\n" + . "\n" + . "" . "" . utf8_encode(htmlspecialchars($request->getMerchantId())) . "\n" + . "" . utf8_encode($request->getSubId()) . "\n" + . "" . utf8_encode($request->getAuthentication()) . "\n" + . "" . utf8_encode($token) . "\n" + . "" . utf8_encode($tokenCode) . "\n" + . "" . utf8_encode(htmlspecialchars($request->getMerchantReturnUrl())) . "\n" + . "\n" + . "" . "" . utf8_encode(htmlspecialchars($request->getPurchaseId())) . "\n" + . "" . utf8_encode($request->getAmount()) . "\n" + . "" . utf8_encode($request->getCurrency()) . "\n" + . "" . utf8_encode($request->getExpirationPeriod()) . "\n" + . "" . utf8_encode($request->getLanguage()) . "\n" + . "" . utf8_encode(htmlspecialchars($request->getDescription())) . "\n" + . "" . utf8_encode(htmlspecialchars($request->getEntranceCode())) . "\n" + . "" . ""; + + $response = $this->_post($this->_conf["ACQUIRERURL"], $this->_conf["ACQUIRERTIMEOUT"], $reqMsg); + + if ($response === false) { + return false; + } + + $xml = new SimpleXMLElement($response); + + if(!$xml->Error) { + $issuerUrl = (string)$xml->Issuer->issuerAuthenticationURL; + $transactionId = (string)$xml->Transaction->transactionID; + $res->setIssuerAuthenticationUrl($issuerUrl); + $res->setTransactionId($transactionId); + $res->setOk(true); + return $res; + } else { + $this->setError($xml->Error->consumerMessage); + return false; + } + } + + /** + * This method sends HTTP XML AcquirerStatusRequest to the Acquirer system. + * Befor calling, all mandatory properties have to be set in the Request object + * by calling the associated setter methods. + * If the request was successful, the response Object is returned. + * @param Request Object filled with necessary data for the XML Request + * @return Response Object with the data of the XML response. + */ + public function processStatusRequest($request) + { + if ($request->getMerchantId() == "") + $request->setMerchantId($this->_conf["MERCHANTID"]); + if ($request->getSubId() == "") + $request->setSubId($this->_conf["SUBID"]); + if ($request->getAuthentication() == "") + $request->setAuthentication($this->_conf["AUTHENTICATIONTYPE"]); + + $res = new Mage_Ideal_Model_Api_Advanced_AcquirerStatusResponse(); + + if (!$request->checkMandatory()) { + $$request->setErrorMessage(Mage::helper('ideal')->__('Required fields are missing.')); + return $res; + } + + // build concatenated string + $timestamp = $this->getGMTTimeMark(); + $token = ""; + $tokenCode = ""; + if ("SHA1_RSA" == $request->getAuthentication()) { + $message = $timestamp . $request->getMerchantId() . $request->getSubId() . $request->getTransactionId(); + $message = $this->_strip($message); + + //create fingerprint of your own certificate + $token = $this->_security->createCertFingerprint($this->_conf["PRIVATECERT"]); + //sign the message + $tokenCode = $this->_security->signMessage( $this->_conf["PRIVATEKEY"], $this->_conf["PRIVATEKEYPASS"], $message ); + //encode with base64 + $tokenCode = base64_encode($tokenCode); + } + $reqMsg = "\n" + . "\n" + . "" . utf8_encode($timestamp) . "\n" + . "" . "" . utf8_encode(htmlspecialchars($request->getMerchantId())) . "\n" + . "" . utf8_encode($request->getSubId()) . "\n" + . "" . utf8_encode($request->getAuthentication()) . "\n" + . "" . utf8_encode($token) . "\n" + . "" . utf8_encode($tokenCode) . "\n" + . "\n" + . "" . "" . utf8_encode(htmlspecialchars($request->getTransactionId())) . "\n" + . "" . ""; + + $response = $this->_post($this->_conf["ACQUIRERURL"], $this->_conf["ACQUIRERTIMEOUT"], $reqMsg); + + if ($response === false) { + return false; + } + + //Process response + $xml = new SimpleXMLElement($response); + $status = (string)$xml->Transaction->status; + $creationTime = (string)$xml->createDateTimeStamp; + $transactionId = (string)$xml->Transaction->transactionID; + $consumerAccountNumber = (string)$xml->Transaction->consumerAccountNumber; + $consumerName = (string)$xml->Transaction->consumerName; + $consumerCity = (string)$xml->Transaction->consumerCity; + + //Check status + if ( strtoupper('Success') == strtoupper($status) ) { + $res->setAuthenticated(true); + } else { + $res->setAuthenticated(false); + } + + $res->setTransactionStatus($status); + $res->setTransactionId($transactionId); + $res->setConsumerAccountNumber($consumerAccountNumber); + $res->setConsumerName($consumerName); + $res->setConsumerCity($consumerCity); + $res->setCreationTime($creationTime); + + // now check the signature of the incoming message + //create signed message string + $message = $creationTime . $transactionId . $status . $consumerAccountNumber; + $message = trim( $message ); + + //now we want to check the signature that has been sent + $signature64 = (string)$xml->Signature->signatureValue; + + //decode the base64 encoded signature + $sig = base64_decode($signature64); + + //get the fingerprint out of the response + $fingerprint = (string)$xml->Signature->fingerprint; + + //search for the certificate file with the given fingerprint + $certfile = $this->_security->getCertificateName($fingerprint, $this->_conf); + + if($certfile == false) { + $res->setAuthenticated(false); + $res->setError('Fingerprint unknown.'); + return $res; + } + + //prepend directory + $valid = $this->_security->verifyMessage($certfile, $message, $sig); + + if( $valid != 1 ) { + $res->setAuthenticated(false); + $res->setError('Bad signature.'); + return $res; + } + + $res->setOk(true); + return $res; + } + + /** + * Return GMT Time mark + * + * @return string + */ + public function getGMTTimeMark() + { + return gmdate('Y') . '-' . gmdate('m') . '-' . gmdate('d') . 'T' + . gmdate('H') . ':' . gmdate('i') . ':' . gmdate('s') . '.000Z'; + } + + /** + * Post a request, note that for a HTTPS URL no port is required + * + * @param string $url + * @param string $path + * @param array $params + * @return mixed + */ + protected function _post($url, $timeout, $dataToSend) + { + $config = array('timeout' => 30); + $this->_http->setConfig($config); + $this->_http->write(Zend_Http_Client::POST, $url, '1.1', array(), $dataToSend); + $response = $this->_http->read(); + $response = preg_split('/^\r?$/m', $response, 2); + $response = trim($response[1]); + + if ($this->_http->getErrno()) { + $this->_http->close(); + $this->setError($this->_http->getErrno() . ':' . $this->_http->getError()); + return false; + } + $this->_http->close(); + return $response; + } + + /** + * stripping spaces + * + * @param string $message + * @return string + */ + protected function _strip($message) + { + $message = str_replace(' ', '', $message); + $message = str_replace("\t", '', $message); + $message = str_replace("\n", '', $message ); + return $message; + } +} diff --git a/app/code/core/Mage/Ideal/Model/Api/Advanced/AcquirerStatusRequest.php b/app/code/core/Mage/Ideal/Model/Api/Advanced/AcquirerStatusRequest.php new file mode 100755 index 0000000000..76646a91cc --- /dev/null +++ b/app/code/core/Mage/Ideal/Model/Api/Advanced/AcquirerStatusRequest.php @@ -0,0 +1,61 @@ + + */ +class Mage_Ideal_Model_Api_Advanced_AcquirerStatusRequest extends Mage_Ideal_Model_Api_Advanced_Request +{ + /** + * rests all input data to empty strings + */ + function clear() + { + parent::clear(); + $this->unsTransactionId(); + } + + /** + * this method checks, wheather all mandatory properties were set. + * If done so, true is returned, otherwise false. + * @return If done so, true is returned, otherwise false. + */ + function checkMandatory() + { + if (parent::checkMandatory() && strlen($this->getTransactionId()) > 0) { + return true; + } else { + return false; + } + + } + +} + diff --git a/app/code/core/Mage/Ideal/Model/Api/Advanced/AcquirerStatusResponse.php b/app/code/core/Mage/Ideal/Model/Api/Advanced/AcquirerStatusResponse.php new file mode 100755 index 0000000000..a517dd93bf --- /dev/null +++ b/app/code/core/Mage/Ideal/Model/Api/Advanced/AcquirerStatusResponse.php @@ -0,0 +1,44 @@ + + */ +class Mage_Ideal_Model_Api_Advanced_AcquirerStatusResponse extends Mage_Ideal_Model_Api_Advanced_Response +{ + /* available vars + var $authenticated + var $consumerName + var $consumerAccountNumber + var $consumerCity + var $transactionId + var $status + */ +} diff --git a/app/code/core/Mage/Ideal/Model/Api/Advanced/AcquirerTrxRequest.php b/app/code/core/Mage/Ideal/Model/Api/Advanced/AcquirerTrxRequest.php new file mode 100755 index 0000000000..31def2e677 --- /dev/null +++ b/app/code/core/Mage/Ideal/Model/Api/Advanced/AcquirerTrxRequest.php @@ -0,0 +1,84 @@ + + */ +class Mage_Ideal_Model_Api_Advanced_AcquirerTrxRequest extends Mage_Ideal_Model_Api_Advanced_Request +{ + /* fields for request xml message + var $issuerId (mandatory) + var $merchantReturnUrl (mandatory) + var $purchaseId (mandatory) + var $amount (mandatory) + var $currency (mandatory) + var $expirationPeriod (mandatory) + var $language (mandatory) + var $description (optional) + var $entranceCode (mandatory) + */ + + function clear() { + parent::clear(); + $this->unsIssuerId(); + $this->unsMerchantReturnUrl(); + $this->unsPurchaseId(); + $this->unsAmount(); + $this->unsCurrency(); + $this->unsExpirationPeriod(); + $this->unsLanguage(); + $this->unsDescription(); + $this->unsEntranceCode(); + } + + /** + * this method checks, whether all mandatory properties were set. + * If done so, true is returned, otherwise false. + * @return If done so, true is returned, otherwise false. + */ + function checkMandatory () { + if ((parent::checkMandatory() == true) + && (strlen($this->getIssuerId()) > 0) + && (strlen($this->getMerchantReturnUrl()) > 0) + && (strlen($this->getPurchaseID()) > 0) + && (strlen($this->getAmount()) > 0) + && (strlen($this->getCurrency()) > 0) + && (strlen($this->getExpirationPeriod()) > 0) + && (strlen($this->getLanguage()) > 0) + && (strlen($this->getEntranceCode()) > 0) + && (strlen($this->getDescription()) > 0) + ) { + return true; + } else { + return false; + } + } + +} diff --git a/app/code/core/Mage/Ideal/Model/Api/Advanced/AcquirerTrxResponse.php b/app/code/core/Mage/Ideal/Model/Api/Advanced/AcquirerTrxResponse.php new file mode 100755 index 0000000000..627e2b2963 --- /dev/null +++ b/app/code/core/Mage/Ideal/Model/Api/Advanced/AcquirerTrxResponse.php @@ -0,0 +1,41 @@ + + */ +class Mage_Ideal_Model_Api_Advanced_AcquirerTrxResponse extends Mage_Ideal_Model_Api_Advanced_Response +{ + /* + var $acquirerId; + var $issuerAuthenticationUrl; + var $transactionId; + */ +} diff --git a/app/code/core/Mage/Ideal/Model/Api/Advanced/DirectoryRequest.php b/app/code/core/Mage/Ideal/Model/Api/Advanced/DirectoryRequest.php new file mode 100755 index 0000000000..349ce4df2a --- /dev/null +++ b/app/code/core/Mage/Ideal/Model/Api/Advanced/DirectoryRequest.php @@ -0,0 +1,36 @@ + + */ +class Mage_Ideal_Model_Api_Advanced_DirectoryRequest extends Mage_Ideal_Model_Api_Advanced_Request{ + +} diff --git a/app/code/core/Mage/Ideal/Model/Api/Advanced/DirectoryResponse.php b/app/code/core/Mage/Ideal/Model/Api/Advanced/DirectoryResponse.php new file mode 100755 index 0000000000..476b451705 --- /dev/null +++ b/app/code/core/Mage/Ideal/Model/Api/Advanced/DirectoryResponse.php @@ -0,0 +1,50 @@ + + */ +class Mage_Ideal_Model_Api_Advanced_DirectoryResponse extends Mage_Ideal_Model_Api_Advanced_Response { + /* + var $acquirerId + var $issuerList - array of Issuer Objects + */ + + /** + * adds an Issuer to the IssuerList + */ + function addIssuer($issuer) { + if(is_a($issuer, "Mage_Ideal_Api_Advanced_Issuer")) { + $this->setIssuerList(array_merge((array)$this->getIssuerList(), (array)$issuer)); + } + } +} + +?> diff --git a/app/code/core/Mage/Ideal/Model/Api/Advanced/Issuer.php b/app/code/core/Mage/Ideal/Model/Api/Advanced/Issuer.php new file mode 100755 index 0000000000..fda1f072d9 --- /dev/null +++ b/app/code/core/Mage/Ideal/Model/Api/Advanced/Issuer.php @@ -0,0 +1,41 @@ + + */ +class Mage_Ideal_Model_Api_Advanced_Issuer extends Varien_Object +{ + /* + var $issuerID + var $issuerName + var $issuerList ("Short", "Long") + */ +} diff --git a/app/code/core/Mage/Ideal/Model/Api/Advanced/Request.php b/app/code/core/Mage/Ideal/Model/Api/Advanced/Request.php new file mode 100755 index 0000000000..c4ef046672 --- /dev/null +++ b/app/code/core/Mage/Ideal/Model/Api/Advanced/Request.php @@ -0,0 +1,80 @@ + + */ +class Mage_Ideal_Model_Api_Advanced_Request extends Varien_Object +{ + /** + * clears all parameters + */ + public function clear() { + $this->unsMerchantId(); + $this->unsSubId(); + $this->unsAuthentication(); + } + + /** + * this method checks, whether all mandatory properties are set. + * @return true if all fields are valid, otherwise returns false + */ + function checkMandatory () { + if (strlen($this->getMerchantId()) > 0 + && strlen($this->getSubID()) > 0 + && strlen($this->getAuthentication()) > 0) { + return true; + } else { + return false; + } + } + + /** + * @param authentication The type of authentication to set. + * Currently only "RSA_SHA1" is implemented. (mandatory) + */ + function setAuthentication($authentication) { + $this->setData('authentication', trim($authentication)); + } + + /** + * @param merchantID The merchantID to set. (mandatory) + */ + function setMerchantId($merchantID) { + $this->setData('merchant_id', trim($merchantID)); + } + + /** + * @param subID The subID to set. (mandatory) + */ + function setSubId($subID) { + $this->setData('sub_id', trim($subID)); + } +} diff --git a/app/code/core/Mage/Ideal/Model/Api/Advanced/Response.php b/app/code/core/Mage/Ideal/Model/Api/Advanced/Response.php new file mode 100755 index 0000000000..2f0d45e6f4 --- /dev/null +++ b/app/code/core/Mage/Ideal/Model/Api/Advanced/Response.php @@ -0,0 +1,54 @@ + + */ +class Mage_Ideal_Model_Api_Advanced_Response extends Varien_Object +{ + /* available vars + var $ok + var $errorMessage + var $errorCode + var $errorDetail + var $suggestedAction + var $suggestedExpirationPeriod + var $consumerMessage + */ + + /** + * @return true, if the request was processed successfully, otherwise false. If + * false, additional information can be received calling getErrorMessage() + */ + + function isOk() { + return $this->ok; + } +} diff --git a/app/code/core/Mage/Ideal/Model/Api/Advanced/Security.php b/app/code/core/Mage/Ideal/Model/Api/Advanced/Security.php new file mode 100755 index 0000000000..ba5ee140b5 --- /dev/null +++ b/app/code/core/Mage/Ideal/Model/Api/Advanced/Security.php @@ -0,0 +1,155 @@ + + */ +class Mage_Ideal_Model_Api_Advanced_Security +{ + /** + * reads in a certificate file and creates a fingerprint + * @param Filename of the certificate + * @return fingerprint + */ + function createCertFingerprint($filename) + { + if(is_readable($filename)) { + $cert = file_get_contents($filename); + } else { + return false; + } + + $data = openssl_x509_read($cert); + + if(!openssl_x509_export($data, $data)) { + + return false; + } + + $data = str_replace("-----BEGIN CERTIFICATE-----", "", $data); + $data = str_replace("-----END CERTIFICATE-----", "", $data); + + $data = base64_decode($data); + + $fingerprint = sha1($data); + + $fingerprint = strtoupper( $fingerprint ); + + return $fingerprint; + } + + /** + * function to sign a message + * @param filename of the private key + * @param message to sign + * @return signature + */ + function signMessage($priv_keyfile, $key_pass, $data) + { + $data = preg_replace("/\s/","",$data); + if (is_readable($priv_keyfile)) { + $priv_key = file_get_contents($priv_keyfile); + + $params = array($priv_key, $key_pass); + $pkeyid = openssl_pkey_get_private($params); + + // compute signature + openssl_sign($data, $signature, $pkeyid); + + // free the key from memory + openssl_free_key($pkeyid); + + return $signature; + } else { + return false; + } + } + + /** + * function to verify a message + * @param filename of the public key to decrypt the signature + * @param message to verify + * @param sent signature + * @return signature + */ + function verifyMessage($certfile, $data, $signature) + { + // $data and $signature are assumed to contain the data and the signature + $ok = 0; + if (is_readable($certfile)) { + $cert = file_get_contents($certfile); + } else { + return false; + } + + $pubkeyid = openssl_get_publickey($cert); + + // state whether signature is okay or not + $ok = openssl_verify($data, $signature, $pubkeyid); + + // free the key from memory + openssl_free_key($pubkeyid); + + return $ok; + } + + /** + * @param fingerprint that's been sent + * @param the configuration file loaded in as an array + * @return the filename of the certificate with this fingerprint + */ + function getCertificateName($fingerprint, $config) + { + $count = 0; + + if (isset($config["CERTIFICATE" . $count])) { + $certFilename = $config["CERTIFICATE" . $count]; + } else { + return false; + } + + while( isset($certFilename) ) { + $buff = $this->createCertFingerprint($certFilename); + + if( $fingerprint == $buff ) { + return $certFilename; + } + + $count+=1; + if (isset($config["CERTIFICATE" . $count])) { + $certFilename = $config["CERTIFICATE" . $count]; + } else { + return false; + } + } + + return false; + } +} diff --git a/app/code/core/Mage/Ideal/Model/Api/Debug.php b/app/code/core/Mage/Ideal/Model/Api/Debug.php new file mode 100644 index 0000000000..e2a4c373ed --- /dev/null +++ b/app/code/core/Mage/Ideal/Model/Api/Debug.php @@ -0,0 +1,40 @@ + + */ +class Mage_Ideal_Model_Api_Debug extends Mage_Core_Model_Abstract +{ + protected function _construct() + { + $this->_init('ideal/api_debug'); + } +} diff --git a/app/code/core/Mage/Ideal/Model/Basic.php b/app/code/core/Mage/Ideal/Model/Basic.php new file mode 100755 index 0000000000..e54abc185b --- /dev/null +++ b/app/code/core/Mage/Ideal/Model/Basic.php @@ -0,0 +1,220 @@ + + */ + +class Mage_Ideal_Model_Basic extends Mage_Payment_Model_Method_Abstract +{ + protected $_code = 'ideal_basic'; + protected $_formBlockType = 'ideal/basic_form'; + protected $_allowCurrencyCode = array('EUR', 'GBP', 'USD', 'CAD', 'SHR', 'NOK', 'SEK', 'DKK'); + + protected $_isGateway = false; + protected $_canAuthorize = false; + protected $_canCapture = true; + protected $_canCapturePartial = false; + protected $_canRefund = false; + protected $_canVoid = false; + protected $_canUseInternal = false; + protected $_canUseCheckout = true; + protected $_canUseForMultishipping = false; + + /** + * @deprecated after 1.4.1.0 + * + * @return boolean + */ + public function getDebug() + { + return $this->getDebugFlag(); + } + + /** + * validate the currency code is avaialable to use for iDEAL Basic or not + * + * @return bool + */ + public function validate() + { + parent::validate(); + $paymentInfo = $this->getInfoInstance(); + if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) { + $currency_code = $paymentInfo->getOrder()->getBaseCurrencyCode(); + } else { + $currency_code = $paymentInfo->getQuote()->getBaseCurrencyCode(); + } + if (!in_array($currency_code, $this->_allowCurrencyCode)) { + Mage::throwException(Mage::helper('ideal')->__('Selected currency code (%s) is not compatible with iDEAL.', $currency_code)); + } + return $this; + } + + public function getOrderPlaceRedirectUrl() + { + return Mage::getUrl('ideal/basic/redirect', array('_secure' => true)); + } + + /** + * Return iDEAL Basic Api Url + * + * @return string Payment API URL + */ + public function getApiUrl() + { + if ($this->getConfigData('test_flag') == 1) { + if (($url = trim($this->getConfigData('api_test_url'))) == '') { + $url = "https://idealtest.secure-ing.com/ideal/mpiPayInitIng.do"; + } + } else { + if (($url = trim($this->getConfigData('api_url'))) == '') { + $url = "https://ideal.secure-ing.com/ideal/mpiPayInitIng.do"; + } + } + return $url; + } + + /** + * Generates array of fields for redirect form + * + * @return array + */ + public function getBasicCheckoutFormFields() + { + $order = $this->getInfoInstance()->getOrder(); + + $shippingAddress = $order->getShippingAddress(); + $currency_code = $order->getBaseCurrencyCode(); + + $fields = array( + 'merchantID' => $this->getConfigData('merchant_id'), + 'subID' => '0', + 'amount' => round($order->getBaseGrandTotal()*100), + 'purchaseID' => $order->getIncrementId(), + 'paymentType' => 'ideal', + 'validUntil' => date('Y-m-d\TH:i:s.000\Z', strtotime ('+1 week')) // plus 1 week + ); + + $i = 1; + foreach ($order->getItemsCollection() as $item) { + $fields = array_merge($fields, array( + "itemNumber".$i => $item->getSku(), + "itemDescription".$i => $item->getName(), + "itemQuantity".$i => $item->getQtyOrdered()*1, + "itemPrice".$i => round($item->getBasePrice()*100) + )); + $i++; + } + + if ($order->getBaseShippingAmount() > 0) { + $fields = array_merge($fields, array( + "itemNumber".$i => $order->getShippingMethod(), + "itemDescription".$i => $order->getShippingDescription(), + "itemQuantity".$i => 1, + "itemPrice".$i => round($order->getBaseShippingAmount()*100) + )); + $i++; + } + + if ($order->getBaseTaxAmount() > 0) { + $fields = array_merge($fields, array( + "itemNumber".$i => 'Tax', + "itemDescription".$i => '', + "itemQuantity".$i => 1, + "itemPrice".$i => round($order->getBaseTaxAmount()*100) + )); + $i++; + } + + if ($order->getBaseDiscountAmount() > 0) { + $fields = array_merge($fields, array( + "itemNumber".$i => 'Discount', + "itemDescription".$i => '', + "itemQuantity".$i => 1, + "itemPrice".$i => -round($order->getBaseDiscountAmount()*100) + )); + $i++; + } + + $fields = $this->appendHash($fields); + + $description = $this->getConfigData('description'); + if ($description == '') { + $description = Mage::app()->getStore()->getFrontendName() . ' ' . 'payment'; + } + + $fields = array_merge($fields, array( + 'language' => $this->getConfigData('language'), + 'currency' => $currency_code, + 'description' => $description, + 'urlCancel' => Mage::getUrl('ideal/basic/cancel', array('_secure' => true)), + 'urlSuccess' => Mage::getUrl('ideal/basic/success', array('_secure' => true)), + 'urlError' => Mage::getUrl('ideal/basic/failure', array('_secure' => true)) + )); + + $returnArray = array(); + foreach ($fields as $k=>$v) { + $returnArray[$k] = $v; + } + + $this->_debug(array('request' => $returnArray)); + + return $returnArray; + } + + /** + * Calculates and appends hash to form fields + * + * @param array $returnArray + * @return array + */ + public function appendHash($returnArray) + { + $merchantKey = $this->getConfigData('merchant_key'); + $hashString = $merchantKey.implode('', $returnArray); + $hashString = str_replace( + array(" ", "\t", "\n", "&", "<", ">", ""e;"), + array("", "", "", "&", "<", ">", "\""), + $hashString); + $hash = sha1($hashString); + return array_merge($returnArray, array('hash' => $hash)); + } + + /** + * Define if debugging is enabled + * + * @return bool + */ + public function getDebugFlag() + { + return $this->getConfigData('debug_flag'); + } +} diff --git a/app/code/core/Mage/Ideal/Model/Mysql4/Api/Debug.php b/app/code/core/Mage/Ideal/Model/Mysql4/Api/Debug.php new file mode 100644 index 0000000000..3191cc9b60 --- /dev/null +++ b/app/code/core/Mage/Ideal/Model/Mysql4/Api/Debug.php @@ -0,0 +1,42 @@ + + */ + +class Mage_Ideal_Model_Mysql4_Api_Debug extends Mage_Core_Model_Mysql4_Abstract +{ + protected function _construct() + { + $this->_init('ideal/api_debug', 'debug_id'); + } +} diff --git a/app/code/core/Mage/Ideal/Model/Mysql4/Api/Debug/Collection.php b/app/code/core/Mage/Ideal/Model/Mysql4/Api/Debug/Collection.php new file mode 100644 index 0000000000..abf52c128b --- /dev/null +++ b/app/code/core/Mage/Ideal/Model/Mysql4/Api/Debug/Collection.php @@ -0,0 +1,41 @@ + + */ +class Mage_Ideal_Model_Mysql4_Api_Debug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract +{ + protected function _construct() + { + $this->_init('ideal/api_debug'); + } +} diff --git a/app/code/core/Mage/Ideal/Model/Mysql4/Setup.php b/app/code/core/Mage/Ideal/Model/Mysql4/Setup.php new file mode 100755 index 0000000000..da622e9a7e --- /dev/null +++ b/app/code/core/Mage/Ideal/Model/Mysql4/Setup.php @@ -0,0 +1,37 @@ + + */ +class Mage_Ideal_Model_Observer +{ + /** + * Convert specific attributes from Quote Payment to Order Payment + * + * @param Varien_Object $observer + * @return Mage_Ideal_Model_Observer + */ + public function convertPayment($observer) + { + $orderPayment = $observer->getEvent()->getOrderPayment(); + $quotePayment = $observer->getEvent()->getQuotePayment(); + $orderPayment->setIdealIssuerId($quotePayment->getIdealIssuerId()); + + if ($quotePayment->getIdealIssuerId()) { + $issuerList = unserialize($quotePayment->getIdealIssuerList()); + if (isset($issuerList[$quotePayment->getIdealIssuerId()])) { + $orderPayment->setIdealIssuerTitle( + $issuerList[$quotePayment->getIdealIssuerId()] + ); + } + } + return $this; + } +} diff --git a/app/code/core/Mage/Ideal/Model/Source/Language.php b/app/code/core/Mage/Ideal/Model/Source/Language.php new file mode 100644 index 0000000000..1c0c4682e1 --- /dev/null +++ b/app/code/core/Mage/Ideal/Model/Source/Language.php @@ -0,0 +1,47 @@ + + */ + +class Mage_Ideal_Model_Source_Language +{ + public function toOptionArray() + { + return array( + array('value' => 'en', 'label' => Mage::helper('ideal')->__('English')), + array('value' => 'nl', 'label' => Mage::helper('ideal')->__('Dutch')) + ); + } +} + + + diff --git a/app/code/core/Mage/Ideal/controllers/AdvancedController.php b/app/code/core/Mage/Ideal/controllers/AdvancedController.php new file mode 100755 index 0000000000..5c269f9e3c --- /dev/null +++ b/app/code/core/Mage/Ideal/controllers/AdvancedController.php @@ -0,0 +1,195 @@ + + */ + +class Mage_Ideal_AdvancedController extends Mage_Core_Controller_Front_Action +{ + public function getCheckout() + { + return Mage::getSingleton('checkout/session'); + } + + /** + * When a customer chooses iDEAL Advanced on Checkout/Payment page + * + */ + public function redirectAction() + { + $order = Mage::getModel('sales/order'); + $order->load($this->getCheckout()->getLastOrderId()); + if($order->getId()){ + $advanced = $order->getPayment()->getMethodInstance(); + $issuerId = $order->getPayment()->getIdealIssuerId(); + + $response = $advanced->sendTransactionRequest($order, $issuerId); + + if ($response) { + $order->getPayment()->setTransactionId($response->getTransactionId()); + $order->getPayment()->setLastTransId($response->getTransactionId()); + $order->getPayment()->setIdealTransactionChecked(0); + + if ($response->getError()) { + $this->getCheckout()->setIdealErrorMessage($response->getError()); + $this->_redirect('*/*/failure'); + return; + } + + $this->getResponse()->setBody( + $this->getLayout()->createBlock('ideal/advanced_redirect') + ->setMessage($this->__('You will be redirected to bank in a few seconds.')) + ->setRedirectUrl($response->getIssuerAuthenticationUrl()) + ->toHtml() + ); + + $order->addStatusToHistory( + $order->getStatus(), + $this->__('The customer was redirected to iDEAL.') + ); + $order->save(); + + $this->getCheckout()->setIdealAdvancedQuoteId($this->getCheckout()->getQuoteId(true)); + $this->getCheckout()->setIdealAdvancedOrderId($this->getCheckout()->getLastOrderId(true)); + + + return; + } + } + + $this->getResponse()->setBody( + $this->getLayout()->createBlock('ideal/advanced_redirect') + ->setMessage($this->__('An error has occurred. You will be redirected back to store.')) + ->setRedirectUrl(Mage::getUrl('checkout/cart')) + ->toHtml() + ); + } + + /** + * When a customer cancels payment from iDEAL + */ + public function cancelAction() + { + $order = Mage::getModel('sales/order'); + $this->getCheckout()->setLastOrderId($this->getCheckout()->getIdealAdvancedOrderId(true)); + $order->load($this->getCheckout()->getLastOrderId()); + + if (!$order->getId()) { + $this->norouteAction(); + return; + } + + $order->addStatusToHistory( + $order->getStatus(), + $this->__('The customer canceled payment.') + ); + $order->cancel(); + $order->save(); + + $$this->getCheckout()->setQuoteId($$this->getCheckout()->setIdealAdvancedQuoteId(true)); + $this->_redirect('checkout/cart'); + } + + /** + * When customer return from iDEAL + */ + public function resultAction() + { + /** + * Decrypt Real Order Id that was sent encrypted + */ + $orderId = Mage::helper('ideal')->decrypt($this->getRequest()->getParam('ec')); + $transactionId = $this->getRequest()->getParam('trxid'); + + $order = Mage::getModel('sales/order'); + $order->loadByIncrementId($orderId); + + if ($order->getId() > 0) { + $advanced = $order->getPayment()->getMethodInstance(); + $advanced->setTransactionId($transactionId); + $response = $advanced->getTransactionStatus($transactionId); + + $this->getCheckout()->setQuoteId($this->getCheckout()->getIdealAdvancedQuoteId(true)); + $this->getCheckout()->setLastOrderId($this->getCheckout()->getIdealAdvancedOrderId(true)); + + if ($response->getTransactionStatus() == Mage_Ideal_Model_Api_Advanced::STATUS_SUCCESS) { + $this->getCheckout()->getQuote()->setIsActive(false)->save(); + + if ($order->canInvoice()) { + $invoice = $order->prepareInvoice(); + $invoice->register()->capture(); + Mage::getModel('core/resource_transaction') + ->addObject($invoice) + ->addObject($invoice->getOrder()) + ->save(); + + $order->addStatusToHistory($order->getStatus(), Mage::helper('ideal')->__('Customer has successfully returned from iDEAL.')); + } + + $order->sendNewOrderEmail(); + + $this->_redirect('checkout/onepage/success'); + } else if ($response->getTransactionStatus() == Mage_Ideal_Model_Api_Advanced::STATUS_CANCELLED) { + $order->cancel(); + $order->addStatusToHistory($order->getStatus(), Mage::helper('ideal')->__('Customer has canceled payment.')); + + $this->_redirect('checkout/cart'); + } else { + $order->cancel(); + $order->addStatusToHistory($order->getStatus(), Mage::helper('ideal')->__('Customer was rejected by iDEAL.')); + $this->getCheckout()->setIdealErrorMessage( + Mage::helper('ideal')->__('An error occurred while processing your iDEAL transaction. Please contact the web shop or try +again later. Transaction number is %s.', $order->getIncrementId()) + ); + + $this->_redirect('*/*/failure'); + } + $order->getPayment()->setIdealTransactionChecked(1); + $order->save(); + } else { + $this->_redirect('checkout/cart'); + } + } + + /** + * Redirected here when customer returns with error + */ + public function failureAction() + { + if (!$this->getCheckout()->getIdealErrorMessage()) { + $this->norouteAction(); + return; + } + + $this->loadLayout(); + $this->renderLayout(); + } +} diff --git a/app/code/core/Mage/Ideal/controllers/BasicController.php b/app/code/core/Mage/Ideal/controllers/BasicController.php new file mode 100755 index 0000000000..761c13e9a4 --- /dev/null +++ b/app/code/core/Mage/Ideal/controllers/BasicController.php @@ -0,0 +1,247 @@ + + */ +class Mage_Ideal_BasicController extends Mage_Core_Controller_Front_Action +{ + + /** + * Return order instance for last real order ID (stored in session) + * + * @return Mage_Sales_Model_Entity_Order object + */ + protected function _getOrder () + { + $order = Mage::getModel('sales/order'); + $order->load(Mage::getSingleton('checkout/session')->getLastOrderId()); + + if (!$order->getId()) { + return false; + } + + return $order; + } + + /** + * When a customer chooses iDEAL Basic on Checkout/Payment page + */ + public function redirectAction() + { + $session = Mage::getSingleton('checkout/session'); + $session->setIdealBasicQuoteId($session->getQuoteId()); + $session->setIdealBasicOrderId($session->getLastOrderId()); + + if (!($order = $this->_getOrder())) { + $this->norouteAction(); + return; + } + $order->addStatusToHistory( + $order->getStatus(), + $this->__('Customer was redirected to iDEAL. Please, check the status of the transaction via the ING iDEAL Dashboard before delivery of the goods purchased.') + ); + $order->save(); + + $this->getResponse()->setBody( + $this->getLayout()->createBlock('ideal/basic_redirect') + ->setOrder($order) + ->toHtml() + ); + $session->unsQuoteId(); + $session->unsLastOrderId(); + } + + /** + * Success response from iDEAL + */ + public function successAction() + { + $session = Mage::getSingleton('checkout/session'); + $session->setLastOrderId($session->getIdealBasicOrderId(true)); + + $order = $this->_getOrder(); + if (!$order->getId()) { + $this->norouteAction(); + return false; + } + + $session->setQuoteId($session->getIdealBasicQuoteId(true)); + + $order->addStatusToHistory( + $order->getStatus(), + $this->__('Customer has successfully returned from iDEAL.') + ); + + $order->sendNewOrderEmail(); + + $this->_saveInvoice($order); + + $order->save(); + + $this->_redirect('checkout/onepage/success'); + } + + /** + * Cancel response from iDEAL + */ + public function cancelAction() + { + $session = Mage::getSingleton('checkout/session'); + $session->setLastOrderId($session->getIdealBasicOrderId(true)); + + $order = $this->_getOrder(); + if (!$order->getId()) { + $this->norouteAction(); + return false; + } + + $order->cancel(); + + $history = $this->__('Payment was canceled by the customer.'); + + $order->addStatusToHistory( + $order->getStatus(), + $history + ); + + $order->save(); + + $session->setQuoteId($session->getIdealBasicQuoteId(true)); + + $this->_redirect('checkout/cart'); + } + + + /** + * Error response from iDEAL + */ + public function failureAction () + { + $session = Mage::getSingleton('checkout/session'); + $session->setLastOrderId($session->getIdealBasicOrderId(true)); + + $order = $this->_getOrder(); + + if (!$order->getId()) { + $this->norouteAction(); + return false; + } + + $order->cancel(); + + $history = $this->__('An error has occurred with the transaction #%s.', $order->getIncrementId()) . ' ' + . $this->__('The customer has returned from iDEAL.'); + + $order->addStatusToHistory( + $order->getStatus(), + $history + ); + + $order->save(); + + $session->setQuoteId($session->getIdealBasicQuoteId(true)); + $session->setIdealErrorMessage($this->__('An error occurred while processing your iDEAL transaction. Please contact the web shop or try again later. The transaction number is %s.', $order->getIncrementId())); + + $this->loadLayout(); + $this->renderLayout(); + + } + + /** + * Notification action that calling by iDEAL + * + */ + public function notifyAction() + { + if (isset($HTTP_RAW_POST_DATA)) { + $xmlResponse = $HTTP_RAW_POST_DATA; + } else { + $xmlResponse = file_get_contents("php://input"); + } + + if (!strlen($xmlResponse)) { + $this->norouteAction(); + return; + } + + $xmlObj = simplexml_load_string($xmlResponse); + $status = (string)$xmlObj->status; + + $order = Mage::getModel('sales/order') + ->loadByIncrementId((int)$xmlObj->purchaseID); + + if (!$order->getId()) { + return; + } + + if ($status == 'Success') { + if (!$order->hasInvoices()) { + $this->_saveInvoice($order); + $order->addStatusToHistory($order->getStatus(), + $this->__('Notification from iDEAL was received with status %s. The invoice was created. Please check the status of a transaction via the ING iDEAL Dashboard before delivery of the goods purchased.', $status) + ); + } else { + $order->addStatusToHistory($order->getStatus(), + $this->__('Notification from iDEAL was received with status %s.', $status) + ); + } + } else { + $order->addStatusToHistory($order->getStatus(), + $this->__('Notification from iDEAL was received with status %s.', $status) + ); + $order->cancel(); + } + + $order->save(); + } + + /** + * Save invoice for order + * + * @param Mage_Sales_Model_Order $order + * @return boolean Can save invoice or not + */ + protected function _saveInvoice(Mage_Sales_Model_Order $order) + { + if ($order->canInvoice()) { + $invoice = $order->prepareInvoice(); + $invoice->register()->capture(); + Mage::getModel('core/resource_transaction') + ->addObject($invoice) + ->addObject($invoice->getOrder()) + ->save(); + return true; + } + return false; + } + +} diff --git a/app/code/core/Mage/Ideal/etc/config.xml b/app/code/core/Mage/Ideal/etc/config.xml new file mode 100755 index 0000000000..b102498ee1 --- /dev/null +++ b/app/code/core/Mage/Ideal/etc/config.xml @@ -0,0 +1,136 @@ + + + + + + 0.1.0 + + + + + + Mage_Ideal_Model + ideal_mysql4 + + + Mage_Ideal_Model_Mysql4 + + ideal_api_debug
      +
      +
      +
      + + + + Mage_Ideal + Mage_Ideal_Model_Mysql4_Setup + + + + + Mage_Ideal_Block + +
      + + + /ideal/advanced + /ideal/basic + + + + standard + + Mage_Ideal + ideal + + + + + + + + Mage_Ideal.csv + + + + + + + + ideal.xml + + + + + + + + ideal/observer + convertPayment + + + + + + + + + + + Mage_Ideal.csv + + + + + + + + + ideal/basic + iDEAL Basic + 0 + + + ideal/advanced + iDEAL Advanced + 0 + 10 + 1 + 1 + + + + + + + 0 */1 * * * + ideal/advanced::transactionStatusCheck + + + +
      diff --git a/app/code/core/Mage/Ideal/etc/system.xml b/app/code/core/Mage/Ideal/etc/system.xml new file mode 100755 index 0000000000..7a8027d568 --- /dev/null +++ b/app/code/core/Mage/Ideal/etc/system.xml @@ -0,0 +1,326 @@ + + + + + + + + + text + 301 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 0 + 1 + 1 + 0 + + + <label>Title</label> + <frontend_type>text</frontend_type> + <sort_order>10</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + text + 20 + 1 + 1 + 0 + + + + text + 30 + 1 + 1 + 0 + + + + Leave empty for default value. + text + 30 + 1 + 1 + 0 + + + + Leave empty for default value. + text + 30 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 40 + 1 + 1 + 0 + + + + Store name will be used if left empty. + text + 50 + 1 + 1 + 0 + + + + select + ideal/source_language + 60 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 70 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_order_status_processing + 80 + 1 + 1 + 0 + + + + allowspecific + 90 + adminhtml/system_config_source_payment_allspecificcountries + 1 + 1 + 0 + + + + multiselect + 100 + adminhtml/system_config_source_country + 1 + 1 + 0 + + + + text + 110 + 1 + 1 + 0 + + + + + + text + 302 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 0 + 1 + 1 + 0 + + + <label>Title</label> + <frontend_type>text</frontend_type> + <sort_order>10</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + text + 20 + 1 + 1 + 0 + + + + Absolute path to private key file. + text + 30 + 1 + 1 + 0 + + + + text + 40 + 1 + 1 + 0 + + + + Absolute path to private certificate file. + text + 30 + 1 + 1 + 0 + + + + Absolute path to public payment provider certificate file. + text + 50 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 60 + 1 + 1 + 0 + + + + Store name will be used if left empty. + text + 70 + 1 + 1 + 0 + + + + In minutes. Minimum is 1 minute and maximum is 60. + text + 80 + 1 + 1 + 0 + + + + Begin to check transaction status if order was made {N} hours ago. + text + 90 + 1 + 1 + 0 + + + + Do not check transaction status if order older than {N} days. + text + 100 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 110 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_order_status_processing + 120 + 1 + 1 + 0 + + + + allowspecific + 130 + adminhtml/system_config_source_payment_allspecificcountries + 1 + 1 + 0 + + + + multiselect + 140 + adminhtml/system_config_source_country + 1 + 1 + 0 + + + + text + 150 + 1 + 1 + 0 + + + + + + + diff --git a/app/code/core/Mage/Ideal/sql/ideal_setup/mysql4-install-0.1.0.php b/app/code/core/Mage/Ideal/sql/ideal_setup/mysql4-install-0.1.0.php new file mode 100755 index 0000000000..042f0a21fc --- /dev/null +++ b/app/code/core/Mage/Ideal/sql/ideal_setup/mysql4-install-0.1.0.php @@ -0,0 +1,51 @@ +startSetup(); + +$installer->run(" +DROP TABLE IF EXISTS `{$this->getTable('ideal/api_debug')}`; +CREATE TABLE `{$this->getTable('ideal/api_debug')}` ( + `debug_id` int(10) unsigned NOT NULL auto_increment, + `debug_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `request_body` text, + `response_body` text, + PRIMARY KEY (`debug_id`), + KEY `debug_at` (`debug_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$installer->endSetup(); + +$installer->addAttribute('quote_payment', 'ideal_issuer_id', array()); +$installer->addAttribute('quote_payment', 'ideal_issuer_list', array('type' => 'text')); +$installer->addAttribute('order_payment', 'ideal_issuer_id', array()); +$installer->addAttribute('order_payment', 'ideal_issuer_title', array()); +$installer->addAttribute('order_payment', 'ideal_transaction_checked', array('type'=>'int')); diff --git a/app/code/core/Mage/Index/Block/Adminhtml/Notifications.php b/app/code/core/Mage/Index/Block/Adminhtml/Notifications.php index b8ec1bafd8..6db26b0519 100644 --- a/app/code/core/Mage/Index/Block/Adminhtml/Notifications.php +++ b/app/code/core/Mage/Index/Block/Adminhtml/Notifications.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Index/Block/Adminhtml/Process.php b/app/code/core/Mage/Index/Block/Adminhtml/Process.php index 9f688eda40..911ed3930e 100644 --- a/app/code/core/Mage/Index/Block/Adminhtml/Process.php +++ b/app/code/core/Mage/Index/Block/Adminhtml/Process.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit.php b/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit.php index 0f473c31f6..250840df9e 100644 --- a/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit.php +++ b/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Form.php b/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Form.php index 991abefd4f..21a358c4a3 100644 --- a/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Form.php +++ b/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Tab/Main.php b/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Tab/Main.php index 52dedbf932..4668e9e17a 100644 --- a/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Tab/Main.php +++ b/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Tab/Main.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Tabs.php b/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Tabs.php index cfedea18d3..1b259a48be 100644 --- a/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Tabs.php +++ b/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Tabs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Index/Block/Adminhtml/Process/Grid.php b/app/code/core/Mage/Index/Block/Adminhtml/Process/Grid.php index 055781fad4..66e334467a 100644 --- a/app/code/core/Mage/Index/Block/Adminhtml/Process/Grid.php +++ b/app/code/core/Mage/Index/Block/Adminhtml/Process/Grid.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Index/Helper/Data.php b/app/code/core/Mage/Index/Helper/Data.php index 6a984e9b4d..5e4b0a13bf 100644 --- a/app/code/core/Mage/Index/Helper/Data.php +++ b/app/code/core/Mage/Index/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Index/Model/Event.php b/app/code/core/Mage/Index/Model/Event.php index 05bd9d0b8e..40bc39fc04 100644 --- a/app/code/core/Mage/Index/Model/Event.php +++ b/app/code/core/Mage/Index/Model/Event.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Index/Model/Indexer.php b/app/code/core/Mage/Index/Model/Indexer.php index 6eeb9b7dd3..0cefcd0973 100644 --- a/app/code/core/Mage/Index/Model/Indexer.php +++ b/app/code/core/Mage/Index/Model/Indexer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Index/Model/Indexer/Abstract.php b/app/code/core/Mage/Index/Model/Indexer/Abstract.php index 673d3ec2d9..dc35c1734c 100644 --- a/app/code/core/Mage/Index/Model/Indexer/Abstract.php +++ b/app/code/core/Mage/Index/Model/Indexer/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Index/Model/Mysql4/Abstract.php b/app/code/core/Mage/Index/Model/Mysql4/Abstract.php index e428ea1057..205d39902d 100644 --- a/app/code/core/Mage/Index/Model/Mysql4/Abstract.php +++ b/app/code/core/Mage/Index/Model/Mysql4/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -30,9 +30,18 @@ abstract class Mage_Index_Model_Mysql4_Abstract extends Mage_Core_Model_Mysql4_Abstract { const IDX_SUFFIX = '_idx'; + const TMP_SUFFIX = '_tmp'; + + /** + * Flag that defines if need to use "_idx" index table suffix instead of "_tmp" + * + * @var bool + */ + protected $_isNeedUseIdxTable = false; public function reindexAll() { + $this->useIdxTable(true); return $this; } @@ -54,10 +63,14 @@ protected function _getIndexAdapter() */ public function getIdxTable($table = null) { + $suffix = self::TMP_SUFFIX; + if ($this->_isNeedUseIdxTable) { + $suffix = self::IDX_SUFFIX; + } if ($table) { - return $table . self::IDX_SUFFIX; + return $table . $suffix; } - return $this->getMainTable() . self::IDX_SUFFIX; + return $this->getMainTable() . $suffix; } /** @@ -164,4 +177,26 @@ public function insertFromSelect($select, $destTable, array $columns, $readToInd $to->query("ALTER TABLE {$destTable} ENABLE KEYS"); return $this; } + + /** + * Set or get what either "_idx" or "_tmp" suffixed temporary index table need to use + * + * @param bool $value + * @return Mage_Index_Model_Mysql4_Abstract + */ + public function useIdxTable($value = null) + { + if (!is_null($value)) { + $this->_isNeedUseIdxTable = (bool)$value; + } + return $this->_isNeedUseIdxTable; + } + + /** + * Clean up temporary index table + */ + public function clearTemporaryIndexTable() + { + $this->_getWriteAdapter()->delete($this->getIdxTable()); + } } diff --git a/app/code/core/Mage/Index/Model/Mysql4/Event.php b/app/code/core/Mage/Index/Model/Mysql4/Event.php index 981d1405a3..0159a3deed 100644 --- a/app/code/core/Mage/Index/Model/Mysql4/Event.php +++ b/app/code/core/Mage/Index/Model/Mysql4/Event.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Index/Model/Mysql4/Event/Collection.php b/app/code/core/Mage/Index/Model/Mysql4/Event/Collection.php index 35d69ff427..5f6bb12515 100644 --- a/app/code/core/Mage/Index/Model/Mysql4/Event/Collection.php +++ b/app/code/core/Mage/Index/Model/Mysql4/Event/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Index/Model/Mysql4/Process.php b/app/code/core/Mage/Index/Model/Mysql4/Process.php index 85b4fdb4ea..4628b4e16f 100644 --- a/app/code/core/Mage/Index/Model/Mysql4/Process.php +++ b/app/code/core/Mage/Index/Model/Mysql4/Process.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Index_Model_Mysql4_Process extends Mage_Core_Model_Mysql4_Abstract diff --git a/app/code/core/Mage/Index/Model/Mysql4/Process/Collection.php b/app/code/core/Mage/Index/Model/Mysql4/Process/Collection.php index 6a148b0b53..953c47b20d 100644 --- a/app/code/core/Mage/Index/Model/Mysql4/Process/Collection.php +++ b/app/code/core/Mage/Index/Model/Mysql4/Process/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Index_Model_Mysql4_Process_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract diff --git a/app/code/core/Mage/Index/Model/Mysql4/Setup.php b/app/code/core/Mage/Index/Model/Mysql4/Setup.php index e8b3290f6f..603ea87ba4 100644 --- a/app/code/core/Mage/Index/Model/Mysql4/Setup.php +++ b/app/code/core/Mage/Index/Model/Mysql4/Setup.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Index/Model/Observer.php b/app/code/core/Mage/Index/Model/Observer.php index 098c01b96d..a4184a7a9c 100644 --- a/app/code/core/Mage/Index/Model/Observer.php +++ b/app/code/core/Mage/Index/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Index/Model/Process.php b/app/code/core/Mage/Index/Model/Process.php index 315ff7622f..8f66e600e3 100644 --- a/app/code/core/Mage/Index/Model/Process.php +++ b/app/code/core/Mage/Index/Model/Process.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -132,7 +132,7 @@ public function matchEvent(Mage_Index_Model_Event $event) public function reindexAll() { if ($this->isLocked()) { - Mage::throwException(Mage::helper('index')->__('%s Index proces is working now. Please try run this process later.', $this->getIndexer()->getName())); + Mage::throwException(Mage::helper('index')->__('%s Index process is working now. Please try run this process later.', $this->getIndexer()->getName())); } $this->_getResource()->startProcess($this); $this->lock(); diff --git a/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php b/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php index 7798ec4472..e609b5447a 100644 --- a/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php +++ b/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Index_Adminhtml_ProcessController extends Mage_Adminhtml_Controller_Action @@ -73,7 +73,7 @@ public function editAction() $this->renderLayout(); } else { $this->_getSession()->addError( - Mage::helper('index')->__('Can\'t initialize indexer process.') + Mage::helper('index')->__('Cannot initialize the indexer process.') ); $this->_redirect('*/*/list'); } @@ -93,19 +93,19 @@ public function saveAction() try { $process->save(); $this->_getSession()->addSuccess( - Mage::helper('index')->__('Index was saved successfully.') + Mage::helper('index')->__('The index has been saved.') ); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { $this->_getSession()->addException($e, - Mage::helper('index')->__('Some problem with saving process.') + Mage::helper('index')->__('There was a problem with saving process.') ); } $this->_redirect('*/*/list'); } else { $this->_getSession()->addError( - Mage::helper('index')->__('Can\'t initialize indexer process.') + Mage::helper('index')->__('Cannot initialize the indexer process.') ); $this->_redirect('*/*/list'); } @@ -124,18 +124,18 @@ public function reindexProcessAction() $process->reindexEverything(); Varien_Profiler::stop('__INDEX_PROCESS_REINDEX_ALL__'); $this->_getSession()->addSuccess( - Mage::helper('index')->__('%s index was rebuilt successfully.', $process->getIndexer()->getName()) + Mage::helper('index')->__('%s index was rebuilt.', $process->getIndexer()->getName()) ); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { $this->_getSession()->addException($e, - Mage::helper('index')->__('Some problem with reindexing process.') + Mage::helper('index')->__('There was a problem with reindexing process.') ); } } else { $this->_getSession()->addError( - Mage::helper('index')->__('Can\'t initialize indexer process.') + Mage::helper('index')->__('Cannot initialize the indexer process.') ); } @@ -180,12 +180,12 @@ public function massReindexAction() } $count = count($processIds); $this->_getSession()->addSuccess( - Mage::helper('index')->__('Total of %d index(es) have successfully reindexed data', $count) + Mage::helper('index')->__('Total of %d index(es) have reindexed data.', $count) ); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('index')->__('Can\'t initialize indexer process.')); + $this->_getSession()->addException($e, Mage::helper('index')->__('Cannot initialize the indexer process.')); } } @@ -214,12 +214,12 @@ public function massChangeModeAction() } $count = count($processIds); $this->_getSession()->addSuccess( - Mage::helper('index')->__('Total of %d index(es) were successfully changed index mode', $count) + Mage::helper('index')->__('Total of %d index(es) have changed index mode.', $count) ); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { - $this->_getSession()->addException($e, Mage::helper('index')->__('Can\'t initialize indexer process.')); + $this->_getSession()->addException($e, Mage::helper('index')->__('Cannot initialize the indexer process.')); } } diff --git a/app/code/core/Mage/Index/etc/adminhtml.xml b/app/code/core/Mage/Index/etc/adminhtml.xml index cd791c8268..b88464bf78 100644 --- a/app/code/core/Mage/Index/etc/adminhtml.xml +++ b/app/code/core/Mage/Index/etc/adminhtml.xml @@ -1,4 +1,4 @@ - + diff --git a/app/code/core/Mage/Index/etc/config.xml b/app/code/core/Mage/Index/etc/config.xml index 69b6861029..af5ff41cf9 100644 --- a/app/code/core/Mage/Index/etc/config.xml +++ b/app/code/core/Mage/Index/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Index/sql/index_setup/mysql4-install-1.4.0.0.php b/app/code/core/Mage/Index/sql/index_setup/mysql4-install-1.4.0.0.php index 8e0791e61c..0b38d6bbfa 100644 --- a/app/code/core/Mage/Index/sql/index_setup/mysql4-install-1.4.0.0.php +++ b/app/code/core/Mage/Index/sql/index_setup/mysql4-install-1.4.0.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php b/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php index 1b11657cd3..785a0f00af 100644 --- a/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php +++ b/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.4.0.1-1.4.0.2.php b/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.4.0.1-1.4.0.2.php index 1d0c86936f..086d0f240e 100644 --- a/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.4.0.1-1.4.0.2.php +++ b/app/code/core/Mage/Index/sql/index_setup/mysql4-upgrade-1.4.0.1-1.4.0.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Index - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/Block/Abstract.php b/app/code/core/Mage/Install/Block/Abstract.php index 45e03c3e78..488ea683b9 100644 --- a/app/code/core/Mage/Install/Block/Abstract.php +++ b/app/code/core/Mage/Install/Block/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/Block/Admin.php b/app/code/core/Mage/Install/Block/Admin.php index 21643c866a..44a8e8ab7d 100644 --- a/app/code/core/Mage/Install/Block/Admin.php +++ b/app/code/core/Mage/Install/Block/Admin.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/Block/Begin.php b/app/code/core/Mage/Install/Block/Begin.php index 82ac11bc92..8d954baf18 100644 --- a/app/code/core/Mage/Install/Block/Begin.php +++ b/app/code/core/Mage/Install/Block/Begin.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/Block/Config.php b/app/code/core/Mage/Install/Block/Config.php index cafbb25706..420db9a544 100644 --- a/app/code/core/Mage/Install/Block/Config.php +++ b/app/code/core/Mage/Install/Block/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -81,7 +81,7 @@ public function getSkipBaseUrlValidation() public function getSessionSaveOptions() { return array( - 'files' => Mage::helper('install')->__('File system'), + 'files' => Mage::helper('install')->__('File System'), 'db' => Mage::helper('install')->__('Database'), ); } @@ -91,7 +91,7 @@ public function getSessionSaveSelect() $html = $this->getLayout()->createBlock('core/html_select') ->setName('config[session_save]') ->setId('session_save') - ->setTitle(Mage::helper('install')->__('Save session files in')) + ->setTitle(Mage::helper('install')->__('Save Session Files In')) ->setClass('required-entry') ->setOptions($this->getSessionSaveOptions()) ->getHtml(); diff --git a/app/code/core/Mage/Install/Block/Download.php b/app/code/core/Mage/Install/Block/Download.php index 037ebbffce..729cf442f3 100644 --- a/app/code/core/Mage/Install/Block/Download.php +++ b/app/code/core/Mage/Install/Block/Download.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/Block/End.php b/app/code/core/Mage/Install/Block/End.php index cfae42e899..b2dbed7d87 100644 --- a/app/code/core/Mage/Install/Block/End.php +++ b/app/code/core/Mage/Install/Block/End.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/Block/Locale.php b/app/code/core/Mage/Install/Block/Locale.php index ffb518f133..bd83de9db5 100644 --- a/app/code/core/Mage/Install/Block/Locale.php +++ b/app/code/core/Mage/Install/Block/Locale.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/Block/State.php b/app/code/core/Mage/Install/Block/State.php index 837e17536c..4508daa57f 100644 --- a/app/code/core/Mage/Install/Block/State.php +++ b/app/code/core/Mage/Install/Block/State.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/Controller/Action.php b/app/code/core/Mage/Install/Controller/Action.php index cd2a01e848..8e50367498 100644 --- a/app/code/core/Mage/Install/Controller/Action.php +++ b/app/code/core/Mage/Install/Controller/Action.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/Helper/Data.php b/app/code/core/Mage/Install/Helper/Data.php index 061f51995f..465cf2efb0 100644 --- a/app/code/core/Mage/Install/Helper/Data.php +++ b/app/code/core/Mage/Install/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/Model/Config.php b/app/code/core/Mage/Install/Model/Config.php index f7f36f0e94..6ccc36001c 100644 --- a/app/code/core/Mage/Install/Model/Config.php +++ b/app/code/core/Mage/Install/Model/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/Model/Installer.php b/app/code/core/Mage/Install/Model/Installer.php index cbdf0f9265..c7de515b4f 100644 --- a/app/code/core/Mage/Install/Model/Installer.php +++ b/app/code/core/Mage/Install/Model/Installer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -247,7 +247,7 @@ public function createAdministrator($data) if (is_array($data)) { $data = $this->validateAndPrepareAdministrator($data); if (is_array(data)) { - throw new Exception(Mage::helper('install')->__('Please correct user data and try again.')); + throw new Exception(Mage::helper('install')->__('Please correct the user data and try again.')); } } diff --git a/app/code/core/Mage/Install/Model/Installer/Abstract.php b/app/code/core/Mage/Install/Model/Installer/Abstract.php index e887aad566..1e384f5e4d 100644 --- a/app/code/core/Mage/Install/Model/Installer/Abstract.php +++ b/app/code/core/Mage/Install/Model/Installer/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/Model/Installer/Config.php b/app/code/core/Mage/Install/Model/Installer/Config.php index 13e81e04fa..90ccbbf0b5 100644 --- a/app/code/core/Mage/Install/Model/Installer/Config.php +++ b/app/code/core/Mage/Install/Model/Installer/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -147,13 +147,13 @@ protected function _checkUrl($url, $secure=false) $body = $response->getBody(); } catch (Exception $e){ - $this->_getInstaller()->getDataModel()->addError(Mage::helper('install')->__('Url "%s" is not accessible', $url)); + $this->_getInstaller()->getDataModel()->addError(Mage::helper('install')->__('The URL "%s" is not accessible.', $url)); throw $e; } if ($body != Mage_Install_Model_Installer::INSTALLER_HOST_RESPONSE) { - $this->_getInstaller()->getDataModel()->addError(Mage::helper('install')->__('Url "%s" is invalid', $url)); - Mage::throwException(Mage::helper('install')->__('This Url is invalid')); + $this->_getInstaller()->getDataModel()->addError(Mage::helper('install')->__('The URL "%s" is invalid.', $url)); + Mage::throwException(Mage::helper('install')->__('This URL is invalid.')); } return $this; } diff --git a/app/code/core/Mage/Install/Model/Installer/Console.php b/app/code/core/Mage/Install/Model/Installer/Console.php index 5c8c29c2e9..79adfa638d 100644 --- a/app/code/core/Mage/Install/Model/Installer/Console.php +++ b/app/code/core/Mage/Install/Model/Installer/Console.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/Model/Installer/Data.php b/app/code/core/Mage/Install/Model/Installer/Data.php index 47e5809dc4..332782c4e0 100644 --- a/app/code/core/Mage/Install/Model/Installer/Data.php +++ b/app/code/core/Mage/Install/Model/Installer/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/Model/Installer/Db.php b/app/code/core/Mage/Install/Model/Installer/Db.php index b9f42d6007..94c9ff5027 100644 --- a/app/code/core/Mage/Install/Model/Installer/Db.php +++ b/app/code/core/Mage/Install/Model/Installer/Db.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -67,17 +67,17 @@ public function checkDatabase($data) // check MySQL Server version if (version_compare($version, $requiredVersion) == -1) { - Mage::throwException(Mage::helper('install')->__('Database server version does not match system requirements (required: %s, actual: %s)', $requiredVersion, $version)); + Mage::throwException(Mage::helper('install')->__('The database server version does not match system requirements (required: %s, actual: %s).', $requiredVersion, $version)); } // check InnoDB support if (!isset($variables['have_innodb']) || $variables['have_innodb'] != 'YES') { - Mage::throwException(Mage::helper('install')->__('Database server does not support InnoDB storage engine')); + Mage::throwException(Mage::helper('install')->__('Database server does not support the InnoDB storage engine.')); } } catch (Exception $e){ $this->_getInstaller()->getDataModel()->addError($e->getMessage()); - Mage::throwException(Mage::helper('install')->__('Database connection error')); + Mage::throwException(Mage::helper('install')->__('Database connection error.')); } } diff --git a/app/code/core/Mage/Install/Model/Installer/Env.php b/app/code/core/Mage/Install/Model/Installer/Env.php index ce734f9119..76cc1e1e12 100644 --- a/app/code/core/Mage/Install/Model/Installer/Env.php +++ b/app/code/core/Mage/Install/Model/Installer/Env.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -70,14 +70,14 @@ protected function _checkExtension($extension) if (!$oneLoaded) { Mage::getSingleton('install/session')->addError( - Mage::helper('install')->__('One from PHP Extensions "%s" must be loaded', implode(',', $extension)) + Mage::helper('install')->__('One of PHP Extensions "%s" must be loaded.', implode(',', $extension)) ); return false; } } elseif(!extension_loaded($extension)) { Mage::getSingleton('install/session')->addError( - Mage::helper('install')->__('PHP Extension "%s" must be loaded', $extension) + Mage::helper('install')->__('PHP extension "%s" must be loaded.', $extension) ); return false; } diff --git a/app/code/core/Mage/Install/Model/Installer/Filesystem.php b/app/code/core/Mage/Install/Model/Installer/Filesystem.php index f52ad95284..2d8c0f3751 100644 --- a/app/code/core/Mage/Install/Model/Installer/Filesystem.php +++ b/app/code/core/Mage/Install/Model/Installer/Filesystem.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -101,7 +101,7 @@ protected function _checkPath($path, $recursive, $existence, $mode) if ($setError) { $this->_getInstaller()->getDataModel()->addError( - Mage::helper('install')->__('Path "%s" must be writable', $fullPath) + Mage::helper('install')->__('Path "%s" must be writable.', $fullPath) ); $res = false; } diff --git a/app/code/core/Mage/Install/Model/Installer/Pear.php b/app/code/core/Mage/Install/Model/Installer/Pear.php index ae34d53f03..04f31949a8 100644 --- a/app/code/core/Mage/Install/Model/Installer/Pear.php +++ b/app/code/core/Mage/Install/Model/Installer/Pear.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/Model/Observer.php b/app/code/core/Mage/Install/Model/Observer.php index d8698a99a3..caca2cf104 100644 --- a/app/code/core/Mage/Install/Model/Observer.php +++ b/app/code/core/Mage/Install/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/Model/Session.php b/app/code/core/Mage/Install/Model/Session.php index 2c961f47a1..a0fcfa2b7a 100644 --- a/app/code/core/Mage/Install/Model/Session.php +++ b/app/code/core/Mage/Install/Model/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/Model/Wizard.php b/app/code/core/Mage/Install/Model/Wizard.php index cbc64665f1..91f7f2c4d2 100644 --- a/app/code/core/Mage/Install/Model/Wizard.php +++ b/app/code/core/Mage/Install/Model/Wizard.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/controllers/IndexController.php b/app/code/core/Mage/Install/controllers/IndexController.php index 03bd4a50f1..36ea18195c 100644 --- a/app/code/core/Mage/Install/controllers/IndexController.php +++ b/app/code/core/Mage/Install/controllers/IndexController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Install/controllers/WizardController.php b/app/code/core/Mage/Install/controllers/WizardController.php index 064652d10c..ec502d341f 100644 --- a/app/code/core/Mage/Install/controllers/WizardController.php +++ b/app/code/core/Mage/Install/controllers/WizardController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -31,6 +31,11 @@ class Mage_Install_WizardController extends Mage_Install_Controller_Action { public function preDispatch() { + if (Mage::isInstalled()) { + $this->setFlag('', self::FLAG_NO_DISPATCH, true); + $this->_redirect('/'); + return; + } $this->setFlag('', self::FLAG_NO_CHECK_INSTALLATION, true); return parent::preDispatch(); } @@ -318,7 +323,7 @@ public function configPostAction() if($data['db_prefix']!='') { if(!preg_match('/^[a-z]+[a-z0-9_]*$/',$data['db_prefix'])) { Mage::throwException( - Mage::helper('install')->__('Table prefix should contain only letters (a-z), numbers (0-9) or underscore(_), first character should be a letter')); + Mage::helper('install')->__('The table prefix should contain only letters (a-z), numbers (0-9) or underscores (_), the first character should be a letter.')); } } $this->_getInstaller()->installConfig($data); diff --git a/app/code/core/Mage/Install/etc/config.xml b/app/code/core/Mage/Install/etc/config.xml index c307a6d548..70e26ba983 100644 --- a/app/code/core/Mage/Install/etc/config.xml +++ b/app/code/core/Mage/Install/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Install/etc/install.xml b/app/code/core/Mage/Install/etc/install.xml index 483f3e511c..f3c73e88be 100644 --- a/app/code/core/Mage/Install/etc/install.xml +++ b/app/code/core/Mage/Install/etc/install.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Install - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Log/Helper/Data.php b/app/code/core/Mage/Log/Helper/Data.php index 2022f0cbae..7a84c6611b 100644 --- a/app/code/core/Mage/Log/Helper/Data.php +++ b/app/code/core/Mage/Log/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/Model/Aggregation.php b/app/code/core/Mage/Log/Model/Aggregation.php index 01aca0d665..b27f194878 100644 --- a/app/code/core/Mage/Log/Model/Aggregation.php +++ b/app/code/core/Mage/Log/Model/Aggregation.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/Model/Cron.php b/app/code/core/Mage/Log/Model/Cron.php index 2024e2c908..2a4a89ca9c 100644 --- a/app/code/core/Mage/Log/Model/Cron.php +++ b/app/code/core/Mage/Log/Model/Cron.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/Model/Customer.php b/app/code/core/Mage/Log/Model/Customer.php index c998dacc95..297a1886ec 100644 --- a/app/code/core/Mage/Log/Model/Customer.php +++ b/app/code/core/Mage/Log/Model/Customer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/Model/Log.php b/app/code/core/Mage/Log/Model/Log.php index 3c276ca926..0bdbac89e2 100644 --- a/app/code/core/Mage/Log/Model/Log.php +++ b/app/code/core/Mage/Log/Model/Log.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/Model/Mysql4/Aggregation.php b/app/code/core/Mage/Log/Model/Mysql4/Aggregation.php index 48d10b788e..9f817e11cb 100644 --- a/app/code/core/Mage/Log/Model/Mysql4/Aggregation.php +++ b/app/code/core/Mage/Log/Model/Mysql4/Aggregation.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/Model/Mysql4/Customer.php b/app/code/core/Mage/Log/Model/Mysql4/Customer.php index ee9a4d95cd..a9bffb0426 100644 --- a/app/code/core/Mage/Log/Model/Mysql4/Customer.php +++ b/app/code/core/Mage/Log/Model/Mysql4/Customer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/Model/Mysql4/Log.php b/app/code/core/Mage/Log/Model/Mysql4/Log.php index 8a01c6b271..7076515f55 100644 --- a/app/code/core/Mage/Log/Model/Mysql4/Log.php +++ b/app/code/core/Mage/Log/Model/Mysql4/Log.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/Model/Mysql4/Visitor.php b/app/code/core/Mage/Log/Model/Mysql4/Visitor.php index 79978d4300..c9c49e406e 100644 --- a/app/code/core/Mage/Log/Model/Mysql4/Visitor.php +++ b/app/code/core/Mage/Log/Model/Mysql4/Visitor.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/Model/Mysql4/Visitor/Aggregator.php b/app/code/core/Mage/Log/Model/Mysql4/Visitor/Aggregator.php index 72b5586ad3..486f0760a7 100644 --- a/app/code/core/Mage/Log/Model/Mysql4/Visitor/Aggregator.php +++ b/app/code/core/Mage/Log/Model/Mysql4/Visitor/Aggregator.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/Model/Mysql4/Visitor/Collection.php b/app/code/core/Mage/Log/Model/Mysql4/Visitor/Collection.php index 5b35078a9f..94f6b80291 100644 --- a/app/code/core/Mage/Log/Model/Mysql4/Visitor/Collection.php +++ b/app/code/core/Mage/Log/Model/Mysql4/Visitor/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/Model/Mysql4/Visitor/Online.php b/app/code/core/Mage/Log/Model/Mysql4/Visitor/Online.php index 279442c623..2f0cf1fc0b 100644 --- a/app/code/core/Mage/Log/Model/Mysql4/Visitor/Online.php +++ b/app/code/core/Mage/Log/Model/Mysql4/Visitor/Online.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/Model/Mysql4/Visitor/Online/Collection.php b/app/code/core/Mage/Log/Model/Mysql4/Visitor/Online/Collection.php index 193d830fe4..8ccc4a07f2 100644 --- a/app/code/core/Mage/Log/Model/Mysql4/Visitor/Online/Collection.php +++ b/app/code/core/Mage/Log/Model/Mysql4/Visitor/Online/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/Model/Visitor.php b/app/code/core/Mage/Log/Model/Visitor.php index 427660ab7e..d14e4e501a 100644 --- a/app/code/core/Mage/Log/Model/Visitor.php +++ b/app/code/core/Mage/Log/Model/Visitor.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/Model/Visitor/Aggregator.php b/app/code/core/Mage/Log/Model/Visitor/Aggregator.php index 166cd503d6..cfee8122f3 100644 --- a/app/code/core/Mage/Log/Model/Visitor/Aggregator.php +++ b/app/code/core/Mage/Log/Model/Visitor/Aggregator.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/Model/Visitor/Online.php b/app/code/core/Mage/Log/Model/Visitor/Online.php index 6f37d15e50..4f6f2c6043 100644 --- a/app/code/core/Mage/Log/Model/Visitor/Online.php +++ b/app/code/core/Mage/Log/Model/Visitor/Online.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/etc/config.xml b/app/code/core/Mage/Log/etc/config.xml index f4763b3d19..ac5c1fa402 100644 --- a/app/code/core/Mage/Log/etc/config.xml +++ b/app/code/core/Mage/Log/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Log/etc/system.xml b/app/code/core/Mage/Log/etc/system.xml index 1f4aa97e02..01056483c0 100644 --- a/app/code/core/Mage/Log/etc/system.xml +++ b/app/code/core/Mage/Log/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -38,7 +38,7 @@ 0 - + text 1 1 @@ -46,7 +46,7 @@ 0 - + select adminhtml/system_config_source_yesno 2 diff --git a/app/code/core/Mage/Log/sql/log_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Log/sql/log_setup/mysql4-install-0.7.0.php index beb5bda8e7..b157875963 100644 --- a/app/code/core/Mage/Log/sql/log_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Log/sql/log_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.0-0.7.1.php index d4f14d6f68..f568d10fae 100644 --- a/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.1-0.7.2.php index 5c10f6c34d..c8fb68ffa1 100644 --- a/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.3-0.7.4.php b/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.3-0.7.4.php index 441dbef4e6..6ae5523652 100644 --- a/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.3-0.7.4.php +++ b/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.3-0.7.4.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.4-0.7.5.php b/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.4-0.7.5.php index b5352e5ccd..7796519d67 100644 --- a/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.4-0.7.5.php +++ b/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.4-0.7.5.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.5-0.7.6.php b/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.5-0.7.6.php index eeb3339be0..726c46963d 100644 --- a/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.5-0.7.6.php +++ b/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.5-0.7.6.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.6-0.7.7.php b/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.6-0.7.7.php index 2a12a62f1f..c0f830d46d 100644 --- a/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.6-0.7.7.php +++ b/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.6-0.7.7.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Log - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Media/Helper/Data.php b/app/code/core/Mage/Media/Helper/Data.php index a874792622..536e73f180 100644 --- a/app/code/core/Mage/Media/Helper/Data.php +++ b/app/code/core/Mage/Media/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Media - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Media/Model/File/Image.php b/app/code/core/Mage/Media/Model/File/Image.php index cb3c13aec7..8e8ffb4922 100644 --- a/app/code/core/Mage/Media/Model/File/Image.php +++ b/app/code/core/Mage/Media/Model/File/Image.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Media - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -100,7 +100,7 @@ public function getImage(Mage_Media_Model_Image $object) } if(!$resource) { - Mage::throwException(Mage::helper('media')->__('Image not exists or invalid')); + Mage::throwException(Mage::helper('media')->__('The image does not exist or is invalid.')); } @@ -182,7 +182,7 @@ public function saveAs(Mage_Media_Model_Image $object, $extension=null) } if(!$result) { - Mage::throwException(Mage::helper('media')->__('Error while creating image')); + Mage::throwException(Mage::helper('media')->__('An error occurred while creating the image.')); } return $this; @@ -198,7 +198,7 @@ public function getDimensions(Mage_Media_Model_Image $object) { $info = @getimagesize($object->getFilePath()); if(!$info) { - Mage::throwException(Mage::helper('media')->__('Image not exists or invalid')); + Mage::throwException(Mage::helper('media')->__('The image does not exist or is invalid.')); } $info = array('width'=>$info[0], 'height'=>$info[1], 'type'=>$info[2]); diff --git a/app/code/core/Mage/Media/Model/Image.php b/app/code/core/Mage/Media/Model/Image.php index a9eb414a02..a6093ef714 100644 --- a/app/code/core/Mage/Media/Model/Image.php +++ b/app/code/core/Mage/Media/Model/Image.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Media - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Media/Model/Image/Config/Interface.php b/app/code/core/Mage/Media/Model/Image/Config/Interface.php index 1e35cc8798..7138f741c5 100644 --- a/app/code/core/Mage/Media/Model/Image/Config/Interface.php +++ b/app/code/core/Mage/Media/Model/Image/Config/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Media - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Media/etc/config.xml b/app/code/core/Mage/Media/etc/config.xml index 4afaac6aff..68d04f8e0b 100644 --- a/app/code/core/Mage/Media/etc/config.xml +++ b/app/code/core/Mage/Media/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Media - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Newsletter/Block/Subscribe.php b/app/code/core/Mage/Newsletter/Block/Subscribe.php index 5d2ee3b3e5..2c0a72f128 100644 --- a/app/code/core/Mage/Newsletter/Block/Subscribe.php +++ b/app/code/core/Mage/Newsletter/Block/Subscribe.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Newsletter/Helper/Data.php b/app/code/core/Mage/Newsletter/Helper/Data.php index ca9957c535..6a40563315 100644 --- a/app/code/core/Mage/Newsletter/Helper/Data.php +++ b/app/code/core/Mage/Newsletter/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Newsletter/Model/Message.php b/app/code/core/Mage/Newsletter/Model/Message.php index 884158d9db..610bbf130f 100644 --- a/app/code/core/Mage/Newsletter/Model/Message.php +++ b/app/code/core/Mage/Newsletter/Model/Message.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Newsletter/Model/Mysql4/Problem.php b/app/code/core/Mage/Newsletter/Model/Mysql4/Problem.php index 05aa351872..055e9d727c 100644 --- a/app/code/core/Mage/Newsletter/Model/Mysql4/Problem.php +++ b/app/code/core/Mage/Newsletter/Model/Mysql4/Problem.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Newsletter/Model/Mysql4/Problem/Collection.php b/app/code/core/Mage/Newsletter/Model/Mysql4/Problem/Collection.php index 5b2df946f8..9f0897408a 100644 --- a/app/code/core/Mage/Newsletter/Model/Mysql4/Problem/Collection.php +++ b/app/code/core/Mage/Newsletter/Model/Mysql4/Problem/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Newsletter/Model/Mysql4/Queue.php b/app/code/core/Mage/Newsletter/Model/Mysql4/Queue.php index 52cf9e06dc..ae4b5bdb5f 100644 --- a/app/code/core/Mage/Newsletter/Model/Mysql4/Queue.php +++ b/app/code/core/Mage/Newsletter/Model/Mysql4/Queue.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -48,11 +48,11 @@ protected function _construct() public function addSubscribersToQueue(Mage_Newsletter_Model_Queue $queue, array $subscriberIds) { if (count($subscriberIds)==0) { - Mage::throwException(Mage::helper('newsletter')->__('No subscribers selected')); + Mage::throwException(Mage::helper('newsletter')->__('No subscribers selected.')); } if (!$queue->getId() && $queue->getQueueStatus()!=Mage_Newsletter_Model_Queue::STATUS_NEVER) { - Mage::throwException(Mage::helper('newsletter')->__('Invalid queue selected')); + Mage::throwException(Mage::helper('newsletter')->__('Invalid queue selected.')); } $select = $this->_getWriteAdapter()->select(); diff --git a/app/code/core/Mage/Newsletter/Model/Mysql4/Queue/Collection.php b/app/code/core/Mage/Newsletter/Model/Mysql4/Queue/Collection.php index 02fe996ce7..891474f0ba 100644 --- a/app/code/core/Mage/Newsletter/Model/Mysql4/Queue/Collection.php +++ b/app/code/core/Mage/Newsletter/Model/Mysql4/Queue/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Newsletter/Model/Mysql4/Subscriber.php b/app/code/core/Mage/Newsletter/Model/Mysql4/Subscriber.php index d1f0dcbfef..d7a3646a62 100644 --- a/app/code/core/Mage/Newsletter/Model/Mysql4/Subscriber.php +++ b/app/code/core/Mage/Newsletter/Model/Mysql4/Subscriber.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -168,7 +168,7 @@ public function received(Mage_Newsletter_Model_Subscriber $subscriber, Mage_News } catch (Exception $e) { $this->_write->rollBack(); - Mage::throwException(Mage::helper('newsletter')->__('Cannot mark as received subscriber')); + Mage::throwException(Mage::helper('newsletter')->__('Cannot mark as received subscriber.')); } return $this; } diff --git a/app/code/core/Mage/Newsletter/Model/Mysql4/Subscriber/Collection.php b/app/code/core/Mage/Newsletter/Model/Mysql4/Subscriber/Collection.php index d8a4a6e784..51867e4a45 100644 --- a/app/code/core/Mage/Newsletter/Model/Mysql4/Subscriber/Collection.php +++ b/app/code/core/Mage/Newsletter/Model/Mysql4/Subscriber/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Newsletter/Model/Mysql4/Template.php b/app/code/core/Mage/Newsletter/Model/Mysql4/Template.php index 9248dfe019..dc0095abb1 100644 --- a/app/code/core/Mage/Newsletter/Model/Mysql4/Template.php +++ b/app/code/core/Mage/Newsletter/Model/Mysql4/Template.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -124,7 +124,7 @@ public function checkCodeUsage(Mage_Newsletter_Model_Template $template) protected function _beforeSave(Mage_Core_Model_Abstract $object) { if ($this->checkCodeUsage($object)) { - Mage::throwException(Mage::helper('newsletter')->__('Duplicate of template code')); + Mage::throwException(Mage::helper('newsletter')->__('Duplicate template code.')); } if (!$object->hasTemplateActual()) { diff --git a/app/code/core/Mage/Newsletter/Model/Mysql4/Template/Collection.php b/app/code/core/Mage/Newsletter/Model/Mysql4/Template/Collection.php index d220b8ed10..32a88b5f92 100644 --- a/app/code/core/Mage/Newsletter/Model/Mysql4/Template/Collection.php +++ b/app/code/core/Mage/Newsletter/Model/Mysql4/Template/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Newsletter/Model/Observer.php b/app/code/core/Mage/Newsletter/Model/Observer.php index ec6081ccd0..139324ed31 100644 --- a/app/code/core/Mage/Newsletter/Model/Observer.php +++ b/app/code/core/Mage/Newsletter/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Newsletter/Model/Problem.php b/app/code/core/Mage/Newsletter/Model/Problem.php index 451248c594..9feeef5c51 100644 --- a/app/code/core/Mage/Newsletter/Model/Problem.php +++ b/app/code/core/Mage/Newsletter/Model/Problem.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Newsletter/Model/Queue.php b/app/code/core/Mage/Newsletter/Model/Queue.php index d04fbe64f6..5eb32c7714 100644 --- a/app/code/core/Mage/Newsletter/Model/Queue.php +++ b/app/code/core/Mage/Newsletter/Model/Queue.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Newsletter/Model/Session.php b/app/code/core/Mage/Newsletter/Model/Session.php index c0eb037bff..1fbd031e06 100644 --- a/app/code/core/Mage/Newsletter/Model/Session.php +++ b/app/code/core/Mage/Newsletter/Model/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Newsletter/Model/Subscriber.php b/app/code/core/Mage/Newsletter/Model/Subscriber.php index 88f37c4083..37d6bb57fb 100644 --- a/app/code/core/Mage/Newsletter/Model/Subscriber.php +++ b/app/code/core/Mage/Newsletter/Model/Subscriber.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -44,6 +44,7 @@ class Mage_Newsletter_Model_Subscriber extends Mage_Core_Model_Abstract const XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE = 'newsletter/subscription/un_email_template'; const XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY = 'newsletter/subscription/un_email_identity'; const XML_PATH_CONFIRMATION_FLAG = 'newsletter/subscription/confirm'; + const XML_PATH_ALLOW_GUEST_SUBSCRIBE_FLAG = 'newsletter/subscription/allow_guest_subscribe'; const XML_PATH_SENDING_SET_RETURN_PATH = Mage_Core_Model_Email_Template::XML_PATH_SENDING_SET_RETURN_PATH; @@ -267,21 +268,27 @@ public function randomSequence($length=32) public function subscribe($email) { $this->loadByEmail($email); - $customer = Mage::getModel('customer/customer') - ->setWebsiteId(Mage::app()->getStore()->getWebsiteId()) - ->loadByEmail($email); - $customerSession = Mage::getSingleton('customer/session'); if(!$this->getId()) { $this->setSubscriberConfirmCode($this->randomSequence()); } - $isConfirmNeed = Mage::getStoreConfig(self::XML_PATH_CONFIRMATION_FLAG) == 1 ? true : false; + $isConfirmNeed = (Mage::getStoreConfig(self::XML_PATH_CONFIRMATION_FLAG) == 1) ? true : false; - if (!$this->getId() || $this->getStatus()==self::STATUS_UNSUBSCRIBED || $this->getStatus()==self::STATUS_NOT_ACTIVE) { + if (!$this->getId() || $this->getStatus() == self::STATUS_UNSUBSCRIBED || $this->getStatus() == self::STATUS_NOT_ACTIVE) { if ($isConfirmNeed) { - $this->setStatus(self::STATUS_NOT_ACTIVE); + // if user subscribes own login email - confirmation is not needed + $ownerId = Mage::getModel('customer/customer') + ->setWebsiteId(Mage::app()->getStore()->getWebsiteId()) + ->loadByEmail($email) + ->getId(); + if ($customerSession->isLoggedIn() && $ownerId == $customerSession->getId()){ + $this->setStatus(self::STATUS_SUBSCRIBED); + } + else { + $this->setStatus(self::STATUS_NOT_ACTIVE); + } } else { $this->setStatus(self::STATUS_SUBSCRIBED); } @@ -290,12 +297,7 @@ public function subscribe($email) if ($customerSession->isLoggedIn()) { $this->setStoreId($customerSession->getCustomer()->getStoreId()); - $this->setStatus(self::STATUS_SUBSCRIBED); $this->setCustomerId($customerSession->getCustomerId()); - } else if ($customer->getId()) { - $this->setStoreId($customer->getStoreId()); - $this->setSubscriberStatus(self::STATUS_SUBSCRIBED); - $this->setCustomerId($customer->getId()); } else { $this->setStoreId(Mage::app()->getStore()->getId()); $this->setCustomerId(0); @@ -312,7 +314,8 @@ public function subscribe($email) } return $this->getStatus(); - } catch (Exception $e) { + } + catch (Exception $e) { throw new Exception($e->getMessage()); } } @@ -320,7 +323,7 @@ public function subscribe($email) public function unsubscribe() { if ($this->hasCheckCode() && $this->getCode() != $this->getCheckCode()) { - Mage::throwException(Mage::helper('newsletter')->__('Invalid subscription confirmation code')); + Mage::throwException(Mage::helper('newsletter')->__('Invalid subscription confirmation code.')); } $this->setSubscriberStatus(self::STATUS_UNSUBSCRIBED) @@ -330,7 +333,7 @@ public function unsubscribe() } /** - * Saving customer cubscription status + * Saving customer subscription status * * @param Mage_Customer_Model_Customer $customer * @return Mage_Newsletter_Model_Subscriber diff --git a/app/code/core/Mage/Newsletter/Model/Template.php b/app/code/core/Mage/Newsletter/Model/Template.php index eafcab4a83..869c8837cc 100644 --- a/app/code/core/Mage/Newsletter/Model/Template.php +++ b/app/code/core/Mage/Newsletter/Model/Template.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Newsletter/Model/Template/Filter.php b/app/code/core/Mage/Newsletter/Model/Template/Filter.php index 36f4a51230..21bdab61b8 100644 --- a/app/code/core/Mage/Newsletter/Model/Template/Filter.php +++ b/app/code/core/Mage/Newsletter/Model/Template/Filter.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Newsletter/controllers/ManageController.php b/app/code/core/Mage/Newsletter/controllers/ManageController.php index f2e0fa013f..4597c8af64 100644 --- a/app/code/core/Mage/Newsletter/controllers/ManageController.php +++ b/app/code/core/Mage/Newsletter/controllers/ManageController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -49,9 +49,9 @@ public function preDispatch() public function indexAction() { - $this->loadLayout(); - $this->_initLayoutMessages('customer/session'); - $this->_initLayoutMessages('catalog/session'); + $this->loadLayout(); + $this->_initLayoutMessages('customer/session'); + $this->_initLayoutMessages('catalog/session'); if ($block = $this->getLayout()->getBlock('customer_newsletter')) { $block->setRefererUrl($this->_getRefererUrl()); @@ -67,13 +67,17 @@ public function saveAction() } try { Mage::getSingleton('customer/session')->getCustomer() - ->setStoreId(Mage::app()->getStore()->getId()) - ->setIsSubscribed((boolean)$this->getRequest()->getParam('is_subscribed', false)) - ->save(); - Mage::getSingleton('customer/session')->addSuccess($this->__('The subscription was successfully saved')); + ->setStoreId(Mage::app()->getStore()->getId()) + ->setIsSubscribed((boolean)$this->getRequest()->getParam('is_subscribed', false)) + ->save(); + if ((boolean)$this->getRequest()->getParam('is_subscribed', false)) { + Mage::getSingleton('customer/session')->addSuccess($this->__('The subscription has been saved.')); + } else { + Mage::getSingleton('customer/session')->addSuccess($this->__('The subscription has been removed.')); + } } catch (Exception $e) { - Mage::getSingleton('customer/session')->addError($this->__('There was an error while saving your subscription')); + Mage::getSingleton('customer/session')->addError($this->__('An error occurred while saving your subscription.')); } $this->_redirect('customer/account/'); } diff --git a/app/code/core/Mage/Newsletter/controllers/SubscriberController.php b/app/code/core/Mage/Newsletter/controllers/SubscriberController.php index 8cde48334f..d13c999f0a 100644 --- a/app/code/core/Mage/Newsletter/controllers/SubscriberController.php +++ b/app/code/core/Mage/Newsletter/controllers/SubscriberController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -39,27 +39,41 @@ class Mage_Newsletter_SubscriberController extends Mage_Core_Controller_Front_Ac public function newAction() { if ($this->getRequest()->isPost() && $this->getRequest()->getPost('email')) { - $session = Mage::getSingleton('core/session'); - $email = (string) $this->getRequest()->getPost('email'); + $session = Mage::getSingleton('core/session'); + $customerSession = Mage::getSingleton('customer/session'); + $email = (string) $this->getRequest()->getPost('email'); try { if (!Zend_Validate::is($email, 'EmailAddress')) { - Mage::throwException($this->__('Please enter a valid email address')); + Mage::throwException($this->__('Please enter a valid email address.')); + } + + if (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_ALLOW_GUEST_SUBSCRIBE_FLAG) != 1 && + !$customerSession->isLoggedIn()) { + Mage::throwException($this->__('Sorry, but administrator denied subscription for guests. Please register.', Mage::getUrl('customer/account/create/'))); + } + + $ownerId = Mage::getModel('customer/customer') + ->setWebsiteId(Mage::app()->getStore()->getWebsiteId()) + ->loadByEmail($email) + ->getId(); + if ($ownerId !== null && $ownerId != $customerSession->getId()) { + Mage::throwException($this->__('Sorry, but your can not subscribe email adress assigned to another user.')); } $status = Mage::getModel('newsletter/subscriber')->subscribe($email); if ($status == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE) { - $session->addSuccess($this->__('Confirmation request has been sent')); + $session->addSuccess($this->__('Confirmation request has been sent.')); } else { - $session->addSuccess($this->__('Thank you for your subscription')); + $session->addSuccess($this->__('Thank you for your subscription.')); } } catch (Mage_Core_Exception $e) { $session->addException($e, $this->__('There was a problem with the subscription: %s', $e->getMessage())); } catch (Exception $e) { - $session->addException($e, $this->__('There was a problem with the subscription')); + $session->addException($e, $this->__('There was a problem with the subscription.')); } } $this->_redirectReferer(); @@ -79,12 +93,12 @@ public function confirmAction() if($subscriber->getId() && $subscriber->getCode()) { if($subscriber->confirm($code)) { - $session->addSuccess($this->__('Your subscription was successfully confirmed')); + $session->addSuccess($this->__('Your subscription has been confirmed.')); } else { - $session->addError($this->__('Invalid subscription confirmation code')); + $session->addError($this->__('Invalid subscription confirmation code.')); } } else { - $session->addError($this->__('Invalid subscription ID')); + $session->addError($this->__('Invalid subscription ID.')); } } @@ -105,7 +119,7 @@ public function unsubscribeAction() Mage::getModel('newsletter/subscriber')->load($id) ->setCheckCode($code) ->unsubscribe(); - $session->addSuccess($this->__('You have been successfully unsubscribed.')); + $session->addSuccess($this->__('You have been unsubscribed.')); } catch (Mage_Core_Exception $e) { $session->addException($e, $e->getMessage()); diff --git a/app/code/core/Mage/Newsletter/etc/adminhtml.xml b/app/code/core/Mage/Newsletter/etc/adminhtml.xml index 5a7e9ef532..2243cee52e 100644 --- a/app/code/core/Mage/Newsletter/etc/adminhtml.xml +++ b/app/code/core/Mage/Newsletter/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Newsletter/etc/config.xml b/app/code/core/Mage/Newsletter/etc/config.xml index 655862a11a..244eee1b03 100644 --- a/app/code/core/Mage/Newsletter/etc/config.xml +++ b/app/code/core/Mage/Newsletter/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -182,6 +182,7 @@ + 1 0 support newsletter_subscription_confirm_email_template diff --git a/app/code/core/Mage/Newsletter/etc/system.xml b/app/code/core/Mage/Newsletter/etc/system.xml index 08f60d41a0..5c5d8060ca 100644 --- a/app/code/core/Mage/Newsletter/etc/system.xml +++ b/app/code/core/Mage/Newsletter/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -44,6 +44,15 @@ 1 1 + + + select + adminhtml/system_config_source_yesno + 1 + 1 + 1 + 1 + select diff --git a/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-install-0.7.0.php index e0e9877db1..d24458184c 100644 --- a/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-install-0.8.0.php b/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-install-0.8.0.php index 13b164cd5f..ceb04f3970 100644 --- a/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-install-0.8.0.php +++ b/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-install-0.8.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-upgrade-0.7.0-0.7.1.php index b579170e19..2d3a3eedd1 100644 --- a/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-upgrade-0.8.0-0.8.1.php b/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-upgrade-0.8.0-0.8.1.php index c29c125e92..7bddda28a5 100644 --- a/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-upgrade-0.8.0-0.8.1.php +++ b/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-upgrade-0.8.0-0.8.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-upgrade-0.8.1-0.8.2.php b/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-upgrade-0.8.1-0.8.2.php index 0cd9df6885..8c0540b3d0 100644 --- a/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-upgrade-0.8.1-0.8.2.php +++ b/app/code/core/Mage/Newsletter/sql/newsletter_setup/mysql4-upgrade-0.8.1-0.8.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Newsletter - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Ogone/Block/Form.php b/app/code/core/Mage/Ogone/Block/Form.php new file mode 100644 index 0000000000..9c492af7a1 --- /dev/null +++ b/app/code/core/Mage/Ogone/Block/Form.php @@ -0,0 +1,39 @@ +setTemplate('ogone/form.phtml'); + } +} diff --git a/app/code/core/Mage/Ogone/Block/Info.php b/app/code/core/Mage/Ogone/Block/Info.php new file mode 100644 index 0000000000..f711049f88 --- /dev/null +++ b/app/code/core/Mage/Ogone/Block/Info.php @@ -0,0 +1,41 @@ +setTemplate('ogone/info.phtml'); + } +} diff --git a/app/code/core/Mage/Ogone/Block/Paypage.php b/app/code/core/Mage/Ogone/Block/Paypage.php new file mode 100644 index 0000000000..d687e92c76 --- /dev/null +++ b/app/code/core/Mage/Ogone/Block/Paypage.php @@ -0,0 +1,41 @@ +setTemplate('ogone/paypage.phtml'); + return $this; + } +} diff --git a/app/code/core/Mage/Ogone/Block/Placeform.php b/app/code/core/Mage/Ogone/Block/Placeform.php new file mode 100644 index 0000000000..7def5e8f2c --- /dev/null +++ b/app/code/core/Mage/Ogone/Block/Placeform.php @@ -0,0 +1,90 @@ +getOrder()) { + $order = $this->getOrder(); + } else if ($this->getCheckout()->getLastRealOrderId()) { + $order = Mage::getModel('sales/order')->loadByIncrementId($this->getCheckout()->getLastRealOrderId()); + } else { + return null; + } + return $order; + } + + /** + * Get Form data by using ogone payment api + * + * @return array + */ + public function getFormData() + { + return $this->_getApi()->getFormFields($this->_getOrder()); + } + + /** + * Getting gateway url + * + * @return string + */ + public function getFormAction() + { + return $this->_getApi()->getConfig()->getGatewayPath(); + } +} diff --git a/app/code/core/Mage/Ogone/Helper/Data.php b/app/code/core/Mage/Ogone/Helper/Data.php new file mode 100644 index 0000000000..18364408b2 --- /dev/null +++ b/app/code/core/Mage/Ogone/Helper/Data.php @@ -0,0 +1,70 @@ +_config = Mage::getSingleton('ogone/config'); + return $this; + } + + /** + * Return ogone config instance + * + * @return Mage_Ogone_Model_Config + */ + public function getConfig() + { + return $this->_config; + } + + /** + * @deprecated after 1.4.1.0 + * + * @param int storeId + * @return bool + */ + public function getDebug($storeId=null) + { + return $this->getDebugFlag(); + } + + /** + * Flag witch prevent automatic invoice creation + * + * @return bool + */ + public function isInitializeNeeded() + { + return true; + } + + /** + * Redirect url to ogone submit form + * + * @return string + */ + public function getOrderPlaceRedirectUrl() + { + return Mage::getUrl('ogone/api/placeform', array('_secure' => true)); + } + + /** + * Return payment_action value from config area + * + * @return string + */ + public function getPaymentAction() + { + return $this->getConfig()->getConfigData('payment_action'); + } + + /** + * Rrepare params array to send it to gateway page via POST + * + * @param Mage_Sales_Model_Order + * @return array + */ + public function getFormFields($order) + { + if (empty($order)) { + if (!($order = $this->getOrder())) { + return array(); + } + } + $billingAddress = $order->getBillingAddress(); + $formFields = array(); + $formFields['PSPID'] = $this->getConfig()->getPSPID(); + $formFields['orderID'] = $order->getIncrementId(); + $formFields['amount'] = round($order->getBaseGrandTotal()*100); + $formFields['currency'] = Mage::app()->getStore()->getBaseCurrencyCode(); + $formFields['language'] = Mage::app()->getLocale()->getLocaleCode(); + + $formFields['CN'] = $this->_translate($billingAddress->getFirstname().' '.$billingAddress->getLastname()); + $formFields['EMAIL'] = $order->getCustomerEmail(); + $formFields['ownerZIP'] = $billingAddress->getPostcode(); + $formFields['ownercty'] = $billingAddress->getCountry(); + $formFields['ownertown']= $this->_translate($billingAddress->getCity()); + $formFields['COM'] = $this->_translate($this->_getOrderDescription($order)); + $formFields['ownertelno'] = $billingAddress->getTelephone(); + $formFields['owneraddress'] = $this->_translate(str_replace("\n", ' ',$billingAddress->getStreet(-1))); + + $paymentAction = $this->_getOgonePaymentOperation(); + if ($paymentAction ) { + $formFields['operation'] = $paymentAction; + } + + $secretCode = $this->getConfig()->getShaOutCode(); + $secretSet = $formFields['orderID'] . $formFields['amount'] . $formFields['currency'] . + $formFields['PSPID'] . $paymentAction . $secretCode; + + $formFields['SHASign'] = Mage::helper('ogone')->shaCrypt($secretSet); + + $formFields['homeurl'] = $this->getConfig()->getHomeUrl(); + $formFields['catalogurl'] = $this->getConfig()->getHomeUrl(); + $formFields['accepturl'] = $this->getConfig()->getAcceptUrl(); + $formFields['declineurl'] = $this->getConfig()->getDeclineUrl(); + $formFields['exceptionurl'] = $this->getConfig()->getExceptionUrl(); + $formFields['cancelurl'] = $this->getConfig()->getCancelUrl(); + + if ($this->getConfig()->getConfigData('template')=='ogone') { + $formFields['TP']= ''; + $formFields['PMListType'] = $this->getConfig()->getConfigData('pmlist'); + } else { + $formFields['TP']= $this->getConfig()->getPayPageTemplate(); + } + $formFields['TITLE'] = $this->_translate($this->getConfig()->getConfigData('html_title')); + $formFields['BGCOLOR'] = $this->getConfig()->getConfigData('bgcolor'); + $formFields['TXTCOLOR'] = $this->getConfig()->getConfigData('txtcolor'); + $formFields['TBLBGCOLOR'] = $this->getConfig()->getConfigData('tblbgcolor'); + $formFields['TBLTXTCOLOR'] = $this->getConfig()->getConfigData('tbltxtcolor'); + $formFields['BUTTONBGCOLOR'] = $this->getConfig()->getConfigData('buttonbgcolor'); + $formFields['BUTTONTXTCOLOR'] = $this->getConfig()->getConfigData('buttontxtcolor'); + $formFields['FONTTYPE'] = $this->getConfig()->getConfigData('fonttype'); + $formFields['LOGO'] = $this->getConfig()->getConfigData('logo'); + return $formFields; + } + + /** + * to translate UTF 8 to ISO 8859-1 + * Ogone system is only compatible with iso-8859-1 and does not (yet) fully support the utf-8 + */ + protected function _translate($text) + { + return htmlentities(iconv("UTF-8", "ISO-8859-1", $text)); + } + + /** + * Get Ogone Payment Action value + * + * @param string + * @return string + */ + protected function _getOgonePaymentOperation() + { + $value = $this->getPaymentAction(); + if ($value==Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE) { + $value = Mage_Ogone_Model_Api::OGONE_AUTHORIZE_ACTION; + } elseif ($value==Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE) { + $value = Mage_Ogone_Model_Api::OGONE_AUTHORIZE_CAPTURE_ACTION; + } + return $value; + } + + /** + * get formated order description + * + * @param Mage_Sales_Model_Order + * @return string + */ + protected function _getOrderDescription($order) + { + $invoiceDesc = ''; + $lengs = 0; + foreach ($order->getAllItems() as $item) { + if ($item->getParentItem()) { + continue; + } + //COM filed can only handle max 100 + if (Mage::helper('core/string')->strlen($invoiceDesc.$item->getName()) > 100) { + break; + } + $invoiceDesc .= $item->getName() . ', '; + } + return Mage::helper('core/string')->substr($invoiceDesc, 0, -2); + } + + /** + * Define if debugging is enabled + * + * @return bool + */ + public function getDebugFlag() + { + return $this->getConfigData('debug_flag'); + } +} diff --git a/app/code/core/Mage/Ogone/Model/Api/Debug.php b/app/code/core/Mage/Ogone/Model/Api/Debug.php new file mode 100644 index 0000000000..fd08f2bd5d --- /dev/null +++ b/app/code/core/Mage/Ogone/Model/Api/Debug.php @@ -0,0 +1,40 @@ +_init('ogone/api_debug'); + } +} diff --git a/app/code/core/Mage/Ogone/Model/Config.php b/app/code/core/Mage/Ogone/Model/Config.php new file mode 100644 index 0000000000..dd69e2e099 --- /dev/null +++ b/app/code/core/Mage/Ogone/Model/Config.php @@ -0,0 +1,151 @@ +decrypt($this->getConfigData('secret_key_in', $storeId)); + } + + /** + * Return SHA1-out crypt key from config. Setup on admin place. + * @param int $storeId + * @return string + */ + public function getShaOutCode($storeId=null) + { + return Mage::helper('core')->decrypt($this->getConfigData('secret_key_out', $storeId)); + } + + /** + * Return gateway path, get from confing. Setup on admin place. + * + * @param int $storeId + * @return string + */ + public function getGatewayPath($storeId=null) + { + return $this->getConfigData('ogone_gateway', $storeId); + } + + /** + * Get PSPID, affiliation name in ogone system + * + * @param int $storeId + * @return string + */ + public function getPSPID($storeId=null) + { + return $this->getConfigData('pspid', $storeId); + } + + /** + * Get paypage template for magento style templates using + * + * @return string + */ + public function getPayPageTemplate() + { + return Mage::getUrl('ogone/api/paypage'); + } + + /** + * Return url which ogone system will use as accept + * + * @return string + */ + public function getAcceptUrl() + { + return Mage::getUrl('ogone/api/accept'); + } + + /** + * Return url which ogone system will use as decline url + * + * @return string + */ + public function getDeclineUrl() + { + return Mage::getUrl('ogone/api/decline'); + } + + /** + * Return url which ogone system will use as exception url + * + * @return string + */ + public function getExceptionUrl() + { + return Mage::getUrl('ogone/api/exception'); + } + + /** + * Return url which ogone system will use as cancel url + * + * @return string + */ + public function getCancelUrl() + { + return Mage::getUrl('ogone/api/cancel'); + } + + /** + * Return url which ogone system will use as our magento home url on ogone success page + * + * @return string + */ + public function getHomeUrl() + { + return Mage::getUrl('checkout/cart'); + } +} diff --git a/app/code/core/Mage/Ogone/Model/Mysql4/Api/Debug.php b/app/code/core/Mage/Ogone/Model/Mysql4/Api/Debug.php new file mode 100644 index 0000000000..0746e2005b --- /dev/null +++ b/app/code/core/Mage/Ogone/Model/Mysql4/Api/Debug.php @@ -0,0 +1,40 @@ +_init('ogone/api_debug', 'debug_id'); + } +} diff --git a/app/code/core/Mage/Ogone/Model/Source/PaymentAction.php b/app/code/core/Mage/Ogone/Model/Source/PaymentAction.php new file mode 100644 index 0000000000..3756a75503 --- /dev/null +++ b/app/code/core/Mage/Ogone/Model/Source/PaymentAction.php @@ -0,0 +1,45 @@ + '', 'label' => Mage::helper('ogone')->__('Ogone Default Operation')), + array('value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE, 'label' => Mage::helper('ogone')->__('Authorization')), + array('value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE, 'label' => Mage::helper('ogone')->__('Direct Sale')), + ); + } +} diff --git a/app/code/core/Mage/Ogone/Model/Source/Pmlist.php b/app/code/core/Mage/Ogone/Model/Source/Pmlist.php new file mode 100644 index 0000000000..cac4135726 --- /dev/null +++ b/app/code/core/Mage/Ogone/Model/Source/Pmlist.php @@ -0,0 +1,45 @@ + Mage_Ogone_Model_Api::PMLIST_HORISONTAL_LEFT, 'label' => Mage::helper('ogone')->__('Horizontally grouped logo with group name on left')), + array('value' => Mage_Ogone_Model_Api::PMLIST_HORISONTAL, 'label' => Mage::helper('ogone')->__('Horizontally grouped logo with no group name')), + array('value' => Mage_Ogone_Model_Api::PMLIST_VERTICAL, 'label' => Mage::helper('ogone')->__('Verical list')), + ); + } +} diff --git a/app/code/core/Mage/Ogone/Model/Source/Template.php b/app/code/core/Mage/Ogone/Model/Source/Template.php new file mode 100644 index 0000000000..7b472cd6ab --- /dev/null +++ b/app/code/core/Mage/Ogone/Model/Source/Template.php @@ -0,0 +1,44 @@ + Mage_Ogone_Model_Api::TEMPLATE_OGONE, 'label' => Mage::helper('ogone')->__('Ogone')), + array('value' => Mage_Ogone_Model_Api::TEMPLATE_MAGENTO, 'label' => Mage::helper('ogone')->__('Magento')), + ); + } +} diff --git a/app/code/core/Mage/Ogone/controllers/ApiController.php b/app/code/core/Mage/Ogone/controllers/ApiController.php new file mode 100644 index 0000000000..b86d2dbdfa --- /dev/null +++ b/app/code/core/Mage/Ogone/controllers/ApiController.php @@ -0,0 +1,482 @@ +_order)) { + $orderId = $this->getRequest()->getParam('orderID'); + $this->_order = Mage::getModel('sales/order'); + $this->_order->loadByIncrementId($orderId); + } + return $this->_order; + } + + /** + * Validation of incoming Ogone data + * + * @return bool + */ + protected function _validateOgoneData() + { + $params = $this->getRequest()->getParams(); + + $this->_getApi()->debugData(array('result' => $params)); + + $secureKey = $this->_getApi()->getConfig()->getShaInCode(); + $secureSet = $this->_getSHAInSet($params, $secureKey); + + if (Mage::helper('ogone')->shaCryptValidation($secureSet, $params['SHASIGN'])!=true) { + $this->_getCheckout()->addError($this->__('The hash is not valid')); + return false; + } + + $order = $this->_getOrder(); + if (!$order->getId()){ + $this->_getCheckout()->addError($this->__('The order is not valid')); + return false; + } + + return true; + } + + /** + * Load place from layout to make POST on ogone + */ + public function placeformAction() + { + $lastIncrementId = $this->_getCheckout()->getLastRealOrderId(); + if ($lastIncrementId) { + $order = Mage::getModel('sales/order'); + $order->loadByIncrementId($lastIncrementId); + if ($order->getId()) { + $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage_Ogone_Model_Api::PENDING_OGONE_STATUS, Mage::helper('ogone')->__('Start Ogone Processing')); + $order->save(); + + $this->_getApi()->debugData(array('request' => $this->_getApi()->getFormFields($order))); + } + } + + $this->_getCheckout()->getQuote()->setIsActive(false)->save(); + $this->_getCheckout()->setOgoneQuoteId($this->_getCheckout()->getQuoteId()); + $this->_getCheckout()->setOgoneLastSuccessQuoteId($this->_getCheckout()->getLastSuccessQuoteId()); + $this->_getCheckout()->clear(); + + $this->loadLayout(); + $this->renderLayout(); + } + + /** + * Display our pay page, need to ogone payment with external pay page mode * + */ + public function paypageAction() + { + $this->loadLayout(); + $this->renderLayout(); + } + + /** + * Action to control postback data from ogone + * + */ + public function postBackAction() + { + if (!$this->_validateOgoneData()) { + $this->getResponse()->setHeader("Status", "404 Not Found"); + return false; + } + + $this->_ogoneProcess(); + } + + /** + * Action to process ogone offline data + * + */ + public function offlineProcessAction() + { + if (!$this->_validateOgoneData()) { + $this->getResponse()->setHeader("Status","404 Not Found"); + return false; + } + $this->_ogoneProcess(); + } + + /** + * Made offline ogone data processing, depending of incoming statuses + */ + protected function _ogoneProcess() + { + $status = $this->getRequest()->getParam('STATUS'); + switch ($status) { + case Mage_Ogone_Model_Api::OGONE_AUTHORIZED : + case Mage_Ogone_Model_Api::OGONE_AUTH_PROCESSING: + case Mage_Ogone_Model_Api::OGONE_PAYMENT_REQUESTED_STATUS : + $this->_acceptProcess(); + break; + case Mage_Ogone_Model_Api::OGONE_AUTH_REFUZED: + case Mage_Ogone_Model_Api::OGONE_PAYMENT_INCOMPLETE: + case Mage_Ogone_Model_Api::OGONE_TECH_PROBLEM: + $this->_declineProcess(); + break; + case Mage_Ogone_Model_Api::OGONE_AUTH_UKNKOWN_STATUS: + case Mage_Ogone_Model_Api::OGONE_PAYMENT_UNCERTAIN_STATUS: + $this->_exceptionProcess(); + break; + default: + //all unknown transaction will accept as exceptional + $this->_exceptionProcess(); + } + } + + /** + * when payment gateway accept the payment, it will land to here + * need to change order status as processed ogone + * update transaction id + * + */ + public function acceptAction() + { + if (!$this->_validateOgoneData()) { + $this->_redirect('checkout/cart'); + return; + } + $this->_ogoneProcess(); + } + + /** + * Process success action by accept url + */ + protected function _acceptProcess() + { + $params = $this->getRequest()->getParams(); + $order = $this->_getOrder(); + + $this->_getCheckout()->setLastSuccessQuoteId($order->getQuoteId()); + + $this->_prepareCCInfo($order, $params); + $order->getPayment()->setTransactionId($params['PAYID']); + $order->getPayment()->setLastTransId($params['PAYID']); + + try{ + if ($this->_getApi()->getPaymentAction()==Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE) { + $this->_processDirectSale(); + } else { + $this->_processAuthorize(); + } + }catch(Exception $e) { + $this->_getCheckout()->addError(Mage::helper('ogone')->__('The order cannot be saved.')); + $this->_redirect('checkout/cart'); + return; + } + } + + /** + * Process Configured Payment Action: Direct Sale, create invoce if state is Pending + * + */ + protected function _processDirectSale() + { + $order = $this->_getOrder(); + $status = $this->getRequest()->getParam('STATUS'); + try{ + if ($status == Mage_Ogone_Model_Api::OGONE_AUTH_PROCESSING) { + $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Ogone_Model_Api::WAITING_AUTHORIZATION, Mage::helper('ogone')->__('Authorization Waiting from Ogone')); + $order->save(); + }elseif ($order->getState()==Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) { + if ($status == Mage_Ogone_Model_Api::OGONE_AUTHORIZED) { + if ($order->getStatus() != Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) { + $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Ogone_Model_Api::PROCESSING_OGONE_STATUS, Mage::helper('ogone')->__('Processed by Ogone')); + } + } else { + $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Ogone_Model_Api::PROCESSED_OGONE_STATUS, Mage::helper('ogone')->__('Processed by Ogone')); + } + + if (!$order->getInvoiceCollection()->getSize()) { + $invoice = $order->prepareInvoice(); + $invoice->register(); + $invoice->setState(Mage_Sales_Model_Order_Invoice::STATE_PAID); + $invoice->getOrder()->setIsInProcess(true); + + $transactionSave = Mage::getModel('core/resource_transaction') + ->addObject($invoice) + ->addObject($invoice->getOrder()) + ->save(); + $order->sendNewOrderEmail(); + } + } else { + $order->save(); + } + $this->_redirect('checkout/onepage/success'); + return; + } catch (Exception $e) { + $this->_getCheckout()->addError(Mage::helper('ogone')->__('Order can\'t save')); + $this->_redirect('checkout/cart'); + return; + } + } + + /** + * Process Configured Payment Actions: Authorized, Default operation + * just place order + */ + protected function _processAuthorize() + { + $order = $this->_getOrder(); + $status = $this->getRequest()->getParam('STATUS'); + try { + if ($status == Mage_Ogone_Model_Api::OGONE_AUTH_PROCESSING) { + $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Ogone_Model_Api::WAITING_AUTHORIZATION, Mage::helper('ogone')->__('Authorization Waiting from Ogone')); + } else { + //to send new order email only when state is pending payment + if ($order->getState()==Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) { + $order->sendNewOrderEmail(); + } + $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Ogone_Model_Api::PROCESSED_OGONE_STATUS, Mage::helper('ogone')->__('Processed by Ogone')); + } + $order->save(); + $this->_redirect('checkout/onepage/success'); + return; + } catch(Exception $e) { + $this->_getCheckout()->addError(Mage::helper('ogone')->__('Order can\'t save')); + $this->_redirect('checkout/cart'); + return; + } + } + + /** + * We get some CC info from ogone, so we must save it + * + * @param Mage_Sales_Model_Order $order + * @param array $ccInfo + * + * @return Mage_Ogone_ApiController + */ + protected function _prepareCCInfo($order, $ccInfo) + { + $order->getPayment()->setCcOwner($ccInfo['CN']); + $order->getPayment()->setCcNumberEnc($ccInfo['CARDNO']); + $order->getPayment()->setCcLast4(substr($ccInfo['CARDNO'], -4)); + $order->getPayment()->setCcExpMonth(substr($ccInfo['ED'], 0, 2)); + $order->getPayment()->setCcExpYear(substr($ccInfo['ED'], 2, 2)); + return $this; + } + + + /** + * the payment result is uncertain + * exception status can be 52 or 92 + * need to change order status as processing ogone + * update transaction id + * + */ + public function exceptionAction() + { + if (!$this->_validateOgoneData()) { + $this->_redirect('checkout/cart'); + return; + } + $this->_exceptionProcess(); + } + + /** + * Process exception action by ogone exception url + */ + public function _exceptionProcess() + { + $params = $this->getRequest()->getParams(); + $order = $this->_getOrder(); + + $exception = ''; + switch($params['STATUS']) { + case Mage_Ogone_Model_Api::OGONE_PAYMENT_UNCERTAIN_STATUS : + $exception = Mage::helper('ogone')->__('Payment uncertain: A technical problem arose during payment process, giving unpredictable result'); + break; + case Mage_Ogone_Model_Api::OGONE_AUTH_UKNKOWN_STATUS : + $exception = Mage::helper('ogone')->__('Authorization not known: A technical problem arose during authorization process, giving unpredictable result'); + break; + default: + $exception = Mage::helper('ogone')->__('Unknown exception'); + } + + if (!empty($exception)) { + try{ + $this->_getCheckout()->setLastSuccessQuoteId($order->getQuoteId()); + $this->_prepareCCInfo($order, $params); + $order->getPayment()->setLastTransId($params['PAYID']); + //to send new order email only when state is pending payment + if ($order->getState()==Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) { + $order->sendNewOrderEmail(); + $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Ogone_Model_Api::PROCESSING_OGONE_STATUS, $exception); + } else { + $order->addStatusToHistory(Mage_Ogone_Model_Api::PROCESSING_OGONE_STATUS, $exception); + } + $order->save(); + }catch(Exception $e) { + $this->_getCheckout()->addError(Mage::helper('ogone')->__('The order cannot be saved for a system reason.')); + } + } else { + $this->_getCheckout()->addError(Mage::helper('ogone')->__('Exception not defined')); + } + + $this->_redirect('checkout/onepage/success'); + } + + /** + * when payment got decline + * need to change order status to cancelled + * take the user back to shopping cart + * + */ + public function declineAction() + { + if (!$this->_validateOgoneData()) { + $this->_redirect('checkout/cart'); + return; + } + $this->_getCheckout()->setQuoteId($this->_getCheckout()->getOgoneQuoteId()); + $this->_declineProcess(); + return $this; + } + + /** + * Process decline action by ogone decline url + */ + protected function _declineProcess() + { + $status = Mage_Ogone_Model_Api::DECLINE_OGONE_STATUS; + $comment = Mage::helper('ogone')->__('Declined Order on Ogone side.'); + $this->_getCheckout()->addError(Mage::helper('ogone')->__('Payment transaction has been declined.')); + $this->_cancelOrder($status, $comment); + } + + /** + * when user cancel the payment + * change order status to cancelled + * need to rediect user to shopping cart + * + * @return Mage_Ogone_ApiController + */ + public function cancelAction() + { + if (!$this->_validateOgoneData()) { + $this->_redirect('checkout/cart'); + return; + } + $this->_getCheckout()->setQuoteId($this->_getCheckout()->getOgoneQuoteId()); + $this->_cancelProcess(); + return $this; + } + + /** + * Process cancel action by cancel url + * + * @return Mage_Ogone_ApiController + */ + public function _cancelProcess() + { + $status = Mage_Ogone_Model_Api::CANCEL_OGONE_STATUS; + $comment = Mage::helper('ogone')->__('The order was canceled on ogone side.'); + $this->_cancelOrder($status, $comment); + return $this; + } + + /** + * Cancel action, used for decline and cancel processes + * + * @return Mage_Ogone_ApiController + */ + protected function _cancelOrder($status, $comment='') + { + $order = $this->_getOrder(); + try{ + $order->cancel(); + $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, $status, $comment); + $order->save(); + }catch(Exception $e) { + $this->_getCheckout()->addError(Mage::helper('ogone')->__('The order cannot be canceled for a system reason.')); + } + + $this->_redirect('checkout/cart'); + return $this; + } + + /** + * Return set of data which is ready for SHA crypt + * + * @param array $data + * @param string $key + * + * @return string + */ + protected function _getSHAInSet($params, $key) + { + return $this->getRequest()->getParam('orderID') . + $this->getRequest()->getParam('currency') . + $this->getRequest()->getParam('amount') . + $this->getRequest()->getParam('PM') . + $this->getRequest()->getParam('ACCEPTANCE') . + $this->getRequest()->getParam('STATUS') . + $this->getRequest()->getParam('CARDNO') . + $this->getRequest()->getParam('PAYID') . + $this->getRequest()->getParam('NCERROR') . + $this->getRequest()->getParam('BRAND') . $key; + } +} diff --git a/app/code/core/Mage/Ogone/etc/config.xml b/app/code/core/Mage/Ogone/etc/config.xml new file mode 100644 index 0000000000..e261ceb1f2 --- /dev/null +++ b/app/code/core/Mage/Ogone/etc/config.xml @@ -0,0 +1,137 @@ + + + + + + 0.0.1 + + + + + + Mage_Ogone_Model + ogone_mysql4 + + + Mage_Ogone_Model_Mysql4 + + ogone_api_debug
      +
      +
      +
      + + + + Mage_Ogone + + + core_setup + + + + + core_write + + + + + core_read + + + + + + Mage_Ogone_Block + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + + + ogone.xml + + + + + /ogone/api + + + + standard + + Mage_Ogone + ogone + + + + + + + + + ogone/api + Ogone + + authorize + + https://secure.ogone.com/ncol/test/orderstandard.asp + pending_ogone + cancel_ogone + decline_ogone + processing_ogone + processed_ogone + waiting_authorozation + + + +
      diff --git a/app/code/core/Mage/Ogone/etc/system.xml b/app/code/core/Mage/Ogone/etc/system.xml new file mode 100644 index 0000000000..889b741ad0 --- /dev/null +++ b/app/code/core/Mage/Ogone/etc/system.xml @@ -0,0 +1,234 @@ + + + + + + + + + +
      +
      +


      Signing up with Ogone

      +

      Please enter the correct post back url and offline processiong url in Ogone configuration

      +

      post back url example: http://myMagentoStore.com/ogone/api/postBack

      +

      offline processing url example: http://myMagentoStore.com/ogone/api/offlineProcess

      +
      +
      +]]>
      + text + 800 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 1 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 2 + 1 + 1 + 0 + + + <label>Title</label> + <frontend_type>text</frontend_type> + <sort_order>3</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + text + PSPID is a case sensitive field. + 4 + 1 + 1 + 0 + + + + + Use in data checking by Ogone before the payment. + ]]> + adminhtml/system_config_backend_encrypted + obscure + 5 + 1 + 1 + 0 + + + + + Use in feedback data checking by Magento + ]]> + adminhtml/system_config_backend_encrypted + obscure + 6 + 1 + 1 + 0 + + + + text + For production, replace "test" with "prod". Example: https://secure.ogone.com/ncol/prod/orderstandard.asp + 7 + 1 + 1 + 0 + + + + select + ogone/source_paymentAction + If you choose "No Operation", Ogone will use default payment procedure setup in Ogone configuration. + 8 + 1 + 1 + 0 + + + + + text + 11 + 1 + 1 + 1 + + + + text + + 12 + 1 + 1 + 1 + + + + text + + 13 + 1 + 1 + 1 + + + + text + + 14 + 1 + 1 + 1 + + + + text + + 15 + 1 + 1 + 1 + + + + text + 16 + 1 + 1 + 1 + + + + text + + 17 + 1 + 1 + 1 + + + + text + + 18 + 1 + 1 + 1 + + + + text + The URL must be absolute and stored on a secure server.]]> + 19 + 1 + 1 + 1 + + + + select + ogone/source_pmlist + You can arrange the layout/list of the payment methods on Ogone payment page. + 20 + 1 + 1 + 1 + + +
      +
      +
      +
      +
      diff --git a/app/code/core/Mage/Ogone/sql/ogone_setup/mysql4-install-0.0.1.php b/app/code/core/Mage/Ogone/sql/ogone_setup/mysql4-install-0.0.1.php new file mode 100644 index 0000000000..906138c049 --- /dev/null +++ b/app/code/core/Mage/Ogone/sql/ogone_setup/mysql4-install-0.0.1.php @@ -0,0 +1,46 @@ +startSetup(); + +$installer->run(" + +DROP TABLE IF EXISTS `{$this->getTable('ogone/api_debug')}`; +CREATE TABLE `{$this->getTable('ogone/api_debug')}` ( + `debug_id` int(10) unsigned NOT NULL auto_increment, + `dir` enum('in', 'out'), + `debug_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `url` varchar(255), + `data` text, + PRIMARY KEY (`debug_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import.php b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import.php new file mode 100644 index 0000000000..1bd54ea44f --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import.php @@ -0,0 +1,43 @@ + + */ + +class Mage_Oscommerce_Block_Adminhtml_Import extends Mage_Adminhtml_Block_Widget_Grid_Container +{ + protected $_blockGroup = 'oscommerce'; + public function __construct() + { + $this->_controller = 'adminhtml_import'; + $this->_headerText = Mage::helper('adminhtml')->__('Manage osCommerce Profiles'); + $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add New osCommerce Profile'); + parent::__construct(); + } +} diff --git a/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit.php b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit.php new file mode 100644 index 0000000000..cc5ee19e7f --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit.php @@ -0,0 +1,68 @@ + + */ + +class Mage_Oscommerce_Block_Adminhtml_Import_Edit extends Mage_Adminhtml_Block_Widget_Form_Container +{ + protected $_blockGroup = 'oscommerce'; + + public function __construct() + { + $this->_objectId = 'id'; + $this->_controller = 'adminhtml_import'; + $this->_updateButton('save', 'label', Mage::helper('oscommerce')->__('Save Profile')); + $this->_updateButton('delete', 'label', Mage::helper('oscommerce')->__('Delete Profile')); + $this->_addButton('save_and_edit_button', + array( + 'label' => Mage::helper('oscommerce')->__('Save and Continue Edit'), + 'onclick' => 'saveAndContinueEdit()', + 'class' => 'save' + ), 100 + + ); + $this->_formScripts[] = " + function saveAndContinueEdit(){ + editForm.submit($('edit_form').action+'continue/back/'); + } + "; + parent::__construct(); + } + + public function getHeaderText() + { + if (Mage::registry('oscommerce_adminhtml_import')->getId()) { // TOCHECK + return Mage::helper('oscommerce')->__('Edit osCommerce Profile :: %s', Mage::registry('oscommerce_adminhtml_import')->getName()); + } + else { + return Mage::helper('oscommerce')->__('New osCommerce Profile'); + } + } +} diff --git a/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit/Form.php b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit/Form.php new file mode 100644 index 0000000000..f599b876ef --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit/Form.php @@ -0,0 +1,52 @@ + + */ + +class Mage_Oscommerce_Block_Adminhtml_Import_Edit_Form extends Mage_Adminhtml_Block_Widget_Form +{ + protected function _prepareForm() + { + $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'POST')); + + $model = Mage::registry('oscommerce_adminhtml_import'); + + if ($model->getId()) { + $form->addField('import_id', 'hidden', array( + 'name' => 'import_id', + )); + $form->setValues($model->getData()); + } + + $form->setUseContainer(true); + $this->setForm($form); + return parent::_prepareForm(); + } +} diff --git a/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit/Tab/General.php b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit/Tab/General.php new file mode 100644 index 0000000000..97bcb182ba --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit/Tab/General.php @@ -0,0 +1,110 @@ + + */ +class Mage_Oscommerce_Block_Adminhtml_Import_Edit_Tab_General extends Mage_Adminhtml_Block_Widget_Form +{ + + function initForm() + { + $model = Mage::registry('oscommerce_adminhtml_import'); + + + $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post')); + + if ($model->getId()) { + $form->addField('import_id', 'hidden', array( + 'name' => 'import_id', + )); + } + $fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('oscommerce')->__('General Information'))); + $fieldset->addField('name', 'text', array( + 'label' => $this->__('Name'), + 'title' => $this->__('Name'), + 'name' => 'name', + 'required' => true, + )); + + $fieldset->addField('host', 'text', array( + 'label' => $this->__('IP or Hostname'), + 'title' => $this->__('IP or Hostname'), + 'name' => 'host', + 'required' => true, + )); + +// $fieldset->addField('port', 'text', array( +// 'label' => $this->__('Port (Default as 3306)'), +// 'title' => $this->__('Port (Default as 3306)'), +// 'name' => 'port', +// 'required' => true, +// 'value' => $model->getData('port') ? $model->getData('port'): Mage_Oscommerce_Model_Oscommerce::DEFAULT_PORT +// )); + + $fieldset->addField('db_name', 'text', array( + 'label' => $this->__('DB Name'), + 'title' => $this->__('DB Name'), + 'name' => 'db_name', + 'required' => true, + )); + + $fieldset->addField('db_user', 'text', array( + 'label' => $this->__('DB Username'), + 'title' => $this->__('DB Username'), + 'name' => 'db_user', + 'required' => true, + )); + + $fieldset->addField('db_password', 'password', array( + 'label' => $this->__('DB Password'), + 'title' => $this->__('DB Password'), + 'name' => 'db_password', + )); + + $fieldset->addField('table_prefix', 'text', array( + 'label' => $this->__('Prefix'), + 'title' => $this->__('Prefix'), + 'name' => 'table_prefix', + )); + + $fieldset->addField('send_subscription', 'checkbox', array( + 'label' => $this->__('Send Subscription Notification to Customers'), + 'title' => $this->__('Send Subscription Notification to Customers'), + 'name' => 'send_subscription', + 'values' => $this->getData('send_subscription'), + 'checked' => $this->getData('send_subscription'), + )); + + $form->setValues($model->getData()); + + $this->setForm($form); + + return $this; + } +} diff --git a/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit/Tab/Run.php b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit/Tab/Run.php new file mode 100644 index 0000000000..4ae2add222 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit/Tab/Run.php @@ -0,0 +1,239 @@ + + */ +class Mage_Oscommerce_Block_Adminhtml_Import_Edit_Tab_Run extends Mage_Adminhtml_Block_Template +{ + protected function _construct() + { + parent::_construct(); + $this->setTemplate('oscommerce/convert/run.phtml'); + } + + /** + * Prepares layout of block + * + */ + protected function _prepareLayout() + { + $this->setChild('save_button', + $this->getLayout()->createBlock('adminhtml/widget_button') + ->setData(array( + 'label' => Mage::helper('oscommerce')->__('Start Running'), + 'class' => 'run', + 'id' => 'run_import' + )) + + ); + + $this->setChild('check_button', + $this->getLayout()->createBlock('adminhtml/widget_button') + ->setData(array( + 'label' => Mage::helper('oscommerce')->__('Check Requirements'), + 'class' => 'run', + 'id' => 'check_import' + )) + + ); + + } + + public function getImportId() + { + return Mage::registry('oscommerce_adminhtml_import')->getId(); + } + + /** + * Retrieve run url + * + * @return string + */ + public function getSubmitUrl() + { + return $this->getUrl('*/*/run/', array('id'=>$this->getOscId())); + } + + /** + * Retrive run button html + * + * @return string + */ + public function getSaveButtonHtml() + { + return $this->getChildHtml('save_button'); + } + + public function getCheckButtonHtml() + { + return $this->getChildHtml('check_button'); + } + + public function getWebsiteOptionHtml() + { + + $html = ''; + return $html; + } + + public function getTimezoneOptionHtml() + { + $html = ''; + return $html; + + } + + /** + * Get list available for mysql connection charsets + * + * @return array + */ + public function getConnectionCharsets() + { + $charsetList = array(); + $fileName = Mage::getModuleDir('etc','Mage_Oscommerce').DS.'charsets.xml'; + if (is_readable($fileName)) { + $xml = new Varien_Simplexml_Config(); + $xml->loadFile($fileName); + $charsets = $xml->getNode('charset'); + foreach($charsets as $charset) { + $attributes = $charset->attributes(); + $code = (string) $attributes['name']; + $charsetList[$code] = (string)$charset->family; + } + } + return $charsetList; + } + + /** + * Get list available for iconv function charsets + * + * @return array + */ + public function getDataCharsets() + { + $charsetList = array( + 'BIG-5' => Mage::helper('oscommerce')->__('Traditional Chinese'), + 'ISO-8859-2' => Mage::helper('oscommerce')->__('Central European'), + 'CP850' => Mage::helper('oscommerce')->__('Western'), + 'ISO-8859-1' => Mage::helper('oscommerce')->__('Western'), + 'HP-ROMAN8' => Mage::helper('oscommerce')->__('Western'), + 'KOI8-R' => Mage::helper('oscommerce')->__('Cyrillic'), + 'ASCII' => Mage::helper('oscommerce')->__('Western'), + 'EUC-JP' => Mage::helper('oscommerce')->__('Japanese'), + 'SHIFT-JIS' => Mage::helper('oscommerce')->__('Japanese'), + 'windows-1251' => Mage::helper('oscommerce')->__('Cyrillic'), + 'ISO-8859-8' => Mage::helper('oscommerce')->__('Hebrew'), + 'TIS-620' => Mage::helper('oscommerce')->__('Thai'), + 'EUC-KR' => Mage::helper('oscommerce')->__('Korean'), + 'ISO-8859-13' => Mage::helper('oscommerce')->__('Baltic'), + 'KOI8-U' => Mage::helper('oscommerce')->__('Cyrillic'), + 'CHINESE' => Mage::helper('oscommerce')->__('Simplified Chinese'), + 'ISO-8859-7' => Mage::helper('oscommerce')->__('Greek'), + 'WINDOWS-1250' => Mage::helper('oscommerce')->__('Central European'), + 'CP936' => Mage::helper('oscommerce')->__('East Asian'), + 'WINDOWS-1257' => Mage::helper('oscommerce')->__('Baltic'), + 'ISO-8859-9' => Mage::helper('oscommerce')->__('South Asian'), + 'ARMSCII-8' => Mage::helper('oscommerce')->__('South Asian'), + 'UTF-8' => Mage::helper('oscommerce')->__('Unicode'), + 'UCS-2' => Mage::helper('oscommerce')->__('Unicode'), + 'CP866' => Mage::helper('oscommerce')->__('Cyrillic'), + 'MACCENTRALEUROPE' => Mage::helper('oscommerce')->__('Central European'), + 'MAC' => Mage::helper('oscommerce')->__('Western'), + 'CP852' => Mage::helper('oscommerce')->__('Central European'), + 'CP1256' => Mage::helper('oscommerce')->__('Arabic'), + 'CP932' => Mage::helper('oscommerce')->__('Japanese'), + ); + return $charsetList; + } + + public function drowOptions($options = array()) + { + asort($options); + $html = ''; + foreach($options as $code => $name) { + $html.= ''; + } + + return $html; + } + + public function getDataCharsetOptionHtml() + { + + $html = ''; + return $html; + } + + public function getConnectionCharsetOptionHtml() + { + $html = ''; + return $html; + } + + /** + * Deprecated + * + * @return string + */ + public function getCharsetOption() + { + $options = ''; + $fileName = Mage::getModuleDir('etc','Mage_Oscommerce').DS.'charsets.xml'; + if (is_readable($fileName)) { + $xml = new Varien_Simplexml_Config(); + $xml->loadFile($fileName); + $charsets = $xml->getNode('charset'); + foreach($charsets as $charset) { + $attributes = $charset->attributes(); + $options .= ''; + } + } + return $options; + } +} diff --git a/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit/Tabs.php b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit/Tabs.php new file mode 100644 index 0000000000..ec0c301ba7 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Edit/Tabs.php @@ -0,0 +1,66 @@ + + */ +class Mage_Oscommerce_Block_Adminhtml_Import_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs +{ + public function __construct() + { + parent::__construct(); + $this->setId('oscommerce_import_tabs'); + $this->setDestElementId('edit_form'); + $this->setTitle(Mage::helper('oscommerce')->__('osCommerce Profile')); + } + + protected function _beforeToHtml() + { + $model = Mage::registry('oscommerce_adminhtml_import'); + + $generalBlock = $this->getLayout()->createBlock('oscommerce/adminhtml_import_edit_tab_general'); + $generalBlock->addData($model->getData()); + + $new = !$model->getId(); + + $this->addTab('general', array( + 'label' => Mage::helper('oscommerce')->__('General Information'), + 'content' => $generalBlock->initForm()->toHtml(), + 'active' => true, + )); + + if (!$new) { + $this->addTab('run', array( + 'label' => Mage::helper('oscommerce')->__('Run Profile'), + 'content' => $this->getLayout()->createBlock('oscommerce/adminhtml_import_edit_tab_run')->toHtml(), + )); + } + + return parent::_beforeToHtml(); + } +} diff --git a/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Grid.php b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Grid.php new file mode 100644 index 0000000000..bb229e6df2 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Grid.php @@ -0,0 +1,94 @@ + + */ + +class Mage_Oscommerce_Block_Adminhtml_Import_Grid extends Mage_Adminhtml_Block_Widget_Grid +{ + + public function __construct() + { + parent::__construct(); + $this->setId('convertOscGrid'); + $this->setDefaultSort('id'); + } + + protected function _prepareCollection() + { + $collection = Mage::getModel('oscommerce/oscommerce')->getCollection(); + $this->setCollection($collection); + return parent::_prepareCollection(); + } + + protected function _prepareColumns() + { + $this->addColumn('id', array( + 'header' =>Mage::helper('oscommerce')->__('ID'), + 'width' =>'50px', + 'index' =>'import_id', + )); + $this->addColumn('name', array( + 'header' =>Mage::helper('oscommerce')->__('Adapter Name'), + 'index' =>'name', + )); + $this->addColumn('host', array( + 'header' =>Mage::helper('oscommerce')->__('IP or Hostname'), + 'index' =>'host', + 'width' =>'120px', + )); + + $this->addColumn('db_name', array( + 'header' =>Mage::helper('oscommerce')->__('DB Name'), + 'index' =>'db_name', + 'width' =>'120px', + )); + + $this->addColumn('created_at', array( + 'header' =>Mage::helper('oscommerce')->__('Created At'), + 'type' => 'date', + 'align' => 'center', + 'index' =>'created_at', + )); + $this->addColumn('updated_at', array( + 'header' =>Mage::helper('oscommerce')->__('Updated At'), + 'type' => 'date', + 'align' => 'center', + 'index' =>'updated_at', + )); + + return parent::_prepareColumns(); + } + + public function getRowUrl($row) + { + return $this->getUrl('*/*/edit', array('id'=>$row->getId())); + } + +} diff --git a/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Run.php b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Run.php new file mode 100644 index 0000000000..50b97d6453 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Run.php @@ -0,0 +1,293 @@ + + */ +class Mage_Oscommerce_Block_Adminhtml_Import_Run extends Mage_Adminhtml_Block_Abstract +{ + public function getImportModel() + { + return Mage::registry('oscommerce_adminhtml_import'); + } + + protected function _toHtml() + { + $importModel = $this->getImportModel(); + + echo ''; + + $headBlock = $this->getLayout()->createBlock('page/html_head'); + $headBlock->addJs('prototype/prototype.js'); + echo $headBlock->getCssJsHtml(); + + echo ' + '.($importModel->getId() ? $this->htmlEscape($importModel->getName()) : $this->__('No osCommerce profile')).' +'; + echo '
        '; + echo '
      • '; + if ($importModel->getId()) { + echo ''; + echo $this->__("Starting profile execution, please wait..."); + echo '
      • '; + echo '
      • '; + echo ''; + echo $this->__("Warning: Please do not close window during importing/exporting data."); + echo '
      • '; + } else { + echo ''; + echo $this->__("No osCommerce profile loaded..."); + } + echo ''; + echo '
      '; + + if ($importModel->getId()) { + echo '
        '; + ob_implicit_flush(); + $showFinished = false; + $countItems = 0; + $batchConfig = array( + 'styles' => array( + 'error' => array( + 'icon' => Mage::getDesign()->getSkinUrl('images/error_msg_icon.gif'), + 'bg' => '#FDD' + ), + 'message' => array( + 'icon' => Mage::getDesign()->getSkinUrl('images/fam_bullet_success.gif'), + 'bg' => '#DDF' + ), + 'loader' => Mage::getDesign()->getSkinUrl('images/ajax-loader.gif') + ), + 'template' => '
      • ' + . '' + . '#{text}' + . '
      • ', + 'text' => $this->__('processed %s%% %s/%s records', '#{percent}', '#{updated}', '#{total}'), + 'successText' => $this->__('Total imported %s records (%s)', '#{updated}', '#{totalImported}') + ); + + + echo ''; + + + echo "
      "; +echo ' + + +'; + +// echo '
        '; + + + if ($totalRecords = $importModel->getTotalRecords()) { + + $maxRows = $importModel->getResource()->getMaxRows(); + echo ''; + foreach($totalRecords as $importType => $totalRecord) { + echo ''; + $page = floor($totalRecord/$maxRows) + 1; + for ($i = 0; $i < $page; $i++) { + $data = array( + 'import_id' => $importModel->getId(), + 'import_type' => $importType, + 'from' => ($i > 0 ? $i * $maxRows:$i), + 'is_done' => ($i == $page - 1)?true:false + ); + echo ''; + } + +// if ($importType=='categories') { +// $data = array( +// 'import_id' => $importModel->getId(), +// 'import_type' => $importType, +// 'page' => 'all', +// 'is_done' => true +// ); +// echo ''; +// +// } else { +// $page = floor($totalRecord/$maxRows) + 1; +// for ($i = 0; $i < $page; $i++) { +// $data = array( +// 'import_id' => $importModel->getId(), +// 'import_type' => $importType, +// 'from' => ($i > 0 ? $i * $maxRows:$i), +// 'is_done' => ($i == $page - 1)?true:false +// ); +// echo ''; +// } +// } + } + echo ''; + + } + + } + echo ''; + exit; + } +} diff --git a/app/code/core/Mage/Oscommerce/Block/Adminhtml/Order.php b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Order.php new file mode 100644 index 0000000000..67004bf888 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Order.php @@ -0,0 +1,43 @@ + + */ + +class Mage_Oscommerce_Block_Adminhtml_Order extends Mage_Adminhtml_Block_Widget_Grid_Container +{ + protected $_blockGroup = 'oscommerce'; + public function __construct() + { + $this->_controller = 'adminhtml_order'; + $this->_headerText = Mage::helper('adminhtml')->__('Manage osCommerce Orders'); + parent::__construct(); + $this->_removeButton('add'); + } +} diff --git a/app/code/core/Mage/Oscommerce/Block/Adminhtml/Order/Grid.php b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Order/Grid.php new file mode 100644 index 0000000000..0ac3d35ed5 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Order/Grid.php @@ -0,0 +1,128 @@ + + */ + +class Mage_Oscommerce_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid +{ + + public function __construct() + { + parent::__construct(); + $this->setId('oscommerceOrderGrid'); + $this->setDefaultSort('id'); + } + + protected function _prepareCollection() + { + $collection = Mage::getModel('oscommerce/oscommerce_order')->getCollection(); + $this->setCollection($collection); + return parent::_prepareCollection(); + } + + protected function _prepareColumns() + { + $this->addColumn('order_id', array( + 'header' =>Mage::helper('oscommerce')->__('Order #'), + 'width' =>'50px', + 'index' =>'osc_magento_id', + 'type' => 'number', + )); + + $this->addColumn('billing_name', array( + 'header' =>Mage::helper('oscommerce')->__('Billing to Name'), + 'index' =>'billing_name', + )); + + $this->addColumn('delivery_name', array( + 'header' =>Mage::helper('oscommerce')->__('Ship to Name'), + 'index' =>'delivery_name', + )); + + $this->addColumn('currency', array( + 'header' =>Mage::helper('oscommerce')->__('Currency'), + 'width' =>'50px', + 'index' =>'currency', + )); + + $this->addColumn('orders_total', array( + 'header' =>Mage::helper('oscommerce')->__('Order Total'), + 'width' =>'50px', + 'index' =>'orders_total', + 'type' => 'currency', + 'currency'=>'order_currency_code' + )); + + $this->addColumn('orders_status', array( + 'header' =>Mage::helper('oscommerce')->__('Order Status'), + 'width' =>'50px', + 'index' =>'orders_status', + )); + + $this->addColumn('date_purchased', array( + 'header' => Mage::helper('oscommerce')->__('Purchased Year'), + 'width' => '150px', + 'index' => 'date_purchased', + 'type' => 'datetime', + )); + +// $this->addColumn('purchased_year', array( +// 'header' =>Mage::helper('oscommerce')->__('Purchased Year'), +// 'width' =>'50px', +// 'index' =>'purchased_year', +// 'type' => 'currency', +// 'currency' => 'store_currency_code', +// )); +// +// $this->addColumn('purchased_month', array( +// 'header' =>Mage::helper('oscommerce')->__('Purchased Month'), +// 'width' =>'50px', +// 'index' =>'purchased_month', +// 'type' => 'currency', +// 'currency' => 'store_currency_code', +// )); +// +// $this->addColumn('purchased_day', array( +// 'header' =>Mage::helper('oscommerce')->__('Purchased Date'), +// 'width' =>'50px', +// 'index' =>'purchased_day', +// 'type' => 'currency', +// 'currency' => 'store_currency_code', +// )); + + return parent::_prepareColumns(); + } + + public function getRowUrl($row) + { + return $this->getUrl('*/*/view', array('order_id'=>$row->getId())); + } + +} diff --git a/app/code/core/Mage/Oscommerce/Block/Adminhtml/Order/View.php b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Order/View.php new file mode 100644 index 0000000000..5444a20c8a --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Order/View.php @@ -0,0 +1,102 @@ + + */ +class Mage_Oscommerce_Block_Adminhtml_Order_View extends Mage_Adminhtml_Block_Template +{ + + public function __construct() + { + parent::__construct(); + $this->setTemplate('oscommerce/order/view.phtml'); + + + } + + protected function _prepareLayout() + { + $this->setChild('backButton', + $this->getLayout()->createBlock('adminhtml/widget_button') + ->setData(array( + 'label' => Mage::helper('oscommerce')->__('Back'), + 'id' => 'back_button', + 'name' => 'back_button', + 'element_name' => 'back_button', + 'class' => 'scalable back', + 'onclick'=> "setLocation('".$this->getBackUrl()."')", + )) + ); + } + /** + * Retrieve order model object + * + * @return Mage_Sales_Model_Order + */ + public function getOrder() + { + return Mage::registry('current_oscommerce_order'); + } + + /** + * Retrieve Order Identifier + * + * @return int + */ + public function getOrderId() + { + return $this->getOrder()->getId(); + } + + public function getHeaderText() + { + $text = Mage::helper('oscommerce')->__('osCommerce Order # %s | Order Date %s', + $this->getOrder()->getOrdersId(), + $this->formatDate($this->getOrder()->getDatePurchased(), 'medium', true) + ); + return $text; + } + + public function getUrl($params='', $params2=array()) + { + $params2['order_id'] = $this->getOrderId(); + return parent::getUrl($params, $params2); + } + + + public function getBackButtonHtml() + { + return $this->getChildHtml('backButton'); + } + + public function getBackUrl() + { + return $this->getUrl("*/*/"); + } +} diff --git a/app/code/core/Mage/Oscommerce/Block/Order/List.php b/app/code/core/Mage/Oscommerce/Block/Order/List.php new file mode 100644 index 0000000000..a4af260470 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Block/Order/List.php @@ -0,0 +1,73 @@ + + */ +class Mage_Oscommerce_Block_Order_List extends Mage_Core_Block_Template +{ + protected function _construct() + { + parent::_construct(); + $this->setTemplate('oscommerce/order/list.phtml'); + $customerId = Mage::getSingleton('customer/session')->getCustomerId(); + $websiteId = $websiteId = Mage::app()->getStore()->getWebsiteId(); + $osCommerce = Mage::getModel('oscommerce/oscommerce'); + $oscOrders = $osCommerce->loadOrders($customerId, $websiteId); + $this->setOsCommerceOrders($oscOrders); + } + + protected function _prepareLayout() + { + $orderInfo = $this->getOrder(); + $order = $orderInfo['order']; + if ($headBlock = $this->getLayout()->getBlock('head')) { + $headBlock->setTitle($this->__('Order # %s', $order['orders_id'])); + } + } + + public function getViewOscommerceUrl($order) + { + return $this->getUrl('oscommerce/order/view', array('order_id'=>$order['osc_magento_id'])); + } + + /** + * Retrieve current order model instance + * + * @return Mage_Sales_Model_Order + */ + public function getOrder() + { + return Mage::registry('current_oscommerce_order'); + } + + public function getBackUrl() + { + return Mage::getUrl('*/*/history'); + } +} diff --git a/app/code/core/Mage/Oscommerce/Block/Order/View.php b/app/code/core/Mage/Oscommerce/Block/Order/View.php new file mode 100644 index 0000000000..57463941b9 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Block/Order/View.php @@ -0,0 +1,69 @@ + + */ +class Mage_Oscommerce_Block_Order_View extends Mage_Core_Block_Template +{ + protected function _construct() + { + parent::_construct(); + $this->setTemplate('oscommerce/order/view.phtml'); + } + + protected function _prepareLayout() + { + $orderInfo = $this->getOrder(); + $order = $orderInfo['order']; + if ($headBlock = $this->getLayout()->getBlock('head')) { + $headBlock->setTitle($this->__('Order # %s', $order['orders_id'])); + } + } + + public function getPaymentInfoHtml() + { + return $this->getChildHtml('payment_info'); + } + + /** + * Retrieve current order model instance + * + * @return Mage_Sales_Model_Order + */ + public function getOrder() + { + return Mage::registry('current_oscommerce_order'); + } + + public function getBackUrl() + { + return Mage::getUrl('sales/order/history'); + } + +} diff --git a/app/code/core/Mage/Oscommerce/Helper/Data.php b/app/code/core/Mage/Oscommerce/Helper/Data.php new file mode 100644 index 0000000000..ff5d0c794a --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Helper/Data.php @@ -0,0 +1,35 @@ + + */ +class Mage_Oscommerce_Helper_Data extends Mage_Core_Helper_Data +{ + +} diff --git a/app/code/core/Mage/Oscommerce/Model/Config.php b/app/code/core/Mage/Oscommerce/Model/Config.php new file mode 100644 index 0000000000..2befc86076 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Model/Config.php @@ -0,0 +1,49 @@ + + */ +class Mage_Oscommerce_Model_Config extends Mage_Core_Model_Config_Base +{ + public function __construct() + { + parent::__construct(Mage::getConfig()->getNode('global')); + } + + public function initForeignConnection($data) + { + $connectionNode = $this->getNode('resources/oscommerce_foreign/connection'); + if ($connectionNode) { + $connectionNode->addChild('host', isset($data['host']) ? $data['host'] : ''); + $connectionNode->addChild('username', isset($data['db_user']) ? $data['db_user'] : ''); + $connectionNode->addChild('password', isset($data['db_password']) ? $data['db_password'] : ''); + $connectionNode->addChild('dbname', isset($data['db_name']) ? $data['db_name'] : ''); + } + } +} diff --git a/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce.php b/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce.php new file mode 100644 index 0000000000..de9ee9fc22 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce.php @@ -0,0 +1,2113 @@ + + */ +class Mage_Oscommerce_Model_Mysql4_Oscommerce extends Mage_Core_Model_Mysql4_Abstract +{ + const DEFAULT_DISPLAY_MODE = 'PRODUCTS'; + const DEFAULT_IS_ANCHOR = '0'; + const DEFAULT_STORE = 'Default'; + const DEFAULT_PRODUCT_TYPE = 'Simple'; + const DEFAULT_ATTRIBUTE_SET = 'Default'; + const DEFAULT_VISIBILITY = 'Catalog, Search'; + const DEFAULT_LOCALE = 'en_US'; + const DEFAULT_MAGENTO_CHARSET = 'UTF-8'; + const DEFAULT_OSC_CHARSET = 'ISO-8859-1'; + const DEFAULT_FIELD_CHARSET = 'utf8'; + + protected $_currentWebsiteId; + protected $_currentWebsite; + + protected $_importType = array(); + protected $_countryIdToCode = array(); + protected $_countryNameToCode = array(); + protected $_regionCode = array(); + protected $_logData = array(); + protected $_languagesToStores = array(); + protected $_prefix = ''; + protected $_storeLocales = array(); + protected $_rootCategory = ''; + + protected $_websiteCode = ''; + protected $_isProductWithCategories = false; + protected $_setupConnection ; + protected $_customerIdPair = array(); + protected $_categoryIdPair = array(); + protected $_prefixPath = ''; + protected $_stores = array(); + protected $_productsToCategories = array(); + protected $_productsToStores = array(); + protected $_connectionCharset; + protected $_dataCharset; + protected $_maxRows; + protected $_oscStores; + protected $_oscDefaultLanguage; + protected $_oscStoreInformation; + protected $_categoryModel; + protected $_customerModel; + protected $_productModel; + protected $_productAdapterModel; + protected $_orderModel; + protected $_addressModel; + protected $_websiteModel; + protected $_storeGroupModel; + protected $_configModel; + protected $_customerGroupModel; + protected $_storeModel; + protected $_importCollection; + protected $_saveRows = 0; + protected $_errors = array(); + protected $_importModel; + protected $_lengthShortDescription; + protected $_currentUserId; + + protected $_oscTables = array( + 'products', 'customers', 'categories', 'orders', 'languages', + 'orders_products', 'orders_status_history', 'orders_total', + 'products_description', 'address_book', 'categories_description' + ); + + protected function _construct() + { + $this->_init('oscommerce/oscommerce', 'import_id'); + $this->_setupConnection = Mage::getSingleton('core/resource')->getConnection('oscommerce_setup'); + $this->_currentWebsite = Mage::app()->getWebsite(); + $this->_currentWebsiteId = $this->_currentWebsite->getId(); + $this->_maxRows = Mage::getStoreConfig('oscommerce/import/max_rows'); + $this->_lengthShortDescription = Mage::getStoreConfig('oscommerce/import/short_description_length'); + } + + /** + * Get paypal session namespace + * + * @return Mage_Paypal_Model_Session + */ + public function getSession() + { + return Mage::getSingleton('oscommerce/session'); + } + + /** + * Get website object + * + * @return Mage_Core_Model_Website + */ + public function getCurrentWebsite() + { + return $this->_currentWebsite; + } + + protected function _beforeSave(Mage_Core_Model_Abstract $object) + { + if (!$object->getCreatedAt()) { + $object->setCreatedAt($this->formatDate(time())); + } + $object->setUpdatedAt($this->formatDate(time())); + parent::_beforeSave($object); + } + + /** + * Getting external connection adapter + * + * @return object + */ + protected function _getForeignAdapter() + { + return $this->_getConnection('foreign'); + } + + /** + * Get store code by id + * + * @param integer $id + * @return string + */ + public function getStoreCodeById($id) + { + if (!$this->_stores) { + $stores = Mage::app()->getStores(); + foreach($stores as $store) { + $this->_stores[$store->getId()] = $store->getCode(); + } + } + if (isset($this->_stores[$id])) { + return $this->_stores[$id]; + } + return false; + } + + public function setWebsiteCode($code) + { + if (isset($code)) $this->_websiteCode = $code; + } + + /** + * Create new website or set current website as default website + * + * @param integer $websiteId + */ + public function createWebsite($websiteId = null) + { + $importModel = $this->getImportModel(); + $websiteModel = $this->getWebsiteModel(); + if (!is_null($websiteId)) { + $websiteModel->load($websiteId); + } + + if (!$websiteModel->getId()) { + $storeInfo = $this->getOscStoreInformation(); + if ($this->_websiteCode && !($websiteModel->load($this->_websiteCode)->getId())) { + $websiteModel->setName($storeInfo['STORE_NAME']); + $websiteModel->setCode($this->_websiteCode ? $this->_websiteCode : $this->_format($storeInfo['STORE_NAME'])); + $websiteModel->save(); + } + } + + + if ($websiteModel->getId()) { + $this->saveLogs(array( 0 => $websiteModel->getId()), 'website'); + } + + /** + * Create Root category + */ + $this->createRootCategory(); + + /** + * Create default store group + */ + $this->createStoreGroup(); + } + + public function createStoreGroup() + { + $importModel = $this->getImportModel(); + $storeInfo = $this->getOscStoreInformation(); + $websiteModel = $this->getWebsiteModel(); + if (!$websiteModel->getId()) { + $websiteModel->load($this->_currentWebsiteId); // NEED TO GET DEFAULT WEBSITE ID FROM CONFIG + } + $storeGroupModel = $this->getStoreGroupModel(); + $storeGroupModel->unsetData(); + $storeGroupModel->setOrigData(); + + $storeGroupName = Mage::helper('oscommerce')->__('%s Store', $websiteModel->getId() == $this->_currentWebsiteId ? $storeInfo['STORE_NAME'] : $websiteModel->getName()); + $storeGroupModel->setWebsiteId($websiteModel->getId()); + $storeGroupModel->setName($storeGroupName); + $storeGroupModel->setRootCategoryId($this->getRootCategory()->getId()); + + try { + $storeGroupModel->save(); + + $websiteModel->setDefaultGroupId($storeGroupModel->getId()); + $websiteModel->save(); + } + catch (Exception $e) { + + } + + $this->saveLogs(array(0 => $storeGroupModel->getId(), 'group')); + return $this; + } + + public function createRootCategory() + { + $importModel = $this->getImportModel(); + $categoryModel = $this->getCategoryModel(); + $categoryModel->unsetData(); + $categoryModel->setOrigData(); + + $websiteModel = $this->getWebsiteModel(); + if (!$websiteModel->getId()) { + $websiteModel->load($this->_currentWebsiteId); // NEED TO GET DEFAULT WEBSITE ID FROM CONFIG + } + + $storeInfo = $this->getOscStoreInformation(); + + $categoryName = Mage::helper('oscommerce')->__('Root Category for %s', $websiteModel->getName()); + + $categoryModel->setStoreId(0); + $categoryModel->setIsActive(1); + $categoryModel->setDisplayMode(self::DEFAULT_DISPLAY_MODE); + $categoryModel->setName($categoryName); + $categoryModel->setParentId(1); + $categoryModel->setPath('1'); + + try { + $categoryModel->save(); + $this->saveLogs(array(0 => $categoryModel->getId()), 'root_category'); + } + catch (Exception $e) { + + } + + $this->setRootCategory(clone $categoryModel); + + return $this; + } + + /** + * Importing store data from osCommerce to Magento + * + * @param Mage_Oscommerce_Model_Oscommerce $obj + */ + public function importStores() + { + $importModel = $this->getImportModel(); + $locales = $this->getStoreLocales(); + $defaultStore = ''; + $storeInformation = $this->getOscStoreInformation(); + $defaultStoreCode = $storeInformation['DEFAULT_LANGUAGE']; + $configModel = $this->getConfigModel(); + $storeModel = $this->getStoreModel(); + $storeGroupModel = $this->getStoreGroupModel(); + $storeGroupId = $storeGroupModel->getId(); + $websiteModel = $this->getWebsiteModel(); + $websiteId = $websiteModel->getId(); + $storePairs = array(); + if ($stores = $this->getOscStores()) { + foreach($stores as $store) { + try { + $oscStoreId = $store['id']; + unset($store['id']); + + $store['group_id'] = $storeGroupId; + $store['website_id'] = $websiteId; + $storeModel->unsetData(); + $storeModel->setOrigData(); + $storeModel->load($store['code']); + if ($storeModel->getId() && $storeModel->getCode() == $store['code']) { + $localeCode = $locales[$store['code']]; + unset($locales[$store['code']]); + $store['code'] = $store['code'].'_'.$websiteId.time(); // for unique store code + $locales[$store['code']] = $localeCode; + } + $store['name'] = $this->convert($store['name']); + $storeModel->unsetData(); + $storeModel->setOrigData(); + $storeModel->setData($store); + $storeModel->save(); + + $storePairs[$oscStoreId] = $storeModel->getId(); + + $storeLocale = isset($locales[$storeModel->getCode()])?$locales[$storeModel->getCode()]: $locales['default']; + + $configModel->unsetData(); + $configModel->setOrigData(); + $configModel->setScope('stores') + ->setScopeId($storeModel->getId()) + ->setPath('general/locale/code') + ->setValue($storeLocale) + ->save(); + if ($store['scode'] == $defaultStoreCode) { + $defaultStore = $storeModel->getId(); + } + Mage::dispatchEvent('store_add', array('store'=>$storeModel)); + } catch (Exception $e) { + //echo $e->getMessage(); + } + } + } + if (sizeof($storePairs) > 0) { + $this->saveLogs($storePairs, 'store'); + } + $this->setStoreLocales($locales); + + if ($defaultStore) { + $storeGroupModel->setDefaultStoreId($defaultStore); + $storeGroupModel->save(); + } + Mage::app()->reinitStores(); + unset($stores); + } + + /** + * Importing customer/address from osCommerce to Magento + * + * @param Mage_Oscommerce_Model_Oscommerce $obj + */ + public function importCustomers($startFrom = 0, $useStartFrom = false, $sendSubscription = true) + { + $this->_resetSaveRows(); + $this->_resetErrors(); + $totalCustomers = $this->getTotalCustomers(); + $maxRows = $this->getMaxRows(); + $pages = floor($totalCustomers / $maxRows) + 1; + + if (!$useStartFrom) { + for ($i = 0; $i < $pages; $i++) { + if ($customers = $this->getCustomers(array('from'=>($i * $maxRows),'max'=>$maxRows))) { + foreach ($customers as $customer) { + $customer['sendSubscription'] = $sendSubscription; + $this->_saveCustomer($customer); + } + } + } + } else { + if ($customers = $this->getCustomers(array('from'=> $startFrom ,'max'=>$maxRows))) { + foreach ($customers as $customer) { + $customer['sendSubscription'] = $sendSubscription; + $this->_saveCustomer($customer); + } + } + } + } + + /** + * Save customer data + * + * @param Mage_Oscommerce_Model_Oscommerce $obj + * @param array $data + */ + protected function _saveCustomer($data = null) { + $addressFieldMapping = array( + 'street' => 'entry_street_address', + 'firstname' => 'entry_firstname', + 'lastname' => 'entry_lastname', + 'city' => 'entry_city', + 'region' => 'entry_state' + ); + $importModel = $this->getImportModel(); + $timezone = $importModel->getTimezone(); + if (!is_null($data)) { + $customerAddresses = array(); + // Getting customer group data + $customerGroupId = Mage::getStoreConfig(Mage_Customer_Model_Group::XML_PATH_DEFAULT_ID); + $customerGroupModel = $this->getCustomerGroupModel()->load($customerGroupId); + $websiteId = $this->getWebsiteModel()->getId(); + $customerModel = $this->getCustomerModel(); + $addressModel = $this->getAddressModel(); + $oscCustomerId = $data['id']; + $data['group_id'] = $customerGroupModel->getName(); + + $prepareCreated = explode(' ', $data['created_at']); + $dateFormat = 'YYYY-MM-dd HH:mm:ss'; + $dateCreated = new Zend_Date(); + $dateCreated->setTimezone($timezone); + $dateCreated->setDate($prepareCreated[0], 'YYYY-MM-dd'); + $dateCreated->setTime($prepareCreated[1], 'HH:mm:ss'); + $dateCreated->setTimezone('GMT'); + $data['created_at'] = $dateCreated->toString($dateFormat); + + foreach($data as $field => $value) { + if (in_array($field, array('firstname', 'lastname'))) { + $value = $this->convert($value); + } + $data[$field] = html_entity_decode($value, ENT_QUOTES, self::DEFAULT_MAGENTO_CHARSET); + + } + + + // Getting addresses + $addresses = $this->getAddresses($data['id']); + if ($addresses) { + foreach ($addresses as $address) { + foreach ($address as $field => $value) { + + if ($field == 'street1') { + $field = 'street'; + } + if ($field == 'country_id') { + $value = $this->getCountryCodeById($value); + $field = 'country'; + } + if ($field == 'region_id' + && in_array($address['country_id'], array(38, 223))) { + $field = 'region'; + } + + if (in_array($field, array_keys($addressFieldMapping))) { + $value = $this->convert($value); + } + + if (!in_array($field, array('customers_id'))) { + $address[$field] = $value; + } else { + unset($address[$field]); + } + } + $address['country_id'] = $address['country']; + unset($address['country']); + $customerAddresses[] = $address; + } + } + $defaultBilling = ''; + $defaultBilling = $data['default_billing']; + unset($data['default_billing']); + unset($data['id']); + + try { + $customerModel->setData($data); + $customerModel->setImportMode(true); + $customerModel->setWebsiteId($websiteId > 0 ? $websiteId: $this->getCurrentWebsite()->getId()); + $customerModel->save(); + $customerId = $customerModel->getId(); + + if ($customerAddresses) foreach ($customerAddresses as $customerAddress) { + $customerAddress['telephone'] = $data['telephone']; + $customerAddress['fax'] = $data['fax']; + $addressModel->unsetData(); + $addressModel->setData($customerAddress); + $addressModel->setCustomerId($customerId); + $addressModel->setId(null); + $addressModel->save(); + if ($defaultBilling == $customerAddress['id']) { + $addressId = $addressModel->getId(); + $customerModel->setDefaultBilling($addressId); + $customerModel->setDefaultShipping($addressId); + } + } + $customerModel->save(); + $this->saveLogs(array($oscCustomerId => $customerId), 'customer'); + $this->_saveRows++; + } catch (Exception $e) { + $this->_addErrors(Mage::helper('oscommerce')->__('Email %s cannot be saved because of %s.', $data['email'], $e->getMessage())); + } + } + } + + public function getCustomerIdPair() + { + if (!$this->_customerIdPair) { + $this->_customerIdPair = $this->getLogPairsByTypeCode('customer'); + } + return $this->_customerIdPair; + } + + public function setCustomerIdPair($data) + { + if (is_array($data)) { + $this->_customerIdPair = $data; + } + } + + public function importCategories($startFrom = 0, $useStartFrom = false) + { + $importModel = $this->getImportModel(); + $this->_logData['type_id'] = $this->getImportTypeIdByCode('category'); + $this->_logData['import_id'] = $importModel->getId(); + $categoryModel = $this->getCategoryModel(); + + $this->_resetSaveRows(); + $this->_resetErrors(); + $maxRows = $this->getMaxRows(); + $totalCategories = $this->getCategoriesCount(); + + $pages = floor($totalCategories / $maxRows) + 1; + if (!$useStartFrom) { + for ($i = 0; $i < $pages; $i++) { + if ($categories = $this->getCategories(array('from'=> $i * $maxRows,'max'=>$maxRows))) { + foreach ($categories as $category) { + $this->_saveCategory($category); + } + } + } + } else { + if ($categories = $this->getCategories(array('from'=> $startFrom ,'max'=>$maxRows))) { + foreach ($categories as $category) { + $this->_saveCategory($category); + } + } + } + } + + protected function _saveCategory($data) { + $importModel = $this->getImportModel(); + $categoryModel = $this->getCategoryModel(); + $oscCategoryId = $data['id']; + unset($data['id']); + try { + $data['store_id'] = 0; + $data['is_active'] = 1; + $data['display_mode'] = self::DEFAULT_DISPLAY_MODE; + $data['is_anchor'] = self::DEFAULT_IS_ANCHOR; + $data['attribute_set_id'] = $categoryModel->getDefaultAttributeSetId(); + $data['name'] = $this->convert($data['name']); + $data['meta_title'] = html_entity_decode($data['name'], ENT_QUOTES, self::DEFAULT_MAGENTO_CHARSET); + $categoryModel->setData($data); + $categoryModel->save(); + $categoryId = $categoryModel->getId(); + $this->saveLogs(array($oscCategoryId => $categoryId), 'category'); + + // saving data for different (encoding has been done in getCategoryToStores method) + $storeData = $data['stores']; + unset($data['stores']); + if (isset($storeData)) { + foreach($storeData as $storeId=>$catData) { + $categoryModel->setStoreId($storeId)->setName($catData['name'])->setMetaTitle($catData['name']) + ->save(); + } + } + $this->_saveRows++; + } catch (Exception $e) { + $this->_addErrors(Mage::helper('oscommerce')->__('Category %s cannot be saved because of %s.', $data['name'], $e->getMessage())); + } + } + + + + public function buildCategoryPath() + { + $categoryIdPair = $this->getCategoryIdPair(); + $importModel = $this->getImportModel(); + if ($categoryIdPair) foreach ($categoryIdPair as $oscommerceId => $magentoId) { + $path = $this->getRootCategory()->getPath().'/'.join('/',$this->getCategoryPath($oscommerceId)); + $this->_getWriteAdapter()->raw_query("UPDATE `{$this->getTable('catalog_category')}` SET `path`='{$path}' WHERE `entity_id`={$magentoId}"); + } + } + + public function getCategoryPath($categoryId) + { + $categoryIdPair = $this->getCategoryIdPair(); + $select = "SELECT `c`.`parent_id` FROM `{$this->getOscTable('categories')}` c "; + $select .= " WHERE `c`.`categories_id`={$categoryId}"; + if ($parentId = $this->_getForeignAdapter()->fetchOne($select)) { + if ($result = $this->getCategoryPath($parentId)) { + if (!isset($results)) { + $results = $result; + } else { + array_merge($results, $result); + } + } else { + $results[] = $categoryIdPair[$parentId]; + } + } + $results[] = $categoryIdPair[$categoryId]; + return $results; + } + + public function getCategoryIdPair() + { + if (!$this->_categoryIdPair) { + $this->_categoryIdPair = $this->getLogPairsByTypeCode('category'); + } + return $this->_categoryIdPair; + } + + public function setCategoryIdPair($data) + { + if (is_array($data)) { + $this->_categoryIdPair = $data; + } + } + + /** + * Import products + * + * @param Mage_Oscommerce_Model_Oscommerce $obj + */ + public function importProducts($startFrom = 0, $useStartFrom = false) + { + $importModel = $this->getImportModel(); + $productAdapterModel = Mage::getModel('catalog/convert_adapter_product'); + $productModel = $this->getProductModel(); + $taxCollections = $this->_getTaxCollections(); + $this->_resetSaveRows(); + $this->_resetErrors(); + $maxRows = $this->getMaxRows(); + $totalProducts = $this->getProductsCount(); + $pages = floor($totalProducts / $maxRows) + 1; + if (!$useStartFrom) { + for ($i = 0; $i < $pages; $i++) { + if ($products = $this->getProducts(array('from'=> $i * $maxRows,'max'=>$maxRows))) { + foreach ($products as $product) { + if (!empty($product['tax_class_id'])) { + $product['tax_class_id'] = $taxCollections[$product['tax_class_id']]; + } + $this->_saveProduct($product); + } + } + } + } else { + if ($products = $this->getProducts(array('from'=> $startFrom ,'max'=>$maxRows))) { + foreach ($products as $product) { + if (!empty($product['tax_class_id'])) { + $product['tax_class_id'] = $taxCollections[$product['tax_class_id']]; + } + $this->_saveProduct($product); + } + } + } + } + + /** + * Save products data + * + * @param Mage_Oscommerce_Model_Oscommerce $obj + * @param array $data + */ + protected function _saveProduct($data) { + $importModel = $this->getImportModel(); + $productAdapterModel = $this->getProductAdapterModel(); + $productModel = $this->getProductModel(); + $mageStores = $this->getLanguagesToStores(); + $storeInfo = $this->getOscStoreInformation(); + $storeName = $storeInfo['STORE_NAME']; + $oscProductId = $data['id']; + unset($data['id']); + if ($this->_isProductWithCategories) { + if ($categories = $this->getProductCategories($oscProductId)) + $data['category_ids'] = $categories; + } + + /** + * Checking product by using sku and website + */ + if (empty($data['sku'])) { + $data['sku'] = $storeName . ' - ' . $oscProductId; + } + $productModel->unsetData(); + $productId = $productModel->getIdBySku($data['sku']); + $productModel->load($productId); + if ($productModel->getId()) { + $websiteIds = $productModel->getWebsiteIds(); + + if ($websiteIds) foreach($websiteIds as $websiteId) { + if ($websiteId == $this->getWebsiteModel()->getId()) { + $this->_addErrors(Mage::helper('oscommerce')->__('SKU %s was not imported since it already exists in %s', + $data['sku'], + $this->getWebsiteModel()->getName())); + return ; + } + } + } + try { + if (isset($data['image'])) { + if (substr($data['image'], 0,1) != DS) { + $data['image'] = DS . $data['image']; + } + + if (!file_exists(Mage::getBaseDir('media'). DS . 'import' . $data['image'])) { + unset($data['image']); + } else { + $data['thumbnail'] = $data['small_image'] = $data['image']; + } + } + if ($stores = $this->getProductStores($oscProductId)) { + + foreach ($stores as $storeId => $store) { + if (!$storeCode = $this->getStoreCodeById($mageStores[$storeId])) { + $storeCode = $this->getCurrentWebsite()->getDefaultStore()->getCode(); + } + $data['store'] = $storeCode; + $data['name'] = html_entity_decode($this->convert($store['name']), ENT_QUOTES, self::DEFAULT_MAGENTO_CHARSET); + $data['description'] = html_entity_decode($this->convert($store['description']), ENT_QUOTES, self::DEFAULT_MAGENTO_CHARSET); + $data['short_description'] = $data['description']; + $productAdapterModel->saveRow($data); + } + } + + $productId = $productAdapterModel->getProductModel()->getId(); + $this->saveLogs(array($oscProductId => $productId), 'product'); + $this->_saveRows++; + } catch (Exception $e) { + $this->_addErrors(Mage::helper('oscommerce')->__('SKU %s cannot be saved because of %s.', $data['sku'], $e->getMessage())); + } + } + + public function importOrders($startFrom = 0, $useStartFrom = false) + { + $importModel = $this->getImportModel(); + $this->_resetSaveRows(); + $this->_resetErrors(); + // Get orders + + $totalOrders = $this->getOrdersCount(); + $maxRows = $this->getMaxRows(); + $pages = floor($totalOrders / $maxRows) + 1; + + if (!$useStartFrom) { + for ($i = 0; $i < $pages; $i++) { + $orders = $this->getOrders(array('from' => $i * $maxRows, 'max' => $maxRows)); + if ($orders) foreach($orders as $order) { + $this->_saveOrder($order); + } + } + } else { + $orders = $this->getOrders(array('from' => $startFrom, 'max' => $maxRows)); + if ($orders) foreach($orders as $order) { + $this->_saveOrder($order); + } + } + } + + public function createOrderTables() + { + $importModel = $this->getImportModel(); + $importId = $importModel->getId(); + $websiteId = $this->getWebsiteModel()->getId(); + + $tables = array( + 'orders' => "CREATE TABLE `{$this->getTable('oscommerce_order')}` ( + `osc_magento_id` int(11) NOT NULL auto_increment, + `orders_id` int(11) NOT NULL default '0', + `customers_id` int(11) NOT NULL default '0', + `magento_customers_id` int(11) NOT NULL default '0', + `import_id` int(11) NOT NULL default '0', + `website_id` int(11) NOT NULL default '0', + `customers_name` varchar(64) NOT NULL default '', + `customers_company` varchar(32) default NULL, + `customers_street_address` varchar(64) NOT NULL default '', + `customers_suburb` varchar(32) default NULL, + `customers_city` varchar(32) NOT NULL default '', + `customers_postcode` varchar(10) NOT NULL default '', + `customers_state` varchar(32) default NULL, + `customers_country` varchar(32) NOT NULL default '', + `customers_telephone` varchar(32) NOT NULL default '', + `customers_email_address` varchar(96) NOT NULL default '', + `customers_address_format_id` int(5) NOT NULL default '0', + `delivery_name` varchar(64) NOT NULL default '', + `delivery_company` varchar(32) default NULL, + `delivery_street_address` varchar(64) NOT NULL default '', + `delivery_suburb` varchar(32) default NULL, + `delivery_city` varchar(32) NOT NULL default '', + `delivery_postcode` varchar(10) NOT NULL default '', + `delivery_state` varchar(32) default NULL, + `delivery_country` varchar(32) NOT NULL default '', + `delivery_address_format_id` int(5) NOT NULL default '0', + `billing_name` varchar(64) NOT NULL default '', + `billing_company` varchar(32) default NULL, + `billing_street_address` varchar(64) NOT NULL default '', + `billing_suburb` varchar(32) default NULL, + `billing_city` varchar(32) NOT NULL default '', + `billing_postcode` varchar(10) NOT NULL default '', + `billing_state` varchar(32) default NULL, + `billing_country` varchar(32) NOT NULL default '', + `billing_address_format_id` int(5) NOT NULL default '0', + `payment_method` varchar(255) NOT NULL default '', + `cc_type` varchar(20) default NULL, + `cc_owner` varchar(64) default NULL, + `cc_number` varchar(32) default NULL, + `cc_expires` varchar(4) default NULL, + `last_modified` datetime default NULL, + `date_purchased` datetime default NULL, + `orders_status` varchar(32) default NULL, + `orders_date_finished` datetime default NULL, + `currency` varchar(3) default NULL, + `currency_value` decimal(14,6) default NULL, + `currency_symbol` varchar(3) default NULL, + `orders_total` decimal(14,6) default NULL, + PRIMARY KEY (`osc_magento_id`), + KEY `idx_orders_customers_id` (`customers_id`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + " + , 'orders_products' => "CREATE TABLE `{$this->getTable('oscommerce_order_products')}` ( + `orders_products_id` int(11) NOT NULL auto_increment, + `osc_magento_id` int(11) NOT NULL default '0', + `products_id` int(11) NOT NULL default '0', + `products_model` varchar(12) default NULL, + `products_name` varchar(64) NOT NULL default '', + `products_price` decimal(15,4) NOT NULL default '0.0000', + `final_price` decimal(15,4) NOT NULL default '0.0000', + `products_tax` decimal(7,4) NOT NULL default '0.0000', + `products_quantity` int(2) NOT NULL default '0', + PRIMARY KEY (`orders_products_id`), + KEY `idx_orders_products_osc_magento_id` (`osc_magento_id`), + KEY `idx_orders_products_products_id` (`products_id`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + " + + , 'orders_total' => "CREATE TABLE IF NOT EXISTS `{$this->getTable('oscommerce_order_total')}` ( + `orders_total_id` int(10) unsigned NOT NULL auto_increment, + `osc_magento_id` int(11) NOT NULL default '0', + `title` varchar(255) NOT NULL default '', + `text` varchar(255) NOT NULL default '', + `value` decimal(15,4) NOT NULL default '0.0000', + `class` varchar(32) NOT NULL default '', + `sort_order` int(11) NOT NULL default '0', + PRIMARY KEY (`orders_total_id`), + KEY `idx_orders_total_osc_magento_id` (`osc_magento_id`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8;" + + , 'orders_status_history'=>"CREATE TABLE IF NOT EXISTS `{$this->getTable('oscommerce_order_history')}` ( + `orders_status_history_id` int(11) NOT NULL auto_increment, + `osc_magento_id` int(11) NOT NULL default '0', + `orders_status_id` int(5) NOT NULL default '0', + `date_added` datetime NOT NULL default '0000-00-00 00:00:00', + `customer_notified` int(1) default '0', + `comments` text, + `orders_status` varchar(32) default NULL, + PRIMARY KEY (`orders_status_history_id`), + KEY `idx_orders_status_history_osc_magento_id` (`osc_magento_id`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8;" + + ); + + $conn = $this->_setupConnection; + foreach ($tables as $table => $schema) { + $conn->beginTransaction(); + try { + $conn->query($schema); + $conn->commit(); + } catch (Exception $e) { +// $conn->rollBack(); + } + } + + $this->checkOrderField(); + } + + public function setTablePrefix($prefix) + { + if (isset($prefix)) $this->_prefix = $prefix; + } + + public function getTablePrefix() + { + return $this->_prefix; + } + + public function setIsProductWithCategories($yn) + { + if (is_bool($yn)) { + $this->_isProductWithCategories = $yn; + } + } + + /** + * Logging imported data to oscommerce_ref table + * + * @param array data + */ + public function log($data = array()) + { + if (isset($data)) { + $this->_getWriteAdapter()->beginTransaction(); + try { + $this->_getWriteAdapter()->insert($this->getTable('oscommerce_ref'), $data); + $this->_getWriteAdapter()->commit(); + } catch (Exception $e) { + $this->_getWriteAdapter()->rollBack(); + } + } + } + + public function getOscStoreInformation() + { + if (!$this->_oscStoreInformation) { + $select = "SELECT `configuration_key` `key`, `configuration_value` `value` FROM `{$this->getOscTable('configuration')}`"; + $select .= " WHERE `configuration_key` IN ('STORE_NAME', 'STORE_OWNER', 'STORE_OWNER_EMAIL', 'STORE_COUNTRY',' STORE_ZONE','DEFAULT_LANGUAGE')"; + if (!($result = $this->_getForeignAdapter()->fetchPairs($select))) { + $result = array(); + } + $this->_oscStoreInformation = $result; + } + return $this->_oscStoreInformation; + } + + /** + * Getting products data from osCommerce + * + */ + public function getProducts($limit = array()) + { + $defaultLanguage = $this->getOscDefaultLanguage(); + $defaultLanguageId = $defaultLanguage['id']; + $code = $this->getWebsiteModel()->getCode(); + $website = $code? $code: $this->getCurrentWebsite()->getCode(); + $connection = $this->_getForeignAdapter(); + $select = " SELECT `p`.`products_id` `id`, `p`.`products_quantity` `qty` "; + $select .= " , `p`.`products_model` `sku`, `p`.`products_price` `price`"; + $select .= " , `p`.`products_image` `image` "; + $select .= " , `p`.`products_weight` `weight`, IF(`p`.`products_status`,'Enabled','Disabled') `status` "; + $select .= " , IF(`p`.`products_status`,'1','0') `is_in_stock`"; + $select .= " , `pd`.`products_name` `name`, `pd`.`products_description` `description` "; +// $select .= " , `tc`.`tax_class_title` `tax_class_id`, IF(1,'".self::DEFAULT_VISIBILITY."','') `visibility` "; + $select .= " , `p`.`products_tax_class_id` `tax_class_id`, IF(1,'".self::DEFAULT_VISIBILITY."','') `visibility` "; + $select .= " , `sp`.`specials_new_products_price` `special_price` "; + $select .= " , `sp`.`specials_date_added` `special_from_date` "; + $select .= " , `sp`.`expires_date` `special_to_date` "; + $select .= " , IF(1,'".self::DEFAULT_ATTRIBUTE_SET."','') `attribute_set` "; + $select .= " , IF(1,'".self::DEFAULT_PRODUCT_TYPE ."','') `type` "; + //$select .= ", IF(1,'".self::DEFAULT_STORE."','') `store` "; + $select .= " , IF(1,'".$website."','') `website` "; + $select .= " FROM `{$this->getOscTable('products')}` p LEFT JOIN `{$this->getOscTable('products_description')}` pd "; + $select .= " ON `pd`.`products_id`=`p`.`products_id` AND `pd`.`language_id`={$defaultLanguageId} "; +// $select .= " LEFT JOIN `{$this->getOscTable('tax_class')}` tc ON `tc`.`tax_class_id`=`p`.`products_tax_class_id` "; + $select .= " LEFT JOIN `{$this->getOscTable('specials')}` sp ON `sp`.`products_id`=`p`.`products_id` "; + if ($limit && isset($limit['from']) && isset($limit['max'])) { + $select .= " LIMIT {$limit['from']}, {$limit['max']}"; + } + if (!($result = $this->_getForeignAdapter()->fetchAll($select))) { + $result = array(); + } + return $result; + } + + public function getProductsCount() + { + return $this->_getForeignAdapter()->fetchOne("SELECT count(*) FROM `{$this->getOscTable('products')}`"); + } + + public function getCategoriesCount() + { + return $this->_getForeignAdapter()->fetchOne("SELECT count(*) FROM `{$this->getOscTable('categories')}`"); + } + + public function getCustomersCount() + { + return $this->_getForeignAdapter()->fetchOne("SELECT count(*) FROM `{$this->getOscTable('customers')}`"); + } + + public function getOrdersCount() + { + return $this->_getForeignAdapter()->fetchOne("SELECT count(*) FROM `{$this->getOscTable('orders')}`"); + } + + public function getOrders($limit = array()) { + $defaultLanguage = $this->getOscDefaultLanguage(); + $defaultLanguageId = $defaultLanguage['id']; + $select = "SELECT `o`.`orders_id`, `o`.`customers_id`, `o`.`customers_name`"; + $select .= " ,`o`.`customers_company`,`o`.`customers_street_address`"; + $select .= " ,`o`.`customers_suburb`, `o`.`customers_city`"; + $select .= " ,`o`.`customers_postcode`, `o`.`customers_state`"; + $select .= " ,`o`.`customers_country`, `o`.`customers_telephone`"; + $select .= " ,`o`.`customers_email_address`, `o`.`customers_address_format_id`"; + $select .= " ,`o`.`delivery_name`, `o`.`delivery_company`"; + $select .= " ,`o`.`delivery_street_address`, `o`.`delivery_suburb`"; + $select .= " ,`o`.`delivery_city`, `o`.`delivery_postcode`, `o`.`delivery_state`"; + $select .= " ,`o`.`delivery_country`, `o`.`delivery_address_format_id`"; + $select .= " ,`o`.`billing_name`, `o`.`billing_company`"; + $select .= " ,`o`.`billing_street_address`, `o`.`billing_suburb`"; + $select .= " ,`o`.`billing_city`, `o`.`billing_postcode`, `o`.`billing_state`"; + $select .= " ,`o`.`billing_country`, `o`.`billing_address_format_id`"; + $select .= " ,`o`.`payment_method`, `o`.`cc_type`, `o`.`cc_owner`, `o`.`cc_number`"; + $select .= " ,`o`.`cc_expires`, `o`.`last_modified`, `o`.`date_purchased`"; + $select .= " ,`o`.`orders_status`, `o`.`orders_date_finished`, `o`.`currency`, `o`.`currency_value`"; + $select .= " ,`c`.`symbol_left` `currency_symbol`,`ot`.`value` `orders_total`"; + $select .= " ,`os`.`orders_status_name` FROM `{$this->getOscTable('orders')}` `o`"; + $select .= " LEFT JOIN `{$this->getOscTable('currencies')}` `c` ON `c`.`code`=`o`.`currency` "; + $select .= " LEFT JOIN `{$this->getOscTable('orders_total')}` `ot` ON `ot`.`orders_id`=`o`.`orders_id` "; + $select .= " AND `ot`.`class`='ot_total'"; + $select .= " LEFT JOIN `{$this->getOscTable('orders_status')}` os ON `os`.`orders_status_id`=`o`.`orders_status` "; + $select .= " AND `os`.`language_id`={$defaultLanguageId} "; + if (isset($limit) && isset($limit['from']) && isset($limit['max'])) { + $select .= " LIMIT {$limit['from']}, {$limit['max']} "; + } + if (!($result = $this->_getForeignAdapter()->fetchAll($select))) { + $result = array(); + } + return $result; + } + + protected function _saveOrder($data) + { + $fieldNoEnc = array( + 'customers_id', + 'orders_id', + 'date_purchased', + 'last_modified', + 'orders_date_finished', + 'orders_products_id', + 'osc_magento_id', + 'products_id' + ); + + $importModel = $this->getImportModel(); + $timezone = $importModel->getTimezone(); + $customerIdPair = $this->getCustomerIdPair(); + $importId = $importModel->getId(); + $websiteId = $this->getWebsiteModel()->getId(); + if ($data['customers_id'] > 0 && isset($this->_customerIdPair[$data['customers_id']])) { + foreach($data as $field => $value) { + if (!in_array($field, $fieldNoEnc)) { + $data[$field] = $this->convert($value); + } + } + + if ($data['date_purchased']) { + $preparePurchased = explode(' ', $data['date_purchased']); + $dateFormat = 'YYYY-MM-dd HH:mm:ss'; + $datePurchased = new Zend_Date(); + $datePurchased->setTimezone($timezone); + $datePurchased->setDate($preparePurchased[0], 'YYYY-MM-dd'); + $datePurchased->setTime($preparePurchased[1], 'HH:mm:ss'); + $datePurchased->setTimezone('GMT'); + $data['date_purchased'] = $datePurchased->toString($dateFormat); + } + + if ($data['last_modified']) { + $prepareModified = explode(' ', $data['last_modified']); + $dateModified = new Zend_Date(); + $dateModified->setTimezone($timezone); + $dateModified->setDate($prepareModified[0], 'YYYY-MM-dd'); + $dateModified->setTime($prepareModified[1], 'HH:mm:ss'); + $dateModified->setTimezone('GMT'); + $data['last_modified'] = $dateModified->toString($dateFormat); + } + + if ($data['orders_date_finished']) { + $prepareFinished = explode(' ', $data['orders_date_finished']); + $dateFinished = new Zend_Date(); + $dateFinished->setTimezone($timezone); + $dateFinished->setDate($prepareFinished[0], 'YYYY-MM-dd'); + $dateFinished->setTime($prepareFinished[1], 'HH:mm:ss'); + $dateFinished->setTimezone('GMT'); + $data['orders_date_finished'] = $dateFinished->toString($dateFormat); + } + + $data['magento_customers_id'] = $this->_customerIdPair[$data['customers_id']]; // get Magento CustomerId + $data['import_id'] = $importId; + $data['website_id'] = $websiteId; + $data['orders_status'] = $data['orders_status_name']; + unset($data['orders_status_name']); + $this->_getWriteAdapter()->insert($this->getTable('oscommerce_order'), $data); + $oscMagentoId = $this->_getWriteAdapter()->lastInsertId(); + $this->_saveRows++; + + // Get orders products + $select = "SELECT `orders_products_id`, `orders_id`, `products_id` "; + $select .= ", `products_model`, `products_name`, `products_price`, `final_price` "; + $select .= ", `products_tax`, `products_quantity` "; + $select .= " FROM `{$this->getOscTable('orders_products')}` WHERE `orders_id`={$data['orders_id']}"; + if ($orderProducts = $this->_getForeignAdapter()->fetchAll($select)) { + foreach ($orderProducts as $orderProduct) { + unset($orderProduct['orders_id']); + unset($orderProduct['orders_products_id']); + $orderProduct['osc_magento_id'] = $oscMagentoId; + foreach ($orderProduct as $field => $value) { + if (!in_array($field, $fieldNoEnc)) { + $orderProduct[$field] = $this->convert($value); + } + } + $this->_getWriteAdapter()->insert($this->getTable('oscommerce_order_products'), $orderProduct); + } + } + + // Get orders totals + $select = "SELECT `orders_total_id`, `orders_id`, `title`, `text`, `value`, `class`, `sort_order` "; + $select .= " FROM `{$this->getOscTable('orders_total')}` WHERE `orders_id`={$data['orders_id']} ORDER BY `sort_order`"; + + if ($orderTotals = $this->_getForeignAdapter()->fetchAll($select)) { + foreach ($orderTotals as $orderTotal) { + + unset($orderTotal['orders_id']); + unset($orderTotal['orders_total_id']); + $orderTotal['osc_magento_id'] = $oscMagentoId; + $orderTotal['title'] = $this->convert($orderTotal['title']); + $orderTotal['text'] = $this->convert($orderTotal['text']); + $this->_getWriteAdapter()->insert($this->getTable('oscommerce_order_total'), $orderTotal); + } + } + + $defaultLanguage = $this->getOscDefaultLanguage(); + $defaultLanguageId = $defaultLanguage['id']; + + // Get orders status history + $select = "SELECT `osh`.`orders_status_history_id`, `osh`.`orders_id`, `osh`.`orders_status_id` "; + $select .= ", `os`.`orders_status_name` `orders_status`, `osh`.`date_added`, `osh`.`customer_notified`, `osh`.`comments` "; + $select .= " FROM `{$this->getOscTable('orders_status_history')}` osh "; + $select .= " LEFT JOIN `{$this->getOscTable('orders_status')}` os ON `os`.`orders_status_id`=`osh`.`orders_status_id` "; + $select .= " AND `os`.`language_id`={$defaultLanguageId}"; + $select .= " WHERE `osh`.`orders_id`={$data['orders_id']}"; + if ($orderHistories = $this->_getForeignAdapter()->fetchAll($select)) { + foreach ($orderHistories as $orderHistory) { + unset($orderHistory['orders_id']); + unset($orderHistory['orders_status_history_id']); + $orderHistory['osc_magento_id'] = $oscMagentoId; + $prepareAdded = explode(' ', $orderHistory['date_added']); + $dateFormat = 'YYYY-MM-dd HH:mm:ss'; + $dateAdded = new Zend_Date(); + $dateAdded->setTimezone($timezone); + $dateAdded->setDate($prepareAdded[0], 'YYYY-MM-dd'); + $dateAdded->setTime($prepareAdded[1], 'HH:mm:ss'); + $dateAdded->setTimezone('GMT'); + $orderHistory['date_added'] = $dateAdded->toString($dateFormat); + $orderHistory['orders_status'] = $this->convert($orderHistory['orders_status']); + $orderHistory['comments'] = $this->convert($orderHistory['comments']); + $orderHistory['customer_notified'] = $this->convert($orderHistory['customer_notified']); + + $this->_getWriteAdapter()->insert($this->getTable('oscommerce_order_history'), $orderHistory); + } + } + } else { + $this->_addErrors(Mage::helper('oscommerce')->__('Order #%s failed to import because the customer ID #%s associated with this order could not be found.', $data['orders_id'], $data['customers_id'])); + } + } + + /** + * Getting product description for different stores + * + * @param integer $productId + * @return mix array/boolean + */ + public function getProductStores($productId) { + if (!$this->_productsToStores) { + $select = "SELECT `products_id`, `language_id` `store`, `products_name` `name`, `products_description` `description`"; + $select .= " FROM `{$this->getOscTable('products_description')}` "; + if ($results = $this->_getForeignAdapter()->fetchAll($select)) { + foreach ($results as $result) { + $this->_productsToStores[$result['products_id']][$result['store']] = array('name'=>$result['name'], 'description' => $result['description']); + } + } + } + if (isset($this->_productsToStores[$productId])) { + return $this->_productsToStores[$productId]; + } + return false; + } + + /** + * Getting new created categories recursively using products of osCommerce + * + * @param integer $productId + * @return string + */ + public function getProductCategories($productId) + { + $importModel = $this->getImportModel(); + if (!$this->_productsToCategories) { + $select = "SELECT `products_id`, `categories_id` FROM `{$this->getOscTable('products_to_categories')}`"; + + if ($results = $this->_getForeignAdapter()->fetchAll($select)) { + $categories = array(); + foreach ($results as $result) { + $categories[$result['products_id']] = $result['categories_id']; + if (isset($categories[$result['products_id']])) { + $categories[$result['products_id']] .= ','.$result['categories_id']; + } else { + $categories[$result['products_id']] = $result['categories_id']; + } + } + //$categories = join(',', array_values($results)); + + //$this->_getReadAdapter(); + $importId = $importModel->getId(); + $typeId = $this->getImportTypeIdByCode('category'); + + + if ($categories) foreach ($categories as $product => $category) { + $select = $this->_getReadAdapter()->select(); + $select->from(array('osc'=>$this->getTable('oscommerce_ref')), array('id'=>'id','ref_id'=>'ref_id')); + $select->where("`osc`.`import_id`='{$importId}' AND `osc`.`type_id`='{$typeId}' AND `osc`.`value` in (".$category.")"); + $resultCategories = $this->_getReadAdapter()->fetchPairs($select); + if ($resultCategories) { + $this->_productsToCategories[$product] = join(',',array_values($resultCategories)); + } + } + } + } + if (isset($this->_productsToCategories[$productId])) { + return $this->_productsToCategories[$productId]; + } + return false; + } + + public function getCategories($limit = array()) { + $importModel = $this->getImportModel(); + $defaultLanguage = $this->getOscDefaultLanguage(); + $defaultLanguageId = $defaultLanguage['id']; + $select = "SELECT `c`.`categories_id` as `id`, `c`.`parent_id`, `cd`.`categories_name` `name` FROM `{$this->getOscTable('categories')}` c ";// WHERE `c`.`parent_id`={$parentId}"; + $select .= " INNER JOIN `{$this->getOscTable('categories_description')}` cd on `cd`.`categories_id`=`c`.`categories_id`"; + $select .= " AND `cd`.`language_id`={$defaultLanguageId} "; + if ($limit && isset($limit['from']) && isset($limit['max'])) { + $select .= " LIMIT {$limit['from']}, {$limit['max']} "; + } + if (!$results = $this->_getForeignAdapter()->fetchAll($select)) { + $results = array(); + } else { + $stores = $this->getLanguagesToStores(); + foreach($results as $index => $result) { + if ($categoriesToStores = $this->getCategoriesToStores($result['id'])) { + foreach($categoriesToStores as $store => $categoriesName) { + $results[$index]['stores'][$stores[$store]] = array( + 'name'=>html_entity_decode($this->convert($categoriesName), ENT_QUOTES, self::DEFAULT_MAGENTO_CHARSET) + ); + } + } + } + } + return $results; + } + + /** + * Getting language to Magento store data + * + * @return array + */ + public function getLanguagesToStores() + { + $importModel = $this->getImportModel(); + $typeId = $this->getImportTypeIdByCode('store'); + $importId = $importModel->getId(); + if (!$this->_languagesToStores) { + //$this->_languagesToStores[1] = 1; + $select = $this->_getReadAdapter()->select(); + $select->from(array('ref'=>$this->getTable('oscommerce_ref')), array('value'=>'value', 'ref_id'=>'ref_id')); + $select->where("`ref`.`import_id`='{$importId}' AND `ref`.`type_id`='{$typeId}'"); + $this->_languagesToStores = $this->_getReadAdapter()->fetchPairs($select); + } + return $this->_languagesToStores; + } + + /** + * Getting categry description for different languages + * + * @param integer $categoryId + * @return mix array/boolean + */ + public function getCategoriesToStores($categoryId) + { + $select = "SELECT `language_id`, `categories_name` FROM `{$this->getOscTable('categories_description')}`"; + $select .= "WHERE `categories_id`='{$categoryId}'"; + if ($categoryId && $result = $this->_getForeignAdapter()->fetchPairs($select)) { + return $result; + } + return false; + } + + /** + * Getting store data of osCommerce + * + * @return array + */ + public function getOscStores() + { + if (!$this->_oscStores) { + $select = "SELECT `languages_id` `id`, `name`, `code` `scode`, "; + $select .= " `directory` `code`, 1 `is_active` FROM `{$this->getOscTable('languages')}`"; + $this->_oscStores = $this->_getForeignAdapter()->fetchAll($select); + } + return $this->_oscStores; + } + + + public function getOscDefaultLanguage() + { + if (!$this->_oscDefaultLanguage) { + $oscStoreInfo = $this->getOscStoreInformation(); + $languageCode = $oscStoreInfo['DEFAULT_LANGUAGE']; + if ($stores = $this->getOscStores()) foreach($stores as $store) { + if ($store['scode'] == $languageCode) { + $this->_oscDefaultLanguage = $store; + } + } + } + return $this->_oscDefaultLanguage; + } + + /** + * Getting customers from osCommerce + * + * @return array + */ + public function getCustomers($limit = array()) + { + $select = "SELECT `c`.`customers_id` `id`, `c`.`customers_firstname` `firstname` "; + $select .= " ,`c`.`customers_lastname` `lastname`, `c`.`customers_email_address` `email` "; + $select .= " ,`c`.`customers_telephone` `telephone`, `c`.`customers_fax` `fax` "; + $select .= " ,`c`.`customers_password` `password_hash`, `c`.`customers_newsletter` `is_subscribed` "; + $select .= " ,`ci`.`customers_info_date_account_created` `created_at` "; + $select .= " ,`c`.`customers_default_address_id` `default_billing` FROM `{$this->getOscTable('customers')}` c"; + $select .= " LEFT JOIN `customers_info` ci ON `ci`.`customers_info_id`=`c`.`customers_id` "; + if ($limit && isset($limit['from']) && isset($limit['max'])) { + $select .= " LIMIT {$limit['from']}, {$limit['max']}"; + } + + if (!($result = $this->_getForeignAdapter()->fetchAll($select))) { + $result = array(); + } + + return $result; + } + + public function getTotalCustomers() { + return $this->_getForeignAdapter()->fetchOne("SELECT count(*) FROM `{$this->getOscTable('customers')}`"); + } + + public function getCustomerName($name) + { + if (isset($name)) { + $n = explode(" ", $name); + if (sizeof($n) > 1) { + $newName['lastname'] = $n[(sizeof($n) - 1)]; + $newName['fistname'] = Mage::helper('core/string')->substr($name, 0, + Mage::helper('core/string')->strlen($name) - (Mage::helper('core/string')->strlen($newName['lastname'] + 1)) + ); + return $newName; + } else { + return array('firstname' => $n); + } + } + return false; + } + + + /** + * Getting customer address by CustomerId from osCommerce + * + * @param integer $customerId + * @return array + */ + public function getAddresses($customerId) + { + + $select = "SELECT `address_book_id` `id`, `customers_id`, `entry_firstname` `firstname`"; + $select .= ", `entry_lastname` `lastname`, `entry_street_address` `street1`"; + $select .= ", `entry_company` `company` "; + $select .= ", `entry_postcode` `postcode`, `entry_city` `city`"; + $select .= ", `entry_state` `region`, `entry_country_id` `country_id`"; + $select .= ", `entry_zone_id` `region_id` FROM `{$this->getOscTable('address_book')}` WHERE customers_id={$customerId}"; + if (!isset($customerId) || !($result = $this->_getForeignAdapter()->fetchAll($select))) { + $result = array(); + } + return $result; + } + + /** + * Get address from address book + * + * @param integer $address_id + * @return array + */ + public function getAddressById($addressId) + { + + $select = "SELECT `address_book_id` `id`, `customers_id`, `entry_firstname` `firstname`"; + $select .= ", `entry_lastname` `lastname`, `entry_street_address` `street1`"; + $select .= ", `entry_postcode` `postcode`, `entry_city` `city`"; + $select .= ", `entry_state` `region`, `entry_country_id` `country_id`"; + $select .= ", `entry_zone_id` `region_id` FROM `{$this->getOscTable('address_book')}` WHERE address_book_id={$addressId}"; + if (!isset($addressId) || !($result = $this->_getForeignAdapter()->fetchRow($select))) { + $result = array(); + } + return $result; + } + + /** + * Getting importing types for loging into oscommerce_ref + * + * @return array + */ + public function getImportTypes() + { + if (! $this->_importType) { + $connection = $this->_getReadAdapter(); + $select = $connection->select(); + $select->from($this->getTable('oscommerce_type'), array('*')); + $this->_importType = $connection->fetchAll($select); + } + return $this->_importType; + } + + /** + * Getting import_type_id by code + * + * @param integer $code + * @return string/boolean + */ + public function getImportTypeIdByCode($code = '') { + $types = $this->getImportTypes(); + if (isset($code) && $types) { + foreach ($types as $type) { + if ($type['type_code'] == $code) { + return $type['type_id']; + } + } + } + return false; + } + + public function getCountryCodeData() + { + $select = "SELECT * FROM `{$this->getOscTable('countries')}`"; + $countries = $this->_getForeignAdapter()->fetchAll($select); + if ($countries) foreach($countries as $country) { + $this->_countryIdToCode[$country['countries_id']] = $country['countries_iso_code_2']; + $this->_countryNameToCode[$country['countries_name']] = $country['countries_iso_code_2']; + } + } + + /** + * Getting country code by country id + * + * @param integer $id + * @return string/boolean + */ + public function getCountryCodeById($id) + { + if (!$this->_countryIdToCode) { + $this->getCountryCodeData(); + } + $countries = $this->_countryIdToCode; + if (isset($id) && isset($countries[$id])) { + return $countries[$id]; + } + return false; + } + + public function getCountryCodeByName($name) + { + if (!$this->_countryNameToCode) { + $this->getCountryCodeData(); + } + $countries = $this->_countryNameToCode; + if (isset($id) && isset($countries[$name])) { + return $countries[$name]; + } + return false; + } + + public function getCountryIdByCode($countryCode) + { + if (!$this->_countryIdToCode) { + $this->getCountryCodeData(); + } + if (isset($code)) { + foreach($this->_countryToCode as $id => $code) { + if ($code == $countryCode) { + return $id; + } + } + } + return false; + } + + + /** + * Getting regions from osCommerce + * + * @return array + */ + public function getRegions() + { + if (!$this->_regionCode) { + $select = "SELECT `zone_id`, `zone_name` FROM `{$this->getOscTable('zones')}`"; + $this->_regionCode = $this->_getForeignAdapter()->fetchPairs($select); + } + return $this->_regionCode; + } + + /** + * Getting region name by id + * + * @param integer $id + * @return string/boolean + */ + public function getRegionCode($id) + { + $regions = $this->getRegions(); + if (isset($id) && isset($regions[$id])) { + return $regions[$id]; + } + return false; + } + + public function setStoreLocales($locale) + { + if (isset($locale) && is_array($locale)) + $this->_storeLocales = $locale; + } + + public function getStoreLocales() + { + if ($this->_storeLocales) { + return $this->_storeLocales; + } else { + return array('default' => self::DEFAULT_LOCALE ); + } + } + + public function setRootCategory(Mage_Catalog_Model_Category $category) { + $this->_rootCategory = $category; + } + + public function getRootCategory() + { + if (!$this->_rootCategory) { + $this->_rootCategory = $this->getCategoryModel()->load($this->getCurrentWebsite()->getDefaultStoreGroup()->getRootCategoryId()); + } + return $this->_rootCategory; + } + + public function setWebsiteId($id) + { + $this->_websiteId = (int) ($id ? $id : 0); + } + + public function importTaxClasses() + { + $taxModel = Mage::getModel('tax/class'); + $storeInfo = $this->getOscStoreInformation(); + $storeName = $storeInfo['STORE_NAME']; + $taxPairs = array(); + if ($classes = $this->getTaxClasses()) { + $existedClasses = $taxCollections = Mage::getResourceModel('tax/class_collection') + ->addFieldToFilter('class_type', 'PRODUCT') + ->load() + ->toOptionHash(); + + foreach ($classes as $id => $name) { + $taxModel->unsData(); + $className = $name . '_' . $storeName; + if (in_array($className, $existedClasses)) { + $taxId = array_search($className, $existedClasses); + } else { + $taxModel->setId(null); + $taxModel->setClassType('PRODUCT'); + $taxModel->setClassName($name . '_' . $storeName); + $taxModel->save(); + $taxId = $taxModel->getId(); + } + $taxPairs[$id] = $taxId; + } + } + + if (sizeof($taxPairs) > 0) { + $this->saveLogs($taxPairs, 'taxclass'); + } + } + + protected function _getTaxCollections() + { + $taxPairs = $this->getLogPairsByTypeCode('taxclass'); + $flipTaxPairs = array_flip($taxPairs); + $newTaxPairs = array(); + $taxCollections = Mage::getResourceModel('tax/class_collection') + ->addFieldToFilter('class_type', 'PRODUCT') + ->load() + ->toOptionArray(); + if ($taxCollections) { + foreach ($taxCollections as $tax) { + if (isset($flipTaxPairs[$tax['value']])) { + $newTaxPairs[$flipTaxPairs[$tax['value']]] = $tax['label']; + } + } + } + return $newTaxPairs; + } + + public function saveLogs($data, $type = null) + { + $importId = $this->getImportModel()->getId(); + $typeId = $this->getImportTypeIdByCode($type); + $userId = $this->_getCurrentUserId(); + $createdAt = $this->formatDate(time()); + if (is_array($data) && $typeId > 0) { + foreach($data as $value => $refId) { + $log = array( + 'value' => $value, + 'ref_id' => $refId, + 'import_id' => $importId, + 'type_id' => $typeId, + 'user_id' => $userId, + 'created_at'=> $createdAt + ); + $this->_getWriteAdapter()->insert($this->getTable('oscommerce_ref'), $log); + } + } + } + + public function getLogPairsByTypeCode($code) + { + $typeId = $this->getImportTypeIdByCode($code); + $importId = $this->getImportModel()->getId(); + $result = array(); + if (!is_null($typeId)) { + $select = $this->_getReadAdapter()->select(); + $select->from($this->getTable('oscommerce_ref'), array('value','ref_id')) + ->where("import_id={$importId}") + ->where("type_id={$typeId}"); + $result = $this->_getReadAdapter()->fetchPairs($select); + } + return $result; + } + + public function getTaxClasses() + { + $select = "SELECT `tax_class_id` `id`, `tax_class_title` `title` FROM `{$this->getOscTable('tax_class')}`"; + if (!($results = $this->_getForeignAdapter()->fetchPairs($select))) { + $results = array(); + } + return $results; + } + + private function _format($str) + { + $str = preg_replace('#[^0-9a-z\/\.]+#i', '', $str); + $str = strtolower(str_replace('\\s','',$str)); + return $str; + } + + public function setPrefixPath($prefix) { + if ($prefix) { + $this->_prefixPath = $prefix; + } + } + + /** + * Load osCommerce orders + * + * @param integer $customerId + * @param integer $websiteId + * @return array + */ + public function loadOrders($customerId, $websiteId = '') + { + if (!isset($websiteId)) { + $webisteId = $this->_currentWebsiteId; + } + $result = array(); + if (!empty($customerId)) { + $select = $this->_getReadAdapter()->select() + ->from(array('order'=>$this->getTable('oscommerce_order'))) + ->join( + array('order_total'=>$this->getTable('oscommerce_order_total')), + "order_total.osc_magento_id=order.osc_magento_id AND order_total.class='ot_total'", + array('value')) + ->where("order.magento_customers_id={$customerId}") + ->where("order.website_id={$websiteId}"); + $result = $this->_getReadAdapter()->fetchAll($select); + } + return $result; + } + + /** + * Load osCommerce order + * + * @param integer $id + * @return array + */ + public function loadOrderById($id) + { + $result = array(); + if (!empty($id)) { + $select = "SELECT * FROM {$this->getTable('oscommerce_order')} WHERE osc_magento_id={$id}"; + $order = $this->_getReadAdapter()->fetchRow($select); + if ($order) { + $result['order'] = $order; + foreach (array('products','total','history') as $table) { + $select = "SELECT * FROM {$this->getTable('oscommerce_order_'.$table)} WHERE osc_magento_id={$id}"; + $result[$table] = $this->_getReadAdapter()->fetchAll($select); + + } + } + + } + return $result; + } + + // Fix for previous version + protected function checkOrderField() + { + $columnName = 'currency_symbol'; + try { + if (!($result = $this->_getReadAdapter()->fetchRow("SHOW `columns` FROM `{$this->getTable('oscommerce_order')}` WHERE field='{$columnName}'"))) { + $this->_setupConnection()->query("ALTER TABLE `{$this->getTable('oscommerce_order')}` ADD {$columnName} char(3) DEFAULT NULL"); + $this->_setupConnection()->commit(); + } + } catch (Exception $e) { + + } + } + + public function setMaxRows($rows) + { + if (is_integer($rows)) { + $this->_maxRows = $rows; + } + } + + public function getMaxRows() + { + if ($this->_maxRows <= 0) { + $this->_maxRows = Mage::getStoreConfig('oscommerce/import/max_rows'); + } + return $this->_maxRows; + } + + /** + * Retrieve website model cache + * + * @return Mage_Core_Model_Web + */ + public function getWebsiteModel() + { + if (is_null($this->_websiteModel)) { + $object = Mage::getModel('core/website'); + $this->_websiteModel = Varien_Object_Cache::singleton()->save($object); + } + return Varien_Object_Cache::singleton()->load($this->_websiteModel); + } + + /** + * Retrieve store model cache + * + * @return Mage_Core_Model_Store + */ + public function getStoreModel() + { + if (is_null($this->_storeModel)) { + $object = Mage::getModel('core/store'); + $this->_storeModel = Varien_Object_Cache::singleton()->save($object); + } + return Varien_Object_Cache::singleton()->load($this->_storeModel); + } + + /** + * Retrieve customer model cache + * + * @return Mage_Customer_Model_Customer + */ + public function getCustomerModel() + { + if (is_null($this->_customerModel)) { + $object = Mage::getModel('customer/customer'); + $this->_customerModel = Varien_Object_Cache::singleton()->save($object); + } + return Varien_Object_Cache::singleton()->load($this->_customerModel); + } + + /** + * Retrieve customer model cache + * + * @return Mage_Customer_Model_Customer + */ + public function getCustomerGroupModel() + { + if (is_null($this->_customerGroupModel)) { + $object = Mage::getModel('customer/group'); + $this->_customerGroupModel = Varien_Object_Cache::singleton()->save($object); + } + return Varien_Object_Cache::singleton()->load($this->_customerGroupModel); + } + + /** + * Retrieve address model cache + * + * @return Mage_Customer_Model_Address + */ + public function getAddressModel() + { + if (is_null($this->_addressModel)) { + $object = Mage::getModel('customer/address'); + $this->_addressModel = Varien_Object_Cache::singleton()->save($object); + } + return Varien_Object_Cache::singleton()->load($this->_addressModel); + } + + + /** + * Retrieve category model cache + * + * @return Mage_Catalog_Model_Category + */ + public function getCategoryModel() + { + if (is_null($this->_categoryModel)) { + $object = Mage::getModel('catalog/category'); + $this->_categoryModel = Varien_Object_Cache::singleton()->save($object); + } + return Varien_Object_Cache::singleton()->load($this->_categoryModel); + } + + /** + * Retrieve category model cache + * + * @return Mage_Catalog_Model_Category + */ + public function getProductModel() + { + if (is_null($this->_productModel)) { + $object = Mage::getModel('catalog/product'); + $this->_productModel = Varien_Object_Cache::singleton()->save($object); + } + return Varien_Object_Cache::singleton()->load($this->_productModel); + } + + public function getProductAdapterModel() + { + if (is_null($this->_productAdapterModel)) { + $object = Mage::getModel('catalog/convert_adapter_product'); + $this->_productAdapterModel = Varien_Object_Cache::singleton()->save($object); + } + return Varien_Object_Cache::singleton()->load($this->_productAdapterModel); + } + /** + * Retrieve store group model cache + * + * @return Mage_Core_Model_Store_Group + */ + public function getStoreGroupModel() + { + if (is_null($this->_storeGroupModel)) { + $object = Mage::getModel('core/store_group'); + $this->_storeGroupModel = Varien_Object_Cache::singleton()->save($object); + } + return Varien_Object_Cache::singleton()->load($this->_storeGroupModel); + } + + public function getConfigModel() + { + if (is_null($this->_configModel)) { + $object = Mage::getModel('core/config_data'); + $this->_configModel = Varien_Object_Cache::singleton()->save($object); + } + return Varien_Object_Cache::singleton()->load($this->_configModel); + + } + + public function importCollection($importId = null) { + $importTypes = array('website', 'root_category', 'group'); + $result = array(); + if (!is_null($importId)) { + $select = $this->_getReadAdapter()->select() + ->from(array('ref'=>$this->getTable('oscommerce_ref'))) + ->join( + array('type'=>$this->getTable('oscommerce_type')), + "type.type_id=ref.type_id AND type.type_code in ('".join("','",$importTypes)."')", + array('type.type_code')) + ->where("ref.import_id={$importId}"); + if ($results = $this->_getReadAdapter()->fetchAll($select)) { + foreach ($results as $result) { + $this->_importCollection[$result['type_code']] = $result['ref_id']; + } + } + + } + return $this->_importCollection; + } + + public function setImportModel(Mage_Oscommerce_Model_Oscommerce $model) + { + $this->_importModel = $model; + } + + public function getImportModel() + { + if ($this->_importModel) { + return $this->_importModel; + } + } + + public function getCollections($code) + { + if ($this->_importCollection) { + return $this->_importCollection; + } + return; + } + + /** + * Deleting oscommerce reference records + * + * @param integer $id + */ + public function deleteRecords($id = null) + { + if (!is_null($id) && $id > 0) { + if ($result = $this->_getReadAdapter() + ->fetchRow('SELECT * FROM '.$this->getTable('oscommerce_ref').' WHERE import_id='.$id)) { + $this->_getWriteAdapter()->raw_query('DELETE FROM '.$this->getTable('oscommerce_ref').' WHERE import_id='.$id); + } + } + } + + /** + * Formatting string + * + * @param string $input + * @param integer $number + * @return string + */ + protected function _formatStringTruncate($data, $number) + { + if (str_word_count($data, 0)>$number) { + $wordKey = str_word_count($data, 1); + $posKey = str_word_count($data, 2); + reset($posKey); + foreach ($wordKey as $key => &$value) { + $value=key($posKey); + next($posKey); + } + return substr($data, 0, $wordKey[$number]); + } else { + return $data; + } + } + + /** + * Getting current user ID + * + * @return string + */ + protected function _getCurrentUserId() + { + if (!$this->_currentUserId) { + $this->_currentUserId = Mage::getSingleton('admin/session')->getUser()->getId(); + $this->_logData['user_id'] = $this->_currentUserId; + } + return $this->_currentUserId; + } + + /** + * Getting oscommerce table with prefix + * + * @param string $table + * @return string + */ + function getOscTable($table) + { + return $this->_prefix.$table; + } + + /** + * Setting connection charset + * + * @param string $charset + */ + public function setConnectionCharset($charset) + { + $this->_connectionCharset = $charset; + } + + /** + * Getting connection charset, set deafult as utf8 + * if there is no predefine charset + * + * @return string + */ + public function getConnectionCharset() + { + if (!$this->_connectionCharset) { + $this->_connectionCharset = self::DEFAULT_FIELD_CHARSET; + } + return $this->_connectionCharset; + } + + public function resetConnectionCharset() + { + $charset = $this->getConnectionCharset(); + $this->_getForeignAdapter()->query("SET NAMES '{$charset}'"); + } + + + /** + * Setting dataCharset by user defined encoding charset + * + * @param string $charset + */ + public function setDataCharset($charset) + { + if (!is_null($charset)) { + $this->_dataCharset = $charset; + } + } + + /** + * Getting dataCharset + * + * @return string + */ + public function getDataCharset() + { + return $this->_dataCharset; + } + + /** + * Converting encoded charsets + * + * @param mixed $data + * @param array $notIncludedFields + * @return mixed + */ + public function convert($data, array $notIncludedFields = array()) + { + $charset = $this->getDataCharset(); + if (!is_null($charset) || $charset != self::DEFAULT_FIELD_CHARSET) { + if (is_array($data)) { + foreach($data as $field => $value) { + if (!in_array($field, $notIncludedFields)) { + $newValue = @iconv($charset, self::DEFAULT_FIELD_CHARSET, $value); + if (strlen($newValue)) { + $data[$field] = $newValue; + } + } + } + } else { + $newValue = @iconv($charset, self::DEFAULT_MAGENTO_CHARSET, $data); + if (strlen($newValue)) { + $data = $newValue; + } + } + } + return $data; + } + + /** + * Getting saveRows + * + * @return integer + */ + public function getSaveRows() + { + return $this->_saveRows; + } + + /** + * Resetting saveRows as zero + * + */ + protected function _resetSaveRows() + { + $this->_saveRows = 0; + } + + /** + * Adding error messages + * + * @param string $error + */ + protected function _addErrors($error) + { + if (isset($error)) $this->_errors[] = $error; + } + + /** + * Getting all errors + * + * @return array + */ + public function getErrors() + { + if (sizeof($this->_errors) > 0) { + return $this->_errors; + } + } + + /** + * Resetting error as empty array + * + */ + protected function _resetErrors() + { + $this->_errors = array(); + } +} diff --git a/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Collection.php b/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Collection.php new file mode 100755 index 0000000000..aea40caea4 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Collection.php @@ -0,0 +1,38 @@ + + */ +class Mage_Oscommerce_Model_Mysql4_Oscommerce_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract +{ + protected function _construct() + { + $this->_init('oscommerce/oscommerce'); + } +} diff --git a/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Order.php b/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Order.php new file mode 100644 index 0000000000..c141394ce7 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Order.php @@ -0,0 +1,81 @@ + + */ +class Mage_Oscommerce_Model_Mysql4_Oscommerce_Order extends Mage_Core_Model_Mysql4_Abstract +{ + protected function _construct() + { + $this->_init('oscommerce/oscommerce_order', 'osc_magento_id'); + } + + public function getProducts() + { + $order = Mage::registry('current_oscommerce_order'); + $result = array(); + if ($order && $order->getData() && $id = $order->getId()) + { + $select = $this->_getReadAdapter()->select(); + $select->from($this->getTable('oscommerce_order_products')) + ->where("osc_magento_id={$id}"); + $result = $this->_getReadAdapter()->fetchAll($select); + } + return $result; + } + + public function getTotal() + { + $order = Mage::registry('current_oscommerce_order'); + $result = array(); + if ($order && $order->getData() && $id = $order->getId()) + { + $select = $this->_getReadAdapter()->select(); + $select->from($this->getTable('oscommerce_order_total')) + ->where("osc_magento_id={$id}")->order('sort_order'); + $result = $this->_getReadAdapter()->fetchAll($select); + } + return $result; + } + + public function getComments() + { + $order = Mage::registry('current_oscommerce_order'); + $result = array(); + if ($order && $order->getData() && $id = $order->getId()) + { + $select = $this->_getReadAdapter()->select(); + $select->from($this->getTable('oscommerce_order_history')) + ->where("osc_magento_id={$id}"); + $result = $this->_getReadAdapter()->fetchAll($select); + } + return $result; + } +} + diff --git a/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Order/Collection.php b/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Order/Collection.php new file mode 100644 index 0000000000..04410dc499 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Order/Collection.php @@ -0,0 +1,55 @@ + + */ +class Mage_Oscommerce_Model_Mysql4_Oscommerce_Order_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract +{ + protected function _construct() + { + $this->_init('oscommerce/oscommerce_order'); + } + + public function addOrderTotalField() + { + $this->_select + ->columns(array('orders_total'=>new Zend_Db_Expr('FORMAT(main_table.orders_total,2)'))); + return $this; + } + + public function load($printQuery=false, $logQuery=false) + { + if ($this->isLoaded()) { + return $this; + } + $this->addOrderTotalField(); + parent::load($printQuery, $logQuery); + return $this; + } +} diff --git a/app/code/core/Mage/Oscommerce/Model/Oscommerce.php b/app/code/core/Mage/Oscommerce/Model/Oscommerce.php new file mode 100755 index 0000000000..aa9079a214 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Model/Oscommerce.php @@ -0,0 +1,87 @@ + + */ +class Mage_Oscommerce_Model_Oscommerce extends Mage_Core_Model_Abstract +{ + const DEFAULT_PORT = 3360; + const CONNECTION_TYPE = 'pdo_mysql'; + const CONNECTION_NAME = 'oscommerce_db'; + + protected function _construct() + { + $this->_init('oscommerce/oscommerce'); + } + + protected function _afterLoad() + { + parent::_afterLoad(); + Mage::getSingleton('oscommerce/config')->initForeignConnection($this->getData()); + +// if (Mage::app()->getRequest()->getActionName() == 'run') { +// $this->importStores(); +// } + + } + /** + * Get paypal session namespace + * + * @return Mage_Paypal_Model_Session + */ + public function getSession() + { + return Mage::getSingleton('oscommerce/session'); + } + + public function importStores() { + $this->getResource()->importStores($this); + } + + public function getImportTypeIdByCode($code = '') { + return $this->getResource()->getImportTypeIdByCode($code); + } + + public function loadOrders($customerId, $websiteId) + { + return $this->getResource()->loadOrders($customerId, $websiteId); + } + + public function loadOrderById($id) + { + return $this->getResource()->loadOrderById($id); + } + + public function deleteImportedRecords($id) + { + if (isset($id) && $id == $this->getId()) { + $this->getResource()->deleteRecords($id); + } + } +} diff --git a/app/code/core/Mage/Oscommerce/Model/Oscommerce/Order.php b/app/code/core/Mage/Oscommerce/Model/Oscommerce/Order.php new file mode 100644 index 0000000000..ca987d7769 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Model/Oscommerce/Order.php @@ -0,0 +1,55 @@ + + */ +class Mage_Oscommerce_Model_Oscommerce_Order extends Mage_Core_Model_Abstract +{ + + protected function _construct() + { + $this->_init('oscommerce/oscommerce_order'); + } + + public function getProducts() + { + return $this->getResource()->getProducts(); + } + + public function getTotal() + { + return $this->getResource()->getTotal(); + } + + public function getComments() + { + return $this->getResource()->getComments(); + } + +} diff --git a/app/code/core/Mage/Oscommerce/Model/Session.php b/app/code/core/Mage/Oscommerce/Model/Session.php new file mode 100644 index 0000000000..301d17cb38 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/Model/Session.php @@ -0,0 +1,39 @@ + + */ +class Mage_Oscommerce_Model_Session extends Mage_Core_Model_Session_Abstract +{ + public function __construct() + { + $this->init('oscommerce'); + } +} diff --git a/app/code/core/Mage/Oscommerce/controllers/Adminhtml/ImportController.php b/app/code/core/Mage/Oscommerce/controllers/Adminhtml/ImportController.php new file mode 100644 index 0000000000..4356d31571 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/controllers/Adminhtml/ImportController.php @@ -0,0 +1,432 @@ + + */ +class Mage_Oscommerce_Adminhtml_ImportController extends Mage_Adminhtml_Controller_Action +{ + /** + * Initailization action of importController + */ + protected function _initAction() + { + $this->loadLayout(); + $this->_setActiveMenu('system/convert'); + return $this; + } + + /** + * Initialization of importController + * + * @param idFieldnName string + * @return Mage_Oscommerce_Adminhtml_ImportController + */ + protected function _initImport($idFieldName = 'id') + { + $id = (int) $this->getRequest()->getParam($idFieldName); + $model = Mage::getModel('oscommerce/oscommerce'); + if ($id) { + $model->load($id); + } + + Mage::register('oscommerce_adminhtml_import', $model); + return $this; + } + + /** + * Index action of importController + */ + public function indexAction() + { + $this->_title($this->__('System')) + ->_title($this->__('Import and Export')) + ->_title($this->__('osCommerce Profiles')); + + $this->_initAction(); + $this->_addContent( + $this->getLayout()->createBlock('oscommerce/adminhtml_import') + ); + $this->renderLayout(); + } + + /** + * Edit action of importController + */ + public function editAction() + { + $this->_title($this->__('System')) + ->_title($this->__('Import and Export')) + ->_title($this->__('osCommerce Profiles')); + + $this->_initImport(); + $this->loadLayout(); + + $model = Mage::registry('oscommerce_adminhtml_import'); + $data = Mage::getSingleton('adminhtml/session')->getSystemConvertOscData(true); + + if (!empty($data)) { + $model->addData($data); + } + + $this->_title($model->getId() ? $model->getName() : $this->__('New Profile')); + + $this->_initAction(); + $this->_addBreadcrumb + (Mage::helper('oscommerce')->__('Edit osCommerce Profile'), + Mage::helper('oscommerce')->__('Edit osCommerce Profile')); + /** + * Append edit tabs to left block + */ + $this->_addLeft($this->getLayout()->createBlock('oscommerce/adminhtml_import_edit_tabs')); + + $this->_addContent($this->getLayout()->createBlock('oscommerce/adminhtml_import_edit')); + + $this->renderLayout(); + } + + /** + * Create new action of importController + */ + public function newAction() + { + $this->_forward('edit'); + } + + /** + * Save action of + */ + public function saveAction() + { + if ($data = $this->getRequest()->getPost()) { + if (isset($data['send_subscription'])) { + $data['send_subscription'] = 1; + } else { + $data['send_subscription'] = 0; + } + + $this->_initImport('import_id'); + $model = Mage::registry('oscommerce_adminhtml_import'); + + // Prepare saving data + if (isset($data)) { + $model->addData($data); + } + +// if (empty($data['port'])) +// $data['port'] = Mage_Oscommerce_Model_Oscommerce::DEFAULT_PORT; + + try { + $model->save(); + + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('oscommerce')->__('The osCommerce profile has been saved.')); + } + catch (Exception $e){ + Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); + Mage::getSingleton('adminhtml/session')->setSystemConvertOscData($data); + $this->getResponse()->setRedirect($this->getUrl('*/*/edit', array('id'=>$model->getId()))); + return; + } + } + if ($this->getRequest()->getParam('continue')) { + $this->_redirect('*/*/edit', array('id'=>$model->getId())); + } else { + $this->_redirect('*/*'); + } + } + + public function batchRunAction() + { + @set_time_limit(0); + $this->_initImport('import_id'); + $importModel = Mage::registry('oscommerce_adminhtml_import'); + + if ($tablePrefix = $importModel->getTablePrefix()) { + $importModel->getResource()->setTablePrefix($tablePrefix); + } + + // Start setting data from sessions + if ($connCharset = $importModel->getSession()->getConnectionCharset()) { + $importModel->getResource()->setConnectionCharset($connCharset); + } + if ($dataCharset = $importModel->getSession()->getDataCharset()) { + $importModel->getResource()->setDataCharset($dataCharset); + } + if ($timezone = $importModel->getSession()->getTimezone()) { + $importModel->setTimezone($timezone); + } + if ($storeLocales = $importModel->getSession()->getStoreLocales()) { + $importModel->getResource()->setStoreLocales($storeLocales); + } + if ($isPoductWithCategories = $importModel->getSession()->getIsProductWithCategories()) { + $importModel->getResource()->setIsProductWithCategories($isPoductWithCategories); + } + // End setting data from sessions + + // Resetting connection charset + $importModel->getResource()->resetConnectionCharset(); + + $importModel->getResource()->setImportModel($importModel); + if ($collections = $importModel->getResource()->importCollection($importModel->getId())) { + if (isset($collections['website'])) { + $importModel->getResource()->getWebsiteModel()->load($collections['website']); + } + if (isset($collections['root_category'])) { + $importModel->getResource()->setRootCategory(clone $importModel->getResource()->getCategoryModel()->load($collections['root_category'])); + } + if (isset($collections['group'])) { + $importModel->getResource()->getStoreGroupModel()->load($collections['group']); + + } + } + + //$isUnderDefaultWebsite = $this->getRequest()->getParam('under_default_website') ? true: false; + $importType = $this->getRequest()->getParam('import_type'); + $importFrom = $this->getRequest()->getParam('from'); + $isImportDone = $this->getRequest()->getParam('is_done'); + switch($importType) { + case 'products': + $importModel->getResource()->importProducts($importFrom, true); + break; + case 'categories': + $importModel->getResource()->importCategories($importFrom, true); + if ($isImportDone == 'true') { + $importModel->getResource()->buildCategoryPath(); + } + break; + case 'customers': + $importModel->getResource()->importCustomers($importFrom, true, $importModel->getData('send_subscription')); + break; + case 'orders': + $importModel->getResource()->importOrders($importFrom, true); + break; + } + + $errors = $importModel->getResource()->getErrors(); + $result = array( + 'savedRows' => $importModel->getResource()->getSaveRows(), + 'errors' => ( $errors ? $errors: array()) + ); + $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result)); + } + + public function runAction() + { + @set_time_limit(0); + Mage::app()->cleanCache(); // Clean all cach + $this->_initImport(); + $importModel = Mage::registry('oscommerce_adminhtml_import'); + /** @var $importModel Mage_Oscommerce_Model_Oscommerce */ + $totalRecords = array(); + + // Start handling charsets + $connCharset = $this->getRequest()->getParam('connection_charset'); + if ($connCharset) { + $importModel->getSession()->setConnectionCharset($connCharset); + $importModel->getResource()->setConnectionCharset($connCharset); + } + $dataCharset = $this->getRequest()->getParam('data_charset'); + if ($dataCharset) { + $importModel->getSession()->setDataCharset($dataCharset); + $importModel->getResource()->setDataCharset($dataCharset); + } // End hanlding charsets + + $timezone = $this->getRequest()->getParam('timezone'); + $importModel->getSession()->setTimezone($timezone); + $importModel->getResource()->resetConnectionCharset(); + + if ($tablPrefix = $importModel->getTablePrefix()) { + $importModel->getResource()->setTablePrefix($tablPrefix); + } + + $importModel->getResource()->setImportModel($importModel); + $importModel->getResource()->importCollection($importModel->getId()); + + // Setting Locale for stores + $locales = explode("|",$this->getRequest()->getParam('store_locale')); + $storeLocales = array(); + if ($locales) foreach($locales as $locale) { + $localeCode = explode(':', $locale); + $storeLocales[$localeCode[0]] = $localeCode[1]; + } + + $importModel->getSession()->setStoreLocales($storeLocales); + $importModel->getResource()->setStoreLocales($storeLocales); + // End setting Locale for stores + + $websiteId = $this->getRequest()->getParam('website_id'); + $websiteCode = $this->getRequest()->getParam('website_code'); + $options = $this->getRequest()->getParam('import'); + + // Checking Website, StoreGroup and RootCategory + if (!$websiteId) { + $importModel->getResource()->setWebsiteCode($websiteCode); + $importModel->getResource()->createWebsite(); + } else { + $importModel->getResource()->createWebsite($websiteId); + } + // End checking Website, StoreGroup and RootCategory + + $importModel->getResource()->importStores(); + $importModel->getResource()->importTaxClasses(); + $importModel->getResource()->createOrderTables(); + + if (isset($options['categories'])) { + $importModel->getSession()->setIsProductWithCategories(true); + $totalRecords['categories'] = $importModel->getResource()->getCategoriesCount(); + } + if (isset($options['products'])) { + $totalRecords['products'] = $importModel->getResource()->getProductsCount(); + } + if (isset($options['customers'])) { + $totalRecords['customers'] = $importModel->getResource()->getCustomersCount(); + } + if (isset($options['customers']) && isset($options['orders'])) { + $totalRecords['orders'] = $importModel->getResource()->getOrdersCount(); + } + if ($totalRecords) { + $importModel->setTotalRecords($totalRecords); + Mage::unRegister('oscommerce_adminhtml_import'); + Mage::register('oscommerce_adminhtml_import', $importModel); + } + $this->getResponse()->setBody($this->getLayout()->createBlock('oscommerce/adminhtml_import_run')->toHtml()); + $this->getResponse()->sendResponse(); + } + + public function batchFinishAction() + { + if ($importId = $this->getRequest()->getParam('id')) { + $importModel = Mage::getModel('oscommerce/oscommerce')->load($importId); + /* @var $batchModel Mage_Dataflow_Model_Batch */ + + if ($importId = $importModel->getId()) { + $importModel->deleteImportedRecords($importId); +// $importModel->getSession()->unsStoreLocales(); +// $importModel->getSession()->unsIsProductWithCategories(); +// if ($importModel->getSession()->getTablePrefix()) { +// $importModel->getSession()->unsTablePrefix(); +// } + $importModel->getSession()->clear(); + } + } + } + + /** + * Delete osc action + */ + public function deleteAction() + { + $this->_initImport(); + $model = Mage::registry('oscommerce_adminhtml_import'); + if ($model->getId()) { + try { + $model->delete(); + Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('oscommerce')->__('The osCommerce profile has been deleted.')); + } + catch (Exception $e){ + Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); + } + } + $this->_redirect('*/*/'); + } + + /** + * Ajax checking store + * + */ + public function checkStoreAction() + { + $this->_initImport(); + $importModel = Mage::registry('oscommerce_adminhtml_import'); + $error = false; + if ($importModel->getId()) { + try { + $charset = $importModel->getResource()->getConnectionCharset(); + $defaultOscCharset = Mage_Oscommerce_Model_Mysql4_Oscommerce::DEFAULT_OSC_CHARSET; + $defaultMageCharset = Mage_Oscommerce_Model_Mysql4_Oscommerce::DEFAULT_MAGENTO_CHARSET; + + $stores = $importModel->getResource()->getOscStores(); + + $locales = Mage::app()->getLocale()->getOptionLocales(); + $options = ''; + foreach ($locales as $locale) { + $options .= ""; + } + $html = ''; + if ($stores) { + $html .= "\n"; + foreach ($stores as $store) { + $html .= "
        " . $importModel->getResource()->convert($store['name']) . " Store"; + $html .= "oscommerce_import
        + + + oscommerce_import_type
        +
        + + oscommerce_ref
        +
        + + catalog_product_website
        +
        + + catalog_category_entity
        +
        + + oscommerce_orders
        +
        + + oscommerce_orders_products
        +
        + + oscommerce_orders_total
        +
        + + oscommerce_orders_status_history
        +
        + + + + + + Mage_Oscommerce_Block + + + + + + Mage_Oscommerce + + + + + pdo_mysql + mysql4 + 1 + + + + + + + + admin + + Mage_Oscommerce + oscommerce + + + + + + + + + + admin/observer + actionPreDispatchAdmin + + + + + + + + + + standard + + Mage_Oscommerce + oscommerce + + + + + + + oscommerce.xml + + + + + + + + + 10 + + + + diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-install-0.8.0.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-install-0.8.0.php new file mode 100755 index 0000000000..b43c33c868 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-install-0.8.0.php @@ -0,0 +1,72 @@ +startSetup(); + +$installer->run(" + +-- DROP TABLE IF EXISTS `{$this->getTable('oscommerce_import')}`; + +CREATE TABLE `{$this->getTable('oscommerce_import')}` ( + `import_id` int(10) unsigned NOT NULL auto_increment, + `name` varchar(255) default NULL, + `created_at` datetime default NULL, + `updated_at` datetime default NULL, + `host` varchar(255) NOT NULL, + `port` int(5) NOT NULL, + `db_name` varchar(255) default NULL, + `db_user` varchar(255) default NULL, + `db_password` varchar(255) default NULL, + `db_type` varchar(32) default NULL, + PRIMARY KEY (`import_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$this->getTable('oscommerce_import_type')}` ( + `type_id` int(2) unsigned NOT NULL auto_increment, + `type_code` varchar(32) NOT NULL, + `type_name` varchar(255) NOT NULL, + PRIMARY KEY (`type_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; + +insert into `{$this->getTable('oscommerce_import_type')}`(`type_id`,`type_code`,`type_name`) values (1,'store','Store'),(2,'category','Category'),(3,'product','Product'), (4,'customer','Customer'),(5,'order','Order'); + +CREATE TABLE `{$this->getTable('oscommerce_ref')}` ( + `id` int(10) unsigned NOT NULL auto_increment, + `import_id` int(10) NOT NULL, + `type_id` int(10) NOT NULL, + `value` int(10) NOT NULL, + `ref_id` int(10) NOT NULL, + `created_at` datetime default NULL, + `user_id` int(10) default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.0-0.8.1.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.0-0.8.1.php new file mode 100755 index 0000000000..1f67b26642 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.0-0.8.1.php @@ -0,0 +1,47 @@ +startSetup(); + +$installer->run(" + +DROP TABLE IF EXISTS `{$this->getTable('oscommerce_import_type')}`; + +CREATE TABLE `{$this->getTable('oscommerce_import_type')}` ( + `type_id` int(2) unsigned NOT NULL auto_increment, + `type_code` varchar(32) NOT NULL, + `type_name` varchar(255) NOT NULL, + PRIMARY KEY (`type_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +insert into `{$this->getTable('oscommerce_import_type')}`(`type_code`,`type_name`) values ('website', 'Website'),('store','Store'),('category','Category'),('product','Product'), ('customer','Customer'),('order','Order'); + +"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.1-0.8.2.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.1-0.8.2.php new file mode 100644 index 0000000000..4e0b7eaf53 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.1-0.8.2.php @@ -0,0 +1,41 @@ +startSetup(); + +$installer->run(" + +truncate `{$this->getTable('oscommerce_import_type')}`; +insert into `{$this->getTable('oscommerce_import_type')}`(`type_code`,`type_name`) values ('website', 'Website'),('store','Store'),('category','Category'),('product','Product'), ('customer','Customer'),('order','Order'),('group','Store Group'), ('taxclass', 'Product Tax Class'); + +ALTER TABLE `{$this->getTable('oscommerce_import')}` ADD table_prefix VARCHAR(32) DEFAULT NULL; + +"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.2-0.8.3.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.2-0.8.3.php new file mode 100644 index 0000000000..f1e89dca0f --- /dev/null +++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.2-0.8.3.php @@ -0,0 +1,125 @@ +startSetup(); + +$installer->run(" +CREATE TABLE IF NOT EXISTS `{$this->getTable('oscommerce_orders')}` ( + `osc_magento_id` int(11) NOT NULL auto_increment, + `orders_id` int(11) NOT NULL, + `customers_id` int(11) NOT NULL default '0', + `magento_customers_id` int(11) NOT NULL default '0', + `import_id` int(11) NOT NULL default '0', + `website_id` int(11) NOT NULL default '0', + `customers_name` varchar(64) NOT NULL default '', + `customers_company` varchar(32) default NULL, + `customers_street_address` varchar(64) NOT NULL default '', + `customers_suburb` varchar(32) default NULL, + `customers_city` varchar(32) NOT NULL default '', + `customers_postcode` varchar(10) NOT NULL default '', + `customers_state` varchar(32) default NULL, + `customers_country` varchar(32) NOT NULL default '', + `customers_telephone` varchar(32) NOT NULL default '', + `customers_email_address` varchar(96) NOT NULL default '', + `customers_address_format_id` int(5) NOT NULL default '0', + `delivery_name` varchar(64) NOT NULL default '', + `delivery_company` varchar(32) default NULL, + `delivery_street_address` varchar(64) NOT NULL default '', + `delivery_suburb` varchar(32) default NULL, + `delivery_city` varchar(32) NOT NULL default '', + `delivery_postcode` varchar(10) NOT NULL default '', + `delivery_state` varchar(32) default NULL, + `delivery_country` varchar(32) NOT NULL default '', + `delivery_address_format_id` int(5) NOT NULL default '0', + `billing_name` varchar(64) NOT NULL default '', + `billing_company` varchar(32) default NULL, + `billing_street_address` varchar(64) NOT NULL default '', + `billing_suburb` varchar(32) default NULL, + `billing_city` varchar(32) NOT NULL default '', + `billing_postcode` varchar(10) NOT NULL default '', + `billing_state` varchar(32) default NULL, + `billing_country` varchar(32) NOT NULL default '', + `billing_address_format_id` int(5) NOT NULL default '0', + `payment_method` varchar(255) NOT NULL default '', + `cc_type` varchar(20) default NULL, + `cc_owner` varchar(64) default NULL, + `cc_number` varchar(32) default NULL, + `cc_expires` varchar(4) default NULL, + `last_modified` datetime default NULL, + `date_purchased` datetime default NULL, + `orders_status` int(5) NOT NULL default '0', + `orders_date_finished` datetime default NULL, + `currency` char(3) default NULL, + `currency_value` decimal(14,6) default NULL, + `currency_symbol` char(3) default NULL, + PRIMARY KEY (`osc_magento_id`), + KEY `idx_orders_customers_id` (`customers_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `{$this->getTable('oscommerce_orders_products')}` ( + `orders_products_id` int(11) NOT NULL auto_increment, + `osc_magento_id` int(11) NOT NULL default '0', + `products_id` int(11) NOT NULL default '0', + `products_model` varchar(12) default NULL, + `products_name` varchar(64) NOT NULL default '', + `products_price` decimal(15,4) NOT NULL default '0.0000', + `final_price` decimal(15,4) NOT NULL default '0.0000', + `products_tax` decimal(7,4) NOT NULL default '0.0000', + `products_quantity` int(2) NOT NULL default '0', + PRIMARY KEY (`orders_products_id`), + KEY `idx_orders_products_osc_magento_id` (`osc_magento_id`), + KEY `idx_orders_products_products_id` (`products_id`) +) ENGINE=MyISAM CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `{$this->getTable('oscommerce_orders_total')}` ( + `orders_total_id` int(10) unsigned NOT NULL auto_increment, + `osc_magento_id` int(11) NOT NULL default '0', + `title` varchar(255) NOT NULL default '', + `text` varchar(255) NOT NULL default '', + `value` decimal(15,4) NOT NULL default '0.0000', + `class` varchar(32) NOT NULL default '', + `sort_order` int(11) NOT NULL default '0', + PRIMARY KEY (`orders_total_id`), + KEY `idx_orders_total_osc_magento_id` (`osc_magento_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `{$this->getTable('oscommerce_orders_status_history')}`( + `orders_status_history_id` int(11) NOT NULL auto_increment, + `osc_magento_id` int(11) NOT NULL default '0', + `orders_status_id` int(5) NOT NULL default '0', + `date_added` datetime NOT NULL default '0000-00-00 00:00:00', + `customer_notified` int(1) default '0', + `comments` text, + PRIMARY KEY (`orders_status_history_id`), + KEY `idx_orders_status_history_osc_magento_id` (`osc_magento_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.3-0.8.4.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.3-0.8.4.php new file mode 100644 index 0000000000..6639af1efe --- /dev/null +++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.3-0.8.4.php @@ -0,0 +1,36 @@ +startSetup(); + +$installer->run(" + ALTER TABLE `{$this->getTable('oscommerce_orders')}` ADD orders_total decimal(14,6) default NULL; +"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.4-0.8.5.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.4-0.8.5.php new file mode 100644 index 0000000000..29188c9b33 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.4-0.8.5.php @@ -0,0 +1,37 @@ +startSetup(); + +$installer->run(" + ALTER TABLE `{$this->getTable('oscommerce_orders')}` MODIFY orders_status varchar(32) default NULL; + ALTER TABLE `{$this->getTable('oscommerce_orders_status_history')}` ADD orders_status varchar(32) default NULL; +"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.5-0.8.6.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.5-0.8.6.php new file mode 100644 index 0000000000..5175b7f889 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.5-0.8.6.php @@ -0,0 +1,37 @@ +startSetup(); + +$installer->run(" + +insert into `{$this->getTable('oscommerce_import_type')}`(`type_code`,`type_name`) values ('root_category', 'Root Category'); +"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.6-0.8.7.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.6-0.8.7.php new file mode 100644 index 0000000000..24aec0da69 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.6-0.8.7.php @@ -0,0 +1,39 @@ +startSetup(); + +$installer->run(" +ALTER TABLE `{$this->getTable('oscommerce_orders')}` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `{$this->getTable('oscommerce_orders_products')}` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `{$this->getTable('oscommerce_orders_status_history')}` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `{$this->getTable('oscommerce_orders_total')}` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.7-0.8.8.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.7-0.8.8.php new file mode 100644 index 0000000000..18240c18f4 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.7-0.8.8.php @@ -0,0 +1,41 @@ +startSetup(); + +$installer->run(" +ALTER TABLE `{$this->getTable('oscommerce_orders')}` ADD purchased_year INT(4) DEFAULT NULL; +ALTER TABLE `{$this->getTable('oscommerce_orders')}` ADD purchased_month INT(2) DEFAULT NULL; +ALTER TABLE `{$this->getTable('oscommerce_orders')}` ADD purchased_day INT(2) DEFAULT NULL; +ALTER TABLE `{$this->getTable('oscommerce_orders')}` ADD modified_year INT(4) DEFAULT NULL; +ALTER TABLE `{$this->getTable('oscommerce_orders')}` ADD modified_month INT(2) DEFAULT NULL; +ALTER TABLE `{$this->getTable('oscommerce_orders')}` ADD modified_day INT(2) DEFAULT NULL; +"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.8-0.8.9.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.8-0.8.9.php new file mode 100644 index 0000000000..f934eb6915 --- /dev/null +++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.8-0.8.9.php @@ -0,0 +1,41 @@ +startSetup(); + +$installer->run(" +ALTER TABLE `{$this->getTable('oscommerce_orders')}` DROP COLUMN purchased_year; +ALTER TABLE `{$this->getTable('oscommerce_orders')}` DROP COLUMN purchased_month; +ALTER TABLE `{$this->getTable('oscommerce_orders')}` DROP COLUMN purchased_day; +ALTER TABLE `{$this->getTable('oscommerce_orders')}` DROP COLUMN modified_year; +ALTER TABLE `{$this->getTable('oscommerce_orders')}` DROP COLUMN modified_month; +ALTER TABLE `{$this->getTable('oscommerce_orders')}` DROP COLUMN modified_day; +"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.9-0.8.10.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.9-0.8.10.php new file mode 100644 index 0000000000..05f085911b --- /dev/null +++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.9-0.8.10.php @@ -0,0 +1,38 @@ +startSetup(); + +$installer->run(" + +ALTER TABLE `{$this->getTable('oscommerce_import')}` ADD send_subscription BOOL NOT NULL DEFAULT '0'; + +"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Page/Block/Html.php b/app/code/core/Mage/Page/Block/Html.php index c5de88c9b7..9abc09530f 100644 --- a/app/code/core/Mage/Page/Block/Html.php +++ b/app/code/core/Mage/Page/Block/Html.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Page/Block/Html/Breadcrumbs.php b/app/code/core/Mage/Page/Block/Html/Breadcrumbs.php index 314d5d57a1..181a136d43 100644 --- a/app/code/core/Mage/Page/Block/Html/Breadcrumbs.php +++ b/app/code/core/Mage/Page/Block/Html/Breadcrumbs.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Page/Block/Html/Footer.php b/app/code/core/Mage/Page/Block/Html/Footer.php index 9a6dace25c..b1937c4b94 100644 --- a/app/code/core/Mage/Page/Block/Html/Footer.php +++ b/app/code/core/Mage/Page/Block/Html/Footer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -45,16 +45,19 @@ protected function _construct() } /** - * Retrieve Key for caching block content + * Get cache key informative items * - * @return string + * @return array */ - public function getCacheKey() + public function getCacheKeyInfo() { - return 'PAGE_FOOTER_' . Mage::app()->getStore()->getId() - . '_' . (int)Mage::app()->getStore()->isCurrentlySecure() - . '_' . Mage::getDesign()->getPackageName() - . '_' . Mage::getDesign()->getTheme('template'); + return array( + 'PAGE_FOOTER', + Mage::app()->getStore()->getId(), + (int)Mage::app()->getStore()->isCurrentlySecure(), + Mage::getDesign()->getPackageName(), + Mage::getDesign()->getTheme('template') + ); } public function setCopyright($copyright) diff --git a/app/code/core/Mage/Page/Block/Html/Head.php b/app/code/core/Mage/Page/Block/Html/Head.php index 0774c22b92..c740aa1d02 100644 --- a/app/code/core/Mage/Page/Block/Html/Head.php +++ b/app/code/core/Mage/Page/Block/Html/Head.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Page/Block/Html/Header.php b/app/code/core/Mage/Page/Block/Html/Header.php index ca67510061..e4ce1eda75 100644 --- a/app/code/core/Mage/Page/Block/Html/Header.php +++ b/app/code/core/Mage/Page/Block/Html/Header.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Page/Block/Html/Notices.php b/app/code/core/Mage/Page/Block/Html/Notices.php index 2b437e4c90..f3a8791f9e 100644 --- a/app/code/core/Mage/Page/Block/Html/Notices.php +++ b/app/code/core/Mage/Page/Block/Html/Notices.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Page/Block/Html/Pager.php b/app/code/core/Mage/Page/Block/Html/Pager.php index 55f401f87f..096d147ea9 100644 --- a/app/code/core/Mage/Page/Block/Html/Pager.php +++ b/app/code/core/Mage/Page/Block/Html/Pager.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Page/Block/Html/Toplinks.php b/app/code/core/Mage/Page/Block/Html/Toplinks.php index f7b94c3bb1..73f2ce9e74 100644 --- a/app/code/core/Mage/Page/Block/Html/Toplinks.php +++ b/app/code/core/Mage/Page/Block/Html/Toplinks.php @@ -20,16 +20,12 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Html page block - * - * @category Mage - * @package Mage_Page - * @author Magento Core Team + * @deprecated after 1.4.0.1 */ class Mage_Page_Block_Html_Toplinks extends Mage_Core_Block_Template { diff --git a/app/code/core/Mage/Page/Block/Html/Wrapper.php b/app/code/core/Mage/Page/Block/Html/Wrapper.php index 74e52eff09..cf76848aee 100644 --- a/app/code/core/Mage/Page/Block/Html/Wrapper.php +++ b/app/code/core/Mage/Page/Block/Html/Wrapper.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Page/Block/Js/Cookie.php b/app/code/core/Mage/Page/Block/Js/Cookie.php index a1c41b9dc3..7e20a152a6 100644 --- a/app/code/core/Mage/Page/Block/Js/Cookie.php +++ b/app/code/core/Mage/Page/Block/Js/Cookie.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Page/Block/Js/Translate.php b/app/code/core/Mage/Page/Block/Js/Translate.php index b527e88444..af229bc0bd 100644 --- a/app/code/core/Mage/Page/Block/Js/Translate.php +++ b/app/code/core/Mage/Page/Block/Js/Translate.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Page/Block/Redirect.php b/app/code/core/Mage/Page/Block/Redirect.php index 9468389f5a..46577e9c3e 100644 --- a/app/code/core/Mage/Page/Block/Redirect.php +++ b/app/code/core/Mage/Page/Block/Redirect.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Page/Block/Switch.php b/app/code/core/Mage/Page/Block/Switch.php index 377c67d858..6295d977d3 100644 --- a/app/code/core/Mage/Page/Block/Switch.php +++ b/app/code/core/Mage/Page/Block/Switch.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Page/Block/Template/Container.php b/app/code/core/Mage/Page/Block/Template/Container.php index ec0a88be19..ed995571c5 100644 --- a/app/code/core/Mage/Page/Block/Template/Container.php +++ b/app/code/core/Mage/Page/Block/Template/Container.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Page/Block/Template/Links.php b/app/code/core/Mage/Page/Block/Template/Links.php index cee60bf812..c0a808a4b7 100644 --- a/app/code/core/Mage/Page/Block/Template/Links.php +++ b/app/code/core/Mage/Page/Block/Template/Links.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Page/Helper/Data.php b/app/code/core/Mage/Page/Helper/Data.php index de86728371..2e524083fc 100644 --- a/app/code/core/Mage/Page/Helper/Data.php +++ b/app/code/core/Mage/Page/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Page/Helper/Html.php b/app/code/core/Mage/Page/Helper/Html.php index ea57224c13..127cb5ddc2 100644 --- a/app/code/core/Mage/Page/Helper/Html.php +++ b/app/code/core/Mage/Page/Helper/Html.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Page/Helper/Layout.php b/app/code/core/Mage/Page/Helper/Layout.php index 380cdd7279..303934e5c8 100644 --- a/app/code/core/Mage/Page/Helper/Layout.php +++ b/app/code/core/Mage/Page/Helper/Layout.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Page/Model/Config.php b/app/code/core/Mage/Page/Model/Config.php index be627286e9..5a9aae0b3c 100644 --- a/app/code/core/Mage/Page/Model/Config.php +++ b/app/code/core/Mage/Page/Model/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Page/Model/Source/Layout.php b/app/code/core/Mage/Page/Model/Source/Layout.php index bf28b6bb36..891a5f27ea 100644 --- a/app/code/core/Mage/Page/Model/Source/Layout.php +++ b/app/code/core/Mage/Page/Model/Source/Layout.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Page/etc/config.xml b/app/code/core/Mage/Page/etc/config.xml index db80a2e40b..ed5a9c1659 100644 --- a/app/code/core/Mage/Page/etc/config.xml +++ b/app/code/core/Mage/Page/etc/config.xml @@ -1,4 +1,4 @@ - + diff --git a/app/code/core/Mage/Page/etc/system.xml b/app/code/core/Mage/Page/etc/system.xml index 85edfd883e..508371405c 100644 --- a/app/code/core/Mage/Page/etc/system.xml +++ b/app/code/core/Mage/Page/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Page - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -105,8 +105,8 @@ --> - - This will be included before head closing tag in page HTML + + This will be included before head closing tag in page HTML. textarea 70 1 @@ -114,7 +114,7 @@ 1 - + select adminhtml/system_config_source_yesno 80 @@ -176,7 +176,7 @@ - This will be displayed just before body closing tag + This will be displayed just before body closing tag. textarea 20 1 diff --git a/app/code/core/Mage/Paybox/Block/Adminhtml/Cart/Type.php b/app/code/core/Mage/Paybox/Block/Adminhtml/Cart/Type.php new file mode 100644 index 0000000000..dccf4f3c9e --- /dev/null +++ b/app/code/core/Mage/Paybox/Block/Adminhtml/Cart/Type.php @@ -0,0 +1,46 @@ + + */ +class Mage_Paybox_Block_Adminhtml_Cart_Type extends Mage_Adminhtml_Block_System_Config_Form_Field +{ + protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) + { + $additional = Mage::getSingleton('core/layout')->createBlock('paybox/adminhtml_cart_type_select') + ->setTemplate('paybox/adminhtml/cart/type/select.phtml') + ->setDependHtmlId($element->getHtmlId()) + ->toHtml(); + + return parent::_getElementHtml($element).$additional; + } + +} diff --git a/app/code/core/Mage/Paybox/Block/Adminhtml/Cart/Type/Select.php b/app/code/core/Mage/Paybox/Block/Adminhtml/Cart/Type/Select.php new file mode 100644 index 0000000000..aedbcb5094 --- /dev/null +++ b/app/code/core/Mage/Paybox/Block/Adminhtml/Cart/Type/Select.php @@ -0,0 +1,56 @@ + + */ +class Mage_Paybox_Block_Adminhtml_Cart_Type_Select extends Mage_Adminhtml_Block_Template +{ + /** + * Enter description here... + * + * @return Mage_Paybox_Model_System + */ + public function getModel() + { + return Mage::getModel('paybox/system'); + } + + public function getParentHtmlId() + { + return substr($this->getDependHtmlId(), 0, strrpos($this->getDependHtmlId(), 'typecarte')) . 'typepaiement'; + } + + public function getJsonCartTypes() + { + return $this->getModel()->getJsonCartTypes(); + } + +} diff --git a/app/code/core/Mage/Paybox/Block/Direct/Form.php b/app/code/core/Mage/Paybox/Block/Direct/Form.php new file mode 100644 index 0000000000..cb070ae20d --- /dev/null +++ b/app/code/core/Mage/Paybox/Block/Direct/Form.php @@ -0,0 +1,42 @@ + + */ +class Mage_Paybox_Block_Direct_Form extends Mage_Payment_Block_Form_Cc +{ + protected function _construct() + { + parent::_construct(); + $this->setTemplate('paybox/direct/form.phtml'); + } + +} diff --git a/app/code/core/Mage/Paybox/Block/Direct/Info.php b/app/code/core/Mage/Paybox/Block/Direct/Info.php new file mode 100644 index 0000000000..c8673e86b7 --- /dev/null +++ b/app/code/core/Mage/Paybox/Block/Direct/Info.php @@ -0,0 +1,48 @@ + + */ +class Mage_Paybox_Block_Direct_Info extends Mage_Payment_Block_Info_Cc +{ + protected function _construct() + { + parent::_construct(); + $this->setTemplate('paybox/direct/info.phtml'); + } + + public function toPdf() + { + $this->setTemplate('paybox/direct/pdf/info.phtml'); + return $this->toHtml(); + } + +} diff --git a/app/code/core/Mage/Paybox/Block/System/Error.php b/app/code/core/Mage/Paybox/Block/System/Error.php new file mode 100644 index 0000000000..7b45903951 --- /dev/null +++ b/app/code/core/Mage/Paybox/Block/System/Error.php @@ -0,0 +1,93 @@ + + */ +class Mage_Paybox_Block_System_Error extends Mage_Core_Block_Template +{ + + /** + * Error messages desciptions + * + * @var array + */ + protected $_pbxErrorsDesc; + + /** + * Enter description here... + * + * @return Mage_Checkout_Model_Session + */ + public function getCheckout() + { + return Mage::getSingleton('checkout/session'); + } + + public function getErrorMessage() + { + if (empty($this->_pbxErrorsDesc)) { + $this->_pbxErrorsDesc = array( + '-1' => 'Error in reading the parameters via stdin (POST method) (error in http reception)', + '-2' => 'Error in memory allocation. Not enough memory available on the trader\'s server', + '-3' => 'Error in reading the parameters QUERY_STRING or CONTENT_LENGTH. (http error)', + '-4' => 'PBX_RETOUR, PBX_ANNULE, PBX_REFUSE or PBX_EFFECTUE are too long (<150 characters)', + '-5' => 'Error in opening the file (if PBX_MODE contains 3) : local file non-existent, not found or access error', + '-6' => 'Error in file format (if PBX_MODE contains 3) : local file badly formed, empty or lines are badly formatted', + '-7' => 'A compulsory variable is missing (PBX_SITE, PBX_RANG, PBX_IDENTIFIANT, PBX_TOTAL, PBX_CMD, etc.)', + '-8' => 'One of the numerical variables contains a non-numerical character (site, rank, identifier, amount, currency etc.)', + '-9' => 'PBX_SITE contains a site number which does not consist of exactly 7 characters', + '-10' => 'PBX_RANG contains a rank number which does not consist of exactly 2 characters', + '-11' => 'PBX_TOTAL has more than 10 or fewer than 3 numerical characters', + '-12' => 'PBX_LANGUE or PBX_DEVISE contains a code which does not contain exactly 3 characters', + '-13' => 'PBX_CMD is empty or contains a reference longer than 250 characters', + '-14' => '', + '-15' => '', + '-16' => 'PBX_PORTEUR does not contain a valid e-mail address', + '-17' => 'Error of coherence (multi-baskets) : Reserved Future Usage', + ); + } + $msg = Mage::helper('paybox')->__($this->_pbxErrorsDesc[$this->getCheckout()->getPayboxErrorNumber()]); + $this->getCheckout()->unsPayboxErrorNumber(); + return $msg; + } + + /** + * Get continue shopping url + * + * @return string + */ + public function getContinueShoppingUrl() + { + return Mage::getUrl('checkout/cart', array('_secure' => true)); + } + +} diff --git a/app/code/core/Mage/Paybox/Block/System/Failure.php b/app/code/core/Mage/Paybox/Block/System/Failure.php new file mode 100644 index 0000000000..800a02e16c --- /dev/null +++ b/app/code/core/Mage/Paybox/Block/System/Failure.php @@ -0,0 +1,61 @@ + + */ +class Mage_Paybox_Block_System_Failure extends Mage_Core_Block_Template +{ + /** + * Enter description here... + * + * @return Mage_Checkout_Model_Session + */ + public function getCheckout() + { + return Mage::getSingleton('checkout/session'); + } + + public function getErrorMessage() + { + $msg = Mage::helper('paybox')->__($this->getCheckout()->getPayboxErrorMessage()); + $this->getCheckout()->unsPayboxErrorMessage(); + return $msg; + } + + /** + * Get continue shopping url + */ + public function getContinueShoppingUrl() + { + return Mage::getUrl('checkout/cart', array('_secure' => true)); + } +} diff --git a/app/code/core/Mage/Paybox/Block/System/Form.php b/app/code/core/Mage/Paybox/Block/System/Form.php new file mode 100644 index 0000000000..9bc040d16c --- /dev/null +++ b/app/code/core/Mage/Paybox/Block/System/Form.php @@ -0,0 +1,42 @@ + + */ +class Mage_Paybox_Block_System_Form extends Mage_Payment_Block_Form +{ + protected function _construct() + { + $this->setTemplate('paybox/system/form.phtml'); + parent::_construct(); + } +} diff --git a/app/code/core/Mage/Paybox/Block/System/Redirect.php b/app/code/core/Mage/Paybox/Block/System/Redirect.php new file mode 100644 index 0000000000..23b13daef5 --- /dev/null +++ b/app/code/core/Mage/Paybox/Block/System/Redirect.php @@ -0,0 +1,57 @@ + + */ +class Mage_Paybox_Block_System_Redirect extends Mage_Core_Block_Abstract +{ + protected function _toHtml() + { + $system = $this->getOrder()->getPayment()->getMethodInstance(); + + $form = new Varien_Data_Form(); + $form->setAction(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).$system->getPayboxFile()) + ->setId('paybox_system_checkout') + ->setName('paybox_system_checkout') + ->setMethod('POST') + ->setUseContainer(true); + foreach ($system->getFormFields() as $field=>$value) { + $form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value)); + } + $html = ''; + $html.= $this->__('You will be redirected to Paybox in a few seconds.'); + $html.= $form->toHtml(); + $html.= ''; + $html.= ''; + + return $html; + } +} diff --git a/app/code/core/Mage/Paygate/Model/Payflow/Pro/Request.php b/app/code/core/Mage/Paybox/Helper/Data.php similarity index 79% rename from app/code/core/Mage/Paygate/Model/Payflow/Pro/Request.php rename to app/code/core/Mage/Paybox/Helper/Data.php index 6f2752b133..1a3a962789 100644 --- a/app/code/core/Mage/Paygate/Model/Payflow/Pro/Request.php +++ b/app/code/core/Mage/Paybox/Helper/Data.php @@ -19,20 +19,19 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Mage - * @package Mage_Paygate - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @package Mage_Paybox + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Payflow Pro Request Model + * Paybox data helper * * @category Mage - * @package Mage_Paygate + * @package Mage_Paybox * @author Magento Core Team */ - -class Mage_Paygate_Model_Payflow_Pro_Request extends Varien_Object +class Mage_Paybox_Helper_Data extends Mage_Core_Helper_Abstract { } diff --git a/app/code/core/Mage/Paybox/Model/Api/Debug.php b/app/code/core/Mage/Paybox/Model/Api/Debug.php new file mode 100644 index 0000000000..7cd1dae547 --- /dev/null +++ b/app/code/core/Mage/Paybox/Model/Api/Debug.php @@ -0,0 +1,40 @@ + + */ +class Mage_Paybox_Model_Api_Debug extends Mage_Core_Model_Abstract +{ + protected function _construct() + { + $this->_init('paybox/api_debug'); + } +} diff --git a/app/code/core/Mage/Paybox/Model/Direct.php b/app/code/core/Mage/Paybox/Model/Direct.php new file mode 100644 index 0000000000..c67e934f6f --- /dev/null +++ b/app/code/core/Mage/Paybox/Model/Direct.php @@ -0,0 +1,503 @@ + + */ +class Mage_Paybox_Model_Direct extends Mage_Payment_Model_Method_Cc +{ + /** + * Paybox direct payment actions + */ + const PBX_PAYMENT_ACTION_ATHORIZE = '00001'; + const PBX_PAYMENT_ACTION_DEBIT = '00002'; + const PBX_PAYMENT_ACTION_ATHORIZE_CAPTURE = '00003'; + const PBX_PAYMENT_ACTION_CANCELLATION = '00005'; + const PBX_PAYMENT_ACTION_REFUND = '00004'; + + const PBX_VERSION = '00103'; + + /** + * ECL(Electronic Commerce Indicator). + * Type of ordering items. Need for some banks. + * 024 - request by internet + */ + const PBX_ACTIVITE_VALUE = '024'; + + protected $_code = 'paybox_direct'; + + protected $_isGateway = true; + protected $_canAuthorize = true; + protected $_canCapture = true; + protected $_canCapturePartial = false; + protected $_canRefund = true; + protected $_canVoid = false; + protected $_canUseInternal = true; + protected $_canUseCheckout = true; + protected $_canUseForMultishipping = true; + protected $_canSaveCc = true; + + protected $_formBlockType = 'paybox/direct_form'; + protected $_infoBlockType = 'paybox/direct_info'; + + protected $_order; + protected $_currenciesNumbers; + protected $_questionNumberModel; + + /** + * Return paybox gateway url. + * If $recallNumber > 0 (primary url is not available) return url of backup gateway + * + * @param integer $recallNumber + * @return string + */ + public function getPayboxUrl($recallNumber) + { + $path = 'pbx_url'; + if ($recallNumber) { + $path = 'pbx_backupurl'; + } + return $this->getConfigData($path); + } + + /** + * Get Payment Action of Paybox Direct, + * changed to Paybox specification + * + * @return string + */ + public function getPaymentAction() + { + $paymentAction = $this->getConfigData('payment_action'); + switch ($paymentAction) { + case self::ACTION_AUTHORIZE: + return self::PBX_PAYMENT_ACTION_ATHORIZE; + break; + case self::ACTION_AUTHORIZE_CAPTURE: + return self::PBX_PAYMENT_ACTION_ATHORIZE_CAPTURE; + break; + default: + return self::PBX_PAYMENT_ACTION_ATHORIZE; + break; + } + } + + /** + * Return site number of account (TPE) + * + * @return string + */ + public function getSiteNumber() + { + return $this->getConfigData('pbx_site'); + } + + /** + * Return rang number of account + * + * @return string + */ + public function getRang() + { + return $this->getConfigData('pbx_rang'); + } + + /** + * Return Cle number of account + * + * @return string + */ + public function getCleNumber() + { + return $this->getConfigData('pbx_cle'); + } + + /** + * Return currency number in ISO4217 format + * + * @return string + */ + public function getCurrencyNumb() + { + $currencyCode = $this->getPayment()->getOrder()->getBaseCurrencyCode(); + if (!$this->_currenciesNumbers) { + $this->_currenciesNumbers = simplexml_load_file(Mage::getBaseDir().'/app/code/core/Mage/Paybox/etc/currency.xml'); + } + if ($this->_currenciesNumbers->$currencyCode) { + return (string)$this->_currenciesNumbers->$currencyCode; + } + } + + /** + * Return model of Question Number + * + * @return Mage_Paybox_Model_Question_Number + */ + public function getQuestionNumberModel() + { + if (!$this->_questionNumberModel) { + $accountHash = md5($this->getSiteNumber().$this->getRang()); + $this->_questionNumberModel = Mage::getModel('paybox/question_number')->load($accountHash, 'account_hash'); + } + return $this->_questionNumberModel; + } + + /** + * Return Debug Flag + * + * @return string + */ + public function getDebugFlag() + { + return $this->getConfigData('debug_flag'); + } + + public function authorize(Varien_Object $payment, $amount) + { + parent::authorize($payment, $amount); + + $this->setAmount($amount) + ->setPayment($payment); + + if ($this->callDoDirectPayment()!==false) { + $payment->setStatus(self::STATUS_APPROVED) + ->setLastTransId($this->getTransactionId()) + ->setPayboxRequestNumber($this->getRequestNumber()) + ->setPayboxQuestionNumber($this->getQuestionNumber()); + } else { + $e = $this->getError(); + if (isset($e['message'])) { + $message = Mage::helper('paybox')->__('There has been an error processing your payment. ') . $e['message']; + } else { + $message = Mage::helper('paybox')->__('There has been an error processing your payment. Please try later or contact us for help.'); + } + Mage::throwException($message); + } + + return $this; + } + + public function capture(Varien_Object $payment, $amount) + { + parent::capture($payment, $amount); + + $this->setAmount($amount) + ->setPayment($payment); + + if ($payment->getLastTransId()) {//if after authorize + $result = $this->callDoDebitPayment()!==false; + } else {//authorize+capture (debit) + $result = $this->callDoDirectPayment()!==false; + } + + if ($result) { + $payment->setStatus(self::STATUS_APPROVED) + ->setLastTransId($this->getTransactionId()) + ->setPayboxRequestNumber($this->getRequestNumber()); + } else { + $e = $this->getError(); + if (isset($e['message'])) { + $message = Mage::helper('paybox')->__('There has been an error processing your payment. ') . $e['message']; + } else { + $message = Mage::helper('paybox')->__('There has been an error processing your payment. Please try later or contact us for help.'); + } + Mage::throwException($message); + } + + return $this; + } + + public function cancel(Varien_Object $payment) + { + $payment->setStatus(self::STATUS_DECLINED); + return $this; + } + + public function refund(Varien_Object $payment, $amount) + { + parent::refund($payment, $amount); + + $error = false; + if($payment->getRefundTransactionId() && $amount>0) { + $this->setTransactionId($payment->getRefundTransactionId()) + ->setPayment($payment) + ->setAmount($amount); + + if ($this->callDoRefund()!==false) { + $payment->setStatus(self::STATUS_SUCCESS) + ->setCcTransId($this->getTransactionId()); + } else { + $payment->setStatus(self::STATUS_ERROR); + $e = $this->getError(); + if (isset($e['message'])) { + $error = $e['message']; + } else { + $error = Mage::helper('paybox')->__('Error in refunding the payment'); + } + } + } else { + $payment->setStatus(self::STATUS_ERROR); + $error = Mage::helper('paybox')->__('Error in refunding the payment'); + } + if ($error !== false) { + Mage::throwException($error); + } + + return $this; + } + + /** + * Building array of params for direct payment + * + * @return bool | array + */ + public function callDoDirectPayment() + { + $payment = $this->getPayment(); + $requestStr = ''; + + $tmpArr = array( + 'VERSION' => self::PBX_VERSION, + 'DATEQ' => Mage::getModel('core/date')->date('dmYHis'), + 'TYPE' => $this->getPaymentAction(), + 'NUMQUESTION' => $this->getQuestionNumberModel()->getNextQuestionNumber(), + 'SITE' => $this->getSiteNumber(), + 'RANG' => $this->getRang(), + 'CLE' => $this->getCleNumber(), + 'IDENTIFIANT' => '', + 'MONTANT' => ($this->getAmount()*100), + 'DEVISE' => $this->getCurrencyNumb(), + 'REFERENCE' => base64_encode($payment->getOrder()->getRealOrderId()), + 'PORTEUR' => $payment->getCcNumber(), + 'DATEVAL' => Mage::getModel('core/date')->date('my', mktime(0,0,0,$payment->getCcExpMonth(),1,$payment->getCcExpYear())), + 'CVV' => $payment->getCcCid(), + 'ACTIVITE' => self::PBX_ACTIVITE_VALUE, + ); + + foreach ($tmpArr as $param=>$value) { + $requestStr .= $param . '=' . $value . '&'; + } + $requestStr = substr($requestStr, 0, -1); + + $resultArr = $this->call($requestStr); + + if ($resultArr === false) { + return false; + } + + $this->getQuestionNumberModel() + ->increaseQuestionNumber(); + + $this->setTransactionId($resultArr['NUMTRANS']); + $this->setRequestNumber($resultArr['NUMAPPEL']); + $this->setQuestionNumber($resultArr['NUMQUESTION']); + + return $resultArr; + } + + /** + * Building array of params for debit (after authorize) + * + * @return bool | array + */ + public function callDoDebitPayment() + { + $payment = $this->getPayment(); + $requestStr = ''; + + $tmpArr = array( + 'VERSION' => self::PBX_VERSION, + 'DATEQ' => Mage::getModel('core/date')->date('dmYHis'), + 'TYPE' => self::PBX_PAYMENT_ACTION_DEBIT, + 'NUMQUESTION' => $payment->getPayboxQuestionNumber(), + 'SITE' => $this->getSiteNumber(), + 'RANG' => $this->getRang(), + 'CLE' => $this->getCleNumber(), + 'MONTANT' => ($this->getAmount()*100), + 'DEVISE' => (string)$this->getCurrencyNumb(), + 'REFERENCE' => base64_encode($payment->getOrder()->getRealOrderId()), + 'NUMAPPEL' => $payment->getPayboxRequestNumber(), + 'NUMTRANS' => $payment->getLastTransId(), + ); + + foreach ($tmpArr as $param=>$value) { + $requestStr .= $param . '=' . $value . '&'; + } + $requestStr = substr($requestStr, 0, -1); + + $resultArr = $this->call($requestStr); + + if ($resultArr === false) { + return false; + } + + $this->setTransactionId($resultArr['NUMTRANS']); + + return $resultArr; + } + + /** + * Building array of params for refund + * + * @return bool | array + */ + public function callDoRefund() + { + $payment = $this->getPayment(); + $requestStr = ''; + + $tmpArr = array( + 'VERSION' => self::PBX_VERSION, + 'DATEQ' => Mage::getModel('core/date')->date('dmYHis'), + 'TYPE' => self::PBX_PAYMENT_ACTION_REFUND, + 'NUMQUESTION' => $this->getQuestionNumberModel()->getNextQuestionNumber(), + 'SITE' => $this->getSiteNumber(), + 'RANG' => $this->getRang(), + 'CLE' => $this->getCleNumber(), + 'MONTANT' => ($this->getAmount()*100), + 'DEVISE' => (string)$this->getCurrencyNumb(), + 'REFERENCE' => base64_encode($payment->getOrder()->getRealOrderId()), + 'PORTEUR' => $payment->getCcNumber(), + 'DATEVAL' => Mage::getModel('core/date')->date('my', mktime(0,0,0,$payment->getCcExpMonth(),1,$payment->getCcExpYear())), + 'NUMAPPEL' => '', + 'NUMTRANS' => '', + ); + + foreach ($tmpArr as $param=>$value) { + $requestStr .= $param . '=' . $value . '&'; + } + $requestStr = substr($requestStr, 0, -1); + + $resultArr = $this->call($requestStr); + + if ($resultArr === false) { + return false; + } + + $this->getQuestionNumberModel() + ->increaseQuestionNumber(); + + $this->setTransactionId($resultArr['NUMTRANS']); + + return $resultArr; + } + + /** + * Making a call to gateway + * + * @param string $requestStr + * @return bool | array + */ + public function call($requestStr) + { + $debugData = array('request' => $requestStr); + + $recall = true; + $recallCounter = 0; + while ($recall && $recallCounter < 3) { + $recall = false; + $this->unsError(); + + $http = new Varien_Http_Adapter_Curl(); + $config = array('timeout' => 30); + $http->setConfig($config); + $http->write(Zend_Http_Client::POST, $this->getPayboxUrl($recallCounter), '1.1', array(), $requestStr); + $response = $http->read(); + + $response = preg_split('/^\r?$/m', $response, 2); + $response = trim($response[1]); + + if ($http->getErrno()) { + $http->close(); + + $debugData['result'] = $response; + $this->_debug($debugData); + + $this->setError(array( + 'message' => $http->getError() + )); + return false; + } + $http->close(); + + $parsedResArr = $this->parseResponseStr($response); + + //primary gateway is down, need to recall to backup gateway + if ($parsedResArr['CODEREPONSE'] == '00001' || + $parsedResArr['CODEREPONSE'] == '00097' || + $parsedResArr['CODEREPONSE'] == '00098' + ) { + $recallCounter++; + $recall = true; + } + } + + $debugData['result'] = $response; + $this->_debug($debugData); + + //if backup gateway was down too + if ($recall) { + $this->setError(array( + 'message' => Mage::helper('paybox')->__('Paybox payment gateway is not available right now') + )); + return false; + } + + if ($parsedResArr['CODEREPONSE'] == '00000') { + return $parsedResArr; + } + + if (isset($parsedResArr['COMMENTAIRE'])) { + $this->setError(array( + 'message' => $parsedResArr['CODEREPONSE'] . ':' . $parsedResArr['COMMENTAIRE'] + )); + } + + return false; + } + + /** + * Parsing response string + * + * @param string $str + * @return array + */ + public function parseResponseStr($str) + { + $tmpResponseArr = explode('&', $str); + $responseArr = array(); + foreach ($tmpResponseArr as $response) { + $paramValue = explode('=', $response); + $responseArr[$paramValue[0]] = $paramValue[1]; + } + + return $responseArr; + } +} diff --git a/app/code/core/Mage/Paybox/Model/Mysql4/Api/Debug.php b/app/code/core/Mage/Paybox/Model/Mysql4/Api/Debug.php new file mode 100644 index 0000000000..1010087c21 --- /dev/null +++ b/app/code/core/Mage/Paybox/Model/Mysql4/Api/Debug.php @@ -0,0 +1,40 @@ + + */ +class Mage_Paybox_Model_Mysql4_Api_Debug extends Mage_Core_Model_Mysql4_Abstract +{ + protected function _construct() + { + $this->_init('paybox/api_debug', 'debug_id'); + } +} diff --git a/app/code/core/Mage/Paypal/Model/Mysql4/Api/Debug/Collection.php b/app/code/core/Mage/Paybox/Model/Mysql4/Api/Debug/Collection.php similarity index 76% rename from app/code/core/Mage/Paypal/Model/Mysql4/Api/Debug/Collection.php rename to app/code/core/Mage/Paybox/Model/Mysql4/Api/Debug/Collection.php index dd08cd6b49..ca2bf8f10c 100644 --- a/app/code/core/Mage/Paypal/Model/Mysql4/Api/Debug/Collection.php +++ b/app/code/core/Mage/Paybox/Model/Mysql4/Api/Debug/Collection.php @@ -19,21 +19,22 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Mage - * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @package Mage_Paybox + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** + * Paybox Api Debug Mysql4 collection model * - * PayPal API Debug Resource Collection - * + * @category Mage + * @package Mage_Paybox * @author Magento Core Team */ -class Mage_Paypal_Model_Mysql4_Api_Debug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract +class Mage_Paybox_Model_Mysql4_Api_Debug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract { protected function _construct() { - $this->_init('paypal/api_debug'); + $this->_init('paybox/api_debug'); } } diff --git a/app/code/core/Mage/Paybox/Model/Mysql4/Question/Number.php b/app/code/core/Mage/Paybox/Model/Mysql4/Question/Number.php new file mode 100644 index 0000000000..0f594f7439 --- /dev/null +++ b/app/code/core/Mage/Paybox/Model/Mysql4/Question/Number.php @@ -0,0 +1,41 @@ + + */ +class Mage_Paybox_Model_Mysql4_Question_Number extends Mage_Core_Model_Mysql4_Abstract +{ + protected function _construct() + { + $this->_init('paybox/question_number', 'account_id'); + } + +} diff --git a/app/code/core/Mage/Paybox/Model/Mysql4/Setup.php b/app/code/core/Mage/Paybox/Model/Mysql4/Setup.php new file mode 100644 index 0000000000..fd6e167554 --- /dev/null +++ b/app/code/core/Mage/Paybox/Model/Mysql4/Setup.php @@ -0,0 +1,37 @@ + + */ +class Mage_Paybox_Model_Mysql4_Setup extends Mage_Sales_Model_Mysql4_Setup +{ + +} diff --git a/app/code/core/Mage/Paybox/Model/Question/Number.php b/app/code/core/Mage/Paybox/Model/Question/Number.php new file mode 100644 index 0000000000..af183a89e5 --- /dev/null +++ b/app/code/core/Mage/Paybox/Model/Question/Number.php @@ -0,0 +1,95 @@ + + */ +class Mage_Paybox_Model_Question_Number extends Mage_Core_Model_Abstract +{ + /** + * Max value of question number + */ + const MAX_QUESTION_NUMBER_VALUE = 2147483647; + + protected $_accountHash; + + protected function _construct() + { + $this->_init('paybox/question_number'); + } + + public function load($id, $field=null) + { + $this->_accountHash = $id; + return parent::load($id, $field); + } + + protected function _afterLoad() + { + //need to create new record (with default data) if it first time using of paybox direct + if (!$this->getAccountHash()) { + $this->setAccountHash($this->_accountHash); + $this->setIncrementValue(1); + $this->save(); + } + unset($this->_accountHash); + + //need to set default value of question number if it reach max value + if ($this->getIncrementValue() >= self::MAX_QUESTION_NUMBER_VALUE) { + $this->setResetDate('CURRENT_TIMESTAMP') + ->setIncrementValue(1); + } + + return parent::_afterLoad(); + } + + /** + * Return next number formated to paybox specification + * + * @return string + */ + public function getNextQuestionNumber() + { + $questionNumber = $this->getIncrementValue()+1; + return sprintf('%010d', $questionNumber); + } + + /** + * Increase question number and save it after successful transaction + * + * @return Mage_Paybox_Model_Question_Number + */ + public function increaseQuestionNumber() + { + $this->setIncrementValue($this->getIncrementValue()+1) + ->save(); + return $this; + } +} diff --git a/app/code/core/Mage/Paybox/Model/Source/CartType.php b/app/code/core/Mage/Paybox/Model/Source/CartType.php new file mode 100644 index 0000000000..511129682d --- /dev/null +++ b/app/code/core/Mage/Paybox/Model/Source/CartType.php @@ -0,0 +1,61 @@ + + */ +class Mage_Paybox_Model_Source_CartType +{ + /** + * Enter description here... + * + * @return Mage_Paybox_Model_System + */ + public function getModel() + { + return Mage::getModel('paybox/system'); + } + + public function toOptionArray() + { + $cartTypesArr = array(); + $tmpArr = $this->getModel()->getCartTypesByPayment($this->getModel()->getPaymentType()); + + foreach ($tmpArr as $code => $name) { + $cartTypesArr[] = array( + 'value' => $code, + 'label' => $name + ); + } + + return $cartTypesArr; + } +} diff --git a/app/code/core/Mage/Paybox/Model/Source/Cctype.php b/app/code/core/Mage/Paybox/Model/Source/Cctype.php new file mode 100644 index 0000000000..46597d3088 --- /dev/null +++ b/app/code/core/Mage/Paybox/Model/Source/Cctype.php @@ -0,0 +1,40 @@ + + */ +class Mage_Paybox_Model_Source_Cctype extends Mage_Payment_Model_Source_Cctype +{ + public function getAllowedTypes() + { + return array('VI', 'MC', 'AE', 'OT'); + } +} diff --git a/app/code/core/Mage/Paybox/Model/Source/Language.php b/app/code/core/Mage/Paybox/Model/Source/Language.php new file mode 100644 index 0000000000..cc5b3bb3e5 --- /dev/null +++ b/app/code/core/Mage/Paybox/Model/Source/Language.php @@ -0,0 +1,50 @@ + + */ +class Mage_Paybox_Model_Source_Language +{ + public function toOptionArray() + { + return array( +// array('value' => Mage_Paypal_Model_Api_Abstract::PAYMENT_TYPE_AUTH, 'label' => Mage::helper('paypal')->__('Authorization')), + array('value' => 'FRA', 'label' => Mage::helper('paybox')->__('FRA (French)')), + array('value' => 'GBR', 'label' => Mage::helper('paybox')->__('GBR (English)')), + array('value' => 'ESP', 'label' => Mage::helper('paybox')->__('ESP (Spanish)')), + array('value' => 'ITA', 'label' => Mage::helper('paybox')->__('ITA (Italian)')), + array('value' => 'DEU', 'label' => Mage::helper('paybox')->__('DEU (German)')), + array('value' => 'NLD', 'label' => Mage::helper('paybox')->__('NLD (Dutch)')), + array('value' => 'SWE', 'label' => Mage::helper('paybox')->__('SWE (Swedish)')), + ); + } +} diff --git a/app/code/core/Mage/Paybox/Model/Source/ManagementMode.php b/app/code/core/Mage/Paybox/Model/Source/ManagementMode.php new file mode 100644 index 0000000000..36e4e57108 --- /dev/null +++ b/app/code/core/Mage/Paybox/Model/Source/ManagementMode.php @@ -0,0 +1,48 @@ + + */ +class Mage_Paybox_Model_Source_ManagementMode +{ + public function toOptionArray() + { + return array( +// array('value' => Mage_Paypal_Model_Api_Abstract::PAYMENT_TYPE_AUTH, 'label' => Mage::helper('paypal')->__('Authorization')), + array('value' => 'A', 'label' => Mage::helper('paybox')->__('Mode A')), + array('value' => 'B', 'label' => Mage::helper('paybox')->__('Mode B')), + array('value' => 'C', 'label' => Mage::helper('paybox')->__('Mode C')), + array('value' => 'D', 'label' => Mage::helper('paybox')->__('Mode D')), + array('value' => 'E', 'label' => Mage::helper('paybox')->__('Mode E')), + ); + } +} diff --git a/app/code/core/Mage/Paybox/Model/Source/MethodCall.php b/app/code/core/Mage/Paybox/Model/Source/MethodCall.php new file mode 100644 index 0000000000..59a37b54aa --- /dev/null +++ b/app/code/core/Mage/Paybox/Model/Source/MethodCall.php @@ -0,0 +1,45 @@ + + */ +class Mage_Paybox_Model_Source_MethodCall +{ + public function toOptionArray() + { + return array( +// array('value' => Mage_Paypal_Model_Api_Abstract::PAYMENT_TYPE_AUTH, 'label' => Mage::helper('paypal')->__('Authorization')), + array('value' => 'GET', 'label' => Mage::helper('paybox')->__('GET')), + array('value' => 'POST', 'label' => Mage::helper('paybox')->__('POST')), + ); + } +} diff --git a/app/code/core/Mage/Paybox/Model/Source/PaymentAction.php b/app/code/core/Mage/Paybox/Model/Source/PaymentAction.php new file mode 100644 index 0000000000..12435a38ef --- /dev/null +++ b/app/code/core/Mage/Paybox/Model/Source/PaymentAction.php @@ -0,0 +1,43 @@ + + */ +class Mage_Paybox_Model_Source_PaymentAction +{ + public function toOptionArray() + { + return array( + array('value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE, 'label' => Mage::helper('paybox')->__('Authorization')), + array('value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE, 'label' => Mage::helper('paybox')->__('Payment')), + ); + } +} diff --git a/app/code/core/Mage/Paybox/Model/Source/PaymentMode.php b/app/code/core/Mage/Paybox/Model/Source/PaymentMode.php new file mode 100644 index 0000000000..9474400562 --- /dev/null +++ b/app/code/core/Mage/Paybox/Model/Source/PaymentMode.php @@ -0,0 +1,45 @@ + + */ +class Mage_Paybox_Model_Source_PaymentMode +{ + public function toOptionArray() + { + return array( +// array('value' => Mage_Paypal_Model_Api_Abstract::PAYMENT_TYPE_AUTH, 'label' => Mage::helper('paypal')->__('Authorization')), + array('value' => 1, 'label' => Mage::helper('paybox')->__('HTML Form')), + array('value' => 4, 'label' => Mage::helper('paybox')->__('Command Line Mode')), + ); + } +} diff --git a/app/code/core/Mage/Paybox/Model/Source/PaymentType.php b/app/code/core/Mage/Paybox/Model/Source/PaymentType.php new file mode 100644 index 0000000000..5de3c38fac --- /dev/null +++ b/app/code/core/Mage/Paybox/Model/Source/PaymentType.php @@ -0,0 +1,48 @@ + + */ +class Mage_Paybox_Model_Source_PaymentType +{ + public function toOptionArray() + { + return array( + array('value' => '', 'label' => Mage::helper('paybox')->__('--Please Select--')), + array('value' => Mage_Paybox_Model_System::PBX_PAYMENT_TYPE_CARTE, 'label' => Mage::helper('paybox')->__('CARTE')), + array('value' => Mage_Paybox_Model_System::PBX_PAYMENT_TYPE_SYMPASS, 'label' => Mage::helper('paybox')->__('SYMPASS')), + array('value' => Mage_Paybox_Model_System::PBX_PAYMENT_TYPE_PAYNOVA , 'label' => Mage::helper('paybox')->__('PAYNOVA')), + array('value' => Mage_Paybox_Model_System::PBX_PAYMENT_TYPE_TERMINEO, 'label' => Mage::helper('paybox')->__('TERMINEO')), + array('value' => Mage_Paybox_Model_System::PBX_PAYMENT_TYPE_PAYPAL, 'label' => Mage::helper('paybox')->__('PAYPAL')), + ); + } +} diff --git a/app/code/core/Mage/Paybox/Model/System.php b/app/code/core/Mage/Paybox/Model/System.php new file mode 100644 index 0000000000..e803ba7a25 --- /dev/null +++ b/app/code/core/Mage/Paybox/Model/System.php @@ -0,0 +1,517 @@ + + */ +class Mage_Paybox_Model_System extends Mage_Payment_Model_Method_Abstract +{ + /** + * Paybox const variables + */ + const PBX_FORM_HTML_METHOD = 1; + const PBX_COMMAND_LINE_METHOD = 4; + + const PBX_METHOD_CALL = 'POST'; + + const PBX_PAYMENT_ACTION_ATHORIZE = 'O'; + const PBX_PAYMENT_ACTION_ATHORIZE_CAPTURE = 'N'; + + const PBX_PAYMENT_TYPE_CARTE = 'CARTE'; + const PBX_PAYMENT_TYPE_SYMPASS = 'SYMPASS'; + const PBX_PAYMENT_TYPE_PAYNOVA = 'PAYNOVA'; + const PBX_PAYMENT_TYPE_TERMINEO = 'TERMINEO'; + const PBX_PAYMENT_TYPE_PAYPAL = 'PAYPAL'; + + const PBX_CARTE_TYPE_CB = 'CB'; + const PBX_CARTE_TYPE_VISA = 'VISA'; + const PBX_CARTE_TYPE_EUROCARDMASTERCARD = 'EUROCARD_MASTERCARD'; + const PBX_CARTE_TYPE_ECARD = 'E_CARD'; + const PBX_CARTE_TYPE_AMEX = 'AMEX'; + const PBX_CARTE_TYPE_DINERS = 'DINERS'; + const PBX_CARTE_TYPE_JCB = 'JCB'; + const PBX_CARTE_TYPE_AURORE = 'AURORE'; + const PBX_CARTE_TYPE_PAYNOVA = 'PAYNOVA'; + const PBX_CARTE_TYPE_TERMINEO = 'TERMINEO'; + const PBX_CARTE_TYPE_PAYPAL = 'PAYPAL'; + + protected $_code = 'paybox_system'; + + protected $_isGateway = false; + protected $_canAuthorize = true; + protected $_canCapture = false; + protected $_canCapturePartial = false; + protected $_canRefund = false; + protected $_canVoid = false; + protected $_canUseInternal = false; + protected $_canUseCheckout = true; + protected $_canUseForMultishipping = false; + + protected $_formBlockType = 'paybox/system_form'; + + protected $_order; + protected $_cartTypes; + protected $_currenciesNumbers; + + /** + * Get order model + * + * @return Mage_Sales_Model_Order + */ + public function getOrder() + { + if (!$this->_order) { + $paymentInfo = $this->getInfoInstance(); + $this->_order = Mage::getModel('sales/order') + ->loadByIncrementId($paymentInfo->getOrder()->getRealOrderId()); + } + return $this->_order; + } + + /** + * Set order + * + * @param Mage_Sales_Model_Order $order + */ + public function setOrder(Mage_Sales_Model_Order $order) + { + $this->_order = $order; + return $this; + } + + /** + * Get cart types for all payment types + * or for given payment type + * + * @param string $paymentType + * @return array + */ + protected function _getCartTypes($paymentType = null) + { + if (!$this->_cartTypes) { + $this->_cartTypes = array( + self::PBX_PAYMENT_TYPE_CARTE => array( + 'none' => Mage::helper('paybox')->__('Customer Choise'), + self::PBX_CARTE_TYPE_CB => Mage::helper('paybox')->__('CB'), + self::PBX_CARTE_TYPE_VISA => Mage::helper('paybox')->__('VISA'), + self::PBX_CARTE_TYPE_EUROCARDMASTERCARD => Mage::helper('paybox')->__('EUROCARD & MASTERCARD'), + self::PBX_CARTE_TYPE_ECARD => Mage::helper('paybox')->__('E CARD'), + self::PBX_CARTE_TYPE_AMEX => Mage::helper('paybox')->__('AMEX'), + self::PBX_CARTE_TYPE_DINERS => Mage::helper('paybox')->__('DINERS'), + self::PBX_CARTE_TYPE_JCB => Mage::helper('paybox')->__('JCB'), + self::PBX_CARTE_TYPE_AURORE => Mage::helper('paybox')->__('AURORE'), + ), + self::PBX_PAYMENT_TYPE_SYMPASS => array( + 'none' => Mage::helper('paybox')->__('Customer Choise'), + self::PBX_CARTE_TYPE_CB => Mage::helper('paybox')->__('CB'), + self::PBX_CARTE_TYPE_VISA => Mage::helper('paybox')->__('VISA'), + self::PBX_CARTE_TYPE_EUROCARDMASTERCARD => Mage::helper('paybox')->__('EUROCARD & MASTERCARD'), + self::PBX_CARTE_TYPE_ECARD => Mage::helper('paybox')->__('E CARD'), + self::PBX_CARTE_TYPE_AMEX => Mage::helper('paybox')->__('AMEX'), + self::PBX_CARTE_TYPE_DINERS => Mage::helper('paybox')->__('DINERS'), + self::PBX_CARTE_TYPE_JCB => Mage::helper('paybox')->__('JCB'), + self::PBX_CARTE_TYPE_AURORE => Mage::helper('paybox')->__('AURORE'), + ), + self::PBX_PAYMENT_TYPE_PAYNOVA => array( + self::PBX_CARTE_TYPE_PAYNOVA => Mage::helper('paybox')->__('PAYNOVA'), + ), + self::PBX_PAYMENT_TYPE_TERMINEO => array( + self::PBX_CARTE_TYPE_TERMINEO => Mage::helper('paybox')->__('TERMINEO'), + ), + self::PBX_PAYMENT_TYPE_PAYPAL => array( + self::PBX_CARTE_TYPE_PAYPAL => Mage::helper('paybox')->__('PAYPAL'), + ) + ); + } + + if (!is_null($paymentType)) { + if (isset($this->_cartTypes[$paymentType])) { + return $this->_cartTypes[$paymentType]; + } + } + + return $this->_cartTypes; + } + + /** + * Get cart types by given payment + * + * @param string $paymentType + * @return array + */ + public function getCartTypesByPayment($paymentType) + { + if ($paymentType == '') { + return array(); + } + return $this->_getCartTypes($paymentType); + } + + /** + * Get all cart types in JSON format + * + * @return string + */ + public function getJsonCartTypes() + { + return Mage::helper('core')->jsonEncode($this->_getCartTypes()); + } + + /** + * Get payment method + * + * @return string + */ + public function getPaymentMethod() + { + return $this->getConfigData('pbx_mode'); + } + + /** + * Get name of executable file + * + * @return string + */ + public function getPayboxFile() + { + return $this->getConfigData('pbx_file'); + } + + /** + * Get Payment type + * + * @return string + */ + public function getPaymentType() + { + return $this->getConfigData('pbx_typepaiement'); + } + + /** + * Get Payment Action of Paybox System changed to Paybox specification + * + * @return string + */ + public function getPaymentAction() + { + $paymentAction = $this->getConfigData('pbx_autoseule'); + switch ($paymentAction) { + case self::ACTION_AUTHORIZE: + return self::PBX_PAYMENT_ACTION_ATHORIZE; + break; + case self::ACTION_AUTHORIZE_CAPTURE: + return self::PBX_PAYMENT_ACTION_ATHORIZE_CAPTURE; + break; + default: + return self::PBX_PAYMENT_ACTION_ATHORIZE; + break; + } + } + + /** + * Get cart type + * + * @return string + */ + public function getCartType() + { + return $this->getConfigData('pbx_typecarte'); + } + + /** + * Get Site number (TPE) + * + * @return string + */ + public function getSiteNumber() + { + return $this->getConfigData('pbx_site'); + } + + /** + * Get Rang number + * + * @return string + */ + public function getRang() + { + return $this->getConfigData('pbx_rang'); + } + + /** + * Get Identifiant number + * + * @return string + */ + public function getIdentifiant() + { + return $this->getConfigData('pbx_identifiant'); + } + + /** + * Get currency number in ISO4217 format + * + * @return string + */ + public function getCurrencyNumber() + { + $currencyCode = $this->getOrder()->getBaseCurrencyCode(); + if (!$this->_currenciesNumbers) { + $this->_currenciesNumbers = simplexml_load_file(Mage::getBaseDir().'/app/code/core/Mage/Paybox/etc/currency.xml'); + } + if ($this->_currenciesNumbers->$currencyCode) { + return (string)$this->_currenciesNumbers->$currencyCode; + } + } + + /** + * Get language of interface of payment defined in config + * + * @return string + */ + public function getLanguage() + { + return $this->getConfigData('pbx_langue'); + } + + /** + * Get api urls if they defined in config + * + * @return unknown + */ + public function getApiUrls() + { + $fielldsArr = array(); + if (($primary = trim($this->getConfigData('pbx_paybox'))) != '') { + $fielldsArr['PBX_PAYBOX'] = $primary; + } + + if (($backup1 = trim($this->getConfigData('pbx_backup1'))) != '') { + $fielldsArr['PBX_BACKUP1'] = $backup1; + } + + if (($backup2 = trim($this->getConfigData('pbx_backup2'))) != '') { + $fielldsArr['PBX_BACKUP2'] = $backup2; + } + + if (($backup3 = trim($this->getConfigData('pbx_backup3'))) != '') { + $fielldsArr['PBX_BACKUP3'] = $backup3; + } + + return $fielldsArr; + } + + /** + * Get timeouts for api urls if timeouts diferent from default + * + * @return array + */ + public function getTimeouts() + { + $fielldsArr = array(); + if (($timeout = trim($this->getConfigData('pbx_timeout'))) != '') { + $fielldsArr['PBX_TIMEOUT'] = $timeout; + } + + if (($timeout1 = trim($this->getConfigData('pbx_timeout1'))) != '') { + $fielldsArr['PBX_TIMEOUT1'] = $timeout1; + } + + if (($timeout2 = trim($this->getConfigData('pbx_timeout2'))) != '') { + $fielldsArr['PBX_TIMEOUT2'] = $timeout2; + } + + if (($timeout3 = trim($this->getConfigData('pbx_timeout3'))) != '') { + $fielldsArr['PBX_TIMEOUT3'] = $timeout3; + } + + return $fielldsArr; + } + + /** + * Get params from config for HTML form mode + * + * @return array + */ + public function getManagementMode() + { + $fieldsArr = array(); + if (($text = trim($this->getConfigData('pbx_txt'))) != '') { + $fieldsArr['PBX_TXT'] = $text; + } + + if (($wait = trim($this->getConfigData('pbx_wait'))) != '') { + $fieldsArr['PBX_WAIT'] = $wait; + } + + if (($boutpi = trim($this->getConfigData('pbx_boutpi')))) { + $fieldsArr['PBX_BOUTPI'] = $boutpi; + } + + if (($bkgd = trim($this->getConfigData('pbx_bkgd'))) != '') { + $fieldsArr['PBX_BKGD'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'payment/paybox/bkgd/' . $bkgd; + } + + $fieldsArr['PBX_OUTPUT'] = $this->getConfigData('pbx_output'); + + return $fieldsArr; + } + + /** + * Get ping flag (commandline mode) + * + * @return unknown + */ + public function getPingFlag() + { + return $this->getConfigData('pbx_ping'); + } + + /** + * Get ping port (commandline mode) + * + * @return string + */ + public function getPingPort() + { + return $this->getConfigData('pbx_port'); + } + + /** + * Get debug flag + * + * @return string + */ + public function getDebugFlag() + { + return $this->getConfigData('debug_flag'); + } + + public function getOrderPlaceRedirectUrl() + { + if ($this->getPaymentMethod() == self::PBX_FORM_HTML_METHOD) { + return Mage::getUrl('paybox/system/redirect', array('_secure' => true)); + } else { + return Mage::getUrl('paybox/system/commandline', array('_secure' => true)); + } + } + + /** + * Building array of params to send + * + * @return array + */ + public function getFormFields() + { + $fieldsArr = array(); + + $fieldsArr = array( + 'PBX_MODE' => $this->getPaymentMethod(), + 'PBX_SITE' => $this->getSiteNumber(),//'1999888', + 'PBX_RANG' => $this->getRang(),//'99', + 'PBX_IDENTIFIANT' => $this->getIdentifiant(),//'2', + 'PBX_TOTAL' => ($this->getOrder()->getBaseGrandTotal()*100), + 'PBX_DEVISE' => $this->getCurrencyNumber(), + 'PBX_CMD' => $this->getOrder()->getRealOrderId(), + 'PBX_PORTEUR' => $this->getOrder()->getCustomerEmail(), + 'PBX_RETOUR' => 'amount:M;ref:R;auto:A;trans:T;error:E', + 'PBX_EFFECTUE' => Mage::getUrl('paybox/system/success', array('_secure' => true)), + 'PBX_REFUSE' => Mage::getUrl('paybox/system/refuse', array('_secure' => true)), + 'PBX_ANNULE' => Mage::getUrl('paybox/system/decline', array('_secure' => true)), + 'PBX_AUTOSEULE' => $this->getPaymentAction(), + 'PBX_LANGUE' => $this->getLanguage(), + 'PBX_ERREUR' => Mage::getUrl('paybox/system/error', array('_secure' => true)), + 'PBX_TYPEPAIEMENT' => $this->getPaymentType(), + 'PBX_TYPECARTE' => $this->getCartType(), + 'PBX_RUF1' => self::PBX_METHOD_CALL, + ); + + if (count($apiUrls = $this->getApiUrls())) { + $fieldsArr = array_merge($fieldsArr, $this->getApiUrls()); + } + if (count($timeouts = $this->getTimeouts())) { + $fieldsArr = array_merge($fieldsArr, $this->getTimeouts()); + } + + if ($this->getPaymentMethod() == self::PBX_FORM_HTML_METHOD) { + $fieldsArr = array_merge($fieldsArr, $this->getManagementMode()); + } + + if ($this->getPaymentMethod() == self::PBX_COMMAND_LINE_METHOD && $this->getPingFlag()) { + $tmpFieldsArr['PBX_PING'] = '1'; + if (($pingPort = trim($this->getPingPort())) != '') { + $tmpFieldsArr['PING_PORT'] = $pingPort; + } + + $fieldsArr = array_merge($fieldsArr, $tmpFieldsArr); + } + + $this->_debug(array('request' => $fieldsArr)); + + return $fieldsArr; + } + + /** + * Checking response + * + * @param array $response + * @return bool + */ + public function checkResponse($response) + { + $this->_debug(array('result' => $response)); + + if (isset($response['error'], $response['amount'], $response['ref'], $response['trans'])) { + return true; + } + return false; + } + + public function capture(Varien_Object $payment, $amount) + { + $payment->setStatus(self::STATUS_APPROVED) + ->setLastTransId($this->getTransactionId()); + return $this; + } + + public function authorize(Varien_Object $payment, $amount) + { + $payment->setStatus(self::STATUS_APPROVED) + ->setLastTransId($this->getTransactionId()); + + return $this; + } + + public function cancel(Varien_Object $payment) + { + $payment->setStatus(self::STATUS_DECLINED); + return $this; + } +} diff --git a/app/code/core/Mage/Paybox/controllers/SystemController.php b/app/code/core/Mage/Paybox/controllers/SystemController.php new file mode 100644 index 0000000000..2be3ff17a6 --- /dev/null +++ b/app/code/core/Mage/Paybox/controllers/SystemController.php @@ -0,0 +1,364 @@ + + */ +class Mage_Paybox_SystemController extends Mage_Core_Controller_Front_Action +{ + protected $_payboxResponse = null; + + protected $_responseStatus = false; + + /** + * seting response after returning from paybox + * + * @param array $response + * @return object $this + */ + protected function setPayboxResponse($response) + { + if (count($response)) { + $this->_payboxResponse = $response; + } + return $this; + } + + /** + * Get System Model + * + * @return Mage_Paybox_Model_System + */ + public function getModel() + { + return Mage::getSingleton('paybox/system'); + } + + /** + * Get Checkout Singleton + * + * @return Mage_Checkout_Model_Session + */ + public function getCheckout() + { + return Mage::getSingleton('checkout/session'); + } + + /** + * Redirect action. Redirect customer to Paybox + * + */ + public function redirectAction() + { + $session = $this->getCheckout(); + $session->setPayboxQuoteId($session->getQuoteId()); + + $order = Mage::getModel('sales/order'); + $order->loadByIncrementId($session->getLastRealOrderId()); + $order->addStatusToHistory($order->getStatus(), $this->__('The customer was redirected to Paybox')); + $order->save(); + + $session->setPayboxOrderId(Mage::helper('core')->encrypt($session->getLastRealOrderId())); + $session->setPayboxPaymentAction( + $order->getPayment()->getMethodInstance()->getPaymentAction() + ); + + $this->getResponse()->setBody( + $this->getLayout() + ->createBlock('paybox/system_redirect') + ->setOrder($order) + ->toHtml() + ); + + $session->unsQuoteId(); + } + + /** + * Customer returning to this action if payment was successe + */ + public function successAction() + { + $this->setPayboxResponse($this->getRequest()->getParams()); + if ($this->_checkResponse()) { + + $order = Mage::getModel('sales/order'); + $order->loadByIncrementId($this->_payboxResponse['ref']); + + if (!$order->getId()) { + Mage::throwException($this->__('There are no orders.')); + } + + if (Mage::helper('core')->decrypt($this->getCheckout()->getPayboxOrderId()) != $this->_payboxResponse['ref']) { + Mage::throwException($this->__('Order does not match.')); + } + $this->getCheckout()->unsPayboxOrderId(); + + if (($order->getBaseGrandTotal()*100) != $this->_payboxResponse['amount']) { + Mage::throwException($this->__('Amount does not match.')); + } + + if ($this->_payboxResponse['error'] == '00000') { + $order->addStatusToHistory($order->getStatus(), $this->__('The customer has returned from Paybox.')); + + $redirectTo = 'checkout/onepage/success'; + if ($this->getCheckout()->getPayboxPaymentAction() == Mage_Paybox_Model_System::PBX_PAYMENT_ACTION_ATHORIZE_CAPTURE) { + $this->getCheckout()->unsPayboxPaymentAction(); + $order->getPayment() + ->getMethodInstance() + ->setTransactionId($this->_payboxResponse['trans']); + if ($this->_createInvoice($order)) { + $order->addStatusToHistory($order->getStatus(), $this->__('The invoice has been created.')); + } else { + $order->addStatusToHistory($order->getStatus(), $this->__('Cannot create the invoice.')); + $redirectTo = '*/*/failure'; + } + } + + $session = $this->getCheckout(); + $session->setQuoteId($session->getPayboxQuoteId(true)); + $session->getQuote()->setIsActive(false)->save(); + $session->unsPayboxQuoteId(); + } else { + $redirectTo = '*/*/failure'; + $order->cancel(); + $order->addStatusToHistory($order->getStatus(), $this->__('The customer was rejected by Paybox.')); + } + + $order->sendNewOrderEmail(); + $order->save(); + + $this->_redirect($redirectTo); + } else { + $this->norouteAction(); + return; + } + } + + /** + * Action when payment was declined by Paybox + */ + public function refuseAction() + { + $this->setPayboxResponse($this->getRequest()->getParams()); + if ($this->_checkResponse()) { + $this->getCheckout()->unsPayboxQuoteId(); + $this->getCheckout()->setPayboxErrorMessage('Order was canceled by Paybox'); + + $order = Mage::getModel('sales/order') + ->loadByIncrementId($this->_payboxResponse['ref']); + $order->cancel(); + $order->addStatusToHistory($order->getStatus(), $this->__('The customer was refused by Paybox.')); + $order->save(); + + $this->_redirect('*/*/failure'); + } else { + $this->norouteAction(); + return; + } + } + + /** + * Action when customer cancele payment or press button to back to shop + */ + public function declineAction() + { + $this->setPayboxResponse($this->getRequest()->getParams()); + if ($this->_checkResponse()) { + + $order = Mage::getModel('sales/order') + ->loadByIncrementId($this->_payboxResponse['ref']); + $order->cancel(); + $order->addStatusToHistory($order->getStatus(), $this->__('The order was canceled by the customer.')); + $order->save(); + + $session = $this->getCheckout(); + $session->setQuoteId($session->getPayboxQuoteId(true)); + $session->getQuote()->setIsActive(false)->save(); + $session->unsPayboxQuoteId(); + + $this->_redirect('checkout/cart'); + } else { + $this->norouteAction(); + return; + } + } + + /** + * Redirect action. Redirect to Paybox using commandline mode + * + */ + public function commandlineAction() + { + $session = $this->getCheckout(); + $session->setPayboxQuoteId($session->getQuoteId()); + + $order = Mage::getModel('sales/order') + ->loadByIncrementId($this->getCheckout()->getLastRealOrderId()); + $order->addStatusToHistory( + $order->getStatus(), $this->__('The customer was redirected to Paybox using \'command line\' mode.') + ); + $order->save(); + + $session->setPayboxOrderId(Mage::helper('core')->encrypt($session->getLastRealOrderId())); + $session->setPayboxPaymentAction( + $order->getPayment()->getMethodInstance()->getPaymentAction() + ); + + $session->unsQuoteId(); + + $payment = $order->getPayment()->getMethodInstance(); + $fieldsArr = $payment->getFormFields(); + $paramStr = ''; + foreach ($fieldsArr as $k => $v) { + $paramStr .= $k.'='.$v.' '; + } + + $paramStr = str_replace(';', '\;', $paramStr); + $result = shell_exec(Mage::getBaseDir().'/'.$this->getModel()->getPayboxFile().' '.$paramStr); + + if (isset($fieldsArr['PBX_PING']) && $fieldsArr['PBX_PING'] == '1') { + $fieldsArr['PBX_PING'] = '0'; + $fieldsArr['PBX_PAYBOX'] = trim(substr($result, strpos($result, 'http'))); + $paramStr = ''; + foreach ($fieldsArr as $k => $v) { + $paramStr .= $k.'='.$v.' '; + } + + $paramStr = str_replace(';', '\;', $paramStr); + $result = shell_exec(Mage::getBaseDir().'/'.$this->getModel()->getPayboxFile().' '.$paramStr); + } + + $this->loadLayout(false); + $this->getResponse()->setBody($result); + $this->renderLayout(); + } + + /** + * Error action. If request params to Paybox has mistakes + * + */ + public function errorAction() + { + if (!$this->getCheckout()->getPayboxQuoteId()) { + $this->norouteAction(); + return; + } + + $session = $this->getCheckout(); + $session->setQuoteId($session->getPayboxQuoteId(true)); + $session->getQuote()->setIsActive(false)->save(); + $session->unsPayboxQuoteId(); + + if (!$this->getRequest()->getParam('NUMERR')) { + $this->norouteAction(); + return; + } + + $this->loadLayout(); + + $this->getCheckout() + ->setPayboxErrorNumber( + $this->getRequest()->getParam('NUMERR') + ); + + $this->renderLayout(); + } + + /** + * Failure action. + * Displaying information if customer was redirecting to cancel or decline actions + * + */ + public function failureAction() + { + if (!$this->getCheckout()->getPayboxErrorMessage()) { + $this->norouteAction(); + return; + } + + $this->loadLayout(); + $this->renderLayout(); + } + + /** + * Checking response and Paybox session variables + * + * @return unknown + */ + protected function _checkResponse() + { + if (!$this->getCheckout()->getPayboxQuoteId()) { + $this->norouteAction(); + return; + } + + if (!$this->getCheckout()->getPayboxOrderId()) { + $this->norouteAction(); + return; + } + + if (!$this->getCheckout()->getPayboxPaymentAction()) { + $this->norouteAction(); + return; + } + + if (!$this->_payboxResponse) { + return false; + } + + //check for valid response + if ($this->getModel()->checkResponse($this->_payboxResponse)) { + return true; + } + + return true; + } + + /** + * Creating invoice + * + * @param Mage_Sales_Model_Order $order + * @return bool + */ + protected function _createInvoice(Mage_Sales_Model_Order $order) + { + if ($order->canInvoice()) { + $invoice = $order->prepareInvoice(); + $invoice->register()->capture(); + Mage::getModel('core/resource_transaction') + ->addObject($invoice) + ->addObject($invoice->getOrder()) + ->save(); + return true; + } + return false; + } + +} diff --git a/app/code/core/Mage/Paybox/etc/config.xml b/app/code/core/Mage/Paybox/etc/config.xml new file mode 100644 index 0000000000..9b68b1d03d --- /dev/null +++ b/app/code/core/Mage/Paybox/etc/config.xml @@ -0,0 +1,120 @@ + + + + + + 0.1.3 + + + + + + Mage_Paybox_Model + paybox_mysql4 + + + Mage_Paybox_Model_Mysql4 + + paybox_api_debug
        + paybox_question_number
        +
        +
        +
        + + + + Mage_Paybox + Mage_Paybox_Model_Mysql4_Setup + + + + + Mage_Paybox_Block + +
        + + + + standard + + Mage_Paybox + paybox + + + + + + + + Mage_Paybox.csv + + + + + + + + + + + Mage_Paybox.csv + + + + + + + + + 1 + + + + authorize + E + FRA + paybox/system + Paybox System + processing + 0 + + + + + + authorize + paybox/direct + Paybox Direct + 1 + processing + AE,VI,MC,DI + 0 + + + +
        diff --git a/app/code/core/Mage/Paybox/etc/currency.xml b/app/code/core/Mage/Paybox/etc/currency.xml new file mode 100644 index 0000000000..adb3a7abe8 --- /dev/null +++ b/app/code/core/Mage/Paybox/etc/currency.xml @@ -0,0 +1,209 @@ + + + + + 971 + 008 + 012 + 840 + 978 + 973 + 951 + 032 + 051 + 533 + 036 + 944 + 044 + 048 + 050 + 052 + 974 + 084 + 952 + 060 + 356 + 064 + 068 + 984 + 977 + 072 + 578 + 986 + 096 + 975 + 108 + 116 + 950 + 124 + 132 + 136 + 152 + 156 + 170 + 174 + 976 + 554 + 188 + 191 + 192 + 203 + 208 + 262 + 214 + 818 + 222 + 232 + 233 + 230 + 238 + 242 + 953 + 270 + 981 + 936 + 292 + 320 + 324 + 328 + 332 + 340 + 344 + 348 + 352 + 360 + 960 + 364 + 368 + 376 + 388 + 392 + 400 + 398 + 404 + 408 + 410 + 414 + 417 + 418 + 428 + 422 + 710 + 426 + 430 + 434 + 756 + 440 + 446 + 807 + 969 + 454 + 458 + 462 + 478 + 480 + 484 + 979 + 498 + 496 + 504 + 943 + 104 + 516 + 524 + 532 + 558 + 566 + 512 + 586 + 590 + 598 + 600 + 604 + 608 + 985 + 634 + 946 + 643 + 646 + 654 + 882 + 678 + 682 + 941 + 690 + 694 + 702 + 703 + 090 + 706 + 144 + 938 + 968 + 748 + 752 + 948 + 947 + 760 + 901 + 972 + 834 + 764 + 776 + 780 + 788 + 949 + 795 + 800 + 980 + 784 + 826 + 998 + 997 + 858 + 940 + 860 + 548 + 937 + 704 + 886 + 894 + 716 + 959 + 955 + 956 + 957 + 958 + 964 + 962 + 961 + Nil + Nil + 963 + 999 + diff --git a/app/code/core/Mage/Paybox/etc/system.xml b/app/code/core/Mage/Paybox/etc/system.xml new file mode 100644 index 0000000000..4767413818 --- /dev/null +++ b/app/code/core/Mage/Paybox/etc/system.xml @@ -0,0 +1,459 @@ + + + + + + + + + text + 101 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 1 + 1 + 1 + 0 + + + + text + 5 + 1 + 1 + 0 + + + + select + paybox/source_paymentMode + 10 + 1 + 1 + 0 + + + + select + paybox/source_paymentAction + 15 + 1 + 1 + 0 + + + + obscure + adminhtml/system_config_backend_encrypted + 20 + 1 + 1 + 0 + + + + obscure + adminhtml/system_config_backend_encrypted + 30 + 1 + 1 + 0 + + + + obscure + adminhtml/system_config_backend_encrypted + 40 + 1 + 1 + 0 + + + + Only if the "HTML From" mode selected. + select + paybox/source_managementMode + 50 + 1 + 1 + 0 + + + + Only if the "HTML From" mode selected. + text + 60 + 1 + 1 + 0 + + + + Only if the "HTML From" mode selected. + text + 70 + 1 + 1 + 0 + + + + Only if the "HTML From" mode selected. + image + adminhtml/system_config_backend_image + payment/paybox/bkgd + payment/paybox/bkgd + 80 + 1 + 1 + 0 + + + + Only if the "HTML From" mode selected. + text + 90 + 1 + 1 + 0 + + + + select + paybox/source_language + 100 + 1 + 1 + 0 + + + + select + paybox/source_paymentType + 105 + 1 + 1 + 0 + + + + select + paybox/adminhtml_cart_type + paybox/source_cartType + 108 + 1 + 1 + 0 + + + + Specify the URL of the primary payment server if different from default. + text + 110 + 1 + 1 + 0 + + + + Time-out (in seconds) to check the avalaibility of the primary payment server (default 8 seconds). + text + 115 + 1 + 1 + 0 + + + + Specify the URL of the primary backup payment server if different from default. + text + 120 + 1 + 1 + 0 + + + + Time-out (in seconds) to check the avalaibility of the primary backup payment server (default 10 seconds). + text + 125 + 1 + 1 + 0 + + + + Specify the URL of the second backup payment server if different from default. + text + 130 + 1 + 1 + 0 + + + + Time-out (in seconds) to check the avalaibility of the second backup payment server (fefault 20 seconds). + text + 135 + 1 + 1 + 0 + + + + Specify the URL of the third backup payment server if different from default. + text + 140 + 1 + 1 + 0 + + + + Time-out (in seconds) to check the avalaibility of the third backup payment server (default 20 seconds). + text + 145 + 1 + 1 + 0 + + + + Only with "Command Line" mode. + select + adminhtml/system_config_source_yesno + 160 + 1 + 1 + 0 + + + + TCP port used to check the availability of a payment server if "Ping Flag" enabled (default port is 443). + text + 170 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 300 + 1 + 1 + 0 + + + <label>Title</label> + <frontend_type>text</frontend_type> + <sort_order>310</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + select + adminhtml/system_config_source_order_status_processing + 320 + 1 + 1 + 0 + + + + text + 500 + 1 + 1 + 0 + + + + allowspecific + 330 + adminhtml/system_config_source_payment_allspecificcountries + 1 + 1 + 0 + + + + multiselect + 340 + adminhtml/system_config_source_country + 1 + 1 + 0 + + + + + + text + 101 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 1 + 1 + 1 + 0 + + + + obscure + adminhtml/system_config_backend_encrypted + 20 + 1 + 1 + 0 + + + + obscure + adminhtml/system_config_backend_encrypted + 30 + 1 + 1 + 0 + + + + obscure + adminhtml/system_config_backend_encrypted + 40 + 1 + 1 + 0 + + + + text + 50 + 1 + 1 + 0 + + + + text + 60 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 70 + 1 + 1 + 0 + + + <label>Title</label> + <frontend_type>text</frontend_type> + <sort_order>80</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + select + adminhtml/system_config_source_order_status_processing + 90 + 1 + 1 + 0 + + + + select + paybox/source_paymentAction + 95 + 1 + 1 + 0 + + + + multiselect + paybox/source_cctype + 100 + 1 + 1 + 0 + + + + allowspecific + 110 + adminhtml/system_config_source_payment_allspecificcountries + 1 + 1 + 0 + + + + multiselect + 120 + adminhtml/system_config_source_country + 1 + 1 + 0 + + + + text + 500 + 1 + 1 + 0 + + + + + + + diff --git a/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-install-0.1.0.php b/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-install-0.1.0.php new file mode 100644 index 0000000000..e54f4e0009 --- /dev/null +++ b/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-install-0.1.0.php @@ -0,0 +1,47 @@ +startSetup(); + +$installer->run(" + +DROP TABLE IF EXISTS `{$this->getTable('paybox/api_debug')}`; +CREATE TABLE `{$this->getTable('paybox/api_debug')}` ( + `debug_id` int(10) unsigned NOT NULL auto_increment, + `debug_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `real_order_id` varchar(50)NOT NULL default '', + `request_body` text, + `response_body` text, + PRIMARY KEY (`debug_id`), + KEY `debug_at` (`debug_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + "); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.0-0.1.1.php b/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.0-0.1.1.php new file mode 100644 index 0000000000..dce93d14da --- /dev/null +++ b/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.0-0.1.1.php @@ -0,0 +1,33 @@ +startSetup(); + +$installer->addAttribute('order_payment', 'paybox_request_number', array()); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.1-0.1.2.php b/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.1-0.1.2.php new file mode 100644 index 0000000000..d7e9e10b36 --- /dev/null +++ b/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.1-0.1.2.php @@ -0,0 +1,44 @@ +startSetup(); + +$installer->run(" + +DROP TABLE IF EXISTS `{$this->getTable('paybox/question_number')}`; +CREATE TABLE `{$this->getTable('paybox/question_number')}` ( + `account_id` int(10) unsigned NOT NULL auto_increment, + `account_hash` varchar(50) NOT NULL default '', + `increment_value` int(10) unsigned NOT NULL default 1, + `reset_date` timestamp NOT NULL default CURRENT_TIMESTAMP, + PRIMARY KEY (`account_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.2-0.1.3.php b/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.2-0.1.3.php new file mode 100644 index 0000000000..6046a84868 --- /dev/null +++ b/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.2-0.1.3.php @@ -0,0 +1,33 @@ +startSetup(); + +$installer->addAttribute('order_payment', 'paybox_question_number', array()); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Paygate/Helper/Data.php b/app/code/core/Mage/Paygate/Helper/Data.php index a33b5392f4..9f50394829 100644 --- a/app/code/core/Mage/Paygate/Helper/Data.php +++ b/app/code/core/Mage/Paygate/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paygate - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Paygate/Model/Authorizenet.php b/app/code/core/Mage/Paygate/Model/Authorizenet.php index db779dd548..54ca9db645 100644 --- a/app/code/core/Mage/Paygate/Model/Authorizenet.php +++ b/app/code/core/Mage/Paygate/Model/Authorizenet.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paygate - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -177,12 +177,15 @@ public function capture(Varien_Object $payment, $amount) $payment->setStatus(self::STATUS_APPROVED); //$payment->setCcTransId($result->getTransactionId()); $payment->setLastTransId($result->getTransactionId()); + if (!$payment->getParentTransactionId() || $result->getTransactionId() != $payment->getParentTransactionId()) { + $payment->setTransactionId($result->getTransactionId()); + } return $this; } if ($result->getResponseReasonText()) { Mage::throwException($this->_wrapGatewayError($result->getResponseReasonText())); } - Mage::throwException(Mage::helper('paygate')->__('Error in capturing the payment')); + Mage::throwException(Mage::helper('paygate')->__('Error in capturing the payment.')); } @@ -208,7 +211,7 @@ public function void(Varien_Object $payment) Mage::throwException($this->_wrapGatewayError($result->getResponseReasonText())); } $payment->setStatus(self::STATUS_ERROR); - Mage::throwException(Mage::helper('paygate')->__('Invalid transaction id')); + Mage::throwException(Mage::helper('paygate')->__('Invalid transaction ID.')); } /** @@ -239,7 +242,7 @@ public function refund(Varien_Object $payment, $amount) } Mage::throwException($this->_wrapGatewayError($result->getResponseReasonText())); } - Mage::throwException(Mage::helper('paygate')->__('Error in refunding the payment')); + Mage::throwException(Mage::helper('paygate')->__('Error in refunding the payment.')); } /** @@ -354,6 +357,8 @@ protected function _buildRequest(Varien_Object $payment) protected function _postRequest(Varien_Object $request) { + $debugData = array('request' => $request->getData()); + $result = Mage::getModel('paygate/authorizenet_result'); $client = new Varien_Http_Client(); @@ -368,41 +373,16 @@ protected function _postRequest(Varien_Object $request) $client->setParameterPost($request->getData()); $client->setMethod(Zend_Http_Client::POST); - if ($this->getConfigData('debug')) { - $requestDebug = clone $request; - - foreach ($this->_debugReplacePrivateDataKeys as $key) { - if ($requestDebug->hasData($key)) { - $requestDebug->setData($key, '***'); - } - } - - foreach( $requestDebug->getData() as $key => $value ) { - $requestData[] = strtoupper($key) . '=' . $value; - } - - $requestData = join('&', $requestData); - - $debug = Mage::getModel('paygate/authorizenet_debug') - ->setRequestBody($requestData) - ->setRequestSerialized(serialize($requestDebug->getData())) - ->setRequestDump(print_r($requestDebug->getData(),1)) - ->save(); - } - try { $response = $client->request(); - } catch (Exception $e) { + } + catch (Exception $e) { $result->setResponseCode(-1) ->setResponseReasonCode($e->getCode()) ->setResponseReasonText($e->getMessage()); - if (!empty($debug)) { - $debug - ->setResultSerialized(serialize($result->getData())) - ->setResultDump(print_r($result->getData(),1)) - ->save(); - } + $debugData['result'] = $result->getData(); + $this->_debug($debugData); Mage::throwException($this->_wrapGatewayError($e->getMessage())); } @@ -427,19 +407,15 @@ protected function _postRequest(Varien_Object $request) ->setMd5Hash($r[37]) ->setCardCodeResponseCode($r[38]) ->setCAVVResponseCode( (isset($r[39])) ? $r[39] : null); - } else { + } + else { Mage::throwException( - Mage::helper('paygate')->__('Error in payment gateway') + Mage::helper('paygate')->__('Error in payment gateway.') ); } - if (!empty($debug)) { - $debug - ->setResponseBody($responseBody) - ->setResultSerialized(serialize($result->getData())) - ->setResultDump(print_r($result->getData(),1)) - ->save(); - } + $debugData['result'] = $result->getData(); + $this->_debug($debugData); return $result; } diff --git a/app/code/core/Mage/Paygate/Model/Authorizenet/Debug.php b/app/code/core/Mage/Paygate/Model/Authorizenet/Debug.php index ea8cb3c2e5..3b9245bedf 100644 --- a/app/code/core/Mage/Paygate/Model/Authorizenet/Debug.php +++ b/app/code/core/Mage/Paygate/Model/Authorizenet/Debug.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paygate - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Paygate/Model/Authorizenet/Request.php b/app/code/core/Mage/Paygate/Model/Authorizenet/Request.php index b6e0b36ac9..9424db15a0 100644 --- a/app/code/core/Mage/Paygate/Model/Authorizenet/Request.php +++ b/app/code/core/Mage/Paygate/Model/Authorizenet/Request.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paygate - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Paygate/Model/Authorizenet/Result.php b/app/code/core/Mage/Paygate/Model/Authorizenet/Result.php index 45a6b41e12..1ef1dcc120 100644 --- a/app/code/core/Mage/Paygate/Model/Authorizenet/Result.php +++ b/app/code/core/Mage/Paygate/Model/Authorizenet/Result.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paygate - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Paygate/Model/Authorizenet/Source/Cctype.php b/app/code/core/Mage/Paygate/Model/Authorizenet/Source/Cctype.php index 86c873481b..059164125c 100644 --- a/app/code/core/Mage/Paygate/Model/Authorizenet/Source/Cctype.php +++ b/app/code/core/Mage/Paygate/Model/Authorizenet/Source/Cctype.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paygate - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Paygate/Model/Authorizenet/Source/PaymentAction.php b/app/code/core/Mage/Paygate/Model/Authorizenet/Source/PaymentAction.php index d3dd948717..adc175c803 100644 --- a/app/code/core/Mage/Paygate/Model/Authorizenet/Source/PaymentAction.php +++ b/app/code/core/Mage/Paygate/Model/Authorizenet/Source/PaymentAction.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paygate - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Paygate/Model/Mysql4/Authorizenet/Debug.php b/app/code/core/Mage/Paygate/Model/Mysql4/Authorizenet/Debug.php index 874989a630..7f26331d34 100644 --- a/app/code/core/Mage/Paygate/Model/Mysql4/Authorizenet/Debug.php +++ b/app/code/core/Mage/Paygate/Model/Mysql4/Authorizenet/Debug.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paygate - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Paygate/Model/Mysql4/Authorizenet/Debug/Collection.php b/app/code/core/Mage/Paygate/Model/Mysql4/Authorizenet/Debug/Collection.php index d19d4951ca..51b6ab098d 100644 --- a/app/code/core/Mage/Paygate/Model/Mysql4/Authorizenet/Debug/Collection.php +++ b/app/code/core/Mage/Paygate/Model/Mysql4/Authorizenet/Debug/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paygate - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Paygate/etc/config.xml b/app/code/core/Mage/Paygate/etc/config.xml index 5342114d8a..ec7c46e397 100644 --- a/app/code/core/Mage/Paygate/etc/config.xml +++ b/app/code/core/Mage/Paygate/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Paygate - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -97,28 +97,6 @@ 0 USD - - - 0 - AE,VI,MC,DI - 0 - paygate/payflow_pro - 1 - holded - - authorize - - C - Credit Card (Payflow Pro) - https://payflowpro.paypal.com/transaction - - - MEDIUM - 0 - - - 0 -
        diff --git a/app/code/core/Mage/Paygate/etc/system.xml b/app/code/core/Mage/Paygate/etc/system.xml index 1c6510ef75..acc4827582 100644 --- a/app/code/core/Mage/Paygate/etc/system.xml +++ b/app/code/core/Mage/Paygate/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Paygate - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -65,7 +65,7 @@ 0 - + select adminhtml/system_config_source_yesno 10 @@ -83,7 +83,7 @@ 0 - + text 11 1 @@ -91,7 +91,7 @@ 0 - + select adminhtml/system_config_source_order_status_processing 4 @@ -100,7 +100,7 @@ 0 - + text 100 1 @@ -108,7 +108,7 @@ 0 - + select adminhtml/system_config_source_yesno 5 @@ -134,7 +134,7 @@ 1 - + obscure adminhtml/system_config_backend_encrypted 3 @@ -160,7 +160,7 @@ 0 - + select adminhtml/system_config_source_currency 6 @@ -169,7 +169,7 @@ 0 - + allowspecific 50 adminhtml/system_config_source_payment_allspecificcountries @@ -178,7 +178,7 @@ 0 - + multiselect 51 adminhtml/system_config_source_country @@ -206,243 +206,6 @@ - - - text - 30 - 1 - 1 - 1 - - - - select - adminhtml/system_config_source_yesno - 1 - 1 - 1 - 0 - - - - multiselect - paygate/payflow_source_cctype - 15 - 1 - 1 - 0 - - - - select - adminhtml/system_config_source_yesno - 16 - 1 - 1 - 0 - - - - select - adminhtml/system_config_source_yesno - 20 - 1 - 1 - 0 - - - - Severe Validation Removes Chargeback Liability on Merchant - select - adminhtml/system_config_source_yesno - 25 - 1 - 1 - 0 - 1 - - - - text - adminhtml/system_config_source_yesno - 30 - 1 - 1 - 0 - 1 - - - - select - adminhtml/system_config_source_order_status_processing - 2 - 1 - 1 - 0 - - - - select - adminhtml/system_config_source_order_status - 2 - 1 - 1 - 0 - - - - text - 3 - 1 - 1 - 0 - - - - obscure - adminhtml/system_config_backend_encrypted - 6 - 1 - 1 - 0 - - - - select - adminhtml/system_config_source_yesno - 30 - 1 - 1 - 0 - - - - text - 31 - 1 - 1 - 0 - - - - text - 32 - 1 - 1 - 0 - - - - text - 100 - 1 - 1 - 0 - - - - text - 2 - 1 - 1 - 0 - - - <label>Title</label> - <frontend_type>text</frontend_type> - <sort_order>2</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - - - - Live: <strong>https://payflowpro.paypal.com/transaction</strong><br />Test: <strong>https://pilot-payflowpro.paypal.com/transaction</strong> - text - 2 - 1 - 1 - 0 - - - - obscure - adminhtml/system_config_backend_encrypted - 5 - 1 - 1 - 0 - - - - text - 4 - 1 - 1 - 0 - - - - text - 2 - 1 - 1 - 0 - - - - select - paygate/payflow_source_paymentAction - 2 - 1 - 1 - 0 - - - - select - adminhtml/system_config_source_yesno - 6 - 1 - 1 - 0 - - - - allowspecific - 50 - adminhtml/system_config_source_payment_allspecificcountries - 1 - 1 - 0 - - - - multiselect - 51 - adminhtml/system_config_source_country - 1 - 1 - 0 - - - - text - 98 - 1 - 1 - 0 - - - - text - 99 - 1 - 1 - 0 - - - diff --git a/app/code/core/Mage/Paygate/sql/paygate_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Paygate/sql/paygate_setup/mysql4-install-0.7.0.php index 059c7487c4..a3e5f03b12 100644 --- a/app/code/core/Mage/Paygate/sql/paygate_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Paygate/sql/paygate_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paygate - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Paygate/sql/paygate_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/Paygate/sql/paygate_setup/mysql4-upgrade-0.7.0-0.7.1.php index 4fca86d286..c23c06f9df 100644 --- a/app/code/core/Mage/Paygate/sql/paygate_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/Paygate/sql/paygate_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paygate - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Payment/Block/Catalog/Product/View/Profile.php b/app/code/core/Mage/Payment/Block/Catalog/Product/View/Profile.php new file mode 100644 index 0000000000..bfd8a4de76 --- /dev/null +++ b/app/code/core/Mage/Payment/Block/Catalog/Product/View/Profile.php @@ -0,0 +1,104 @@ + => array('blah-blah', 'bla-bla-blah', ...) + * => ... + * ) + * @return array + */ + public function getScheduleInfo() + { + $scheduleInfo = array(); + foreach ($this->_profile->exportScheduleInfo() as $info) { + $scheduleInfo[$info->getTitle()] = $info->getSchedule(); + } + return $scheduleInfo; + } + + /** + * Render date input element + * + * @return string + */ + public function getDateHtml() + { + if ($this->_profile->getStartDateIsEditable()) { + $this->setDateHtmlId('recurring_start_date'); + $format = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT); + $calendar = $this->getLayout() + ->createBlock('core/html_date') + ->setId('recurring_start_date') + ->setName(Mage_Payment_Model_Recurring_Profile::BUY_REQUEST_START_DATETIME) + ->setClass('datetime-picker input-text') + ->setImage($this->getSkinUrl('images/calendar.gif')) + ->setFormat($format) + ->setTime(true); + return $calendar->getHtml(); + } + } + + /** + * Determine current product and initialize its recurring profile model + * + * @return Mage_Payment_Block_Catalog_Product_View_Profile + */ + protected function _prepareLayout() + { + $product = Mage::registry('current_product'); + if ($product) { + $this->_profile = Mage::getModel('payment/recurring_profile')->importProduct($product); + } + return parent::_prepareLayout(); + } + + /** + * If there is no profile information, the template will be unset, blocking the output + * + * @return string + */ + protected function _toHtml() + { + if (!$this->_profile) { + $this->_template = null; + } + return parent::_toHtml(); + } +} diff --git a/app/code/core/Mage/Payment/Block/Form.php b/app/code/core/Mage/Payment/Block/Form.php index 4a64b959e5..ab8f28f6f0 100644 --- a/app/code/core/Mage/Payment/Block/Form.php +++ b/app/code/core/Mage/Payment/Block/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -39,7 +39,7 @@ public function getMethod() $method = $this->getData('method'); if (!($method instanceof Mage_Payment_Model_Method_Abstract)) { - Mage::throwException($this->__('Cannot retrieve payment method model object.')); + Mage::throwException($this->__('Cannot retrieve the payment method model object.')); } return $method; } @@ -64,4 +64,14 @@ public function getInfoData($field) { return $this->htmlEscape($this->getMethod()->getInfoInstance()->getData($field)); } + + /** + * Check whether current payment method can create billing agreement + * + * @return bool + */ + public function canCreateBillingAgreement() + { + return $this->getMethod()->canCreateBillingAgreement(); + } } diff --git a/app/code/core/Mage/Payment/Block/Form/Cc.php b/app/code/core/Mage/Payment/Block/Form/Cc.php index b994d8885e..406fb94d98 100644 --- a/app/code/core/Mage/Payment/Block/Form/Cc.php +++ b/app/code/core/Mage/Payment/Block/Form/Cc.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -119,8 +119,9 @@ public function hasVerification() */ public function hasSsCardType() { - $availableTypes =$this->getMethod()->getConfigData('cctypes'); - if ($availableTypes && in_array('SS', explode(',', $availableTypes))) { + $availableTypes = explode(',', $this->getMethod()->getConfigData('cctypes')); + $ssPresenations = array_intersect(array('SS', 'SM', 'SO'), $availableTypes); + if ($availableTypes && count($ssPresenations) > 0) { return true; } return false; diff --git a/app/code/core/Mage/Payment/Block/Form/Ccsave.php b/app/code/core/Mage/Payment/Block/Form/Ccsave.php index f376b2f98c..e05f9c6a5a 100644 --- a/app/code/core/Mage/Payment/Block/Form/Ccsave.php +++ b/app/code/core/Mage/Payment/Block/Form/Ccsave.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Payment/Block/Form/Checkmo.php b/app/code/core/Mage/Payment/Block/Form/Checkmo.php index 08aea6df17..8d3db761c5 100644 --- a/app/code/core/Mage/Payment/Block/Form/Checkmo.php +++ b/app/code/core/Mage/Payment/Block/Form/Checkmo.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Payment/Block/Form/Container.php b/app/code/core/Mage/Payment/Block/Form/Container.php index d66c63b201..b1b7f745cf 100644 --- a/app/code/core/Mage/Payment/Block/Form/Container.php +++ b/app/code/core/Mage/Payment/Block/Form/Container.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Payment/Block/Form/Purchaseorder.php b/app/code/core/Mage/Payment/Block/Form/Purchaseorder.php index ba23f85b99..ebdbf97367 100644 --- a/app/code/core/Mage/Payment/Block/Form/Purchaseorder.php +++ b/app/code/core/Mage/Payment/Block/Form/Purchaseorder.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Payment/Block/Info.php b/app/code/core/Mage/Payment/Block/Info.php index 7d2eb88a96..8dcacec635 100644 --- a/app/code/core/Mage/Payment/Block/Info.php +++ b/app/code/core/Mage/Payment/Block/Info.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -52,7 +52,7 @@ public function getInfo() { $info = $this->getData('info'); if (!($info instanceof Mage_Payment_Model_Info)) { - Mage::throwException($this->__('Cannot retrieve payment info model object.')); + Mage::throwException($this->__('Cannot retrieve the payment info model object.')); } return $info; } diff --git a/app/code/core/Mage/Payment/Block/Info/Cc.php b/app/code/core/Mage/Payment/Block/Info/Cc.php index 348a76dcd2..6da238ba04 100644 --- a/app/code/core/Mage/Payment/Block/Info/Cc.php +++ b/app/code/core/Mage/Payment/Block/Info/Cc.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -83,12 +83,12 @@ protected function _prepareSpecificInformation($transport = null) return $this->_paymentSpecificInformation; } $transport = parent::_prepareSpecificInformation($transport); - $data[Mage::helper('payment')->__('Credit Card Type')] = $this->getCcTypeName(); - + $data = array(); + if ($ccType = $this->getCcTypeName()) { + $data[Mage::helper('payment')->__('Credit Card Type')] = $ccType; + } if ($this->getInfo()->getCcLast4()) { $data[Mage::helper('payment')->__('Credit Card Number')] = sprintf('xxxx-%s', $this->getInfo()->getCcLast4()); - } else { - $data[Mage::helper('payment')->__('Credit Card Number')] = Mage::helper('payment')->__('N/A'); } if ($ccSsIssue = $this->getInfo()->getCcSsIssue()) { $data[Mage::helper('payment')->__('Switch/Solo Issue Number')] = $ccSsIssue; diff --git a/app/code/core/Mage/Payment/Block/Info/Ccsave.php b/app/code/core/Mage/Payment/Block/Info/Ccsave.php index 0366a9e3e9..9e204e0265 100644 --- a/app/code/core/Mage/Payment/Block/Info/Ccsave.php +++ b/app/code/core/Mage/Payment/Block/Info/Ccsave.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Payment/Block/Info/Checkmo.php b/app/code/core/Mage/Payment/Block/Info/Checkmo.php index ad94dc0f27..da65fd7089 100644 --- a/app/code/core/Mage/Payment/Block/Info/Checkmo.php +++ b/app/code/core/Mage/Payment/Block/Info/Checkmo.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Payment/Block/Info/Container.php b/app/code/core/Mage/Payment/Block/Info/Container.php index ccd91684c8..5574828088 100644 --- a/app/code/core/Mage/Payment/Block/Info/Container.php +++ b/app/code/core/Mage/Payment/Block/Info/Container.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Payment/Block/Info/Purchaseorder.php b/app/code/core/Mage/Payment/Block/Info/Purchaseorder.php index 1931ff4b3b..962e063e6d 100644 --- a/app/code/core/Mage/Payment/Block/Info/Purchaseorder.php +++ b/app/code/core/Mage/Payment/Block/Info/Purchaseorder.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Payment/Exception.php b/app/code/core/Mage/Payment/Exception.php index 17c50606a1..94c6cb663d 100644 --- a/app/code/core/Mage/Payment/Exception.php +++ b/app/code/core/Mage/Payment/Exception.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Payment/Helper/Data.php b/app/code/core/Mage/Payment/Helper/Data.php index 3ae300d4b6..1c7d279ca3 100644 --- a/app/code/core/Mage/Payment/Helper/Data.php +++ b/app/code/core/Mage/Payment/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -32,6 +32,7 @@ class Mage_Payment_Helper_Data extends Mage_Core_Helper_Abstract { const XML_PATH_PAYMENT_METHODS = 'payment'; + const XML_PATH_PAYMENT_GROUPS = 'global/payment/groups'; /** * Retrieve method model object @@ -55,27 +56,26 @@ public function getMethodInstance($code) * array structure: * $index => Varien_Simplexml_Element * - * @param mixed $store - * @return array + * @param mixed $store + * @param Mage_Sales_Model_Quote $quote + * @return array */ public function getStoreMethods($store = null, $quote = null) { - $methods = Mage::getStoreConfig(self::XML_PATH_PAYMENT_METHODS, $store); $res = array(); - foreach ($methods as $code => $methodConfig) { + foreach ($this->getPaymentMethods($store) as $code => $methodConfig) { $prefix = self::XML_PATH_PAYMENT_METHODS . '/' . $code . '/'; if (!$model = Mage::getStoreConfig($prefix . 'model', $store)) { continue; } $methodInstance = Mage::getModel($model); + $methodInstance->setStore($store); if (!$methodInstance->isAvailable($quote)) { - /* if the payment method can not be used at this time */ + /* if the payment method cannot be used at this time */ continue; } - $sortOrder = (int)$methodInstance->getConfigData('sort_order', $store); $methodInstance->setSortOrder($sortOrder); - $methodInstance->setStore($store); $res[] = $methodInstance; } @@ -127,4 +127,139 @@ public function getInfoBlock(Mage_Payment_Model_Info $info) $block->setInfo($info); return $block; } + + /** + * Retrieve available billing agreement methods + * + * @param mixed $store + * @param Mage_Sales_Model_Quote $quote + * @return array + */ + public function getBillingAgreementMethods($store = null, $quote = null) + { + $result = array(); + foreach ($this->getStoreMethods($store, $quote) as $method) { + if ($method->canManageBillingAgreements()) { + $result[] = $method; + } + } + return $result; + } + + /** + * Get payment methods that implement recurring profilez management + * + * @param mixed $store + * @return array + */ + public function getRecurringProfileMethods($store = null) + { + $result = array(); + foreach ($this->getPaymentMethods($store) as $code => $data) { + $method = $this->getMethodInstance($code); + if ($method->canManageRecurringProfiles()) { + $result[] = $method; + } + } + return $result; + } + + /** + * Retrieve all payment methods + * + * @param mixed $store + * @return array + */ + public function getPaymentMethods($store = null) + { + return Mage::getStoreConfig(self::XML_PATH_PAYMENT_METHODS, $store); + } + + /** + * Retrieve all payment methods list as an array + * + * Possible output: + * 1) assoc array as => + * 2) array of array('label' => <title>, 'value' => <code>) + * 3) array of array( + * array('value' => <code>, 'label' => <title>), + * array('value' => array( + * 'value' => array(array(<code1> => <title1>, <code2> =>...), + * 'label' => <group name> + * )), + * array('value' => <code>, 'label' => <title>), + * ... + * ) + * + * @param bool $sorted + * @param bool $asLabelValue + * @param bool $withGroups + * @return array + */ + public function getPaymentMethodList($sorted = true, $asLabelValue = false, $withGroups = false, $store = null) + { + $methods = array(); + $groups = array(); + $groupRelations = array(); + + foreach ($this->getPaymentMethods($store) as $code => $data) { + if ((isset($data['title']))) { + $methods[$code] = $data['title']; + } else { + $methods[$code] = $this->getMethodInstance($code)->getConfigData('title', $store); + } + if ($asLabelValue && $withGroups && isset($data['group'])) { + $groupRelations[$code] = $data['group']; + } + } + if ($asLabelValue && $withGroups) { + $groups = Mage::app()->getConfig()->getNode(self::XML_PATH_PAYMENT_GROUPS)->asCanonicalArray(); + foreach ($groups as $code => $title) { + $methods[$code] = $title; // for sorting, see below + } + } + if ($sorted) { + asort($methods); + } + if ($asLabelValue) { + $labelValues = array(); + foreach ($methods as $code => $title) { + $labelValues[$code] = array(); + } + foreach ($methods as $code => $title) { + if (isset($groups[$code])) { + $labelValues[$code]['label'] = $title; + } elseif (isset($groupRelations[$code])) { + unset($labelValues[$code]); + $labelValues[$groupRelations[$code]]['value'][$code] = array('value' => $code, 'label' => $title); + } else { + $labelValues[$code] = array('value' => $code, 'label' => $title); + } + } + return $labelValues; + } + + return $methods; + } + + /** + * Retrieve all billing agreement methods (code and label) + * + * @return array + */ + public function getAllBillingAgreementMethods() + { + $result = array(); + $interface = 'Mage_Payment_Model_Billing_Agreement_MethodInterface'; + foreach ($this->getPaymentMethods() as $code => $data) { + if (!isset($data['model'])) { + continue; + } + $method = Mage::app()->getConfig()->getModelClassName($data['model']); + if (in_array($interface, class_implements($method))) { + $result[$code] = $data['title']; + } + } + return $result; + } } diff --git a/app/code/core/Mage/Payment/Model/Billing/Agreement.php b/app/code/core/Mage/Payment/Model/Billing/Agreement.php new file mode 100644 index 0000000000..2cd4a6e882 --- /dev/null +++ b/app/code/core/Mage/Payment/Model/Billing/Agreement.php @@ -0,0 +1,110 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Mage + * @package Mage_Payment + * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * Billing Agreement abstaract class + * + * @category Mage + * @package Mage_Payment + * @author Magento Core Team <core@magentocommerce.com> + */ + +abstract class Mage_Payment_Model_Billing_Agreement extends Mage_Core_Model_Abstract +{ + /** + * Payment method instance + * + * @var Mage_Payment_Model_Method_Abstract + */ + protected $_paymentMethodInstance = null; + + /** + * Init billing agreement + * + */ + abstract public function initToken(); + + /** + * Verify billing agreement details + * + */ + abstract public function verifyToken(); + + /** + * Create billing agreement + * + * @param Mage_Customer_Model_Customer $customer + */ + abstract public function place(Mage_Customer_Model_Customer $customer); + + /** + * Cancel billing agreement + * + */ + abstract public function cancel(); + + /** + * Retreive payment method instance + * + * @throws Mage_Core_Exception + * @return Mage_Payment_Model_Method_Abstract + */ + public function getPaymentMethodInstance() + { + if (is_null($this->_paymentMethodInstance)) { + $this->_paymentMethodInstance = Mage::helper('payment')->getMethodInstance($this->getMethodCode()); + } + return $this->_paymentMethodInstance; + } + + /** + * Validate data before save + * + * @return Mage_Payment_Model_Billing_Agreement + */ + public function validate() + { + if (is_null($this->_paymentMethodInstance) + || !$this->_paymentMethodInstance->getCode() + || !$this->getCustomerId() + || !$this->getReferenceId() + || !$this->getStatus()) { + throw new Mage_Core_Exception('Not enough data to save billing agreement instance.'); + } + return $this; + } + + /** + * Before save + * + * @return Mage_Core_Model_Abstract + */ + protected function _beforeSave() + { + $this->validate(); + return parent::_beforeSave(); + } +} diff --git a/app/code/core/Mage/Payment/Model/Billing/Agreement/MethodInterface.php b/app/code/core/Mage/Payment/Model/Billing/Agreement/MethodInterface.php new file mode 100644 index 0000000000..6fb42249d5 --- /dev/null +++ b/app/code/core/Mage/Payment/Model/Billing/Agreement/MethodInterface.php @@ -0,0 +1,61 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Mage + * @package Mage_Payment + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * Interface for payment methods that support billing agreements management + * + * @author Magento Core Team <core@magentocommerce.com> + */ +interface Mage_Payment_Model_Billing_Agreement_MethodInterface +{ + /** + * Init billing agreement + * + * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement + */ + public function initBillingAgreementToken(Mage_Payment_Model_Billing_AgreementAbstract $agreement); + + /** + * Retrieve billing agreement details + * + * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement + */ + public function getBillingAgreementTokenInfo(Mage_Payment_Model_Billing_AgreementAbstract $agreement); + + /** + * Create billing agreement + * + * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement + */ + public function placeBillingAgreement(Mage_Payment_Model_Billing_AgreementAbstract $agreement); + + /** + * Update billing agreement status + * + * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement + */ + public function updateBillingAgreementStatus(Mage_Payment_Model_Billing_AgreementAbstract $agreement); +} diff --git a/app/code/core/Mage/Payment/Model/Billing/AgreementAbstract.php b/app/code/core/Mage/Payment/Model/Billing/AgreementAbstract.php new file mode 100644 index 0000000000..a262d73084 --- /dev/null +++ b/app/code/core/Mage/Payment/Model/Billing/AgreementAbstract.php @@ -0,0 +1,117 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Mage + * @package Mage_Payment + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * Billing Agreement abstaract class + * + * @author Magento Core Team <core@magentocommerce.com> + */ +abstract class Mage_Payment_Model_Billing_AgreementAbstract extends Mage_Core_Model_Abstract +{ + /** + * Payment method instance + * + * @var Mage_Payment_Model_Method_Abstract + */ + protected $_paymentMethodInstance = null; + + /** + * Billing Agreement Errors + * + * @var array + */ + protected $_errors = array(); + + /** + * Init billing agreement + * + */ + abstract public function initToken(); + + /** + * Verify billing agreement details + * + */ + abstract public function verifyToken(); + + /** + * Create billing agreement + * + */ + abstract public function place(); + + /** + * Cancel billing agreement + * + */ + abstract public function cancel(); + + /** + * Retreive payment method instance + * + * @return Mage_Payment_Model_Method_Abstract + */ + public function getPaymentMethodInstance() + { + if (is_null($this->_paymentMethodInstance)) { + $this->_paymentMethodInstance = Mage::helper('payment')->getMethodInstance($this->getMethodCode()); + $this->_paymentMethodInstance->setStore($this->getStoreId()); + } + return $this->_paymentMethodInstance; + } + + /** + * Validate data before save + * + * @return bool + */ + public function isValid() + { + $this->_errors = array(); + if (is_null($this->_paymentMethodInstance) || !$this->_paymentMethodInstance->getCode()) { + $this->_errors[] = Mage::helper('payment')->__('Payment method code is not set.'); + } + if (!$this->getReferenceId()) { + $this->_errors[] = Mage::helper('payment')->__('Reference ID is not set.'); + } + return empty($this->_errors); + } + + /** + * Before save, it's overriden just to make data validation on before save event + * + * @throws Mage_Core_Exception + * @return Mage_Core_Model_Abstract + */ + protected function _beforeSave() + { + if ($this->isValid()) { + return parent::_beforeSave(); + } + array_unshift($this->_errors, Mage::helper('payment')->__('Unable to save Billing Agreement:')); + throw new Mage_Core_Exception(implode(' ', $this->_errors)); + } +} diff --git a/app/code/core/Mage/Payment/Model/Config.php b/app/code/core/Mage/Payment/Model/Config.php index d1811eb669..5d72a54a9d 100644 --- a/app/code/core/Mage/Payment/Model/Config.php +++ b/app/code/core/Mage/Payment/Model/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -96,7 +96,9 @@ public function getCcTypes() $types = array(); foreach ($_types as $data) { - $types[$data['code']] = $data['name']; + if (isset($data['code']) && isset($data['name'])) { + $types[$data['code']] = $data['name']; + } } return $types; } diff --git a/app/code/core/Mage/Payment/Model/Info.php b/app/code/core/Mage/Payment/Model/Info.php index 7fe5bebc5b..5a35eefe5d 100644 --- a/app/code/core/Mage/Payment/Model/Info.php +++ b/app/code/core/Mage/Payment/Model/Info.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -80,7 +80,7 @@ public function getMethodInstance() } else { return $this->_getData('method_instance'); } - Mage::throwException(Mage::helper('payment')->__('Cannot retrieve payment method instance')); + Mage::throwException(Mage::helper('payment')->__('Cannot retrieve payment method instance.')); } /** @@ -158,6 +158,10 @@ public function getAdditionalInformation($key = null) */ public function unsAdditionalInformation($key = null) { + if ($key && isset($this->_additionalInformation[$key])) { + unset($this->_additionalInformation[$key]); + return $this->setData('additional_information', $this->_additionalInformation); + } $this->_additionalInformation = -1; return $this->unsetData('additional_information'); } diff --git a/app/code/core/Mage/Payment/Model/Method/Abstract.php b/app/code/core/Mage/Payment/Model/Method/Abstract.php index c1aa62bd8f..3a22f2d275 100644 --- a/app/code/core/Mage/Payment/Model/Method/Abstract.php +++ b/app/code/core/Mage/Payment/Model/Method/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -49,17 +49,21 @@ abstract class Mage_Payment_Model_Method_Abstract extends Varien_Object * Payment Method features * @var bool */ - protected $_isGateway = false; - protected $_canAuthorize = false; - protected $_canCapture = false; - protected $_canCapturePartial = false; - protected $_canRefund = false; - protected $_canRefundInvoicePartial = false; - protected $_canVoid = false; - protected $_canUseInternal = true; - protected $_canUseCheckout = true; - protected $_canUseForMultishipping = true; - protected $_isInitializeNeeded = false; + protected $_isGateway = false; + protected $_canAuthorize = false; + protected $_canCapture = false; + protected $_canCapturePartial = false; + protected $_canRefund = false; + protected $_canRefundInvoicePartial = false; + protected $_canVoid = false; + protected $_canUseInternal = true; + protected $_canUseCheckout = true; + protected $_canUseForMultishipping = true; + protected $_isInitializeNeeded = false; + protected $_canFetchTransactionInfo = false; + protected $_canReviewPayment = false; + protected $_canCreateBillingAgreement = false; + protected $_canManageRecurringProfiles = true; /** * TODO: whether a captured transaction may be voided by this gateway * This may happen when amount is captured, but not settled @@ -67,6 +71,13 @@ abstract class Mage_Payment_Model_Method_Abstract extends Varien_Object */ protected $_canCancelInvoice = false; + /** + * Fields that should be replaced in debug with '***' + * + * @var array + */ + protected $_debugReplacePrivateDataKeys = array(); + public function __construct() { @@ -174,6 +185,38 @@ public function canEdit() return true; } + /** + * Check fetch transaction info availability + * + * @return bool + */ + public function canFetchTransactionInfo() + { + return $this->_canFetchTransactionInfo; + } + + /** + * Check whether payment method instance can create billing agreements + * + * @return bool + */ + public function canCreateBillingAgreement() + { + return $this->_canCreateBillingAgreement; + } + + /** + * Fetch transaction info + * + * @param Mage_Payment_Model_Info $payment + * @param string $transactionId + * @return array + */ + public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId) + { + return array(); + } + /** * Retrieve payment system relation flag * @@ -225,6 +268,26 @@ public function canUseForCurrency($currencyCode) return true; } + /** + * Check manage billing agreements availability + * + * @return bool + */ + public function canManageBillingAgreements() + { + return ($this instanceof Mage_Payment_Model_Billing_Agreement_MethodInterface); + } + + /** + * Whether can manage recurring profiles + * + * @return bool + */ + public function canManageRecurringProfiles() + { + return $this->_canManageRecurringProfiles && ($this instanceof Mage_Payment_Model_Recurring_Profile_MethodInterface); + } + /** * Retrieve model helper * @@ -243,7 +306,7 @@ protected function _getHelper() public function getCode() { if (empty($this->_code)) { - Mage::throwException($this->_getHelper()->__('Can not retrieve payment method code')); + Mage::throwException($this->_getHelper()->__('Cannot retrieve the payment method code.')); } return $this->_code; } @@ -259,7 +322,7 @@ public function getFormBlockType() } /** - * Retirve block type for display method information + * Retrieve block type for display method information * * @return string */ @@ -277,7 +340,7 @@ public function getInfoInstance() { $instance = $this->getData('info_instance'); if (!($instance instanceof Mage_Payment_Model_Info)) { - Mage::throwException($this->_getHelper()->__('Can not retrieve payment iformation object instance')); + Mage::throwException($this->_getHelper()->__('Cannot retrieve the payment information object instance.')); } return $instance; } @@ -314,7 +377,7 @@ public function validate() public function authorize(Varien_Object $payment, $amount) { if (!$this->canAuthorize()) { - Mage::throwException($this->_getHelper()->__('Authorize action is not available')); + Mage::throwException($this->_getHelper()->__('Authorize action is not available.')); } return $this; } @@ -328,7 +391,7 @@ public function authorize(Varien_Object $payment, $amount) public function capture(Varien_Object $payment, $amount) { if (!$this->canCapture()) { - Mage::throwException($this->_getHelper()->__('Capture action is not available')); + Mage::throwException($this->_getHelper()->__('Capture action is not available.')); } return $this; @@ -372,7 +435,7 @@ public function refund(Varien_Object $payment, $amount) { if (!$this->canRefund()) { - Mage::throwException($this->_getHelper()->__('Refund action is not available')); + Mage::throwException($this->_getHelper()->__('Refund action is not available.')); } @@ -425,11 +488,53 @@ public function processBeforeVoid($invoice, $payment) public function void(Varien_Object $payment) { if (!$this->canVoid($payment)) { - Mage::throwException($this->_getHelper()->__('Void action is not available')); + Mage::throwException($this->_getHelper()->__('Void action is not available.')); } return $this; } + /** + * Whether this method can accept or deny payment + * + * @param Mage_Payment_Model_Info $payment + * @param bool $soft + * @return bool + */ + public function canReviewPayment(Mage_Payment_Model_Info $payment) + { + return $this->_canReviewPayment; + } + + /** + * Attempt to accept a payment that us under review + * + * @param Mage_Payment_Model_Info $payment + * @return bool + * @throws Mage_Core_Exception + */ + public function acceptPayment(Mage_Payment_Model_Info $payment) + { + if (!$this->canReviewPayment($payment)) { + Mage::throwException(Mage::helper('payment')->__('The payment review action is unavailable.')); + } + return false; + } + + /** + * Attempt to deny a payment that us under review + * + * @param Mage_Payment_Model_Info $payment + * @return bool + * @throws Mage_Core_Exception + */ + public function denyPayment(Mage_Payment_Model_Info $payment) + { + if (!$this->canReviewPayment($payment)) { + Mage::throwException(Mage::helper('payment')->__('The payment review action is unavailable.')); + } + return false; + } + /** * Retrieve payment method title * @@ -497,6 +602,15 @@ public function isAvailable($quote = null) 'method_instance' => $this, 'quote' => $quote, )); + + // disable method if it cannot implement recurring profiles management and there are recurring items in quote + if ($checkResult->isAvailable) { + $implementsRecurring = $this->canManageRecurringProfiles(); + // the $quote->hasRecurringItems() causes big performance impact, thus it has to be called last + if ($quote && (!$implementsRecurring) && $quote->hasRecurringItems()) { + $checkResult->isAvailable = false; + } + } return $checkResult->isAvailable; } @@ -522,4 +636,38 @@ public function getConfigPaymentAction() { return $this->getConfigData('payment_action'); } + + /** + * Log debug data to file + * + * @param mixed $debugData + */ + protected function _debug($debugData) + { + if ($this->getDebugFlag()) { + Mage::getModel('core/log_adapter', 'payment_' . $this->getCode() . '.log') + ->setFilterDataKeys($this->_debugReplacePrivateDataKeys) + ->log($debugData); + } + } + + /** + * Define if debugging is enabled + * + * @return bool + */ + public function getDebugFlag() + { + return $this->getConfigData('debug'); + } + + /** + * Used to call debug method from not Paymant Method context + * + * @param mixed $debugData + */ + public function debugData($debugData) + { + $this->_debug($debugData); + } } diff --git a/app/code/core/Mage/Payment/Model/Method/Cc.php b/app/code/core/Mage/Payment/Model/Method/Cc.php index 9415c955ae..ee6d97385c 100644 --- a/app/code/core/Mage/Payment/Model/Method/Cc.php +++ b/app/code/core/Mage/Payment/Model/Method/Cc.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -108,11 +108,15 @@ public function validate() $ccType = 'OT'; $ccTypeRegExpList = array( - 'VI' => '/^4[0-9]{12}([0-9]{3})?$/', // Visa - 'MC' => '/^5[1-5][0-9]{14}$/', // Master Card - 'AE' => '/^3[47][0-9]{13}$/', // American Express - 'DI' => '/^6011[0-9]{12}$/', // Discovery - 'SS' => '/^((6759[0-9]{12})|(49[013][1356][0-9]{13})|(633[34][0-9]{12})|(633110[0-9]{10})|(564182[0-9]{10}))([0-9]{2,3})?$/' + 'SS' => '/^((6759[0-9]{12})|(6334|6767[0-9]{12})|(6334|6767[0-9]{14,15})|(5018|5020|5038|6304|6759|6761|6763[0-9]{12,19})|(49[013][1356][0-9]{12})|(633[34][0-9]{12})|(633110[0-9]{10})|(564182[0-9]{10}))([0-9]{2,3})?$/', // Maestro / Solo + 'VI' => '/^4[0-9]{12}([0-9]{3})?$/', // Visa + 'MC' => '/^5[1-5][0-9]{14}$/', // Master Card + 'AE' => '/^3[47][0-9]{13}$/', // American Express + 'DI' => '/^6011[0-9]{12}$/', // Discovery + 'JCB' => '/^(3[0-9]{15}|(2131|1800)[0-9]{11})$/', // JCB + // Solo, Switch or Maestro. International safe + 'SM' => '/(^(5[0678])\d{11,18}$)|(^(6[^05])\d{11,18}$)|(^(601)[^1]\d{9,16}$)|(^(6011)\d{9,11}$)|(^(6011)\d{13,16}$)|(^(65)\d{11,13}$)|(^(65)\d{15,18}$)|(^(49030)[2-9](\d{10}$|\d{12,13}$))|(^(49033)[5-9](\d{10}$|\d{12,13}$))|(^(49110)[1-2](\d{10}$|\d{12,13}$))|(^(49117)[4-9](\d{10}$|\d{12,13}$))|(^(49118)[0-2](\d{10}$|\d{12,13}$))|(^(4936)(\d{12}$|\d{14,15}$))/', + 'SO' => '/(^(6334)[5-9](\d{11}$|\d{13,14}$))|(^(6767)(\d{12}$|\d{14,15}$))/', // Solo only ); foreach ($ccTypeRegExpList as $ccTypeMatch=>$ccTypeRegExp) { @@ -124,7 +128,7 @@ public function validate() if (!$this->OtherCcType($info->getCcType()) && $ccType!=$info->getCcType()) { $errorCode = 'ccsave_cc_type,ccsave_cc_number'; - $errorMsg = $this->_getHelper()->__('Credit card number mismatch with credit card type'); + $errorMsg = $this->_getHelper()->__('Credit card number mismatch with credit card type.'); } } else { @@ -135,7 +139,7 @@ public function validate() } else { $errorCode = 'ccsave_cc_type'; - $errorMsg = $this->_getHelper()->__('Credit card type is not allowed for this payment method'); + $errorMsg = $this->_getHelper()->__('Credit card type is not allowed for this payment method.'); } //validate credit card verification number @@ -147,16 +151,16 @@ public function validate() } } + if ($ccType != 'SS' && !$this->_validateExpDate($info->getCcExpYear(), $info->getCcExpMonth())) { + $errorCode = 'ccsave_expiration,ccsave_expiration_yr'; + $errorMsg = $this->_getHelper()->__('Incorrect credit card expiration date.'); + } + if($errorMsg){ Mage::throwException($errorMsg); //throw Mage::exception('Mage_Payment', $errorMsg, $errorCode); } - if ($ccType != 'SS' && !$this->_validateExpDate($info->getCcExpYear(), $info->getCcExpMonth())) { - $errorCode = 'ccsave_expiration,ccsave_expiration_yr'; - $errorMsg = $this->_getHelper()->__('Incorrect credit card expiration date'); - } - //This must be after all validation conditions if ($this->getIsCentinelValidationEnabled()) { $this->getCentinelValidator()->validate($this->getCentinelValidationData()); @@ -182,7 +186,10 @@ public function getVerificationRegEx() 'AE' => '/^[0-9]{4}$/', // American Express 'DI' => '/^[0-9]{3}$/', // Discovery 'SS' => '/^[0-9]{3,4}$/', - 'OT' => '/^[0-9]{3,4}$/' + 'SM' => '/^[0-9]{3,4}$/', // Switch or Maestro + 'SO' => '/^[0-9]{3,4}$/', // Solo + 'OT' => '/^[0-9]{3,4}$/', + 'JCB' => '/^[0-9]{4}$/' //JCB ); return $verificationExpList; } @@ -374,5 +381,3 @@ private function _isPlaceOrder() } } } - - diff --git a/app/code/core/Mage/Payment/Model/Method/Ccsave.php b/app/code/core/Mage/Payment/Model/Method/Ccsave.php index 4d0d0e1672..05c9a37481 100644 --- a/app/code/core/Mage/Payment/Model/Method/Ccsave.php +++ b/app/code/core/Mage/Payment/Model/Method/Ccsave.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Payment/Model/Method/Checkmo.php b/app/code/core/Mage/Payment/Model/Method/Checkmo.php index 74ed623408..c9ff838c97 100644 --- a/app/code/core/Mage/Payment/Model/Method/Checkmo.php +++ b/app/code/core/Mage/Payment/Model/Method/Checkmo.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Payment/Model/Method/Free.php b/app/code/core/Mage/Payment/Model/Method/Free.php index 41898e4751..1e4b00a50c 100644 --- a/app/code/core/Mage/Payment/Model/Method/Free.php +++ b/app/code/core/Mage/Payment/Model/Method/Free.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Payment/Model/Method/Purchaseorder.php b/app/code/core/Mage/Payment/Model/Method/Purchaseorder.php index 3e3889ba00..79eb1980b5 100644 --- a/app/code/core/Mage/Payment/Model/Method/Purchaseorder.php +++ b/app/code/core/Mage/Payment/Model/Method/Purchaseorder.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Payment/Model/Observer.php b/app/code/core/Mage/Payment/Model/Observer.php index 2efb495a6b..a3da3955db 100644 --- a/app/code/core/Mage/Payment/Model/Observer.php +++ b/app/code/core/Mage/Payment/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -63,4 +63,49 @@ public function salesOrderBeforeSave($observer) } return $this; } + + /** + * Collect buy request and set it as custom option + * + * Also sets the collected information and schedule as informational static options + * + * @param Varien_Event_Observer $observer + */ + public function prepareProductRecurringProfileOptions($observer) + { + $product = $observer->getEvent()->getProduct(); + $buyRequest = $observer->getEvent()->getBuyRequest(); + + if (!$product->isRecurring()) { + return; + } + + $profile = Mage::getModel('payment/recurring_profile') + ->setLocale(Mage::app()->getLocale()) + ->setStore(Mage::app()->getStore()) + ->importBuyRequest($buyRequest) + ->importProduct($product); + if (!$profile) { + return; + } + + // add the start datetime as product custom option + $product->addCustomOption(Mage_Payment_Model_Recurring_Profile::PRODUCT_OPTIONS_KEY, + serialize(array('start_datetime' => $profile->getStartDatetime())) + ); + + // duplicate as 'additional_options' to render with the product statically + $infoOptions = array(array( + 'label' => $profile->getFieldLabel('start_datetime'), + 'value' => $profile->exportStartDatetime(true), + )); + + foreach ($profile->exportScheduleInfo() as $info) { + $infoOptions[] = array( + 'label' => $info->getTitle(), + 'value' => $info->getSchedule(), + ); + } + $product->addCustomOption('additional_options', serialize($infoOptions)); + } } diff --git a/app/code/core/Mage/Payment/Model/Paygate/Request.php b/app/code/core/Mage/Payment/Model/Paygate/Request.php index 80a011b55e..e4b1195d39 100644 --- a/app/code/core/Mage/Payment/Model/Paygate/Request.php +++ b/app/code/core/Mage/Payment/Model/Paygate/Request.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Payment/Model/Paygate/Result.php b/app/code/core/Mage/Payment/Model/Paygate/Result.php index 87de7c054d..174f480c30 100644 --- a/app/code/core/Mage/Payment/Model/Paygate/Result.php +++ b/app/code/core/Mage/Payment/Model/Paygate/Result.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Payment/Model/Recurring/Profile.php b/app/code/core/Mage/Payment/Model/Recurring/Profile.php new file mode 100644 index 0000000000..ebe989fbbf --- /dev/null +++ b/app/code/core/Mage/Payment/Model/Recurring/Profile.php @@ -0,0 +1,618 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Mage + * @package Mage_Payment + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * Recurring payment profile + * Extends from Mage_Core_Abstract for a reason: to make descendants have its own resource + */ +class Mage_Payment_Model_Recurring_Profile extends Mage_Core_Model_Abstract +{ + /** + * Constants for passing data through catalog + * + * @var string + */ + const BUY_REQUEST_START_DATETIME = 'recurring_profile_start_datetime'; + const PRODUCT_OPTIONS_KEY = 'recurring_profile_options'; + + /** + * Errors collected during validation + * + * @var array + */ + protected $_errors = array(); + + /** + * + * @var Mage_Payment_Model_Method_Abstract + */ + protected $_methodInstance = null; + + /** + * Locale instance used for importing/exporting data + * + * @var Mage_Core_Model_Locale + */ + protected $_locale = null; + + /** + * Store instance used by locale or method instance + * + * @var Mage_Core_Model_Store + */ + protected $_store = null; + + /** + * Payment methods reference + * + * @var array + */ + protected $_paymentMethods = array(); + + /** + * Check whether the object data is valid + * Returns true if valid. + * + * @return bool + */ + public function isValid() + { + $this->_filterValues(); + $this->_errors = array(); + + // start date, order ref ID, schedule description + if (!$this->getStartDatetime()) { + $this->_errors['start_datetime'][] = Mage::helper('payment')->__('Start date is undefined.'); + } elseif (!Zend_Date::isDate($this->getStartDatetime(), Varien_Date::DATETIME_INTERNAL_FORMAT)) { + $this->_errors['start_datetime'][] = Mage::helper('payment')->__('Start date has invalid format.'); + } + if (!$this->getScheduleDescription()) { + $this->_errors['schedule_description'][] = Mage::helper('payment')->__('Schedule description must be not empty.'); + } + + // period unit and frequency, trial period unit and trial frequency + if (!$this->getPeriodUnit() || !in_array($this->getPeriodUnit(), $this->getAllPeriodUnits(false), true)) { + $this->_errors['period_unit'][] = Mage::helper('payment')->__('Billing period unit is not defined or wrong.'); + } elseif ($this->getPeriodFrequency()) { + $this->_validatePeriodFrequency('period_unit', 'period_frequency'); + } + if ($this->getTrialPeriodUnit()) { + if (!in_array($this->getTrialPeriodUnit(), $this->getAllPeriodUnits(false), true)) { + $this->_errors['trial_period_unit'][] = Mage::helper('payment')->__('Trial billing period unit is wrong.'); + } elseif ($this->getTrialPeriodFrequency()) { + $this->_validatePeriodFrequency('trial_period_unit', 'trial_period_frequency'); + } + } + + // billing and other amounts + if (!$this->getBillingAmount() || 0 >= $this->getBillingAmount()) { + $this->_errors['billing_amount'][] = Mage::helper('payment')->__('Wrong or empty billing amount specified.'); + } + foreach (array('trial_billing_abount', 'shipping_amount', 'tax_amount', 'init_amount') as $key) { + if ($this->hasData($key) && 0 >= $this->getData($key)) { + $this->_errors[$key][] = Mage::helper('payment')->__('Wrong %s specified.', $this->getFieldLabel($key)); + } + } + + // currency code + if (!$this->getCurrencyCode()) { + $this->_errors['currency_code'][] = Mage::helper('payment')->__('Currency code is undefined.'); + } + + // payment method + if (!$this->_methodInstance || !$this->getMethodCode()) { + $this->_errors['method_code'][] = Mage::helper('payment')->__('Payment method code is undefined.'); + } + if ($this->_methodInstance) { + try { + $this->_methodInstance->validateRecurringProfile($this); + } catch (Mage_Core_Exception $e) { + $this->_errors['payment_method'][] = $e->getMessage(); + } + } + + return empty($this->_errors); + } + + /** + * Getter for errors that may appear after validation + * + * @param bool $isGrouped + * @return array + */ + public function getValidationErrors($isGrouped = true, $asMessage = false) + { + if ($isGrouped && $this->_errors) { + $result = array(); + foreach ($this->_errors as $row) { + $result[] = implode(' ', $row); + } + if ($asMessage) { + return Mage::throwException( + Mage::helper('payment')->__("Payment profile is invalid:\n%s", implode("\n", $result)) + ); + } + return $result; + } + return $this->_errors; + } + + /** + * Setter for payment method instance + * + * @param Mage_Payment_Model_Method_Abstract $object + * @return Mage_Payment_Model_Recurring_Profile + * @throws Exception + */ + public function setMethodInstance(Mage_Payment_Model_Method_Abstract $object) + { + if ($object instanceof Mage_Payment_Model_Recurring_Profile_MethodInterface) { + $this->_methodInstance = $object; + } else { + throw new Exception('Invalid payment method instance for use in recurring profile.'); + } + return $this; + } + + /** + * Collect needed information from buy request + * Then filter data + * + * @param Varien_Object $buyRequest + * @return Mage_Payment_Model_Recurring_Profile + * @throws Mage_Core_Exception + */ + public function importBuyRequest(Varien_Object $buyRequest) + { + $startDate = $buyRequest->getData(self::BUY_REQUEST_START_DATETIME); + if ($startDate) { + $this->_ensureLocaleAndStore(); + $dateFormat = $this->_locale->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT); + $localeCode = $this->_locale->getLocaleCode(); + if (!Zend_Date::isDate($startDate, $dateFormat, $localeCode)) { + Mage::throwException(Mage::helper('payment')->__('Recurring profile start date has invalid format.')); + } + $utcTime = $this->_locale->utcDate($this->_store, $startDate, true, $dateFormat) + ->toString(Varien_Date::DATETIME_INTERNAL_FORMAT); + $this->setStartDatetime($utcTime)->setImportedStartDatetime($startDate); + } + return $this->_filterValues(); + } + + /** + * Import product recurring profile information + * Returns false if it cannot be imported + * + * @param Mage_Catalog_Model_Product $product + * @return Mage_Payment_Model_Recurring_Profile|false + */ + public function importProduct(Mage_Catalog_Model_Product $product) + { + if ($product->isRecurring() && is_array($product->getRecurringProfile())) { + // import recurring profile data + $this->addData($product->getRecurringProfile()); + + // automatically set product name if there is no schedule description + if (!$this->hasScheduleDescription()) { + $this->setScheduleDescription($product->getName()); + } + + // collect start datetime from the product options + $options = $product->getCustomOption(self::PRODUCT_OPTIONS_KEY); + if ($options) { + $options = unserialize($options->getValue()); + if (is_array($options)) { + if (isset($options['start_datetime'])) { + $startDatetime = new Zend_Date($options['start_datetime'], Varien_Date::DATETIME_INTERNAL_FORMAT); + $this->setNearestStartDatetime($startDatetime); + } + } + } + + return $this->_filterValues(); + } + return false; + } + + /** + * Render available schedule information + * + * @return array + */ + public function exportScheduleInfo() + { + $result = array( + new Varien_Object(array( + 'title' => Mage::helper('payment')->__('Billing Period'), + 'schedule' => $this->_renderSchedule('period_unit', 'period_frequency', 'period_max_cycles'), + )) + ); + $trial = $this->_renderSchedule('trial_period_unit', 'trial_period_frequency', 'trial_period_max_cycles'); + if ($trial) { + $result[] = new Varien_Object(array( + 'title' => Mage::helper('payment')->__('Trial Period'), + 'schedule' => $trial, + )); + } + return $result; + } + + /** + * Determine nearest possible profile start date + * + * @param Zend_Date $minAllowed + * @return Mage_Payment_Model_Recurring_Profile + */ + public function setNearestStartDatetime(Zend_Date $minAllowed = null) + { + // TODO: implement proper logic with invoking payment method instance + $date = $minAllowed; + if (!$date || $date->getTimestamp() < time()) { + $date = new Zend_Date(time()); + } + $this->setStartDatetime($date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)); + return $this; + } + + /** + * Convert the start datetime (if set) to proper locale/timezone and return + * + * @param bool $asString + * @return Zend_Date|string + */ + public function exportStartDatetime($asString = true) + { + $datetime = $this->getStartDatetime(); + if (!$datetime || !$this->_locale || !$this->_store) { + return; + } + $date = $this->_locale->storeDate($this->_store, $datetime, true); + if ($asString) { + return $date->toString($this->_locale->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)); + } + return $date; + } + + /** + * Locale instance setter + * + * @param Mage_Core_Model_Locale $locale + * @return Mage_Payment_Model_Recurring_Profile + */ + public function setLocale(Mage_Core_Model_Locale $locale) + { + $this->_locale = $locale; + return $this; + } + + /** + * Store instance setter + * + * @param Mage_Core_Model_Store $store + * @return Mage_Payment_Model_Recurring_Profile + */ + public function setStore(Mage_Core_Model_Store $store) + { + $this->_store = $store; + return $this; + } + + /** + * Getter for available period units + * + * @param bool $withLabels + * @return array + */ + public function getAllPeriodUnits($withLabels = true) + { + $units = array('day', 'week', 'semi_month', 'month', 'year'); + if ($withLabels) { + $result = array(); + foreach ($units as $unit) { + $result[$unit] = $this->getPeriodUnitLabel($unit); + } + return $result; + } + return $units; + } + + /** + * Render label for specified period unit + * + * @param string $unit + */ + public function getPeriodUnitLabel($unit) + { + switch ($unit) { + case 'day': return Mage::helper('payment')->__('Day'); + case 'week': return Mage::helper('payment')->__('Week'); + case 'semi_month': return Mage::helper('payment')->__('Two Weeks'); + case 'month': return Mage::helper('payment')->__('Month'); + case 'year': return Mage::helper('payment')->__('Year'); + } + return $unit; + } + + /** + * Getter for field label + * + * @param string $field + * @return string|null + */ + public function getFieldLabel($field) + { + switch ($field) { + case 'subscriber_name': + return Mage::helper('payment')->__('Subscriber Name'); + case 'start_datetime': + return Mage::helper('payment')->__('Start Date'); + case 'internal_reference_id': + return Mage::helper('payment')->__('Internal Reference ID'); + case 'schedule_description': + return Mage::helper('payment')->__('Schedule Description'); + case 'suspension_threshold': + return Mage::helper('payment')->__('Maximum Payment Failures'); + case 'bill_failed_later': + return Mage::helper('payment')->__('Auto Bill on Next Cycle'); + case 'period_unit': + return Mage::helper('payment')->__('Billing Period Unit'); + case 'period_frequency': + return Mage::helper('payment')->__('Billing Frequency'); + case 'period_max_cycles': + return Mage::helper('payment')->__('Maximum Billing Cycles'); + case 'billing_amount': + return Mage::helper('payment')->__('Billing Amount'); + case 'trial_period_unit': + return Mage::helper('payment')->__('Trial Billing Period Unit'); + case 'trial_period_frequency': + return Mage::helper('payment')->__('Trial Billing Frequency'); + case 'trial_period_max_cycles': + return Mage::helper('payment')->__('Maximum Trial Billing Cycles'); + case 'trial_billing_amount': + return Mage::helper('payment')->__('Trial Billing Amount'); + case 'currency_code': + return Mage::helper('payment')->__('Currency'); + case 'shipping_amount': + return Mage::helper('payment')->__('Shipping Amount'); + case 'tax_amount': + return Mage::helper('payment')->__('Tax Amount'); + case 'init_amount': + return Mage::helper('payment')->__('Initial Fee'); + case 'init_may_fail': + return Mage::helper('payment')->__('Allow Initial Fee Failure'); + case 'method_code': + return Mage::helper('payment')->__('Payment Method'); + case 'reference_id': + return Mage::helper('payment')->__('Payment Reference ID'); + } + } + + /** + * Getter for field comments + * + * @param string $field + * @return string|null + */ + public function getFieldComment($field) + { + switch ($field) { + case 'subscriber_name': + return Mage::helper('payment')->__('Full name of the person receiving the product or service paid for by the recurring payment.'); + case 'start_datetime': + return Mage::helper('payment')->__('The date when billing for the profile begins.'); + case 'schedule_description': + return Mage::helper('payment')->__('Short description of the recurring payment. By default equals to the product name.'); + case 'suspension_threshold': + return Mage::helper('payment')->__('The number of scheduled payments that can fail before the profile is automatically suspended.'); + case 'bill_failed_later': + return Mage::helper('payment')->__('Automatically bill the outstanding balance amount in the next billing cycle (if there were failed payments).'); + case 'period_unit': + return Mage::helper('payment')->__('Unit for billing during the subscription period.'); + case 'period_frequency': + return Mage::helper('payment')->__('Number of billing periods that make up one billing cycle.'); + case 'period_max_cycles': + return Mage::helper('payment')->__('The number of billing cycles for payment period.'); + case 'init_amount': + return Mage::helper('payment')->__('Initial non-recurring payment amount due immediately upon profile creation.'); + case 'init_may_fail': + return Mage::helper('payment')->__('Whether to suspend the payment profile if the initial fee fails or add it to the outstanding balance.'); + } + } + + /** + * Transform some specific data for output + * + * @param string $key + * @return mixed + */ + public function renderData($key) + { + $value = $this->_getData($key); + switch ($key) { + case 'period_unit': + return $this->getPeriodUnitLabel($value); + case 'method_code': + if (!$this->_paymentMethods) { + $this->_paymentMethods = Mage::helper('payment')->getPaymentMethodList(false); + } + if (isset($this->_paymentMethods[$value])) { + return $this->_paymentMethods[$value]; + } + break; + case 'start_datetime': + return $this->exportStartDatetime(true); + } + return $value; + } + + /** + * Filter self data to make sure it can be validated properly + * + * @return Mage_Payment_Model_Recurring_Profile + */ + protected function _filterValues() + { + // determine payment method/code + if ($this->_methodInstance) { + $this->setMethodCode($this->_methodInstance->getCode()); + } + elseif ($this->getMethodCode()) { + $this->getMethodInstance(); + } + + // unset redundant values, if empty + foreach (array('schedule_description', + 'suspension_threshold', 'bill_failed_later', 'period_frequency', 'period_max_cycles', 'reference_id', + 'trial_period_unit', 'trial_period_frequency', 'trial_period_max_cycles', 'init_may_fail') as $key) { + if ($this->hasData($key) && (!$this->getData($key) || '0' == $this->getData($key))) { + $this->unsetData($key); + } + } + + // cast amounts + foreach (array( + 'billing_amount', 'trial_billing_amount', 'shipping_amount', 'tax_amount', 'init_amount') as $key) { + if ($this->hasData($key)) { + if (!$this->getData($key) || 0 == $this->getData($key)) { + $this->unsetData($key); + } else { + $this->setData($key, sprintf('%.4F', $this->getData($key))); + } + } + } + + // automatically determine start date, if not set + if ($this->getStartDatetime()) { + $date = new Zend_Date($this->getStartDatetime(), Varien_Date::DATETIME_INTERNAL_FORMAT); + $this->setNearestStartDatetime($date); + } else { + $this->setNearestStartDatetime(); + } + + return $this; + } + + /** + * Check that locale and store instances are set + * + * @throws Exception + */ + protected function _ensureLocaleAndStore() + { + if (!$this->_locale || !$this->_store) { + throw new Exception('Locale and store instances must be set for this operation.'); + } + } + + /** + * Return payment method instance + * + * @return Mage_Payment_Model_Method_Abstract + */ + protected function getMethodInstance() + { + if (!$this->_methodInstance) { + $this->setMethodInstance(Mage::helper('payment')->getMethodInstance($this->getMethodCode())); + } + $this->_methodInstance->setStore($this->getStoreId()); + return $this->_methodInstance; + } + + /** + * Check accordance of the unit and frequency + * + * @param string $unitKey + * @param string $frequencyKey + */ + protected function _validatePeriodFrequency($unitKey, $frequencyKey) + { +// TODO: implement + // check accordance of the unit and frequency + // $this->_errors + // if set, invoke payment method instance? + } + + /** + * Perform full validation before saving + * + * @throws Mage_Core_Exception + */ + protected function _validateBeforeSave() + { + if (!$this->isValid()) { + Mage::throwException($this->getValidationErrors(true, true)); + } + if (!$this->getInternalReferenceId()) { + Mage::throwException( + Mage::helper('payment')->__('An internal reference ID is required to save the payment profile.') + ); + } + } + + /** + * Validate before saving + * + * @return Mage_Payment_Model_Recurring_Profile + */ + protected function _beforeSave() + { + $this->_validateBeforeSave(); + return parent::_beforeSave(); + } + + /** + * Generate explanations for specified schedule parameters + * + * TODO: utilize Zend_Translate_Plural or similar stuff to render proper declensions with numerals. + * + * @param string $periodKey + * @param string $frequencyKey + * @param string $cyclesKey + * @return array + */ + protected function _renderSchedule($periodKey, $frequencyKey, $cyclesKey) + { + $result = array(); + + $period = $this->_getData($periodKey); + $frequency = (int)$this->_getData($frequencyKey); + if (!$period || !$frequency) { + return $result; + } + if ('semi_month' == $period) { + $frequency = ''; + } + $result[] = Mage::helper('payment')->__('%s %s cycle.', $frequency, $this->getPeriodUnitLabel($period)); + + $cycles = (int)$this->_getData($cyclesKey); + if ($cycles) { + $result[] = Mage::helper('payment')->__('Repeats %s time(s).', $cycles); + } else { + $result[] = Mage::helper('payment')->__('Repeats until suspended or canceled.'); + } + return $result; + } +} diff --git a/app/code/core/Mage/Payment/Model/Recurring/Profile/MethodInterface.php b/app/code/core/Mage/Payment/Model/Recurring/Profile/MethodInterface.php new file mode 100644 index 0000000000..f5c060fbf6 --- /dev/null +++ b/app/code/core/Mage/Payment/Model/Recurring/Profile/MethodInterface.php @@ -0,0 +1,76 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Mage + * @package Mage_Payment + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * Recurring profile gateway management interface + */ +interface Mage_Payment_Model_Recurring_Profile_MethodInterface +{ + /** + * Validate data + * + * @param Mage_Payment_Model_Recurring_Profile $profile + * @throws Mage_Core_Exception + */ + public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile); + + /** + * Submit to the gateway + * + * @param Mage_Payment_Model_Recurring_Profile $profile + * @param Mage_Payment_Model_Info $paymentInfo + */ + public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, Mage_Payment_Model_Info $paymentInfo); + + /** + * Fetch details + * + * @param string $referenceId + * @param Varien_Object $result + */ + public function getRecurringProfileDetails($referenceId, Varien_Object $result); + + /** + * Check whether can get recurring profile details + * + * @return bool + */ + public function canGetRecurringProfileDetails(); + + /** + * Update data + * + * @param Mage_Payment_Model_Recurring_Profile $profile + */ + public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile); + + /** + * Manage status + * + * @param Mage_Payment_Model_Recurring_Profile $profile + */ + public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile); +} diff --git a/app/code/core/Mage/Payment/Model/Source/Cctype.php b/app/code/core/Mage/Payment/Model/Source/Cctype.php index f71654a5d3..8d73f703c0 100644 --- a/app/code/core/Mage/Payment/Model/Source/Cctype.php +++ b/app/code/core/Mage/Payment/Model/Source/Cctype.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Payment/Model/Source/Invoice.php b/app/code/core/Mage/Payment/Model/Source/Invoice.php index d28f6b1803..2c07ddcae8 100644 --- a/app/code/core/Mage/Payment/Model/Source/Invoice.php +++ b/app/code/core/Mage/Payment/Model/Source/Invoice.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Payment/etc/adminhtml.xml b/app/code/core/Mage/Payment/etc/adminhtml.xml index 7142ad361d..885dfea1c1 100644 --- a/app/code/core/Mage/Payment/etc/adminhtml.xml +++ b/app/code/core/Mage/Payment/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Payment/etc/config.xml b/app/code/core/Mage/Payment/etc/config.xml index bb5c08a641..0c5014e4b6 100644 --- a/app/code/core/Mage/Payment/etc/config.xml +++ b/app/code/core/Mage/Payment/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -69,7 +69,7 @@ </VI> <MC> <code>MC</code> - <name>Master Card</name> + <name>MasterCard</name> <order>20</order> </MC> <DI> @@ -82,6 +82,16 @@ <name>Maestro/Solo</name> <order>40</order> </SS> + <JCB> + <code>JCB</code> + <name>JCB</name> + <order>50</order> + </JCB> + <MCI> + <code>MCI</code> + <name>Maestro (International)</name> + <order>53</order> + </MCI> <OT> <code>OT</code> <name>Other</name> @@ -89,6 +99,10 @@ </OT> </types> </cc> + + <groups> + <offline>Offline Payment Methods</offline> + </groups> </payment> <events> @@ -101,7 +115,6 @@ </observers> </sales_order_save_before> </events> - </global> <frontend> @@ -114,6 +127,23 @@ </Mage_Payment> </modules> </translate> + <events> + <catalog_product_type_prepare_cart_options> + <observers> + <payment_recurring_profile_prepare_options> + <class>payment/observer</class> + <method>prepareProductRecurringProfileOptions</method> + </payment_recurring_profile_prepare_options> + </observers> + </catalog_product_type_prepare_cart_options> + </events> + <layout> + <updates> + <payment module="Mage_Payment"> + <file>payment.xml</file> + </payment> + </updates> + </layout> </frontend> <adminhtml> <translate> @@ -136,6 +166,7 @@ <order_status>pending</order_status> <title>Credit Card (saved) 0 + offline @@ -144,6 +175,7 @@ pending Check / Money order 0 + offline @@ -157,6 +189,7 @@ 0 --> 1 + offline @@ -165,6 +198,7 @@ pending Purchase Order 0 + offline diff --git a/app/code/core/Mage/Payment/etc/system.xml b/app/code/core/Mage/Payment/etc/system.xml index 423ac1114d..0ed7bea589 100644 --- a/app/code/core/Mage/Payment/etc/system.xml +++ b/app/code/core/Mage/Payment/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Payment - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -64,7 +64,7 @@ 1 - + select adminhtml/system_config_source_order_status_new 2 @@ -73,7 +73,7 @@ 0 - + text 100 1 @@ -107,9 +107,9 @@ 1 0 - + - Severe Validation Removes Chargeback Liability on Merchant + Severe validation removes chargeback liability on merchant. select adminhtml/system_config_source_yesno 25 @@ -118,8 +118,9 @@ 0 1 - + + A value is required for live mode. Refer to your CardinalCommerce agreement. text adminhtml/system_config_source_yesno 30 @@ -130,7 +131,7 @@ - + allowspecific 50 adminhtml/system_config_source_payment_allspecificcountries @@ -139,7 +140,7 @@ 0 - + multiselect 51 adminhtml/system_config_source_country @@ -169,7 +170,7 @@ - + text 5 1 @@ -186,7 +187,7 @@ 0 - + select adminhtml/system_config_source_order_status_new 20 @@ -195,7 +196,7 @@ 0 - + text 100 1 @@ -211,7 +212,7 @@ 1 - + allowspecific 50 adminhtml/system_config_source_payment_allspecificcountries @@ -220,7 +221,7 @@ 0 - + multiselect 51 adminhtml/system_config_source_country @@ -230,7 +231,7 @@ 1 - + 61 1 1 @@ -282,7 +283,7 @@ 0 - + select adminhtml/system_config_source_order_status_newprocessing 2 @@ -291,7 +292,7 @@ 0 - + select payment/source_invoice 3 @@ -300,7 +301,7 @@ 0 - + text 100 1 @@ -316,7 +317,7 @@ 1 - + allowspecific 50 adminhtml/system_config_source_payment_allspecificcountries @@ -325,7 +326,7 @@ 0 - + multiselect 51 adminhtml/system_config_source_country @@ -357,7 +358,7 @@ - + text 7 1 @@ -374,7 +375,7 @@ 0 - + select adminhtml/system_config_source_order_status_new 2 @@ -383,7 +384,7 @@ 0 - + text 100 1 @@ -399,7 +400,7 @@ 1 - + allowspecific 50 adminhtml/system_config_source_payment_allspecificcountries @@ -408,7 +409,7 @@ 0 - + multiselect 51 adminhtml/system_config_source_country diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Details.php b/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Details.php new file mode 100644 index 0000000000..201a2a63b1 --- /dev/null +++ b/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Details.php @@ -0,0 +1,60 @@ + + */ +class Mage_Paypal_Block_Adminhtml_Settlement_Details extends Mage_Adminhtml_Block_Widget_Form_Container +{ + /** + * Block construction + * Initialize titles, buttons + */ + public function __construct() + { + parent::__construct(); + $this->_controller = ''; + $this->_headerText = Mage::helper('paypal')->__('View Transaction Details'); + $this->_removeButton('reset') + ->_removeButton('delete') + ->_removeButton('save'); + } + + /** + * Initialize form + * @return Mage_Paypal_Block_Adminhtml_Settlement_Details + */ + protected function _prepareLayout() + { + parent::_prepareLayout(); + $this->setChild('form', $this->getLayout()->createBlock('paypal/adminhtml_settlement_details_form')); + return $this; + } +} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Details/Form.php b/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Details/Form.php new file mode 100644 index 0000000000..80ec270afa --- /dev/null +++ b/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Details/Form.php @@ -0,0 +1,122 @@ + + */ +class Mage_Paypal_Block_Adminhtml_Settlement_Details_Form extends Mage_Adminhtml_Block_Widget_Form +{ + /** + * Prepare read-only data and group it by fieldsets + * @return Mage_Paypal_Block_Adminhtml_Settlement_Details_Form + */ + protected function _prepareForm() + { + $model = Mage::registry('current_transaction'); + /* @var $model Mage_Paypal_Model_Report_Settlement_Row */ + $settlement = Mage::getSingleton('paypal/report_settlement'); + /* @var $settlement Mage_Paypal_Model_Report_Settlement */ + + $fieldsets = array( + 'reference_fieldset' => array( + 'fields' => array( + 'transaction_id' => array('label' => $settlement->getFieldLabel('transaction_id')), + 'invoice_id' => array('label' => $settlement->getFieldLabel('invoice_id')), + 'paypal_reference_id' => array('label' => $settlement->getFieldLabel('paypal_reference_id')), + 'paypal_reference_id_type' => array( + 'label' => $settlement->getFieldLabel('paypal_reference_id_type'), + 'value' => $model->getReferenceType($model->getData('paypal_reference_id_type')) + ), + 'custom_field' => array('label' => $settlement->getFieldLabel('custom_field')), + ), + 'legend' => Mage::helper('paypal')->__('Reference Information') + ), + + 'transaction_fieldset' => array( + 'fields' => array( + 'transaction_event_code' => array( + 'label' => $settlement->getFieldLabel('transaction_event_code'), + 'value' => sprintf('%s (%s)', $model->getData('transaction_event_code'), $model->getTransactionEvent($model->getData('transaction_event_code'))) + ), + 'transaction_initiation_date' => array( + 'label' => $settlement->getFieldLabel('transaction_initiation_date'), + 'value' => $this->helper('core')->formatDate($model->getData('transaction_initiation_date'), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true) + ), + 'transaction_completion_date' => array( + 'label' => $settlement->getFieldLabel('transaction_completion_date'), + 'value' => $this->helper('core')->formatDate($model->getData('transaction_completion_date'), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true) + ), + 'transaction_debit_or_credit' => array( + 'label' => $settlement->getFieldLabel('transaction_debit_or_credit'), + 'value' => $model->getDebitCreditText($model->getData('transaction_debit_or_credit')) + ), + 'gross_transaction_amount' => array( + 'label' => $settlement->getFieldLabel('gross_transaction_amount'), + 'value' => Mage::app()->getLocale() + ->currency($model->getData('gross_transaction_currency')) + ->toCurrency($model->getData('gross_transaction_amount')) + ), + ), + 'legend' => Mage::helper('paypal')->__('Transaction Information') + ), + + 'fee_fieldset' => array( + 'fields' => array( + 'fee_debit_or_credit' => array( + 'label' => $settlement->getFieldLabel('fee_debit_or_credit'), + 'value' => $model->getDebitCreditText($model->getData('fee_debit_or_credit')) + ), + 'fee_amount' => array( + 'label' => $settlement->getFieldLabel('fee_amount'), + 'value' => Mage::app()->getLocale() + ->currency($model->getData('fee_currency')) + ->toCurrency($model->getData('fee_amount')) + ), + ), + 'legend' => Mage::helper('paypal')->__('PayPal Fee Information') + ), + ); + + $form = new Varien_Data_Form(); + foreach ($fieldsets as $key => $data) { + $fieldset = $form->addFieldset($key, array('legend' => $data['legend'])); + foreach ($data['fields'] as $id => $info) { + $fieldset->addField($id, 'label', array( + 'name' => $id, + 'label' => $info['label'], + 'title' => $info['label'], + 'value' => isset($info['value']) ? $info['value'] : $model->getData($id), + )); + } + } + $this->setForm($form); + return parent::_prepareForm(); + } +} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Report.php b/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Report.php new file mode 100644 index 0000000000..6b8af73a10 --- /dev/null +++ b/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Report.php @@ -0,0 +1,53 @@ + + */ +class Mage_Paypal_Block_Adminhtml_Settlement_Report extends Mage_Adminhtml_Block_Widget_Grid_Container +{ + /** + * Prepare grid container, add additional buttons + */ + public function __construct() + { + $this->_blockGroup = 'paypal'; + $this->_controller = 'adminhtml_settlement_report'; + $this->_headerText = Mage::helper('paypal')->__('PayPal Settlement Reports'); + parent::__construct(); + $this->_removeButton('add'); + $message = Mage::helper('paypal')->__('Connecting to PayPal SFTP server to fetch new reports. Are you sure you want to proceed?'); + $this->_addButton('fetch', array( + 'label' => Mage::helper('paypal')->__('Fetch Updates'), + 'onclick' => "confirmSetLocation('{$message}', '{$this->getUrl('*/*/fetch')}')", + 'class' => 'task' + )); + } +} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Report/Grid.php b/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Report/Grid.php new file mode 100644 index 0000000000..a1742c1a81 --- /dev/null +++ b/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Report/Grid.php @@ -0,0 +1,144 @@ + + */ +class Mage_Paypal_Block_Adminhtml_Settlement_Report_Grid extends Mage_Adminhtml_Block_Widget_Grid +{ + /** + * Retain filter parameters in session + * + * @var bool + */ + protected $_saveParametersInSession = true; + + /** + * Constructor + * Set main configuration of grid + */ + public function __construct() + { + parent::__construct(); + $this->setId('settlementGrid'); + $this->setUseAjax(true); + } + + /** + * Prepare collection for grid + * @return Mage_Paypal_Block_Adminhtml_Settlement_Grid + */ + protected function _prepareCollection() + { + $collection = Mage::getResourceModel('paypal/report_settlement_row_collection'); + $this->setCollection($collection); + if (!$this->getParam($this->getVarNameSort())) { + $collection->setOrder('row_id', 'desc'); + } + return parent::_prepareCollection(); + } + + /** + * Prepare grid columns + * @return Mage_Paypal_Block_Adminhtml_Settlement_Grid + */ + protected function _prepareColumns() + { + $settlement = Mage::getSingleton('paypal/report_settlement'); + $this->addColumn('report_date', array( + 'header' => $settlement->getFieldLabel('report_date'), + 'index' => 'report_date', + 'type' => 'date' + )); + $this->addColumn('account_id', array( + 'header' => $settlement->getFieldLabel('account_id'), + 'index' => 'account_id' + )); + $this->addColumn('transaction_id', array( + 'header' => $settlement->getFieldLabel('transaction_id'), + 'index' => 'transaction_id' + )); + $this->addColumn('invoice_id', array( + 'header' => $settlement->getFieldLabel('invoice_id'), + 'index' => 'invoice_id' + )); + $this->addColumn('paypal_reference_id', array( + 'header' => $settlement->getFieldLabel('paypal_reference_id'), + 'index' => 'paypal_reference_id' + )); + $this->addColumn('transaction_event_code', array( + 'header' => $settlement->getFieldLabel('transaction_event'), + 'index' => 'transaction_event_code', + 'type' => 'options', + 'options' => Mage::getModel('paypal/report_settlement_row')->getTransactionEvents() + )); + $this->addColumn('transaction_initiation_date', array( + 'header' => $settlement->getFieldLabel('transaction_initiation_date'), + 'index' => 'transaction_initiation_date', + 'type' => 'datetime' + )); + $this->addColumn('transaction_completion_date', array( + 'header' => $settlement->getFieldLabel('transaction_completion_date'), + 'index' => 'transaction_completion_date', + 'type' => 'datetime' + )); + $this->addColumn('gross_transaction_amount', array( + 'header' => $settlement->getFieldLabel('gross_transaction_amount'), + 'index' => 'gross_transaction_amount', + 'type' => 'currency', + 'currency' => 'gross_transaction_currency', + )); + $this->addColumn('fee_amount', array( + 'header' => $settlement->getFieldLabel('fee_amount'), + 'index' => 'fee_amount', + 'type' => 'currency', + 'currency' => 'gross_transaction_currency', + )); + return parent::_prepareColumns(); + } + + /** + * Return grid URL + * @return string + */ + public function getGridUrl() + { + return $this->getUrl('*/*/grid'); + } + + /** + * Return item view URL + * @return string + */ + public function getRowUrl($item) + { + return $this->getUrl('*/*/details', array('id' => $item->getId())); + } +} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/ApiWizard.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/ApiWizard.php new file mode 100644 index 0000000000..d96889cf7c --- /dev/null +++ b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/ApiWizard.php @@ -0,0 +1,72 @@ +getTemplate()) { + $this->setTemplate('paypal/system/config/api_wizard.phtml'); + } + return $this; + } + + /** + * Unset some non-related element parameters + * + * @param Varien_Data_Form_Element_Abstract $element + * @return string + */ + public function render(Varien_Data_Form_Element_Abstract $element) + { + $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); + return parent::render($element); + } + + /** + * Get the button and scripts contents + * + * @param Varien_Data_Form_Element_Abstract $element + * @return string + */ + protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) + { + $originalData = $element->getOriginalData(); + $this->addData(array( + 'button_label' => Mage::helper('paypal')->__($originalData['button_label']), + 'button_url' => $originalData['button_url'], + 'html_id' => $element->getHtmlId(), + )); + return $this->_toHtml(); + } +} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Global.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Global.php new file mode 100644 index 0000000000..3cfb36ac1e --- /dev/null +++ b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Global.php @@ -0,0 +1,201 @@ + + */ +class Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Global + extends Mage_Adminhtml_Block_Abstract + implements Varien_Data_Form_Element_Renderer_Interface +{ + /** + * Associative array of PayPal product selection elements + * + * @var array + */ + protected $_elements = array(); + + /** + * Custom template + * + * @var string + */ + protected $_template = 'paypal/system/config/fieldset/global.phtml'; + + /** + * Render fieldset html + * + * @param Varien_Data_Form_Element_Abstract $fieldset + * @return string + */ + public function render(Varien_Data_Form_Element_Abstract $fieldset) + { + foreach ($fieldset->getSortedElements() as $element) { + $htmlId = $element->getHtmlId(); + $this->_elements[$htmlId] = $element; + } + $originalData = $fieldset->getOriginalData(); + $this->addData(array( + 'fieldset_label' => $fieldset->getLegend(), + 'fieldset_help_url' => isset($originalData['help_url']) ? $originalData['help_url'] : '', + )); + return $this->toHtml(); + } + + /** + * Get array of element objects + * + * @return array + */ + public function getElements() + { + return $this->_elements; + } + + /** + * Return checkbox html with hidden field for correct config values + * + * @param string $elementId + * @return string + */ + public function getElementHtml(Varien_Data_Form_Element_Abstract $element) + { + $configValue = (string)$element->getValue(); + if ($configValue) { + $element->setChecked(true); + } else { + $element->setValue('1'); + } + if ($element->getCanUseDefaultValue() && $element->getInherit()) { + $element->setDisabled(true); + } + + $hidden = new Varien_Data_Form_Element_Hidden(array( + 'html_id' => $element->getHtmlId() . '_value', + 'name' => $element->getName(), + 'value' => '0' + )); + $hidden->setForm($element->getForm()); + return $hidden->getElementHtml() . $element->getElementHtml(); + } + + /** + * Whether element should be rendered in "simplified" mode + * + * @param Varien_Data_Form_Element_Abstract $element + * @return bool + */ + public function getIsElementSimplified(Varien_Data_Form_Element_Abstract $element) + { + $originalData = $element->getOriginalData(); + return isset($originalData['is_simplified']) && 1 == $originalData['is_simplified']; + } + + /** + * Getter for element label + * + * @param Varien_Data_Form_Element_Abstract $element + * @return string + */ + public function getElementLabel(Varien_Data_Form_Element_Abstract $element) + { + return $element->getLabel(); + } + + /** + * Getter for element comment + * + * @param Varien_Data_Form_Element_Abstract $element + * @return string + */ + public function getElementComment(Varien_Data_Form_Element_Abstract $element) + { + return $element->getComment(); + } + + /** + * Getter for element comment + * + * @param Varien_Data_Form_Element_Abstract $element + * @return string + */ + public function getElementOriginalData(Varien_Data_Form_Element_Abstract $element, $key) + { + $data = $element->getOriginalData(); + return isset($data[$key]) ? $data[$key] : ''; + } + + /** + * Check whether checkbox has "Use default" option or not + * + * @param Varien_Data_Form_Element_Abstract $element + * @return bool + */ + public function hasInheritElement(Varien_Data_Form_Element_Abstract $element) + { + return (bool)$element->getCanUseDefaultValue(); + } + + /** + * Return "Use default" checkbox html + * + * @param Varien_Data_Form_Element_Abstract $element + * @return string + */ + public function getInheritElementHtml(Varien_Data_Form_Element_Abstract $element) + { + $elementId = $element->getHtmlId(); + $inheritCheckbox = new Varien_Data_Form_Element_Checkbox(array( + 'html_id' => $elementId . '_inherit', + 'name' => preg_replace('/\[value\](\[\])?$/', '[inherit]', $element->getName()), + 'value' => '1', + 'class' => 'checkbox config-inherit', + 'onclick' => 'toggleValueElements(this, $(\'' . $elementId . '\').up())' + )); + if ($element->getInherit()) { + $inheritCheckbox->setChecked(true); + } + + $inheritCheckbox->setForm($element->getForm()); + return $inheritCheckbox->getElementHtml(); + } + + /** + * Return label for "Use default" checkbox + * + * @param Varien_Data_Form_Element_Abstract $element + * @return string + */ + public function getInheritElementLabelHtml(Varien_Data_Form_Element_Abstract $element) + { + return sprintf('', + $element->getHtmlId() . '_inherit', + $element->getDefaultValue(), + Mage::helper('adminhtml')->__('Use Default') + ); + } +} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Hint.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Hint.php new file mode 100644 index 0000000000..bc61e9bc39 --- /dev/null +++ b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Hint.php @@ -0,0 +1,48 @@ + + */ +class Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Hint + extends Mage_Adminhtml_Block_Abstract + implements Varien_Data_Form_Element_Renderer_Interface +{ + protected $_template = 'paypal/system/config/fieldset/hint.phtml'; + + /** + * Render fieldset html + * + * @param Varien_Data_Form_Element_Abstract $element + * @return string + */ + public function render(Varien_Data_Form_Element_Abstract $element) + { + return $this->toHtml(); + } +} diff --git a/app/code/core/Mage/Paypal/Block/Express/Form.php b/app/code/core/Mage/Paypal/Block/Express/Form.php index bd0fb05592..90d4902107 100644 --- a/app/code/core/Mage/Paypal/Block/Express/Form.php +++ b/app/code/core/Mage/Paypal/Block/Express/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -41,7 +41,22 @@ class Mage_Paypal_Block_Express_Form extends Mage_Paypal_Block_Standard_Form protected function _construct() { $result = parent::_construct(); - $this->setRedirectMessage(Mage::helper('paypal')->__('Your billing address will be ignored and you will be redirected to PayPal website.')); + $this->setRedirectMessage(Mage::helper('paypal')->__('You will be redirected to PayPal website.')); return $result; } + + /** + * Set data to block + * + * @return Mage_Core_Block_Abstract + */ + protected function _beforeToHtml() + { + $customerId = Mage::getSingleton('customer/session')->getCustomerId(); + if (Mage::helper('paypal')->shouldAskToCreateBillingAgreement($this->_config, $customerId) + && $this->canCreateBillingAgreement()) { + $this->setCreateBACode(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT); + } + return parent::_beforeToHtml(); + } } diff --git a/app/code/core/Mage/Paypal/Block/Express/Review.php b/app/code/core/Mage/Paypal/Block/Express/Review.php index 903106b67d..5701cccfbe 100644 --- a/app/code/core/Mage/Paypal/Block/Express/Review.php +++ b/app/code/core/Mage/Paypal/Block/Express/Review.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -38,6 +38,13 @@ class Mage_Paypal_Block_Express_Review extends Mage_Core_Block_Template */ protected $_quote; + /** + * Currently selected shipping rate + * + * @var Mage_Sales_Model_Quote_Address_Rate + */ + protected $_currentShippingRate = null; + /** * Paypal action prefix * @@ -81,105 +88,149 @@ public function getShippingAddress() } /** - * Return address base on quote shipping address + * Get HTML output for specified address * - * @return Mage_Sales_Quote_Address + * @param Mage_Sales_Model_Quote_Address + * @return string */ - public function getAddress() + public function renderAddress($address) { - if (empty($this->_address)) { - $this->_address = $this->_quote->getShippingAddress(); - } - return $this->_address; + return $address->getFormated(true); } /** - * Return shipping rates + * Return carrier name from config, base on carrier code * - * @return array + * @param $carrierCode string + * @return string */ - public function getShippingRates() + public function getCarrierName($carrierCode) { - if (empty($this->_rates)) { - $groups = $this->getAddress()->getGroupedAllShippingRates(); - return $this->_rates = $groups; + if ($name = Mage::getStoreConfig("carriers/{$carrierCode}/title")) { + return $name; } - return $this->_rates; + return $carrierCode; } /** - * Return carrier name from config, base on carrier code + * Get either shipping rate code or empty value on error * - * @param $carrierCode string + * @param Varien_Object $rate * @return string */ - public function getCarrierName($carrierCode) + public function renderShippingRateValue(Varien_Object $rate) { - if ($name = Mage::getStoreConfig('carriers/'.$carrierCode.'/title')) { - return $name; + if ($rate->getErrorMessage()) { + return ''; } - return $carrierCode; + return $rate->getCode(); } /** - * get shipping method + * Get shipping rate code title and its price or error message * + * @param Varien_Object $rate + * @param string $format + * @param string $inclTaxFormat * @return string */ - public function getAddressShippingMethod() + public function renderShippingRateOption($rate, $format = '%s - %s%s', $inclTaxFormat = ' (%s %s)') { - return $this->getAddress()->getShippingMethod(); + $renderedInclTax = ''; + if ($rate->getErrorMessage()) { + $price = $rate->getErrorMessage(); + } else { + $price = $this->_getShippingPrice($rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); + $incl = $this->_getShippingPrice($rate->getPrice(), true); + if (($incl != $price) && $this->helper('tax')->displayShippingBothPrices()) { + $renderedInclTax = sprintf($inclTaxFormat, Mage::helper('tax')->__('Incl. Tax'), $incl); + } + } + return sprintf($format, $rate->getMethodTitle(), $price, $renderedInclTax); } /** - * Return formated shipping price - * - * @param $price float - * @param $flag bool + * Getter for current shipping rate * - * @return bool + * @return Mage_Sales_Model_Quote_Address_Rate */ - public function getShippingPrice($price, $flag) + public function getCurrentShippingRate() { - return $this->formatPrice($this->helper('tax')->getShippingPrice($price, $flag, $this->getAddress())); + return $this->_currentShippingRate; } /** - * Format price base on store convert price method - * - * @param $price float - * @return string + * Set paypal actions prefix */ - public function formatPrice($price) + public function setPaypalActionPrefix($prefix) { - return $this->_quote->getStore()->convertPrice($price, true); + $this->_paypalActionPrefix = $prefix; } /** - * Return quote virtual status + * Return formatted shipping price + * + * @param float $price + * @param bool $isInclTax * * @return bool */ - public function isVirtual() + protected function _getShippingPrice($price, $isInclTax) { - return $this->_quote->getIsVirtual(); + return $this->_formatPrice($this->helper('tax')->getShippingPrice($price, $isInclTax, $this->_address)); } /** - * Return paypal actions prefix + * Format price base on store convert price method * + * @param float $price * @return string */ - public function getPaypalActionPrefix() + protected function _formatPrice($price) { - return $this->_paypalActionPrefix; + return $this->_quote->getStore()->convertPrice($price, true); } /** - * Set paypal actions prefix + * Retrieve payment method and assign additional template values + * + * @return Mage_Paypal_Block_Express_Review */ - public function setPaypalActionPrefix($prefix) + protected function _beforeToHtml() { - $this->_paypalActionPrefix = $prefix; + $methodInstance = $this->_quote->getPayment()->getMethodInstance(); + $this->setPaymentMethodTitle($methodInstance->getTitle()); + + $this->setShippingRateRequired(true); + if ($this->_quote->getIsVirtual()) { + $this->setShippingRateRequired(false); + } else { + // prepare shipping rates + $this->_address = $this->_quote->getShippingAddress(); + $groups = $this->_address->getGroupedAllShippingRates(); + if ($groups && $this->_address) { + $this->setShippingRateGroups($groups); + // determine current selected code & name + foreach ($groups as $code => $rates) { + foreach ($rates as $rate) { + if ($this->_address->getShippingMethod() == $rate->getCode()) { + $this->_currentShippingRate = $rate; + break(2); + } + } + } + } + + // misc shipping parameters + $this->setShippingMethodSubmitUrl($this->getUrl("{$this->_paypalActionPrefix}/express/saveShippingMethod")) + ->setCanEditShippingAddress($this->_quote->getMayEditShippingAddress()) + ->setCanEditShippingMethod($this->_quote->getMayEditShippingMethod()) + ; + } + + $this->setEditUrl($this->getUrl("{$this->_paypalActionPrefix}/express/edit")) + ->setPlaceOrderUrl($this->getUrl("{$this->_paypalActionPrefix}/express/placeOrder")); + + return parent::_beforeToHtml(); } } diff --git a/app/code/core/Mage/Paypal/Block/Express/Review/Details.php b/app/code/core/Mage/Paypal/Block/Express/Review/Details.php index 6612d70d33..0b838b3727 100644 --- a/app/code/core/Mage/Paypal/Block/Express/Review/Details.php +++ b/app/code/core/Mage/Paypal/Block/Express/Review/Details.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Paypal/Block/Express/Shortcut.php b/app/code/core/Mage/Paypal/Block/Express/Shortcut.php index 53e3e02b4f..ab9515b351 100644 --- a/app/code/core/Mage/Paypal/Block/Express/Shortcut.php +++ b/app/code/core/Mage/Paypal/Block/Express/Shortcut.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -30,25 +30,18 @@ class Mage_Paypal_Block_Express_Shortcut extends Mage_Core_Block_Template { /** - * Model type + * Whether the block should be eventually rendered * - * @var string - */ - protected $_modelType = 'paypal/express'; - - /** - * Pro model type - * - * @var string + * @var bool */ - protected $_proModelType = 'paypal/pro'; + protected $_shouldRender = true; /** * Payment method code * * @var string */ - protected $_paymentMethod = Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS; + protected $_paymentMethodCode = Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS; /** * Start express action @@ -58,115 +51,77 @@ class Mage_Paypal_Block_Express_Shortcut extends Mage_Core_Block_Template protected $_startAction = 'paypal/express/start'; /** - * PayPal Pro instance + * Express checkout model factory name * - * @var Mage_Paypal_Model_Pro + * @var string */ - protected $_pro = null; + protected $_checkoutType = 'paypal/express_checkout'; - /** - * Express checkout URL getter - * - * @return string - */ - public function getCheckoutUrl() + protected function _beforeToHtml() { - return $this->getUrl($this->_startAction); - } + $result = parent::_beforeToHtml(); + $config = Mage::getModel('paypal/config', array($this->_paymentMethodCode)); + $isInCatalog = $this->getIsInCatalogProduct(); + $quote = ($isInCatalog || '' == $this->getIsQuoteAllowed()) + ? null : Mage::getSingleton('checkout/session')->getQuote(); - /** - * Get checkout button image url - * - * @return string - */ - public function getImageUrl() - { - return Mage::getModel('paypal/express_checkout', array( - 'quote' => Mage::getSingleton('checkout/session')->getQuote(), - 'config' => $this->_getProInstance()->getConfig(), - ))->getCheckoutShortcutImageUrl(); - } + // check visibility on cart or product page + $context = $isInCatalog ? 'visible_on_product' : 'visible_on_cart'; + if (!$config->$context) { + $this->_shouldRender = false; + return $result; + } - /** - * Payment method model type setter - * - * @param string - */ - public function setPaymentModelType($type) - { - $this->_modelType = $type; - } + // validate minimum quote amount + if (null !== $quote && !$quote->validateMinimumAmount()) { + $this->_shouldRender = false; + return $result; + } - /** - * Pro model type setter - * - * @param string - */ - public function setProModelType($type) - { - $this->_proModelType = $type; - } + // check payment method availability + $methodInstance = Mage::helper('payment')->getMethodInstance($this->_paymentMethodCode); + if (!$methodInstance->isAvailable($quote)) { + $this->_shouldRender = false; + return $result; + } - /** - * Payment method setter - * - * @param string - */ - public function setPaymentMethod($method) - { - $this->_paymentMethod = $method; - } + // set misc data + $this->setShortcutHtmlId($this->helper('core')->uniqHash('ec_shortcut_')) + ->setCheckoutUrl($this->getUrl($this->_startAction)) + ; - /** - * Start action setter - * - * @param string - */ - public function setStartAction($action) - { - $this->_startAction = $action; - } + // use static image if in catalog + if ($isInCatalog || null === $quote) { + $this->setImageUrl($config->getExpressCheckoutShortcutImageUrl(Mage::app()->getLocale()->getLocaleCode())); + } else { + $this->setImageUrl(Mage::getModel($this->_checkoutType, array( + 'quote' => $quote, + 'config' => $config, + ))->getCheckoutShortcutImageUrl()); + } - /** - * Shortcut text setter - * - * @param string - */ - public function setShortcutText($text) - { - $this->_shortcutText = $text; + // ask whether to create a billing agreement + $customerId = Mage::getSingleton('customer/session')->getCustomerId(); // potential issue for caching + if (Mage::helper('paypal')->shouldAskToCreateBillingAgreement($config, $customerId)) { + $this->setConfirmationUrl($this->getUrl($this->_startAction, + array(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT => 1) + )); + $this->setConfirmationMessage(Mage::helper('paypal')->__('Would you like to sign a billing agreement to streamline further purchases with PayPal?')); + } + + return $result; } /** - * Check whether method is available and render HTML - * TODO: payment method instance is not supposed to know about quote. - * The block also is not supposed to know about payment method instance + * Render the block if needed * * @return string */ protected function _toHtml() { - if (!$this->_getProInstance()->getConfig()->visibleOnCart) { - return ''; - } - $quote = Mage::getSingleton('checkout/session')->getQuote(); - if (!$quote->validateMinimumAmount() - || !Mage::getModel($this->_modelType, array($this->_pro))->isAvailable($quote)) { + if (!$this->_shouldRender) { return ''; } return parent::_toHtml(); } - - /** - * PayPal Pro instance getter - * - * @return Mage_Paypal_Model_Pro - */ - protected function _getProInstance() - { - if (null === $this->_pro) { - $this->_pro = Mage::getModel($this->_proModelType)->setMethod($this->_paymentMethod); - } - return $this->_pro; - } } diff --git a/app/code/core/Mage/Paypal/Block/Logo.php b/app/code/core/Mage/Paypal/Block/Logo.php new file mode 100644 index 0000000000..99c45ba727 --- /dev/null +++ b/app/code/core/Mage/Paypal/Block/Logo.php @@ -0,0 +1,67 @@ +_getConfig()->getPaymentMarkWhatIsPaypalUrl(Mage::app()->getLocale()); + } + + /** + * Getter for paypal config + * + * @return Mage_Paypal_Model_Config + */ + protected function _getConfig() + { + return Mage::getSingleton('paypal/config'); + } + + /** + * Disable block output if logo turned off + * + * @return string + */ + protected function _toHtml() + { + $type = $this->getLogoType(); // assigned in layout etc. + $logoUrl = $this->_getConfig()->getAdditionalOptionsLogoUrl(Mage::app()->getLocale()->getLocaleCode(), $type); + if (!$logoUrl) { + return ''; + } + $this->setLogoImageUrl($logoUrl); + return parent::_toHtml(); + } +} diff --git a/app/code/core/Mage/Paypal/Block/Payment/Info.php b/app/code/core/Mage/Paypal/Block/Payment/Info.php index a864060946..fd89e46ee9 100644 --- a/app/code/core/Mage/Paypal/Block/Payment/Info.php +++ b/app/code/core/Mage/Paypal/Block/Payment/Info.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -30,6 +30,18 @@ */ class Mage_Paypal_Block_Payment_Info extends Mage_Payment_Block_Info_Cc { + /** + * Don't show CC type for non-CC methods + * + * @return string|null + */ + public function getCcTypeName() + { + if (Mage_Paypal_Model_Config::getIsCreditCardMethod($this->getInfo()->getMethod())) { + return parent::getCcTypeName(); + } + } + /** * Prepare PayPal-specific payment information * diff --git a/app/code/core/Mage/Paypal/Block/Standard/Form.php b/app/code/core/Mage/Paypal/Block/Standard/Form.php index 2ceb5d6a57..825c19b44d 100644 --- a/app/code/core/Mage/Paypal/Block/Standard/Form.php +++ b/app/code/core/Mage/Paypal/Block/Standard/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -35,24 +35,31 @@ class Mage_Paypal_Block_Standard_Form extends Mage_Payment_Block_Form */ protected $_methodCode = Mage_Paypal_Model_Config::METHOD_WPS; + /** + * Config model instance + * + * @var Mage_Paypal_Model_Config + */ + protected $_config; + /** * Set template and redirect message */ protected function _construct() { - $config = Mage::getSingleton('paypal/config')->setMethod($this->getMethodCode()); + $this->_config = Mage::getModel('paypal/config')->setMethod($this->getMethodCode()); $locale = Mage::app()->getLocale(); $mark = Mage::getConfig()->getBlockClassName('core/template'); $mark = new $mark; $mark->setTemplate('paypal/payment/mark.phtml') - ->setPaymentAcceptanceMarkHref($config->getPaymentMarkWhatIsPaypalUrl($locale)) - ->setPaymentAcceptanceMarkSrc($config->getPaymentMarkImageUrl($locale->getLocaleCode())) + ->setPaymentAcceptanceMarkHref($this->_config->getPaymentMarkWhatIsPaypalUrl($locale)) + ->setPaymentAcceptanceMarkSrc($this->_config->getPaymentMarkImageUrl($locale->getLocaleCode())) ; // known issue: code above will render only static mark image $this->setTemplate('paypal/payment/redirect.phtml') ->setRedirectMessage( Mage::helper('paypal')->__('You will be redirected to PayPal website when you place an order.') ) - ->setBannerSrc($config->getPaymentFormLogoUrl($locale->getLocaleCode())) + ->setMethodTitle('') // Output PayPal mark, omit title ->setMethodLabelAfterHtml($mark->toHtml()) ; return parent::_construct(); diff --git a/app/code/core/Mage/Paypal/Block/Standard/Redirect.php b/app/code/core/Mage/Paypal/Block/Standard/Redirect.php index c35707faca..567ae30a7b 100644 --- a/app/code/core/Mage/Paypal/Block/Standard/Redirect.php +++ b/app/code/core/Mage/Paypal/Block/Standard/Redirect.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Paypal_Block_Standard_Redirect extends Mage_Core_Block_Abstract diff --git a/app/code/core/Mage/Paypal/Controller/Express/Abstract.php b/app/code/core/Mage/Paypal/Controller/Express/Abstract.php index 29a2ef9f1f..938348090c 100644 --- a/app/code/core/Mage/Paypal/Controller/Express/Abstract.php +++ b/app/code/core/Mage/Paypal/Controller/Express/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -39,6 +39,11 @@ abstract class Mage_Paypal_Controller_Express_Abstract extends Mage_Core_Control */ protected $_config = null; + /** + * @var Mage_Sales_Model_Quote + */ + protected $_quote = false; + /** * Instantiate config */ @@ -55,9 +60,21 @@ public function startAction() { try { $this->_initCheckout(); + + // billing agreement + $customerId = Mage::getSingleton('customer/session')->getCustomerId(); + $isBARequested = (bool)$this->getRequest() + ->getParam(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT); + if ($customerId) { + $this->_checkout->setCustomerId($customerId); + $this->_checkout->setIsBillingAgreementRequested($isBARequested); + } + + // giropay $this->_checkout->prepareGiropayUrls(Mage::getUrl('checkout/onepage/success'), Mage::getUrl('paypal/express/cancel'), Mage::getUrl('checkout/onepage/success') ); + $token = $this->_checkout->start(Mage::getUrl('*/*/return'), Mage::getUrl('*/*/cancel')); if ($token && $url = $this->_checkout->getRedirectUrl()) { $this->_initToken($token); @@ -75,6 +92,22 @@ public function startAction() $this->_redirect('checkout/cart'); } + /** + * Return shipping options items for shipping address from request + */ + public function shippingOptionsCallbackAction() + { + try { + $quoteId = $this->getRequest()->getParam('quote_id'); + $this->_quote = Mage::getModel('sales/quote')->load($quoteId); + $this->_initCheckout(); + $response = $this->_checkout->getShippingOptionsCallbackResponse($this->getRequest()->getParams()); + $this->getResponse()->setBody($response); + } catch (Exception $e) { + Mage::logException($e); + } + } + /** * Cancel Express Checkout */ @@ -92,11 +125,11 @@ public function cancelAction() ->unsLastSuccessQuoteId() ->unsLastOrderId() ->unsLastRealOrderId() - ->addSuccess($this->__('Express Checkout and Order have been cancelled.')) + ->addSuccess($this->__('Express Checkout and Order have been canceled.')) ; } } else { - $this->_getCheckoutSession()->addSuccess($this->__('Express Checkout has been cancelled.')); + $this->_getCheckoutSession()->addSuccess($this->__('Express Checkout has been canceled.')); } } catch (Mage_Core_Exception $e) { $this->_getCheckoutSession()->addError($e->getMessage()); @@ -140,7 +173,6 @@ public function reviewAction() $this->_initLayoutMessages('paypal/session'); $this->getLayout()->getBlock('paypal.express.review') ->setQuote($this->_getQuote()) - ->setCanEditShippingAddress($this->_checkout->mayEditShippingAddress()) ->getChild('details')->setQuote($this->_getQuote()) ; $this->renderLayout(); @@ -209,16 +241,41 @@ public function placeOrderAction() { try { $this->_initCheckout(); - $order = $this->_checkout->placeOrder($this->_initToken()); + $this->_checkout->place($this->_initToken()); + // prepare session to success or cancellation page + $session = $this->_getCheckoutSession(); + $session->clearHelperData(); + + // "last successful quote" $quoteId = $this->_getQuote()->getId(); - $this->_getCheckoutSession() - ->setLastQuoteId($quoteId) - ->setLastSuccessQuoteId($quoteId) - ->setLastOrderId($order->getId()) - ->setLastRealOrderId($order->getIncrementId()) - ; - if ($url = $this->_checkout->getRedirectUrl()) { + $session->setLastQuoteId($quoteId)->setLastSuccessQuoteId($quoteId); + + // an order may be created + $order = $this->_checkout->getOrder(); + if ($order) { + $session->setLastOrderId($order->getId()) + ->setLastRealOrderId($order->getIncrementId()); + // as well a billing agreement can be created + $agreement = $this->_checkout->getBillingAgreement(); + if ($agreement) { + $session->setLastBillingAgreementId($agreement->getId()); + } + } + + // recurring profiles may be created along with the order or without it + $profiles = $this->_checkout->getRecurringPaymentProfiles(); + if ($profiles) { + $ids = array(); + foreach($profiles as $profile) { + $ids[] = $profile->getId(); + } + $session->setLastRecurringProfileIds($ids); + } + + // redirect if PayPal specified some URL (for example, to Giropay bank) + $url = $this->_checkout->getRedirectUrl(); + if ($url) { $this->getResponse()->setRedirect($url); return; } @@ -310,6 +367,9 @@ private function _getCheckoutSession() */ private function _getQuote() { - return $this->_getCheckoutSession()->getQuote(); + if (!$this->_quote) { + $this->_quote = $this->_getCheckoutSession()->getQuote(); + } + return $this->_quote; } } diff --git a/app/code/core/Mage/Paypal/Controller/Ipn/Abstract.php b/app/code/core/Mage/Paypal/Controller/Ipn/Abstract.php deleted file mode 100644 index 3f764ea1e4..0000000000 --- a/app/code/core/Mage/Paypal/Controller/Ipn/Abstract.php +++ /dev/null @@ -1,81 +0,0 @@ -_ipnAction(Mage_Paypal_Model_Config::METHOD_WPS); - } - - /** - * Process IPN for PayPal Express - */ - public function expressAction() - { - return $this->_ipnAction(Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS); - } - - /** - * Process IPN for PayPal Direct - */ - public function directAction() - { - return $this->_ipnAction(Mage_Paypal_Model_Config::METHOD_WPP_DIRECT); - } - - /** - * Actually process the IPN - * @param string $method - */ - protected function _ipnAction($method) - { - if (!$this->getRequest()->isPost()) { - return; - } - $config = Mage::getModel($this->_configType, array($method)); - if (!$config->active) { - return; - } - Mage::getModel('paypal/ipn') - ->setConfig($config) - ->setIpnFormData($this->getRequest()->getPost()) - ->processIpnRequest(); - } -} diff --git a/app/code/core/Mage/Paypal/Helper/Data.php b/app/code/core/Mage/Paypal/Helper/Data.php index 0991b7833a..a70d4de6cb 100644 --- a/app/code/core/Mage/Paypal/Helper/Data.php +++ b/app/code/core/Mage/Paypal/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,6 +29,13 @@ */ class Mage_Paypal_Helper_Data extends Mage_Core_Helper_Abstract { + /** + * Cache for shouldAskToCreateBillingAgreement() + * + * @var bool + */ + protected static $_shouldAskToCreateBillingAgreement = null; + /** * Get line items and totals from sales quote or order * @@ -38,7 +45,7 @@ class Mage_Paypal_Helper_Data extends Mage_Core_Helper_Abstract * the items discount should go as separate cart line item with negative amount * the shipping_discount is outlined in PayPal API docs, but ignored for some reason. Hence commented out. * - * @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $salesEntity + * @param Mage_Sales_Model_Order $salesEntity * @return array (array of $items, array of totals, $discountTotal, $shippingTotal) */ public function prepareLineItems(Mage_Core_Model_Abstract $salesEntity, $discountTotalAsItem = true, $shippingTotalAsItem = false) @@ -58,6 +65,7 @@ public function prepareLineItems(Mage_Core_Model_Abstract $salesEntity, $discoun 'subtotal' => $salesEntity->getBaseSubtotal() - $discountAmount, 'tax' => $salesEntity->getBaseTaxAmount(), 'shipping' => $salesEntity->getBaseShippingAmount(), + 'discount' => $discountAmount, // 'shipping_discount' => -1 * abs($salesEntity->getBaseShippingDiscountAmount()), ); } else { @@ -72,6 +80,7 @@ public function prepareLineItems(Mage_Core_Model_Abstract $salesEntity, $discoun // 'shipping_discount' => -1 * abs($address->getBaseShippingDiscountAmount()), ); } + // discount total as line item (negative) if ($discountTotalAsItem && $discountAmount) { $items[] = new Varien_Object(array( @@ -89,36 +98,67 @@ public function prepareLineItems(Mage_Core_Model_Abstract $salesEntity, $discoun 'amount' => (float)$totals['shipping'], )); } + + $hiddenTax = (float) $salesEntity->getBaseHiddenTaxAmount(); + if ($hiddenTax) { + $items[] = new Varien_Object(array( + 'name' => Mage::helper('paypal')->__('Discount Tax'), + 'qty' => 1, + 'amount' => (float)$hiddenTax, + )); + } + return array($items, $totals, $discountAmount, $totals['shipping']); } /** - * Compare order total amount with cart's items cost sum + * Check whether cart line items are eligible for exporting to PayPal API * - * @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $salesEntity - * @param float $orderAmount + * Requires data returned by self::prepareLineItems() + * + * @param array $items + * @param array $totals + * @param float $referenceAmount * @return bool */ - public function doLineItemsMatchAmount(Mage_Core_Model_Abstract $salesEntity, $orderAmount) + public function areCartLineItemsValid($items, $totals, $referenceAmount) { - $total = 0; - foreach ($salesEntity->getAllItems() as $item) { - if ($salesEntity instanceof Mage_Sales_Model_Order) { - $qty = $item->getQtyOrdered(); - $amount = $item->getBasePrice(); - $shipping = $salesEntity->getBaseShippingAmount(); - } else { - $address = $salesEntity->getIsVirtual() ? $salesEntity->getBillingAddress() : $salesEntity->getShippingAddress(); - $qty = $item->getTotalQty(); - $amount = $item->getBaseCalculationPrice(); - $shipping = $address->getBaseShippingAmount(); - } - $total += (float)$amount*$qty; + $sum = 0; + foreach ($items as $i) { + $sum = $sum + $i['qty'] * $i['amount']; } + /** + * numbers are intentionally converted to strings because of possible comparison error + * see http://php.net/float + */ + return sprintf('%.4F', ($sum + $totals['shipping'] + $totals['tax'])) == sprintf('%.4F', $referenceAmount); + } - if ($total == $orderAmount || $total+$shipping == $orderAmount) { - return true; + /** + * Check whether customer should be asked confirmation whether to sign a billing agreement + * + * @param Mage_Paypal_Model_Config $config + * @param int $customerId + * @return bool + */ + public function shouldAskToCreateBillingAgreement(Mage_Paypal_Model_Config $config, $customerId) + { + if (null === self::$_shouldAskToCreateBillingAgreement) { + self::$_shouldAskToCreateBillingAgreement = false; + if ($customerId && $config->shouldAskToCreateBillingAgreement()) { + if (Mage::getModel('sales/billing_agreement')->needToCreateForCustomer($customerId)) { + self::$_shouldAskToCreateBillingAgreement = true; + } + } } + return self::$_shouldAskToCreateBillingAgreement; + } + + /** + * @deprecated after 1.4.0.1 + */ + public function doLineItemsMatchAmount(Mage_Core_Model_Abstract $salesEntity, $orderAmount) + { return false; } @@ -134,9 +174,10 @@ protected function _prepareLineItemFields(Mage_Core_Model_Abstract $salesEntity, if ($salesEntity instanceof Mage_Sales_Model_Order) { $qty = $item->getQtyOrdered(); $amount = $item->getBasePrice(); + // TODO: nominal item for order } else { $qty = $item->getTotalQty(); - $amount = $item->getBaseCalculationPrice(); + $amount = $item->isNominal() ? 0 : $item->getBaseCalculationPrice(); } // workaround in case if item subtotal precision is not compatible with PayPal (.2) $subAggregatedLabel = ''; diff --git a/app/code/core/Mage/Paypal/Model/Api/Abstract.php b/app/code/core/Mage/Paypal/Model/Api/Abstract.php index 2b7b27ba40..977d89e5b1 100644 --- a/app/code/core/Mage/Paypal/Model/Api/Abstract.php +++ b/app/code/core/Mage/Paypal/Model/Api/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -63,6 +63,27 @@ abstract class Mage_Paypal_Model_Api_Abstract extends Varien_Object */ protected $_lineItemExportTotals = array(); protected $_lineItemExportItemsFormat = array(); + protected $_lineItemExportItemsFilters = array(); + + /** + * Shipping options export to request mapping settings + * @var array + */ + protected $_shippingOptionsExportItemsFormat = array(); + + /** + * Imported recurring profiles array + * + * @var array + */ + protected $_recurringPaymentProfiles = array(); + + /** + * Fields that should be replaced in debug with '***' + * + * @var array + */ + protected $_debugReplacePrivateDataKeys = array(); /** * Return Paypal Api user name based on config data @@ -135,13 +156,13 @@ public function getProxyPort() } /** - * Return Paypal Api debug flag based on config data + * @deprecated after 1.4.1.0 * * @return bool */ public function getDebug() { - return $this->_config->debugFlag; + return $this->getDebugFlag(); } /** @@ -204,6 +225,14 @@ public function getPaymentAction() return $this->_getDataOrConfig('payment_action'); } + /** + * PayPal merchant email getter + */ + public function getBusinessAccount() + { + return $this->_getDataOrConfig('business_account'); + } + /** * Import $this public data to specified object or array * @@ -259,24 +288,17 @@ public function getFraudManagementFiltersEnabled() } /** - * Whether specified payment status indicates that money were paid + * Set recurring profiles * - * @param string $paymentStatus - * @return bool - */ - public function isPaid($paymentStatus) - { - return $paymentStatus === 'Completed'; - } - - /** - * Whether payment is completed - * - * @return bool + * @param array $items + * @return Mage_Paypal_Model_Api_Abstract */ - public function isPaymentComplete() + public function addRecurringPaymentProfiles(array $items) { - return $this->isPaid($this->getPaymentStatus()); + if ($items) { + $this->_recurringPaymentProfiles = $items; + } + return $this; } /** @@ -343,6 +365,10 @@ protected function _exportLineItems(array &$request, $i = 0) foreach ($items as $item) { foreach ($this->_lineItemExportItemsFormat as $publicKey => $privateFormat) { $value = $item->getDataUsingMethod($publicKey); + if (isset($this->_lineItemExportItemsFilters[$publicKey])) { + $callback = $this->_lineItemExportItemsFilters[$publicKey]; + $value = call_user_func(array($this, $callback), $value); + } if (is_float($value)) { $value = $this->_filterAmount($value); } @@ -355,7 +381,7 @@ protected function _exportLineItems(array &$request, $i = 0) if ($lineItemTotals) { $request = Varien_Object_Mapper::accumulateByMap($lineItemTotals, $request, $this->_lineItemExportTotals); foreach ($this->_lineItemExportTotals as $privateKey) { - if (isset($request[$privateKey])) { + if (array_key_exists($privateKey, $request)) { $request[$privateKey] = $this->_filterAmount($request[$privateKey]); } else { Mage::logException(new Exception(sprintf('Missing index "%s" for line item totals.', $privateKey))); @@ -365,6 +391,36 @@ protected function _exportLineItems(array &$request, $i = 0) } } + /** + * Prepare shipping options request + * Returns false if there are no shipping options + * + * @param array &$request + * @param int $i + * @return bool + */ + protected function _exportShippingOptions(array &$request, $i = 0) + { + $options = $this->getShippingOptions(); + if (empty($options)) { + return false; + } + foreach ($options as $option) { + foreach ($this->_shippingOptionsExportItemsFormat as $publicKey => $privateFormat) { + $value = $option->getDataUsingMethod($publicKey); + if (is_float($value)) { + $value = $this->_filterAmount($value); + } + if (is_bool($value)) { + $value = $this->_filterBool($value); + } + $request[sprintf($privateFormat, $i)] = $value; + } + $i++; + } + return true; + } + /** * Filter amounts in API calls * @param float|string $value @@ -375,6 +431,28 @@ protected function _filterAmount($value) return sprintf('%.2F', $value); } + /** + * Filter boolean values in API calls + * + * @param mixed $value + * @return string + */ + protected function _filterBool($value) + { + return ($value) ? 'true' : 'false'; + } + + /** + * Filter int values in API calls + * + * @param mixed $value + * @return int + */ + protected function _filterInt($value) + { + return (int)$value; + } + /** * Unified getter that looks in data or falls back to config * @@ -439,4 +517,40 @@ protected function _buildQuery($request) { return http_build_query($request); } + + /** + * Filter qty in API calls + * Paypal note: The value for quantity must be a positive integer. Null, zero, or negative numbers are not allowed. + * + * @param float|string|int $value + * @return string + */ + protected function _filterQty($value) + { + return intval($value); + } + + /** + * Log debug data to file + * + * @param mixed $debugData + */ + protected function _debug($debugData) + { + if ($this->getDebugFlag()) { + Mage::getModel('core/log_adapter', 'payment_' . $this->_config->getMethodCode() . '.log') + ->setFilterDataKeys($this->_debugReplacePrivateDataKeys) + ->log($debugData); + } + } + + /** + * Define if debugging is enabled + * + * @return bool + */ + public function getDebugFlag() + { + return $this->_config->debug; + } } diff --git a/app/code/core/Mage/Paypal/Model/Api/Nvp.php b/app/code/core/Mage/Paypal/Model/Api/Nvp.php index 179177601f..fbb66eaff6 100644 --- a/app/code/core/Mage/Paypal/Model/Api/Nvp.php +++ b/app/code/core/Mage/Paypal/Model/Api/Nvp.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -40,13 +40,20 @@ class Mage_Paypal_Model_Api_Nvp extends Mage_Paypal_Model_Api_Abstract const SET_EXPRESS_CHECKOUT = 'SetExpressCheckout'; const GET_EXPRESS_CHECKOUT_DETAILS = 'GetExpressCheckoutDetails'; const DO_EXPRESS_CHECKOUT_PAYMENT = 'DoExpressCheckoutPayment'; + const CALLBACK_RESPONSE = 'CallbackResponse'; + + /** + * Paypal ManagePendingTransactionStatus actions + */ + const PENDING_TRANSACTION_ACCEPT = 'Accept'; + const PENDING_TRANSACTION_DENY = 'Deny'; /** * Capture types (make authorization close or remain open) * @var string */ protected $_captureTypeComplete = 'Complete'; - protected $_captureTypeNotcomplete = 'Complete'; + protected $_captureTypeNotcomplete = 'NotComplete'; /** * Global public interface map @@ -59,6 +66,10 @@ class Mage_Paypal_Model_Api_Nvp extends Mage_Paypal_Model_Api_Abstract 'PWD' => 'api_password', 'SIGNATURE' => 'api_signature', 'BUTTONSOURCE' => 'build_notation_code', + + // for Unilateral payments + 'SUBJECT' => 'business_account', + // commands 'PAYMENTACTION' => 'payment_action', 'RETURNURL' => 'return_url', @@ -108,6 +119,11 @@ class Mage_Paypal_Model_Api_Nvp extends Mage_Paypal_Model_Api_Abstract // backwards compatibility 'FIRSTNAME' => 'firstname', 'LASTNAME' => 'lastname', + + // shipping rate + 'SHIPPINGOPTIONNAME' => 'shipping_rate_code', + 'NOSHIPPING' => 'suppress_shipping', + // paypal direct credit card information 'CREDITCARDTYPE' => 'credit_card_type', 'ACCT' => 'credit_card_number', @@ -118,13 +134,49 @@ class Mage_Paypal_Model_Api_Nvp extends Mage_Paypal_Model_Api_Abstract 'CVV2MATCH' => 'cvv2_check_result', 'AVSCODE' => 'avs_result', // cardinal centinel - 'AUTHSTATUS3D' => 'centinel_authstatus', - 'MPIVENDOR3DS' => 'centinel_mpivendor', + 'AUTHSTATUS3DS' => 'centinel_authstatus', + 'MPIVENDOR3DS' => 'centinel_mpivendor', 'CAVV' => 'centinel_cavv', 'ECI3DS' => 'centinel_eci', 'XID' => 'centinel_xid', 'VPAS' => 'centinel_vpas_result', 'ECISUBMITTED3DS' => 'centinel_eci_result', + + // recurring payment profiles +//'TOKEN' => 'token', + 'SUBSCRIBERNAME' =>'subscriber_name', + 'PROFILESTARTDATE' => 'start_datetime', + 'PROFILEREFERENCE' => 'internal_reference_id', + 'DESC' => 'schedule_description', + 'MAXFAILEDPAYMENTS' => 'suspension_threshold', + 'AUTOBILLAMT' => 'bill_failed_later', + 'BILLINGPERIOD' => 'period_unit', + 'BILLINGFREQUENCY' => 'period_frequency', + 'TOTALBILLINGCYCLES' => 'period_max_cycles', +//'AMT' => 'billing_amount', // have to use 'amount', see above + 'TRIALBILLINGPERIOD' => 'trial_period_unit', + 'TRIALBILLINGFREQUENCY' => 'trial_period_frequency', + 'TRIALTOTALBILLINGCYCLES' => 'trial_period_max_cycles', + 'TRIALAMT' => 'trial_billing_amount', +// 'CURRENCYCODE' => 'currency_code', + 'SHIPPINGAMT' => 'shipping_amount', + 'TAXAMT' => 'tax_amount', + 'INITAMT' => 'init_amount', + 'FAILEDINITAMTACTION' => 'init_may_fail', + 'PROFILEID' => 'recurring_profile_id', + 'PROFILESTATUS' => 'recurring_profile_status', + 'STATUS' => 'status', + + 'BILLINGAGREEMENTID' => 'billing_agreement_id', + 'REFERENCEID' => 'reference_id', + 'BILLINGAGREEMENTSTATUS' => 'billing_agreement_status', + 'BILLINGTYPE' => 'billing_type', + 'SREET' => 'street', + 'CITY' => 'city', + 'STATE' => 'state', + 'COUNTRYCODE' => 'countrycode', + 'ZIP' => 'zip', + 'PAYERBUSINESS' => 'payer_business', ); /** @@ -133,13 +185,25 @@ class Mage_Paypal_Model_Api_Nvp extends Mage_Paypal_Model_Api_Abstract * @var array */ protected $_exportToRequestFilters = array( - 'AMT' => '_filterAmount', + 'AMT' => '_filterAmount', + 'TRIALAMT' => '_filterAmount', + 'SHIPPINGAMT' => '_filterAmount', + 'TAXAMT' => '_filterAmount', + 'INITAMT' => '_filterAmount', 'CREDITCARDTYPE' => '_filterCcType', +// 'PROFILESTARTDATE' => '_filterToPaypalDate', + 'AUTOBILLAMT' => '_filterBillFailedLater', + 'BILLINGPERIOD' => '_filterPeriodUnit', + 'TRIALBILLINGPERIOD' => '_filterPeriodUnit', + 'FAILEDINITAMTACTION' => '_filterInitialAmountMayFail', + 'BILLINGAGREEMENTSTATUS' => '_filterBillingAgreementStatus', + 'NOSHIPPING' => '_filterInt', ); protected $_importFromRequestFilters = array( 'REDIRECTREQUIRED' => '_filterToBool', 'SUCCESSPAGEREDIRECTREQUESTED' => '_filterToBool', + 'PAYMENTSTATUS' => '_filterPaymentStatusFromNvpToInfo', ); /** @@ -153,9 +217,10 @@ class Mage_Paypal_Model_Api_Nvp extends Mage_Paypal_Model_Api_Abstract * @var array */ protected $_setExpressCheckoutRequest = array( - 'PAYMENTACTION', 'AMT', 'CURRENCYCODE', 'RETURNURL', 'CANCELURL', 'INVNUM', 'SOLUTIONTYPE', + 'PAYMENTACTION', 'AMT', 'CURRENCYCODE', 'RETURNURL', 'CANCELURL', 'INVNUM', 'SOLUTIONTYPE', 'NOSHIPPING', 'GIROPAYCANCELURL', 'GIROPAYSUCCESSURL', 'BANKTXNPENDINGURL', 'PAGESTYLE', 'HDRIMG', 'HDRBORDERCOLOR', 'HDRBACKCOLOR', 'PAYFLOWCOLOR', 'LOCALECODE', + 'BILLINGTYPE', 'SUBJECT', ); protected $_setExpressCheckoutResponse = array('TOKEN'); @@ -163,7 +228,7 @@ class Mage_Paypal_Model_Api_Nvp extends Mage_Paypal_Model_Api_Abstract * GetExpressCheckoutDetails request/response map * @var array */ - protected $_getExpressCheckoutDetailsRequest = array('TOKEN'); + protected $_getExpressCheckoutDetailsRequest = array('TOKEN', 'SUBJECT',); /** * DoExpressCheckoutPayment request/response map @@ -171,9 +236,10 @@ class Mage_Paypal_Model_Api_Nvp extends Mage_Paypal_Model_Api_Abstract */ protected $_doExpressCheckoutPaymentRequest = array( 'TOKEN', 'PAYERID', 'PAYMENTACTION', 'AMT', 'CURRENCYCODE', 'IPADDRESS', 'BUTTONSOURCE', 'NOTIFYURL', + 'RETURNFMFDETAILS', 'SUBJECT', ); protected $_doExpressCheckoutPaymentResponse = array( - 'TRANSACTIONID', 'AMT', 'PAYMENTSTATUS', 'REDIRECTREQUIRED', 'SUCCESSPAGEREDIRECTREQUESTED', + 'TRANSACTIONID', 'AMT', 'PAYMENTSTATUS', 'PENDINGREASON', 'REDIRECTREQUIRED', 'SUCCESSPAGEREDIRECTREQUESTED', ); /** @@ -184,7 +250,7 @@ class Mage_Paypal_Model_Api_Nvp extends Mage_Paypal_Model_Api_Abstract 'PAYMENTACTION', 'IPADDRESS', 'RETURNFMFDETAILS', 'AMT', 'CURRENCYCODE', 'INVNUM', 'NOTIFYURL', 'EMAIL', //, 'ITEMAMT', 'SHIPPINGAMT', 'TAXAMT', 'CREDITCARDTYPE', 'ACCT', 'EXPDATE', 'CVV2', 'STARTDATE', 'ISSUENUMBER', - 'AUTHSTATUS3D', 'MPIVENDOR3DS', 'CAVV', 'ECI3DS', 'XID', + 'AUTHSTATUS3DS', 'MPIVENDOR3DS', 'CAVV', 'ECI3DS', 'XID', ); protected $_doDirectPaymentResponse = array( 'TRANSACTIONID', 'AMT', 'AVSCODE', 'CVV2MATCH', 'VPAS', 'ECISUBMITTED3DS' @@ -204,7 +270,7 @@ class Mage_Paypal_Model_Api_Nvp extends Mage_Paypal_Model_Api_Abstract * @var array */ protected $_doCaptureRequest = array('AUTHORIZATIONID', 'COMPLETETYPE', 'AMT', 'CURRENCYCODE', 'NOTE', 'INVNUM',); - protected $_doCaptureResponse = array('TRANSACTIONID', 'CURRENCYCODE', 'AMT',); + protected $_doCaptureResponse = array('TRANSACTIONID', 'CURRENCYCODE', 'AMT', 'PAYMENTSTATUS', 'PENDINGREASON',); /** * DoVoid request map @@ -218,7 +284,8 @@ class Mage_Paypal_Model_Api_Nvp extends Mage_Paypal_Model_Api_Abstract */ protected $_getTransactionDetailsRequest = array('TRANSACTIONID'); protected $_getTransactionDetailsResponse = array( - 'PAYERID', 'FIRSTNAME', 'LASTNAME', 'TRANSACTIONID', 'PARENTTRANSACTIONID', 'CURRENCYCODE', 'AMT', 'PAYMENTSTATUS' + 'PAYERID', 'FIRSTNAME', 'LASTNAME', 'TRANSACTIONID', 'PARENTTRANSACTIONID', 'CURRENCYCODE', 'AMT', + 'PAYMENTSTATUS', 'PENDINGREASON', ); /** @@ -232,7 +299,7 @@ class Mage_Paypal_Model_Api_Nvp extends Mage_Paypal_Model_Api_Abstract * ManagePendingTransactionStatus request/response map */ protected $_managePendingTransactionStatusRequest = array('TRANSACTIONID', 'ACTION'); - protected $_managePendingTransactionStatusResponse = array('TRANSACTIONID'); + protected $_managePendingTransactionStatusResponse = array('TRANSACTIONID', 'STATUS'); /** * GetPalDetails response map @@ -240,6 +307,36 @@ class Mage_Paypal_Model_Api_Nvp extends Mage_Paypal_Model_Api_Abstract */ protected $_getPalDetailsResponse = array('PAL'); + /** + * CreateRecurringPaymentsProfile request/response map + * + * @var array + */ + protected $_createRecurringPaymentsProfileRequest = array( + 'TOKEN', 'SUBSCRIBERNAME', 'PROFILESTARTDATE', 'PROFILEREFERENCE', 'DESC', 'MAXFAILEDPAYMENTS', 'AUTOBILLAMT', + 'BILLINGPERIOD', 'BILLINGFREQUENCY', 'TOTALBILLINGCYCLES', 'AMT', 'TRIALBILLINGPERIOD', 'TRIALBILLINGFREQUENCY', + 'TRIALTOTALBILLINGCYCLES', 'TRIALAMT', 'CURRENCYCODE', 'SHIPPINGAMT', 'TAXAMT', 'INITAMT', 'FAILEDINITAMTACTION' + ); + protected $_createRecurringPaymentsProfileResponse = array( + 'PROFILEID', 'PROFILESTATUS' + ); + + /** + * Request/response for ManageRecurringPaymentsProfileStatus map + * + * @var array + */ + protected $_manageRecurringPaymentsProfileStatusRequest = array('PROFILEID', 'ACTION'); +// protected $_manageRecurringPaymentsProfileStatusResponse = array('PROFILEID'); + + /** + * Request/response for GetRecurringPaymentsProfileDetails + * + * @var array + */ + protected $_getRecurringPaymentsProfileDetailsRequest = array('PROFILEID'); + protected $_getRecurringPaymentsProfileDetailsResponse = array('STATUS', /* TODO: lot of other stuff */); + /** * Map for billing address import/export * @var array @@ -278,13 +375,26 @@ class Mage_Paypal_Model_Api_Nvp extends Mage_Paypal_Model_Api_Abstract // 'SHIPTONAME' will be treated manually in address import/export methods ); + /** + * Map for callback request + * @var array + */ + protected $_callbackRequestMap = array( + 'SHIPTOCOUNTRY' => 'country_id', + 'SHIPTOSTATE' => 'region', + 'SHIPTOCITY' => 'city', + 'SHIPTOSTREET' => 'street', + 'SHIPTOSTREET2' => 'street2', + 'SHIPTOZIP' => 'postcode' + ); + /** * Payment information response specifically to be collected after some requests * @var array */ protected $_paymentInformationResponse = array( 'PAYERID', 'PAYERSTATUS', 'CORRELATIONID', 'ADDRESSID', 'ADDRESSSTATUS', - 'PAYMENTSTATUS', 'PENDINGREASON', 'PROTECTIONELIGIBILITY', 'EMAIL', + 'PAYMENTSTATUS', 'PENDINGREASON', 'PROTECTIONELIGIBILITY', 'EMAIL', 'SHIPPINGOPTIONNAME' ); /** @@ -304,6 +414,57 @@ class Mage_Paypal_Model_Api_Nvp extends Mage_Paypal_Model_Api_Abstract 'amount' => 'L_AMT%d', ); + /** + * Shipping options export to request mapping settings + * @var array + */ + protected $_shippingOptionsExportItemsFormat = array( + 'is_default' => 'L_SHIPPINGOPTIONISDEFAULT%d', + 'amount' => 'L_SHIPPINGOPTIONAMOUNT%d', + 'code' => 'L_SHIPPINGOPTIONNAME%d', + 'name' => 'L_SHIPPINGOPTIONLABEL%d', + ); + + /** + * init Billing Agreement request/response map + * @var array + */ + protected $_customerBillingAgreementRequest = array('RETURNURL', 'CANCELURL', 'BILLINGTYPE'); + protected $_customerBillingAgreementResponse = array('TOKEN'); + + /** + * Billing Agreement details request/response map + * @var array + */ + protected $_billingAgreementCustomerDetailsRequest = array('TOKEN'); + protected $_billingAgreementCustomerDetailsResponse = array('EMAIL', 'PAYERID', 'PAYERSTATUS', 'SHIPTOCOUNTRYCODE', 'PAYERBUSINESS'); + + /** + * Create Billing Agreement request/response map + * @var array + */ + protected $_createBillingAgreementRequest = array('TOKEN'); + protected $_createBillingAgreementResponse = array('BILLINGAGREEMENTID'); + + /** + * Update Billing Agreement request/response map + * @var array + */ + protected $_updateBillingAgreementRequest = array( + 'REFERENCEID', 'BILLINGAGREEMENTDESCRIPTION', 'BILLINGAGREEMENTSTATUS', 'BILLINGAGREEMENTCUSTOM' + ); + protected $_updateBillingAgreementResponse = array( + 'REFERENCEID', 'BILLINGAGREEMENTDESCRIPTION', 'BILLINGAGREEMENTSTATUS', 'BILLINGAGREEMENTCUSTOM' + ); + + /** + * Do Reference Transaction request/response map + * + * @var array + */ + protected $_doReferenceTransactionRequest = array('REFERENCEID', 'PAYMENTACTION', 'AMT'); + protected $_doReferenceTransactionResponse = array('BILLINGAGREEMENTID', 'TRANSACTIONID'); + /** * Fields that should be replaced in debug with '***' * @@ -317,7 +478,8 @@ class Mage_Paypal_Model_Api_Nvp extends Mage_Paypal_Model_Api_Abstract * Map of credit card types supported by this API * @var array */ - protected $_supportedCcTypes = array('VI' => 'Visa', 'MC' => 'MasterCard', 'DI' => 'Discover', 'AE' => 'Amex'); + protected $_supportedCcTypes = array( + 'VI' => 'Visa', 'MC' => 'MasterCard', 'DI' => 'Discover', 'AE' => 'Amex', 'SM' => 'Maestro', 'SO' => 'Solo'); /** * Warning codes recollected after each API call @@ -326,6 +488,20 @@ class Mage_Paypal_Model_Api_Nvp extends Mage_Paypal_Model_Api_Abstract */ protected $_callWarnings = array(); + /** + * Error codes recollected after each API call + * + * @var array + */ + protected $_callErrors = array(); + + /** + * Whether to return raw response information after each call + * + * @var bool + */ + protected $_rawResponseNeeded = false; + /** * API endpoint getter * @@ -346,6 +522,16 @@ public function getVersion() return '60.0'; } + /** + * Retrieve billing agreement type + * + * @return string + */ + public function getBillingAgreementType() + { + return 'MerchantInitiatedBilling'; + } + /** * SetExpressCheckout call * @see https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout @@ -353,16 +539,29 @@ public function getVersion() */ public function callSetExpressCheckout() { + $this->_prepareExpressCheckoutCallRequest($this->_setExpressCheckoutRequest); $request = $this->_exportToRequest($this->_setExpressCheckoutRequest); $this->_exportLineItems($request); // import/suppress shipping address, if any - if ($address = $this->getAddress()) { + $address = $this->getAddress(); + $options = $this->getShippingOptions(); + if ($address) { $request = $this->_importAddress($address, $request); $request['ADDROVERRIDE'] = 1; + } elseif ($options && (count($options) < 10)) { // doesn't support more than 10 shipping options + $request['CALLBACK'] = $this->getShippingOptionsCallbackUrl(); + $request['CALLBACKTIMEOUT'] = 6; // max value + $request['MAXAMT'] = $request['AMT'] + 999.00; // it is impossible to calculate max amount + $this->_exportShippingOptions($request); } - if ($this->getSuppressShipping()) { - $request['NOSHIPPING'] = 1; + + // add recurring profiles information + $i = 0; + foreach ($this->_recurringPaymentProfiles as $profile) { + $request["L_BILLINGTYPE{$i}"] = 'RecurringPayments'; + $request["L_BILLINGAGREEMENTDESCRIPTION{$i}"] = $profile->getScheduleDescription(); + $i++; } $response = $this->call(self::SET_EXPRESS_CHECKOUT, $request); @@ -375,6 +574,7 @@ public function callSetExpressCheckout() */ function callGetExpressCheckoutDetails() { + $this->_prepareExpressCheckoutCallRequest($this->_getExpressCheckoutDetailsRequest); $request = $this->_exportToRequest($this->_getExpressCheckoutDetailsRequest); $response = $this->call(self::GET_EXPRESS_CHECKOUT_DETAILS, $request); $this->_importFromResponse($this->_paymentInformationResponse, $response); @@ -387,13 +587,14 @@ function callGetExpressCheckoutDetails() */ public function callDoExpressCheckoutPayment() { + $this->_prepareExpressCheckoutCallRequest($this->_doExpressCheckoutPaymentRequest); $request = $this->_exportToRequest($this->_doExpressCheckoutPaymentRequest); $this->_exportLineItems($request); $response = $this->call(self::DO_EXPRESS_CHECKOUT_PAYMENT, $request); $this->_importFromResponse($this->_paymentInformationResponse, $response); $this->_importFromResponse($this->_doExpressCheckoutPaymentResponse, $response); - $this->_importFraudFiltersResult($response, $this->_callWarnings); + $this->_importFromResponse($this->_createBillingAgreementResponse, $response); } /** @@ -408,7 +609,28 @@ public function callDoDirectPayment() } $response = $this->call(self::DO_DIRECT_PAYMENT, $request); $this->_importFromResponse($this->_doDirectPaymentResponse, $response); - $this->_importFraudFiltersResult($response, $this->_callWarnings); + } + + /** + * Do Reference Transaction call + * @see https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoReferenceTransaction + */ + public function callDoReferenceTransaction() + { + $request = $this->_exportToRequest($this->_doReferenceTransactionRequest); + $this->_exportLineItems($request); + $response = $this->call('DoReferenceTransaction', $request); + $this->_importFromResponse($this->_doReferenceTransactionResponse, $response); + } + + /** + * Check whether the last call was returned with fraud warning + * + * @return bool + */ + public function getIsFraudDetected() + { + return in_array(11610, $this->_callWarnings); } /** @@ -476,6 +698,9 @@ public function callRefundTransaction() public function callManagePendingTransactionStatus() { $request = $this->_exportToRequest($this->_managePendingTransactionStatusRequest); + if (isset($request['ACTION'])) { + $request['ACTION'] = $this->_filterPaymentReviewAction($request['ACTION']); + } $response = $this->call('ManagePendingTransactionStatus', $request); $this->_importFromResponse($this->_managePendingTransactionStatusResponse, $response); } @@ -492,7 +717,148 @@ public function callGetPalDetails() } /** - *Add method to request array + * Set Customer BillingA greement call + * + * @see https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetCustomerBillingAgreement + */ + public function callSetCustomerBillingAgreement() + { + $request = $this->_exportToRequest($this->_customerBillingAgreementRequest); + $response = $this->call('SetCustomerBillingAgreement', $request); + $this->_importFromResponse($this->_customerBillingAgreementResponse, $response); + } + + /** + * Get Billing Agreement Customer Details call + * + * @see https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetBillingAgreementCustomerDetails + */ + public function callGetBillingAgreementCustomerDetails() + { + $request = $this->_exportToRequest($this->_billingAgreementCustomerDetailsRequest); + $response = $this->call('GetBillingAgreementCustomerDetails', $request); + $this->_importFromResponse($this->_billingAgreementCustomerDetailsResponse, $response); + } + + /** + * Create Billing Agreement call + * + */ + public function callCreateBillingAgreement() + { + $request = $this->_exportToRequest($this->_createBillingAgreementRequest); + $response = $this->call('CreateBillingAgreement', $request); + $this->_importFromResponse($this->_createBillingAgreementResponse, $response); + } + + /** + * Billing Agreement Update call + * + */ + public function callUpdateBillingAgreement() + { + $request = $this->_exportToRequest($this->_updateBillingAgreementRequest); + try { + $response = $this->call('BillAgreementUpdate', $request); + } catch (Mage_Core_Exception $e) { + if (in_array(10201, $this->_callErrors)) { + $this->setIsBillingAgreementAlreadyCancelled(true); + } + throw $e; + } + $this->_importFromResponse($this->_updateBillingAgreementResponse, $response); + } + + /** + * CreateRecurringPaymentsProfile call + */ + public function callCreateRecurringPaymentsProfile() + { + $request = $this->_exportToRequest($this->_createRecurringPaymentsProfileRequest); + $response = $this->call('CreateRecurringPaymentsProfile', $request); + $this->_importFromResponse($this->_createRecurringPaymentsProfileResponse, $response); + $this->_analyzeRecurringProfileStatus($this->getRecurringProfileStatus(), $this); + } + + /** + * ManageRecurringPaymentsProfileStatus call + */ + public function callManageRecurringPaymentsProfileStatus() + { + $request = $this->_exportToRequest($this->_manageRecurringPaymentsProfileStatusRequest); + if (isset($request['ACTION'])) { + $request['ACTION'] = $this->_filterRecurringProfileActionToNvp($request['ACTION']); + } + try { + $response = $this->call('ManageRecurringPaymentsProfileStatus', $request); + } catch (Mage_Core_Exception $e) { + // trying to cancel already canceled + if (in_array(11556, $this->_callErrors)) { + if ('Cancel' === $request['ACTION'] && $this->getIsAlreadyCanceled()) { + return; + } + } + // trying to suspend already suspended + + // trying to suspend already canceled + elseif (in_array(11557, $this->_callErrors)) { + if ('Suspend' === $request['ACTION'] && $this->getIsAlreadySuspended()) { + return; + } + } + // trying to activate already active + + // trying to activate already canceled + elseif (in_array(11558, $this->_callErrors)) { + if ('Reactivate' === $request['ACTION'] && $this->getIsAlreadyActive()) { + return; + } + } + throw $e; + } + } + + /** + * GetRecurringPaymentsProfileDetails call + */ + public function callGetRecurringPaymentsProfileDetails(Varien_Object $result) + { + $request = $this->_exportToRequest($this->_getRecurringPaymentsProfileDetailsRequest); + $response = $this->call('GetRecurringPaymentsProfileDetails', $request); + $this->_importFromResponse($this->_getRecurringPaymentsProfileDetailsResponse, $response); + $this->_analyzeRecurringProfileStatus($this->getStatus(), $result); + } + + /** + * Import callback request array into $this public data + * + * @param array $request + * @return Varien_Object + */ + public function prepareShippingOptionsCallbackAddress(array $request) + { + $address = new Varien_Object(); + Varien_Object_Mapper::accumulateByMap($request, $address, $this->_callbackRequestMap); + $address->setExportedKeys(array_values($this->_callbackRequestMap)); + $this->_applyStreetAndRegionWorkarounds($address); + return $address; + } + + /** + * Prepare response for shipping options callback + * + * @return string + */ + public function formatShippingOptionsCallback() + { + $response = array(); + if (!$this->_exportShippingOptions($response)) { + $response['NO_SHIPPING_OPTION_DETAILS'] = '1'; + } + $response = $this->_addMethodToRequest(self::CALLBACK_RESPONSE, $response); + return $this->_buildQuery($response); + } + + /** + * Add method to request array * * @param string $methodName * @param array $request @@ -500,7 +866,7 @@ public function callGetPalDetails() */ protected function _addMethodToRequest($methodName, $request) { - $request['method'] = $methodName; + $request['METHOD'] = $methodName; return $request; } @@ -515,53 +881,66 @@ protected function _addMethodToRequest($methodName, $request) public function call($methodName, array $request) { $request = $this->_addMethodToRequest($methodName, $request); - $request = $this->_exportToRequest($this->_eachCallRequest, $request); + $eachCallRequest = $this->_prepareEachCallRequest($methodName); + $request = $this->_exportToRequest($eachCallRequest, $request); - if ($this->getDebug()) { - $requestDebug = $request; - foreach ($this->_debugReplacePrivateDataKeys as $key) { - if (isset($request[$key])) { - $requestDebug[$key] = '***'; - } + $debugData = array('url' => $this->getApiEndpoint(), $methodName => $request); + + try { + $http = new Varien_Http_Adapter_Curl(); + $config = array('timeout' => 30); + if ($this->getUseProxy()) { + $config['proxy'] = $this->getProxyHost(). ':' . $this->getProxyPort(); } - $debug = Mage::getModel('paypal/api_debug') - ->setApiEndpoint($this->getApiEndpoint()) - ->setRequestBody(var_export($requestDebug, 1)) - ->save(); + $http->setConfig($config); + $http->write(Zend_Http_Client::POST, $this->getApiEndpoint(), '1.1', array(), $this->_buildQuery($request)); + $response = $http->read(); + } catch (Exception $e) { + $debugData['http_error'] = array('error' => $e->getMessage(), 'code' => $e->getCode()); + $this->_debug($debugData); + throw $e; } - $http = new Varien_Http_Adapter_Curl(); - $config = array('timeout' => 30); - if ($this->getUseProxy()) { - $config['proxy'] = $this->getProxyHost(). ':' . $this->getProxyPort(); - } - $http->setConfig($config); - $http->write(Zend_Http_Client::POST, $this->getApiEndpoint(), '1.1', array(), $this->_buildQuery($request)); - $response = $http->read(); $http->close(); + $response = preg_split('/^\r?$/m', $response, 2); $response = trim($response[1]); $response = $this->_deformatNVP($response); - if ($this->getDebug()) { - $debug->setResponseBody(var_export($response, 1))->save(); - } + $debugData['response'] = $response; + $this->_debug($debugData); // handle transport error if ($http->getErrno()) { Mage::logException(new Exception( sprintf('PayPal NVP CURL connection error #%s: %s', $http->getErrno(), $http->getError()) )); - Mage::throwException(Mage::helper('paypal')->__('Unable to communicate with PayPal gateway.')); + Mage::throwException(Mage::helper('paypal')->__('Unable to communicate with the PayPal gateway.')); } + $this->_callErrors = array(); if ($this->_isCallSuccessful($response)) { + if ($this->_rawResponseNeeded) { + $this->setRawSuccessResponseData($response); + } return $response; } $this->_handleCallErrors($response); return $response; } + /** + * Setter for 'raw response needed' flag + * + * @param bool $flag + * @return Mage_Paypal_Model_Api_Nvp + */ + public function setRawResponseNeeded($flag) + { + $this->_rawResponseNeeded = $flag; + return $this; + } + /** * Handle logical errors * @@ -577,15 +956,17 @@ protected function _handleCallErrors($response) $errors[] = $longMessage ? sprintf('%s (#%s: %s).', $longMessage, $response["L_ERRORCODE{$i}"], $shortMessage) : sprintf('#%s: %s.', $response["L_ERRORCODE{$i}"], $shortMessage); + $this->_callErrors[] = $response["L_ERRORCODE{$i}"]; } if ($errors) { $errors = implode(' ', $errors); - $e = new Exception(sprintf('PayPal NVP gateway errors: %s Corellation ID: %s. Version: %s.', $errors, + $e = Mage::exception('Mage_Core', sprintf('PayPal NVP gateway errors: %s Correlation ID: %s. Version: %s.', $errors, isset($response['CORRELATIONID']) ? $response['CORRELATIONID'] : '', isset($response['VERSION']) ? $response['VERSION'] : '' )); Mage::logException($e); - Mage::throwException(Mage::helper('paypal')->__('PayPal geteway rejected request. %s', $errors)); + $e->setMessage(Mage::helper('paypal')->__('PayPal gateway has rejected request. %s', $errors)); + throw $e; } } @@ -650,7 +1031,6 @@ protected function _exportAddressses($data) $address->setExportedKeys(array_values($this->_billingAddressMap)); $this->_applyStreetAndRegionWorkarounds($address); $this->setExportedBillingAddress($address); - // assume there is shipping address if there is at least one field specific to shipping if (isset($data['SHIPTONAME'])) { $shippingAddress = clone $address; @@ -750,26 +1130,142 @@ protected function _filterToBool($value) } /** - * Get FMF results from response, if any - * TODO: PayPal doesn't provide this information in API response for some reason. - * However, the FMF results go in IPN + * Filter for 'AUTOBILLAMT' * - * @param array $from - * @param array $collectedWarnings + * @param string $value + * @return string */ - protected function _importFraudFiltersResult(array $from, array $collectedWarnings) + protected function _filterBillFailedLater($value) { - // detect whether there is a fraud warning - if (!in_array(11610, $collectedWarnings)) { - return; + return $value ? 'AddToNextBilling' : 'NoAutoBill'; + } + + /** + * Filter for 'BILLINGPERIOD' and 'TRIALBILLINGPERIOD' + * + * @param string $value + * @return string + */ + protected function _filterPeriodUnit($value) + { + switch ($value) { + case 'day': return 'Day'; + case 'week': return 'Week'; + case 'semi_month': return 'SemiMonth'; + case 'month': return 'Month'; + case 'year': return 'Year'; } - $this->setIsPaymentPending(true); - $collectedFilters = array(); - for ($i = 0; isset($from["L_FMFfilterID{$i}"]); $i++) { - $collectedFilters[] = $from["L_FMFfilterNAME{$i}"]; + } + + /** + * Filter for 'FAILEDINITAMTACTION' + * + * @param string $value + * @return string + */ + protected function _filterInitialAmountMayFail($value) + { + return $value ? 'ContinueOnFailure' : 'CancelOnFailure'; + } + + /** + * Filter for billing agreement status + * + * @param string $value + * @return string + */ + protected function _filterBillingAgreementStatus($value) + { + switch ($value) { + case 'canceled': return 'Canceled'; + case 'active': return 'Active'; + } + } + + /** + * Convert payment status from NVP format to paypal/info model format + * + * @param string $value + * @return string|null + */ + protected function _filterPaymentStatusFromNvpToInfo($value) + { + switch ($value) { + case 'None': return Mage_Paypal_Model_Info::PAYMENTSTATUS_NONE; + case 'Completed': return Mage_Paypal_Model_Info::PAYMENTSTATUS_COMPLETED; + case 'Denied': return Mage_Paypal_Model_Info::PAYMENTSTATUS_DENIED; + case 'Expired': return Mage_Paypal_Model_Info::PAYMENTSTATUS_EXPIRED; + case 'Failed': return Mage_Paypal_Model_Info::PAYMENTSTATUS_FAILED; + case 'In-Progress': return Mage_Paypal_Model_Info::PAYMENTSTATUS_INPROGRESS; + case 'Pending': return Mage_Paypal_Model_Info::PAYMENTSTATUS_PENDING; + case 'Refunded': return Mage_Paypal_Model_Info::PAYMENTSTATUS_REFUNDED; + case 'Partially-Refunded': return Mage_Paypal_Model_Info::PAYMENTSTATUS_REFUNDEDPART; + case 'Reversed': return Mage_Paypal_Model_Info::PAYMENTSTATUS_REVERSED; + case 'Canceled-Reversal': return Mage_Paypal_Model_Info::PAYMENTSTATUS_UNREVERSED; + case 'Processed': return Mage_Paypal_Model_Info::PAYMENTSTATUS_PROCESSED; + case 'Voided': return Mage_Paypal_Model_Info::PAYMENTSTATUS_VOIDED; + } + } + + /** + * Convert payment review action to NVP-compatible value + * + * @param string $value + * @return string|null + */ + protected function _filterPaymentReviewAction($value) + { + switch ($value) { + case Mage_Paypal_Model_Pro::PAYMENT_REVIEW_ACCEPT: + return 'Accept'; + case Mage_Paypal_Model_Pro::PAYMENT_REVIEW_DENY: + return 'Deny'; + } + } + + /** + * Convert RP management action to NVP format + * + * @param string $value + * @return string|null + */ + protected function _filterRecurringProfileActionToNvp($value) + { + switch ($value) { + case 'cancel': return 'Cancel'; + case 'suspend': return 'Suspend'; + case 'activate': return 'Reactivate'; } - if ($collectedFilters) { - $this->setCollectedFraudFilters($collectedFilters); + } + + /** + * Check the obtained RP status in NVP format and specify the profile state + * + * @param string $value + * @param Varien_Object $result + */ + protected function _analyzeRecurringProfileStatus($value, Varien_Object $result) + { + switch ($value) { + case 'ActiveProfile': + case 'Active': + $result->setIsProfileActive(true); + break; + case 'PendingProfile': + $result->setIsProfilePending(true); + break; + case 'CancelledProfile': + case 'Cancelled': + $result->setIsProfileCanceled(true); + break; + case 'SuspendedProfile': + case 'Suspended': + $result->setIsProfileSuspended(true); + break; + case 'ExpiredProfile': + case 'Expired': // ?? + $result->setIsProfileExpired(true); + break; } } @@ -785,4 +1281,35 @@ protected function _getCaptureCompleteType() ? $this->_captureTypeComplete : $this->_captureTypeNotcomplete; } + + /** + * Return each call request without unused fields in case of Express Checkout Unilateral payments + * + * @param string $methodName Current method name + * @return array + */ + protected function _prepareEachCallRequest($methodName) + { + $expressCheckooutMetods = array( + self::SET_EXPRESS_CHECKOUT, self::GET_EXPRESS_CHECKOUT_DETAILS, self::DO_EXPRESS_CHECKOUT_PAYMENT + ); + if (!in_array($methodName, $expressCheckooutMetods) || !$this->_config->shouldUseUnilateralPayments()) { + return $this->_eachCallRequest; + } + return array_diff($this->_eachCallRequest, array('USER', 'PWD', 'SIGNATURE')); + } + + /** + * Check the EC request against unilateral payments mode and remove the SUBJECT if needed + * + * @param &array $requestFields + */ + protected function _prepareExpressCheckoutCallRequest(&$requestFields) + { + if (!$this->_config->shouldUseUnilateralPayments()) { + if ($key = array_search('SUBJECT', $requestFields)) { + unset($requestFields[$key]); + } + } + } } diff --git a/app/code/core/Mage/Paypal/Model/Api/Standard.php b/app/code/core/Mage/Paypal/Model/Api/Standard.php index ed80c657cc..53923a2d75 100644 --- a/app/code/core/Mage/Paypal/Model/Api/Standard.php +++ b/app/code/core/Mage/Paypal/Model/Api/Standard.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -60,7 +60,7 @@ class Mage_Paypal_Model_Api_Standard extends Mage_Paypal_Model_Api_Abstract ); protected $_exportToRequestFilters = array( 'amount' => '_filterAmount', - 'shipping' => '_filterAmount', + 'shipping' => '_filterAmount' ); /** @@ -74,12 +74,19 @@ class Mage_Paypal_Model_Api_Standard extends Mage_Paypal_Model_Api_Abstract protected $_aggregatedOrderFields = array('item_name', 'amount', 'shipping'); /** - * Keys that are not supposed to get into debug dump + * @deprecated after 1.4.1.0 * * @var array */ protected $_obscureDebugFor = array('business'); + /** + * Fields that should be replaced in debug with '***' + * + * @var array + */ + protected $_debugReplacePrivateDataKeys = array('business'); + /** * Line items export mapping settings * @var array @@ -95,6 +102,10 @@ class Mage_Paypal_Model_Api_Standard extends Mage_Paypal_Model_Api_Abstract 'amount' => 'amount_%d', ); + protected $_lineItemExportItemsFilters = array( + 'qty' => '_filterQty' + ); + /** * Address export to request map * @var array @@ -138,7 +149,7 @@ public function getStandardCheckoutRequest() } // payer address $this->_importAddress($request); - $this->debugRequest($request); // TODO: this is not supposed to be called in getter + $this->_debug(array('request' => $request)); // TODO: this is not supposed to be called in getter return $request; } @@ -160,21 +171,14 @@ public function getPaymentAction() return strtolower(parent::getPaymentAction()); } + /** + * @deprecated after 1.4.1.0 + * + * @param array $request + */ public function debugRequest($request) { - if (!$this->_config->debugFlag) { - return; - } - foreach ($this->_obscureDebugFor as $key) { - if (isset($request[$key])) { - $request[$key] = '***'; - } - } - $debug = Mage::getModel('paypal/api_debug') - ->setApiEndpoint($this->_config->getPaypalUrl()) - ->setRequestBody(var_export($request, 1)) - ->save() - ; + return; } /** diff --git a/app/code/core/Mage/Paypal/Model/Config.php b/app/code/core/Mage/Paypal/Model/Config.php index 2d376c79cb..d52f222f4e 100644 --- a/app/code/core/Mage/Paypal/Model/Config.php +++ b/app/code/core/Mage/Paypal/Model/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -48,6 +48,26 @@ class Mage_Paypal_Model_Config */ const METHOD_WPP_DIRECT = 'paypal_direct'; + /** + * Direct Payments (Payflow Edition) + * @var string + */ + const METHOD_WPP_PE_DIRECT = 'paypaluk_direct'; + + /** + * Express Checkout (Payflow Edition) + * @var string + */ + const METHOD_WPP_PE_EXPRESS = 'paypaluk_express'; + + /** + * Payflow Pro Gateway + * @var string + */ + const METHOD_PAYFLOWPRO = 'verisign'; + + const METHOD_BILLING_AGREEMENT = 'paypal_billing_agreement'; + /** * Buttons and images * @var string @@ -61,6 +81,8 @@ class Mage_Paypal_Model_Config const PAYMENT_MARK_60x38 = '60x38'; const PAYMENT_MARK_180x113 = '180x113'; + const DEFAULT_LOGO_TYPE = 'wePrefer_150x60'; + /** * Payment actions * @var string @@ -99,6 +121,15 @@ class Mage_Paypal_Model_Config const WPS_TRANSPORT_PDT = 'pdt'; const WPS_TRANSPORT_IPN_PDT = 'ipn_n_pdt'; + /** + * Billing Agreement Signup + * + * @var string + */ + const EC_BA_SIGNUP_AUTO = 'auto'; + const EC_BA_SIGNUP_ASK = 'ask'; + const EC_BA_SIGNUP_NEVER = 'never'; + /** * Default URL for centinel API (PayPal Direct) * @@ -124,9 +155,11 @@ class Mage_Paypal_Model_Config * @var array */ protected $_buildNotationPPMap = array( - 'paypal_standard' => 'WPS', - 'paypal_express' => 'EC', - 'paypal_direct' => 'DP', + 'paypal_standard' => 'WPS', + 'paypal_express' => 'EC', + 'paypal_direct' => 'DP', + 'paypaluk_express' => 'EC', + 'paypaluk_direct' => 'DP', ); /** @@ -148,6 +181,39 @@ class Mage_Paypal_Model_Config protected $_supportedCurrencyCodes = array('AUD', 'CAD', 'CZK', 'DKK', 'EUR', 'HKD', 'HUF', 'ILS', 'JPY', 'MXN', 'NOK', 'NZD', 'PLN', 'GBP', 'SGD', 'SEK', 'CHF', 'USD'); + /** + * Merchant country supported by PayPal + * @var array + */ + protected $_supportedCountryCodes = array( + 'AE','AR','AT','AU','BE','BG','BR','CA','CH','CL','CR','CY','CZ','DE','DK','DO','EC','EE','ES','FI','FR','GB', + 'GF','GI','GP','GR','HK','HU','ID','IE','IL','IN','IS','IT','JM','JP','KR','LI','LT','LU','LV','MQ','MT','MX', + 'MY','NL','NO','NZ','PH','PL','PT','RE','RO','SE','SG','SI','SK','SM','TH','TR','TW','US','UY','VE','VN','ZA'); + + /** + * Buyer country supported by PayPal + * + * @var array + */ + protected $_supportedBuyerCountryCodes = array( + 'AF ', 'AX ', 'AL ', 'DZ ', 'AS ', 'AD ', 'AO ', 'AI ', 'AQ ', 'AG ', 'AR ', 'AM ', 'AW ', 'AU ', 'AT ', 'AZ ', + 'BS ', 'BH ', 'BD ', 'BB ', 'BY ', 'BE ', 'BZ ', 'BJ ', 'BM ', 'BT ', 'BO ', 'BA ', 'BW ', 'BV ', 'BR ', 'IO ', + 'BN ', 'BG ', 'BF ', 'BI ', 'KH ', 'CM ', 'CA ', 'CV ', 'KY ', 'CF ', 'TD ', 'CL ', 'CN ', 'CX ', 'CC ', 'CO ', + 'KM ', 'CG ', 'CD ', 'CK ', 'CR ', 'CI ', 'HR ', 'CU ', 'CY ', 'CZ ', 'DK ', 'DJ ', 'DM ', 'DO ', 'EC ', 'EG ', + 'SV ', 'GQ ', 'ER ', 'EE ', 'ET ', 'FK ', 'FO ', 'FJ ', 'FI ', 'FR ', 'GF ', 'PF ', 'TF ', 'GA ', 'GM ', 'GE ', + 'DE ', 'GH ', 'GI ', 'GR ', 'GL ', 'GD ', 'GP ', 'GU ', 'GT ', 'GG ', 'GN ', 'GW ', 'GY ', 'HT ', 'HM ', 'VA ', + 'HN ', 'HK ', 'HU ', 'IS ', 'IN ', 'ID ', 'IR ', 'IQ ', 'IE ', 'IM ', 'IL ', 'IT ', 'JM ', 'JP ', 'JE ', 'JO ', + 'KZ ', 'KE ', 'KI ', 'KP ', 'KR ', 'KW ', 'KG ', 'LA ', 'LV ', 'LB ', 'LS ', 'LR ', 'LY ', 'LI ', 'LT ', 'LU ', + 'MO ', 'MK ', 'MG ', 'MW ', 'MY ', 'MV ', 'ML ', 'MT ', 'MH ', 'MQ ', 'MR ', 'MU ', 'YT ', 'MX ', 'FM ', 'MD ', + 'MC ', 'MN ', 'MS ', 'MA ', 'MZ ', 'MM ', 'NA ', 'NR ', 'NP ', 'NL ', 'AN ', 'NC ', 'NZ ', 'NI ', 'NE ', 'NG ', + 'NU ', 'NF ', 'MP ', 'NO ', 'OM ', 'PK ', 'PW ', 'PS ', 'PA ', 'PG ', 'PY ', 'PE ', 'PH ', 'PN ', 'PL ', 'PT ', + 'PR ', 'QA ', 'RE ', 'RO ', 'RU ', 'RW ', 'SH ', 'KN ', 'LC ', 'PM ', 'VC ', 'WS ', 'SM ', 'ST ', 'SA ', 'SN ', + 'CS ', 'SC ', 'SL ', 'SG ', 'SK ', 'SI ', 'SB ', 'SO ', 'ZA ', 'GS ', 'ES ', 'LK ', 'SD ', 'SR ', 'SJ ', 'SZ ', + 'SE ', 'CH ', 'SY ', 'TW ', 'TJ ', 'TZ ', 'TH ', 'TL ', 'TG ', 'TK ', 'TO ', 'TT ', 'TN ', 'TR ', 'TM ', 'TC ', + 'TV ', 'UG ', 'UA ', 'AE ', 'GB ', 'US ', 'UM ', 'UY ', 'UZ ', 'VU ', 'VE ', 'VN ', 'VG ', 'VI ', 'WF ', 'EH ', + 'YE ', 'ZM ', 'ZW' + ); + /** * Locale codes supported by misc images (marks, shortcuts etc) * @var array @@ -209,6 +275,76 @@ public function setStoreId($storeId) return $this; } + /** + * Check whether method active in configuration and supported for merchant country or not + * + * @param string $method Method code + * @return bool + */ + public function isMethodActive($method) + { + if ($this->isMethodSupportedForCountry($method) + && Mage::getStoreConfigFlag("payment/{$method}/active", $this->_storeId)) + { + return true; + } + return false; + } + + /** + * Check whether method available for checkout or not + * Logic based on merchant country, methods dependence + * + * @param string $method Method code + * @return bool + */ + public function isMethodAvailable($methodCode = null) + { + if ($methodCode === null) { + $methodCode = $this->getMethodCode(); + } + + $result = true; + + if (!$this->isMethodActive($methodCode)) { + $result = false; + } + + switch ($methodCode) { + case self::METHOD_WPS: + if (!$this->businessAccount) { + $result = false; + break; + } + // check for direct payments dependence + if ($this->isMethodActive(self::METHOD_WPP_DIRECT) || $this->isMethodActive(self::METHOD_WPP_PE_DIRECT)) { + $result = false; + } + break; + case self::METHOD_WPP_EXPRESS: + // check for direct payments dependence + if ($this->isMethodActive(self::METHOD_WPP_DIRECT)) { + $result = true; + } + break; + case self::METHOD_WPP_PE_EXPRESS: + // check for direct payments dependence + if ($this->isMethodActive(self::METHOD_WPP_PE_DIRECT)) { + $result = true; + } elseif (!$this->isMethodActive(self::METHOD_WPP_PE_DIRECT) && !$this->isMethodActive(self::METHOD_PAYFLOWPRO)) { + $result = false; + } + break; + case self::METHOD_BILLING_AGREEMENT: + $result = $this->isWppApiAvailabe(); + break; + case self::METHOD_WPP_DIRECT: + case self::METHOD_WPP_PE_DIRECT: + break; + } + return $result; + } + /** * Config field magic getter * The specified key can be either in camelCase or under_score format @@ -222,11 +358,141 @@ public function __get($key) { $underscored = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $key)); $value = Mage::getStoreConfig($this->_getSpecificConfigPath($underscored), $this->_storeId); + $value = $this->_prepareValue($underscored, $value); $this->$key = $value; $this->$underscored = $value; return $value; } + /** + * Perform additional config value preparation and return new value if needed + * + * @param string $key Underscored key + * @param string $value Old value + * @return string Modified value or old value + */ + protected function _prepareValue($key, $value) + { + // Always set payment action as "Sale" for Unilateral payments in EC + if ($key == 'payment_action' + && $value != self::PAYMENT_ACTION_SALE + && $this->_methodCode == self::METHOD_WPP_EXPRESS + && $this->shouldUseUnilateralPayments()) + { + return self::PAYMENT_ACTION_SALE; + } + return $value; + } + + /** + * Return merchant country codes supported by PayPal + * + * @return array + */ + public function getSupportedMerchantCountryCodes() + { + return $this->_supportedCountryCodes; + } + + /** + * Return buyer country codes supported by PayPal + * + * @return array + */ + public function getSupportedBuyerCountryCodes() + { + return $this->_supportedBuyerCountryCodes; + } + + /** + * Return merchant country code, use default country if it not specified in General settings + * + * @return string + */ + public function getMerchantCountry() + { + $countryCode = Mage::getStoreConfig($this->_mapGeneralFieldset('merchant_country'), $this->_storeId); + if (!$countryCode) { + $countryCode = Mage::getStoreConfig('general/country/default', $this->_storeId); + } + return $countryCode; + } + + /** + * Check whether method supported for specified country or not + * Use $_methodCode and merchant country by default + * + * @return bool + */ + public function isMethodSupportedForCountry($method = null, $countryCode = null) + { + if ($method === null) { + $method = $this->getMethodCode(); + } + if ($countryCode === null) { + $countryCode = $this->getMerchantCountry(); + } + $countryMethods = $this->getCountryMethods($countryCode); + if (in_array($method, $countryMethods)) { + return true; + } + return false; + } + + /** + * Return list of allowed methods for specified country iso code + * + * @param string $countryCode 2-letters iso code + * @return array + */ + public function getCountryMethods($countryCode = null) + { + $countryMethods = array( + 'US' => array( + self::METHOD_WPS, + self::METHOD_WPP_DIRECT, + self::METHOD_WPP_EXPRESS, + self::METHOD_WPP_PE_DIRECT, + self::METHOD_WPP_PE_EXPRESS, + self::METHOD_PAYFLOWPRO, + ), + 'CA' => array( + self::METHOD_WPS, + self::METHOD_WPP_DIRECT, + self::METHOD_WPP_EXPRESS, + self::METHOD_PAYFLOWPRO, + ), + 'GB' => array( + self::METHOD_WPS, + self::METHOD_WPP_DIRECT, + self::METHOD_WPP_EXPRESS, + self::METHOD_WPP_PE_DIRECT, + self::METHOD_WPP_PE_EXPRESS, + ), + 'AU' => array( + self::METHOD_WPS, + self::METHOD_WPP_EXPRESS, + self::METHOD_PAYFLOWPRO, + ), + 'NZ' => array( + self::METHOD_WPS, + self::METHOD_WPP_EXPRESS, + self::METHOD_PAYFLOWPRO, + ), + 'DE' => array( + self::METHOD_WPS, + self::METHOD_WPP_EXPRESS, + ), + 'other' => array( + self::METHOD_WPS, + self::METHOD_WPP_EXPRESS, + ) + ); + if ($countryCode === null) { + return $countryMethods; + } + return isset($countryMethods[$countryCode]) ? $countryMethods[$countryCode] : $countryMethods['other']; } + /** * Get url for dispatching customer to express checkout start * @param string $token @@ -268,6 +534,20 @@ public function getExpressCheckoutCompleteUrl($token) )); } + /** + * Retrieve url for initialization of billing agreement + * + * @param string $token + * @return string + */ + public function getStartBillingAgreementUrl($token) + { + return $this->getPaypalUrl(array( + 'cmd' => '_customer-billing-agreement', + 'token' => $token, + )); + } + /** * PayPal web URL generic getter * @@ -425,6 +705,47 @@ public function getPaymentFormLogoUrl($localeCode) return sprintf('https://www.%s/%s/%si/%s/%s.gif', $domain, $locale, $countryPrefix, $imageType, $imageName); } + /** + * Return supported types for PayPal logo + * + * @return array + */ + public function getAdditionalOptionsLogoTypes() + { + return array( + 'wePrefer_150x60' => Mage::helper('paypal')->__('We prefer PayPal (150 X 60)'), + 'wePrefer_150x40' => Mage::helper('paypal')->__('We prefer PayPal (150 X 40)'), + 'nowAccepting_150x60' => Mage::helper('paypal')->__('Now accepting PayPal (150 X 60)'), + 'nowAccepting_150x40' => Mage::helper('paypal')->__('Now accepting PayPal (150 X 40)'), + 'paymentsBy_150x60' => Mage::helper('paypal')->__('Payments by PayPal (150 X 60)'), + 'paymentsBy_150x40' => Mage::helper('paypal')->__('Payments by PayPal (150 X 40)'), + 'shopNowUsing_150x60' => Mage::helper('paypal')->__('Shop now using (150 X 60)'), + 'shopNowUsing_150x40' => Mage::helper('paypal')->__('Shop now using (150 X 40)'), + ); + } + + /** + * Return PayPal logo URL with additional options + * + * @param string $localeCode Supported locale code + * @param string $type One of supported logo types + * @return string|bool Logo Image URL or false if logo disabled in configuration + */ + public function getAdditionalOptionsLogoUrl($localeCode, $type = false) + { + $configType = Mage::getStoreConfig($this->_mapGenericStyleFieldset('logo'), $this->_storeId); + if (!$configType) { + return false; + } + $type = $type ? $type : $configType; + $locale = $this->_getSupportedLocaleCode($localeCode); + $supportedTypes = array_keys($this->getAdditionalOptionsLogoTypes()); + if (!in_array($type, $supportedTypes)) { + $type = self::DEFAULT_LOGO_TYPE; + } + return sprintf('https://www.paypalobjects.com/%s/i/bnr/bnr_%s.gif', $locale, $type); + } + /** * BN code getter * @@ -437,7 +758,7 @@ public function getBuildNotationCode($countryCode = null) $product = $this->_buildNotationPPMap[$this->_methodCode]; } if (null === $countryCode) { - $countryCode = $this->_matchBnCountryCode(Mage::getStoreConfig('general/country/default', $this->_storeId)); + $countryCode = $this->_matchBnCountryCode($this->getMerchantCountry()); } if ($countryCode) { $countryCode = '_' . $countryCode; @@ -513,6 +834,51 @@ public function getExpressCheckoutSolutionTypes() ); } + /** + * Retrieve express checkout billing agreement signup options + * + * @return array + */ + public function getExpressCheckoutBASignupOptions() + { + return array( + self::EC_BA_SIGNUP_AUTO => Mage::helper('paypal')->__('Auto'), + self::EC_BA_SIGNUP_ASK => Mage::helper('paypal')->__('Ask Customer'), + self::EC_BA_SIGNUP_NEVER => Mage::helper('paypal')->__('Never') + ); + } + + /** + * Whether to ask customer to create billing agreements + * Unilateral payments are incompatible with the billing agreements + * + * @return bool + */ + public function shouldAskToCreateBillingAgreement() + { + return ($this->allow_ba_signup === self::EC_BA_SIGNUP_ASK) && !$this->shouldUseUnilateralPayments(); + } + + /** + * Check whether only Unilateral payments (Accelerated Boarding) possible for Express method or not + * + * @return bool + */ + public function shouldUseUnilateralPayments() + { + return $this->business_account && !$this->isWppApiAvailabe(); + } + + /** + * Check whether WPP API credentials are available for this method + * + * @return bool + */ + public function isWppApiAvailabe() + { + return $this->api_username && $this->api_password && $this->api_signature; + } + /** * Payment data delivery methods getter for PayPal Standard * @return array @@ -528,16 +894,55 @@ public function getWpsPaymentDeliveryMethods() } /** - * PayPal Direct cc types source getter + * Return list of supported credit card types by Paypal Direct gateway * * @return array */ - public function getDirectCcTypesAsOptionArray() + public function getWppCcTypesAsOptionArray() { - $model = Mage::getModel('payment/source_cctype')->setAllowedTypes(array('VI', 'MC', 'AE', 'DI', 'OT')); + $model = Mage::getModel('payment/source_cctype')->setAllowedTypes(array('AE', 'VI', 'MC', 'SS', 'DI')); return $model->toOptionArray(); } + /** + * Return list of supported credit card types by Paypal Direct (Payflow Edition) gateway + * + * @return array + */ + public function getWppPeCcTypesAsOptionArray() + { + $model = Mage::getModel('payment/source_cctype')->setAllowedTypes(array('VI', 'MC', 'SM', 'SO', 'OT')); + return $model->toOptionArray(); + } + + /** + * Return list of supported credit card types by Payflow Pro gateway + * + * @return array + */ + public function getPayflowproCcTypesAsOptionArray() + { + $model = Mage::getModel('payment/source_cctype')->setAllowedTypes(array('AE', 'VI', 'MC', 'JCB', 'DI')); + return $model->toOptionArray(); + } + + /** + * Check whether the specified payment method is a CC-based one + * + * @param string $code + * @return bool + */ + public static function getIsCreditCardMethod($code) + { + switch ($code) { + case self::METHOD_WPP_DIRECT: + case self::METHOD_WPP_PE_DIRECT: + case self::METHOD_PAYFLOWPRO: + return true; + } + return false; + } + /** * Check whether specified currency code is supported * @param string $code @@ -609,20 +1014,64 @@ protected function _getSupportedLocaleCode($localeCode = null) */ protected function _getSpecificConfigPath($fieldName) { - if (self::METHOD_WPS === $this->_methodCode) { - return $this->_mapStandardFieldset($fieldName); - } elseif (self::METHOD_WPP_EXPRESS === $this->_methodCode || self::METHOD_WPP_DIRECT === $this->_methodCode) { - $path = self::METHOD_WPP_EXPRESS === $this->_methodCode - ? $this->_mapExpressFieldset($fieldName) - : $this->_mapDirectFieldset($fieldName) - ; - if (!$path) { - $path = $this->_mapWppFieldset($fieldName); - } - if (!$path) { - $path = $this->_mapWppStyleFieldset($fieldName); + $path = null; + switch ($this->_methodCode) { + case self::METHOD_WPS: + $path = $this->_mapStandardFieldset($fieldName); + break; + case self::METHOD_WPP_EXPRESS: + case self::METHOD_WPP_PE_EXPRESS: + $path = $this->_mapExpressFieldset($fieldName); + break; + case self::METHOD_WPP_DIRECT: + case self::METHOD_WPP_PE_DIRECT: + $path = $this->_mapDirectFieldset($fieldName); + break; + case self::METHOD_BILLING_AGREEMENT: + $path = $this->_mapMethodFieldset($fieldName); + break; + } + + if ($path === null) { + switch ($this->_methodCode) { + case self::METHOD_WPP_EXPRESS: + case self::METHOD_WPP_DIRECT: + case self::METHOD_BILLING_AGREEMENT: + $path = $this->_mapWppFieldset($fieldName); + break; + case self::METHOD_WPP_PE_EXPRESS: + case self::METHOD_WPP_PE_DIRECT: + $path = $this->_mapWpukFieldset($fieldName); + break; } - return $path; + } + + if ($path === null) { + $path = $this->_mapGeneralFieldset($fieldName); + } + if ($path === null) { + $path = $this->_mapGenericStyleFieldset($fieldName); + } + return $path; + } + + /** + * Check wheter specified country code is supported by build notation codes for specific countries + * + * @param $code + * @return string|null + */ + private function _matchBnCountryCode($code) + { + switch ($code) { + // GB == UK + case 'GB': + return 'UK'; + // Australia, Austria, Belgium, Canada, China, France, Germany, Hong Kong, Italy + case 'AU': case 'AT': case 'BE': case 'CA': case 'CN': case 'FR': case 'DE': case 'HK': case 'IT': + // Japan, Mexico, Netherlands, Poland, Singapore, Spain, Switzerland, United Kingdom, United States + case 'JP': case 'MX': case 'NL': case 'PL': case 'SG': case 'ES': case 'CH': case 'UK': case 'US': + return $code; } } @@ -636,76 +1085,76 @@ protected function _mapStandardFieldset($fieldName) { switch ($fieldName) { - case 'business_account': - case 'debug_flag': - case 'sandbox_flag': - return "paypal/wps/{$fieldName}"; - case 'active': - case 'title': - case 'payment_action': - case 'types': - case 'order_status': - case 'transaction_type': - case 'sort_order': - case 'allowspecific': - case 'specificcountry': - case 'line_items_enabled': case 'line_items_summary': + case 'sandbox_flag': return 'payment/' . self::METHOD_WPS . "/{$fieldName}"; default: - return $this->_mapGenericStyleFieldset($fieldName); + return $this->_mapMethodFieldset($fieldName); } } /** - * Map PayPal Website Payments Pro common style config fields + * Map PayPal Express config fields * * @param string $fieldName * @return string|null */ - protected function _mapWppStyleFieldset($fieldName) + protected function _mapExpressFieldset($fieldName) { switch ($fieldName) { - case 'button_flavor': - return "paypal/style/{$fieldName}"; + case 'transfer_shipping_options': + case 'solution_type': + case 'visible_on_cart': + case 'visible_on_product': + case 'allow_ba_signup': + return "payment/{$this->_methodCode}/{$fieldName}"; default: - return $this->_mapGenericStyleFieldset($fieldName); + return $this->_mapMethodFieldset($fieldName); } } /** - * Check wheter specified country code is supported by build notation codes for specific countries + * Map PayPal Direct config fields * - * @param $code + * @param string $fieldName * @return string|null */ - private function _matchBnCountryCode($code) + protected function _mapDirectFieldset($fieldName) { - switch ($code) { - // Australia, Austria, Belgium, Canada, China, France, Germany, Hong Kong, Italy - case 'AU': case 'AT': case 'BE': case 'CA': case 'CN': case 'FR': case 'DE': case 'HK': case 'IT': - // Japan, Mexico, Netherlands, Poland, Singapore, Spain, Switzerland, United Kingdom, United States - case 'JP': case 'MX': case 'NL': case 'PL': case 'SG': case 'ES': case 'CH': case 'UK': case 'US': - return $code; + switch ($fieldName) + { + case 'useccv': + case 'centinel': + case 'centinel_is_mode_strict': + case 'centinel_api_url': + return "payment/{$this->_methodCode}/{$fieldName}"; + default: + return $this->_mapMethodFieldset($fieldName); } } /** - * Map PayPal common style config fields + * Map PayPal Website Payments Pro common config fields * * @param string $fieldName * @return string|null */ - protected function _mapGenericStyleFieldset($fieldName) + protected function _mapWppFieldset($fieldName) { - switch ($fieldName) { - case 'page_style': - case 'paypal_hdrimg': - case 'paypal_hdrbackcolor': - case 'paypal_hdrbordercolor': - case 'paypal_payflowcolor': - return "paypal/style/{$fieldName}"; + switch ($fieldName) + { + case 'api_username': + case 'api_password': + case 'api_signature': + case 'sandbox_flag': + case 'use_proxy': + case 'proxy_host': + case 'proxy_port': + case 'button_flavor': + return "paypal/wpp/{$fieldName}"; + default: + return null; } } @@ -715,73 +1164,93 @@ protected function _mapGenericStyleFieldset($fieldName) * @param string $fieldName * @return string|null */ - protected function _mapWppFieldset($fieldName) + protected function _mapWpukFieldset($fieldName) { - switch ($fieldName) - { - case 'api_password': - case 'api_signature': - case 'api_username': - case 'business_account': - case 'debug_flag': - case 'paypal_url': - case 'proxy_host': - case 'proxy_port': + $pathPrefix = 'paypal/wpuk'; + // Use PUMP credentials from Verisign for EC when Direct Payments are unavailable + if ($this->_methodCode == self::METHOD_WPP_PE_EXPRESS && !$this->isMethodAvailable(self::METHOD_WPP_PE_DIRECT)) { + $pathPrefix = 'payment/verisign'; + } + switch ($fieldName) { + case 'partner': + case 'user': + case 'vendor': + case 'pwd': case 'sandbox_flag': case 'use_proxy': - return "paypal/wpp/{$fieldName}"; + case 'proxy_host': + case 'proxy_port': + return $pathPrefix . '/' . $fieldName; + default: + return null; } } /** - * Map PayPal Express config fields + * Map PayPal common style config fields * * @param string $fieldName * @return string|null */ - protected function _mapExpressFieldset($fieldName) + protected function _mapGenericStyleFieldset($fieldName) + { + switch ($fieldName) { + case 'logo': + case 'page_style': + case 'paypal_hdrimg': + case 'paypal_hdrbackcolor': + case 'paypal_hdrbordercolor': + case 'paypal_payflowcolor': + return "paypal/style/{$fieldName}"; + default: + return null; + } + } + + /** + * Map PayPal General Settings + * + * @param string $fieldName + * @return string|null + */ + protected function _mapGeneralFieldset($fieldName) { switch ($fieldName) { - case 'active': - case 'allowspecific': - case 'fraud_filter': - case 'line_items_enabled': - case 'order_status': - case 'payment_action': - case 'solution_type': - case 'sort_order': - case 'specificcountry': - case 'title': - case 'visible_on_cart': - return 'payment/' . self::METHOD_WPP_EXPRESS . "/{$fieldName}"; + case 'business_account': + case 'merchant_country': + return "paypal/general/{$fieldName}"; + default: + return null; } } /** - * Map PayPal Direct config fields + * Map PayPal General Settings * * @param string $fieldName * @return string|null */ - protected function _mapDirectFieldset($fieldName) + protected function _mapMethodFieldset($fieldName) { + if (!$this->_methodCode) { + return null; + } switch ($fieldName) { case 'active': + case 'title': + case 'payment_action': case 'allowspecific': - case 'cctypes': - case 'centinel': - case 'centinel_is_mode_strict': - case 'centinel_api_url': - case 'fraud_filter': + case 'specificcountry': case 'line_items_enabled': - case 'order_status': - case 'payment_action': + case 'cctypes': case 'sort_order': - case 'specificcountry': - case 'title': - return 'payment/' . self::METHOD_WPP_DIRECT . "/{$fieldName}"; + case 'debug': + return "payment/{$this->_methodCode}/{$fieldName}"; + default: + return null; } } } + diff --git a/app/code/core/Mage/Paypal/Model/Direct.php b/app/code/core/Mage/Paypal/Model/Direct.php index 20e6c0c4c5..5170183a00 100644 --- a/app/code/core/Mage/Paypal/Model/Direct.php +++ b/app/code/core/Mage/Paypal/Model/Direct.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -49,6 +49,8 @@ class Mage_Paypal_Model_Direct extends Mage_Payment_Model_Method_Cc protected $_canUseCheckout = true; protected $_canUseForMultishipping = true; protected $_canSaveCc = false; + protected $_canFetchTransactionInfo = true; + protected $_canReviewPayment = true; /** * Website Payments Pro instance @@ -64,20 +66,6 @@ class Mage_Paypal_Model_Direct extends Mage_Payment_Model_Method_Cc */ protected $_proType = 'paypal/pro'; - /** - * Info instance type - * - * @var $_proType string - */ - protected $_infoType = 'paypal/info'; - - /** - * Ipn notify action - * - * @var string - */ - protected $_notifyAction = 'paypal/ipn/direct'; - public function __construct($params = array()) { $proInstance = array_shift($params); @@ -98,6 +86,9 @@ public function __construct($params = array()) public function setStore($store) { $this->setData('store', $store); + if (null === $store) { + $store = Mage::app()->getStore()->getId(); + } $this->_pro->getConfig()->setStoreId(is_object($store) ? $store->getId() : $store); return $this; } @@ -124,6 +115,57 @@ public function getConfigPaymentAction() return $this->_pro->getConfig()->getPaymentAction(); } + /** + * Return available CC types for gateway based on merchant country + * + * @return string + */ + public function getAllowedCcTypes() + { + $ccTypes = explode(',', $this->_pro->getConfig()->cctypes); + $country = $this->_pro->getConfig()->getMerchantCountry(); + if ($country == 'GB') { + $ccTypes = array_intersect(array('SS', 'MC', 'DI', 'VI'), $ccTypes); + } elseif ($country == 'CA') { + $ccTypes = array_intersect(array('MC', 'VI'), $ccTypes); + } + return implode(',', $ccTypes); + } + + /** + * Check whether payment method can be used + * @param Mage_Sales_Model_Quote + * @return bool + */ + public function isAvailable($quote = null) + { + if ($this->_pro->getConfig()->isMethodAvailable() && parent::isAvailable($quote)) { + return true; + } + return false; + } + + /** + * Custom getter for payment configuration + * + * @param string $field + * @param int $storeId + * @return mixed + */ + public function getConfigData($field, $storeId = null) + { + $value = null; + switch ($field) + { + case 'cctypes': + $value = $this->getAllowedCcTypes(); + break; + default: + $value = $this->_pro->getConfig()->$field; + } + return $value; + } + /** * Authorize payment * @@ -185,6 +227,41 @@ public function cancel(Varien_Object $payment) return $this; } + /** + * Whether payment can be reviewed + * + * @param Mage_Sales_Model_Order_Payment $payment + * @return bool + */ + public function canReviewPayment(Mage_Payment_Model_Info $payment) + { + return parent::canReviewPayment($payment) && $this->_pro->canReviewPayment($payment); + } + + /** + * Attempt to accept a pending payment + * + * @param Mage_Sales_Model_Order_Payment $payment + * @return bool + */ + public function acceptPayment(Mage_Payment_Model_Info $payment) + { + parent::acceptPayment($payment); + return $this->_pro->reviewPayment($payment, Mage_Paypal_Model_Pro::PAYMENT_REVIEW_ACCEPT); + } + + /** + * Attempt to deny a pending payment + * + * @param Mage_Sales_Model_Order_Payment $payment + * @return bool + */ + public function denyPayment(Mage_Payment_Model_Info $payment) + { + parent::denyPayment($payment); + return $this->_pro->reviewPayment($payment, Mage_Paypal_Model_Pro::PAYMENT_REVIEW_DENY); + } + /** * Set fallback API URL if not defined in configuration * @@ -199,6 +276,18 @@ public function getCentinelValidator() return $validator; } + /** + * Fetch transaction details info + * + * @param Mage_Payment_Model_Info $payment + * @param string $transactionId + * @return array + */ + public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId) + { + return $this->_pro->fetchTransactionInfo($payment, $transactionId); + } + /** * Place an order with authorization or capture action * @@ -216,15 +305,20 @@ protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount) ->setCurrencyCode($order->getBaseCurrencyCode()) ->setInvNum($order->getIncrementId()) ->setEmail($order->getCustomerEmail()) - ->setNotifyUrl(Mage::getUrl($this->_notifyAction)) + ->setNotifyUrl(Mage::getUrl('paypal/ipn/')) ->setCreditCardType($payment->getCcType()) ->setCreditCardNumber($payment->getCcNumber()) - ->setCreditCardExpirationDate(sprintf('%02d%02d', $payment->getCcExpMonth(), $payment->getCcExpYear())) + ->setCreditCardExpirationDate( + $this->_getFormattedCcExpirationDate($payment->getCcExpMonth(), $payment->getCcExpYear()) + ) ->setCreditCardCvv2($payment->getCcCid()) ->setMaestroSoloIssueNumber($payment->getCcSsIssue()) ; if ($payment->getCcSsStartMonth() && $payment->getCcSsStartYear()) { - $api->setMaestroSoloIssueDate(sprintf('%02d%02d', $payment->getCcSsStartMonth(), preg_replace('~\d\d(\d\d)~','$1', $payment->getCcSsStartYear()))); + $year = sprintf('%02d', substr($payment->getCcSsStartYear(), -2, 2)); + $api->setMaestroSoloIssueDate( + $this->_getFormattedCcExpirationDate($payment->getCcSsStartMonth(), $year) + ); } if ($this->getIsCentinelValidationEnabled()) { $this->getCentinelValidator()->exportCmpiData($api); @@ -238,17 +332,34 @@ protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount) } // add line items - if ($this->_pro->getConfig()->lineItemsEnabled && Mage::helper('paypal')->doLineItemsMatchAmount($order, $amount)) {//For transfering line items order amount must be equal to cart total amount + if ($this->_pro->getConfig()->lineItemsEnabled) { list($items, $totals) = Mage::helper('paypal')->prepareLineItems($order); - $api->setLineItems($items)->setLineItemTotals($totals); + if (Mage::helper('paypal')->areCartLineItemsValid($items, $totals, $amount)) { + $api->setLineItems($items)->setLineItemTotals($totals); + } } // call api and import transaction and other payment information $api->callDoDirectPayment(); $this->_importResultToPayment($api, $payment); + $api->callGetTransactionDetails(); + $this->_importResultToPayment($api, $payment); return $this; } + /** + * Format credit card expiration date based on month and year values + * Format: mmyyyy + * + * @param string|int $month + * @param string|int $year + * @return string + */ + protected function _getFormattedCcExpirationDate($month, $year) + { + return sprintf('%02d%02d', $month, $year); + } + /** * Import direct payment results to payment * @@ -257,8 +368,7 @@ protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount) */ protected function _importResultToPayment($api, $payment) { - $payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(0) - ->setIsTransactionPending($api->getIsPaymentPending()); - Mage::getModel($this->_infoType)->importToPayment($api, $payment); + $payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(0); + $this->_pro->importPaymentInfo($api, $payment); } } diff --git a/app/code/core/Mage/Paypal/Model/Express.php b/app/code/core/Mage/Paypal/Model/Express.php index 453a85e0b7..b78311e9d3 100644 --- a/app/code/core/Mage/Paypal/Model/Express.php +++ b/app/code/core/Mage/Paypal/Model/Express.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,6 +29,7 @@ * PayPal Express Module */ class Mage_Paypal_Model_Express extends Mage_Payment_Model_Method_Abstract + implements Mage_Payment_Model_Recurring_Profile_MethodInterface { protected $_code = Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS; protected $_formBlockType = 'paypal/express_form'; @@ -44,23 +45,19 @@ class Mage_Paypal_Model_Express extends Mage_Payment_Model_Method_Abstract /** * Availability options */ - protected $_isGateway = false; - protected $_canAuthorize = true; - protected $_canCapture = true; - protected $_canCapturePartial = true; - protected $_canRefund = true; - protected $_canRefundInvoicePartial = true; - protected $_canVoid = true; - protected $_canUseInternal = false; - protected $_canUseCheckout = true; - protected $_canUseForMultishipping = false; - - /** - * Ipn action - * - * @var string - */ - protected $_ipnAction = 'paypal/ipn/express'; + protected $_isGateway = false; + protected $_canAuthorize = true; + protected $_canCapture = true; + protected $_canCapturePartial = true; + protected $_canRefund = true; + protected $_canRefundInvoicePartial = true; + protected $_canVoid = true; + protected $_canUseInternal = false; + protected $_canUseCheckout = true; + protected $_canUseForMultishipping = false; + protected $_canFetchTransactionInfo = true; + protected $_canCreateBillingAgreement = true; + protected $_canReviewPayment = true; /** * Website Payments Pro instance @@ -89,6 +86,9 @@ public function __construct($params = array()) public function setStore($store) { $this->setData('store', $store); + if (null === $store) { + $store = Mage::app()->getStore()->getId(); + } $this->_pro->getConfig()->setStoreId(is_object($store) ? $store->getId() : $store); return $this; } @@ -115,6 +115,31 @@ public function getConfigPaymentAction() return $this->_pro->getConfig()->getPaymentAction(); } + /** + * Check whether payment method can be used + * @param Mage_Sales_Model_Quote + * @return bool + */ + public function isAvailable($quote = null) + { + if ($this->_pro->getConfig()->isMethodAvailable() && parent::isAvailable($quote)) { + return true; + } + return false; + } + + /** + * Custom getter for payment configuration + * + * @param string $field + * @param int $storeId + * @return mixed + */ + public function getConfigData($field, $storeId = null) + { + return $this->_pro->getConfig()->$field; + } + /** * Authorize payment * @@ -176,6 +201,41 @@ public function cancel(Varien_Object $payment) return $this; } + /** + * Whether payment can be reviewed + * + * @param Mage_Sales_Model_Order_Payment $payment + * @return bool + */ + public function canReviewPayment(Mage_Payment_Model_Info $payment) + { + return parent::canReviewPayment($payment) && $this->_pro->canReviewPayment($payment); + } + + /** + * Attempt to accept a pending payment + * + * @param Mage_Sales_Model_Order_Payment $payment + * @return bool + */ + public function acceptPayment(Mage_Payment_Model_Info $payment) + { + parent::acceptPayment($payment); + return $this->_pro->reviewPayment($payment, Mage_Paypal_Model_Pro::PAYMENT_REVIEW_ACCEPT); + } + + /** + * Attempt to deny a pending payment + * + * @param Mage_Sales_Model_Order_Payment $payment + * @return bool + */ + public function denyPayment(Mage_Payment_Model_Info $payment) + { + parent::denyPayment($payment); + return $this->_pro->reviewPayment($payment, Mage_Paypal_Model_Pro::PAYMENT_REVIEW_DENY); + } + /** * Checkout redirect URL getter for onepage checkout (hardcode) * @@ -188,6 +248,99 @@ public function getCheckoutRedirectUrl() return Mage::getUrl('paypal/express/start'); } + /** + * Fetch transaction details info + * + * @param Mage_Payment_Model_Info $payment + * @param string $transactionId + * @return array + */ + public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId) + { + return $this->_pro->fetchTransactionInfo($payment, $transactionId); + } + + /** + * Validate RP data + * + * @param Mage_Payment_Model_Recurring_Profile $profile + */ + public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile) + { + return $this->_pro->validateRecurringProfile($profile); + } + + /** + * Submit RP to the gateway + * + * @param Mage_Payment_Model_Recurring_Profile $profile + * @param Mage_Payment_Model_Info $paymentInfo + */ + public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, Mage_Payment_Model_Info $paymentInfo) + { + $token = $paymentInfo->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_TOKEN); + $profile->setToken($token); + $this->_pro->submitRecurringProfile($profile, $paymentInfo); + } + + /** + * Fetch RP details + * + * @param string $referenceId + * @param Varien_Object $result + */ + public function getRecurringProfileDetails($referenceId, Varien_Object $result) + { + return $this->_pro->getRecurringProfileDetails($referenceId, $result); + } + + /** + * Whether can get recurring profile details + */ + public function canGetRecurringProfileDetails() + { + return true; + } + + /** + * Update RP data + * + * @param Mage_Payment_Model_Recurring_Profile $profile + */ + public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile) + { + return $this->_pro->updateRecurringProfile($profile); + } + + /** + * Manage status + * + * @param Mage_Payment_Model_Recurring_Profile $profile + */ + public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile) + { + return $this->_pro->updateRecurringProfile($profile); + } + + /** + * Assign data to info model instance + * + * @param mixed $data + * @return Mage_Payment_Model_Info + */ + public function assignData($data) + { + $result = parent::assignData($data); + $key = Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT; + if (is_array($data)) { + $this->getInfoInstance()->setAdditionalInformation($key, isset($data[$key]) ? $data[$key] : null); + } + elseif ($data instanceof Varien_Object) { + $this->getInfoInstance()->setAdditionalInformation($key, $data->getData($key)); + } + return $result; + } + /** * Place an order with authorization or capture action * @@ -197,23 +350,26 @@ public function getCheckoutRedirectUrl() */ protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount) { - // prepare api call $order = $payment->getOrder(); + + // prepare api call $token = $payment->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_TOKEN); $api = $this->_pro->getApi() ->setToken($token) ->setPayerId($payment->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID)) ->setAmount($amount) ->setPaymentAction($this->_pro->getConfig()->paymentAction) - ->setNotifyUrl(Mage::getUrl($this->_ipnAction)) + ->setNotifyUrl(Mage::getUrl('paypal/ipn/')) ->setInvNum($order->getIncrementId()) ->setCurrencyCode($order->getBaseCurrencyCode()) ; // add line items - if ($this->_pro->getConfig()->lineItemsEnabled && Mage::helper('paypal')->doLineItemsMatchAmount($order, $amount)) {//For transfering line items order amount must be equal to cart total amount + if ($this->_pro->getConfig()->lineItemsEnabled) { list($items, $totals) = Mage::helper('paypal')->prepareLineItems($order); - $api->setLineItems($items)->setLineItemTotals($totals); + if (Mage::helper('paypal')->areCartLineItemsValid($items, $totals, $amount)) { + $api->setLineItems($items)->setLineItemTotals($totals); + } } // call api and get details from it @@ -233,8 +389,15 @@ protected function _importToPayment($api, $payment) $payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(0) ->setAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_REDIRECT, $api->getRedirectRequired() || $api->getRedirectRequested() - ) - ->setIsTransactionPending($api->getIsPaymentPending()); - Mage::getModel('paypal/info')->importToPayment($api, $payment); + ); + + if ($api->getBillingAgreementId()) { + $payment->setBillingAgreementData(array( + 'billing_agreement_id' => $api->getBillingAgreementId(), + 'method_code' => Mage_Paypal_Model_Config::METHOD_BILLING_AGREEMENT + )); + } + + $this->_pro->importPaymentInfo($api, $payment); } } diff --git a/app/code/core/Mage/Paypal/Model/Express/Checkout.php b/app/code/core/Mage/Paypal/Model/Express/Checkout.php index 2c6e2fb73c..7a3671057b 100644 --- a/app/code/core/Mage/Paypal/Model/Express/Checkout.php +++ b/app/code/core/Mage/Paypal/Model/Express/Checkout.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -43,8 +43,10 @@ class Mage_Paypal_Model_Express_Checkout */ const PAYMENT_INFO_TRANSPORT_TOKEN = 'paypal_express_checkout_token'; const PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDEN = 'paypal_express_checkout_shipping_overriden'; + const PAYMENT_INFO_TRANSPORT_SHIPPING_METHOD = 'paypal_express_checkout_shipping_method'; const PAYMENT_INFO_TRANSPORT_PAYER_ID = 'paypal_express_checkout_payer_id'; const PAYMENT_INFO_TRANSPORT_REDIRECT = 'paypal_express_checkout_redirect_required'; + const PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT = 'paypal_ec_create_ba'; /** * @var Mage_Sales_Model_Quote @@ -92,6 +94,41 @@ class Mage_Paypal_Model_Express_Checkout */ protected $_giropayUrls = array(); + /** + * Create Billing Agreement flag + * + * @var bool + */ + protected $_isBARequested = false; + + /** + * Customer ID + * + * @var int + */ + protected $_customerId = null; + + /** + * Recurring payment profiles + * + * @var array + */ + protected $_recurringPaymentProfiles = array(); + + /** + * Billing agreement that might be created during order placing + * + * @var Mage_Sales_Model_Billing_Agreement + */ + protected $_billingAgreement = null; + + /** + * Order + * + * @var Mage_Sales_Model_QuoteMage_Sales_Model_Quote + */ + protected $_order = null; + /** * Set quote and config instances * @param array $params @@ -158,12 +195,37 @@ public function prepareGiropayUrls($successUrl, $cancelUrl, $pendingUrl) return $this; } + /** + * Set create billing agreement flag + * + * @param bool $flag + * @return Mage_Paypal_Model_Express_Checkout + */ + public function setIsBillingAgreementRequested($flag) + { + $this->_isBARequested = $flag; + return $this; + } + + /** + * Setter for customer Id + * + * @param int $id + * @return Mage_Paypal_Model_Express_Checkout + */ + public function setCustomerId($id) + { + $this->_customerId = $id; + return $this; + } + /** * Reserve order ID for specified quote and start checkout on PayPal * @return string */ public function start($returnUrl, $cancelUrl) { + $this->_quote->collectTotals(); $this->_quote->reserveOrderId()->save(); // prepare API $this->_getApi(); @@ -184,6 +246,8 @@ public function start($returnUrl, $cancelUrl) )); } + $this->_setBillingAgreementRequest(); + // supress or export shipping address if ($this->_quote->getIsVirtual()) { $this->_api->setSuppressShipping(true); @@ -200,9 +264,32 @@ public function start($returnUrl, $cancelUrl) $this->_quote->getPayment()->save(); } // add line items - if ($this->_config->lineItemsEnabled && Mage::helper('paypal')->doLineItemsMatchAmount($this->_quote, $this->_quote->getBaseGrandTotal())) {//For transfering line items order amount must be equal to cart total amount + if ($this->_config->lineItemsEnabled) { list($items, $totals) = Mage::helper('paypal')->prepareLineItems($this->_quote); - $this->_api->setLineItems($items)->setLineItemTotals($totals); + if (Mage::helper('paypal')->areCartLineItemsValid($items, $totals, $this->_quote->getBaseGrandTotal())) { + $this->_api->setLineItems($items)->setLineItemTotals($totals); + } + + // add shipping options + if ($this->_config->transferShippingOptions + && !$this->_quote->getIsVirtual() && !$this->_quote->hasNominalItems()) { + if ($options = $this->_prepareShippingOptions($address, true)) { + $this->_api->setShippingOptionsCallbackUrl( + Mage::getUrl('*/*/shippingOptionsCallback', array('quote_id' => $this->_quote->getId())) + )->setShippingOptions($options); + } + } + } + + // add recurring payment profiles information + if ($profiles = $this->_quote->prepareRecurringPaymentProfiles()) { + foreach ($profiles as $profile) { + $profile->setMethodCode(Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS); + if (!$profile->isValid()) { + Mage::throwException($profile->getValidationErrors(true, true)); + } + } + $this->_api->addRecurringPaymentProfiles($profiles); } $this->_config->exportExpressCheckoutStyleSettings($this->_api); @@ -211,6 +298,9 @@ public function start($returnUrl, $cancelUrl) $this->_api->callSetExpressCheckout(); $token = $this->_api->getToken(); $this->_redirectUrl = $this->_config->getExpressCheckoutStartUrl($token); + + $this->_quote->getPayment()->unsAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT); + $this->_quote->getPayment()->save(); return $token; } @@ -221,21 +311,38 @@ public function start($returnUrl, $cancelUrl) public function returnFromPaypal($token) { $this->_getApi(); - $this->_api->setToken($token)->callGetExpressCheckoutDetails(); + $this->_api->setToken($token) + ->callGetExpressCheckoutDetails(); - // import addresses + // import billing address $billingAddress = $this->_quote->getBillingAddress(); $exportedBillingAddress = $this->_api->getExportedBillingAddress(); foreach ($exportedBillingAddress->getExportedKeys() as $key) { $billingAddress->setDataUsingMethod($key, $exportedBillingAddress->getData($key)); } + + // import shipping address $exportedShippingAddress = $this->_api->getExportedShippingAddress(); - if ((!$this->_quote->getIsVirtual()) && $exportedShippingAddress - && $shippingAddress = $this->_quote->getShippingAddress()) { - foreach ($exportedShippingAddress->getExportedKeys() as $key) { - $shippingAddress->setDataUsingMethod($key, $exportedShippingAddress->getData($key)); + if (!$this->_quote->getIsVirtual()) { + $shippingAddress = $this->_quote->getShippingAddress(); + if ($shippingAddress) { + if ($exportedShippingAddress) { + foreach ($exportedShippingAddress->getExportedKeys() as $key) { + $shippingAddress->setDataUsingMethod($key, $exportedShippingAddress->getData($key)); + } + $shippingAddress->setCollectShippingRates(true)->collectShippingRates(); + } + + // import shipping method + $code = ''; + if ($this->_api->getShippingRateCode()) { + if ($code = $this->_matchShippingMethodCode($shippingAddress, $this->_api->getShippingRateCode())) { + // possible bug of double collecting rates :-/ + $shippingAddress->setShippingMethod($code)->setCollectShippingRates(true); + } + } + $this->_quote->getPayment()->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_METHOD, $code); } - $shippingAddress->setCollectShippingRates(true); } $this->_ignoreAddressValidation(); @@ -261,10 +368,55 @@ public function prepareOrderReview($token = null) if (!$payment || !$payment->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_PAYER_ID)) { Mage::throwException(Mage::helper('paypal')->__('Payer is not identified.')); } + $this->_quote->setMayEditShippingAddress( + 1 != $this->_quote->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDEN) + ); + $this->_quote->setMayEditShippingMethod( + '' == $this->_quote->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_METHOD) + ); $this->_ignoreAddressValidation(); $this->_quote->collectTotals()->save(); } + /** + * Return callback response with shipping options + * + * @param array $request + * @return string + */ + public function getShippingOptionsCallbackResponse(array $request) + { + // prepare debug data + $logger = Mage::getModel('core/log_adapter', 'payment_' . $this->_methodType . '.log'); + $debugData = array('request' => $request, 'response' => array()); + + try { + // obtain addresses + $this->_getApi(); + $address = $this->_api->prepareShippingOptionsCallbackAddress($request); + $quoteAddress = $this->_quote->getShippingAddress(); + + // compare addresses, calculate shipping rates and prepare response + $options = array(); + if ($address && $quoteAddress && !$this->_quote->getIsVirtual()) { + foreach ($address->getExportedKeys() as $key) { + $quoteAddress->setDataUsingMethod($key, $address->getData($key)); + } + $quoteAddress->setCollectShippingRates(true)->collectShippingRates(); + $options = $this->_prepareShippingOptions($quoteAddress, false); + } + $response = $this->_api->setShippingOptions($options)->formatShippingOptionsCallback(); + + // log request and response + $debugData['response'] = $response; + $logger->log($debugData); + return $response; + } catch (Exception $e) { + $logger->log($debugData); + throw $e; + } + } + /** * Set shipping method to quote, if needed * @param string $methodCode @@ -281,14 +433,13 @@ public function updateShippingMethod($methodCode) } /** - * Place the order when customer returned from paypal + * Place the order and recurring payment profiles when customer returned from paypal * Until this moment all quote data must be valid * * @param string $token * @param string $shippingMethodCode - * @return Mage_Sales_Model_Order */ - public function placeOrder($token, $shippingMethodCode = null) + public function place($token, $shippingMethodCode = null) { if ($shippingMethodCode) { $this->updateShippingMethod($shippingMethodCode); @@ -301,8 +452,18 @@ public function placeOrder($token, $shippingMethodCode = null) } $this->_ignoreAddressValidation(); - $order = Mage::getModel('sales/service_quote', $this->_quote)->submit(); + $this->_quote->collectTotals(); + $service = Mage::getModel('sales/service_quote', $this->_quote); + $service->submitAll(); $this->_quote->save(); + $this->_recurringPaymentProfiles = $service->getRecurringPaymentProfiles(); + // TODO: send recurring profile emails + + $order = $service->getOrder(); + if (!$order) { + return; + } + $this->_billingAgreement = $order->getPayment()->getBillingAgreement(); // commence redirecting to finish payment, if paypal requires it if ($order->getPayment()->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_REDIRECT)) { @@ -317,21 +478,11 @@ public function placeOrder($token, $shippingMethodCode = null) // regular placement, when everything is ok case Mage_Sales_Model_Order::STATE_PROCESSING: case Mage_Sales_Model_Order::STATE_COMPLETE: + case Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW: $order->sendNewOrderEmail(); break; } - return $order; - } - - /** - * Whether customer is allowed to edit shipping address on order review - * - * @return bool - */ - public function mayEditShippingAddress() - { - return 1 != $this->_quote->getPayment() - ->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDEN); + $this->_order = $order; } /** @@ -356,6 +507,62 @@ public function getRedirectUrl() return $this->_redirectUrl; } + /** + * Return recurring payment profiles + * + * @return array + */ + public function getRecurringPaymentProfiles() + { + return $this->_recurringPaymentProfiles; + } + + /** + * Get created billing agreement + * + * @return Mage_Sales_Model_Billing_Agreement|null + */ + public function getBillingAgreement() + { + return $this->_billingAgreement; + } + + /** + * Return order + * + * @return Mage_Sales_Model_Order + */ + public function getOrder() + { + return $this->_order; + } + + /** + * Set create billing agreement flag to api call + * + * @return Mage_Paypal_Model_Express_Checkout + */ + protected function _setBillingAgreementRequest() + { + if (!$this->_customerId || $this->_quote->hasNominalItems()) { + return $this; + } + + $isRequested = $this->_isBARequested || $this->_quote->getPayment() + ->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT); + + if (!($this->_config->allow_ba_signup == Mage_Paypal_Model_Config::EC_BA_SIGNUP_AUTO + || $isRequested && $this->_config->shouldAskToCreateBillingAgreement())) { + return $this; + } + + if (!Mage::getModel('sales/billing_agreement')->needToCreateForCustomer($this->_customerId)) { + return $this; + } + $this->_api->setBillingType($this->_api->getBillingAgreementType()); + return $this; + } + /** * @return Mage_Paypal_Model_Api_Nvp */ @@ -366,4 +573,79 @@ protected function _getApi() } return $this->_api; } + + /** + * Attempt to collect address shipping rates and return them for further usage in instant update API + * Returns empty array if it was impossible to obtain any shipping rate + * If there are shipping rates obtained, the method must return one of them as default. + * + * @param Mage_Sales_Model_Quote_Address $address + * @param bool $mayReturnEmpty + * @return array|false + */ + protected function _prepareShippingOptions(Mage_Sales_Model_Quote_Address $address, $mayReturnEmpty = false) + { + $options = array(); $i = 0; $iMin = false; $min = false; $iDefault = false; + + foreach ($address->getGroupedAllShippingRates() as $group) { + foreach ($group as $rate) { + $amount = (float)$rate->getPrice(); + if (!$rate->getMethodTitle() || 0.00 == $amount) { + continue; + } + $isDefault = $address->getShippingMethod() === $rate->getCode(); + if ($isDefault) { + $iDefault = $i; + } + $options[$i] = new Varien_Object(array( + 'is_default' => $isDefault, + 'name' => "{$rate->getCarrierTitle()} - {$rate->getMethodTitle()}", + 'code' => $rate->getCode(), + 'amount' => $amount, + )); + if (false === $min || $amount < $min) { + $min = $amount; $iMin = $i; + } + $i++; + } + } + + if ($mayReturnEmpty) { + $options[] = new Varien_Object(array( + 'is_default' => (false === $iDefault ? true : false), + 'name' => 'N/A', + 'code' => 'no_rate', + 'amount' => 0.00, + )); + } elseif (false === $iDefault && isset($options[$iMin])) { + $options[$iMin]->setIsDefault(true); + } + + return $options; + } + + /** + * Try to find whether the code provided by PayPal corresponds to any of possible shipping rates + * This method was created only because PayPal has issues with returning the selected code. + * If in future the issue is fixed, we don't need to attempt to match it. It would be enough to set the method code + * before collecting shipping rates + * + * @param Mage_Sales_Model_Quote_Address $address + * @param string $selectedCode + * @return string + */ + protected function _matchShippingMethodCode(Mage_Sales_Model_Quote_Address $address, $selectedCode) + { + $options = $this->_prepareShippingOptions($address, false); + foreach ($options as $option) { + if ($selectedCode === $option['code'] // the proper case as outlined in documentation + || $selectedCode === $option['name'] // workaround: PayPal may return name instead of the code + // workaround: PayPal may concatenate code and name, and return it instead of the code: + || $selectedCode === "{$option['code']} {$option['name']}" + ) { + return $option['code']; + } + } + return ''; + } } diff --git a/app/code/core/Mage/Paypal/Model/Info.php b/app/code/core/Mage/Paypal/Model/Info.php index 9ba7c37fc7..57c58c0a60 100644 --- a/app/code/core/Mage/Paypal/Model/Info.php +++ b/app/code/core/Mage/Paypal/Model/Info.php @@ -20,13 +20,16 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Payment information import/export model + * PayPal payment information model + * + * Aware of all PayPal payment methods * Collects and provides access to PayPal-specific payment data + * Provides business logic information about payment flow */ class Mage_Paypal_Model_Info { @@ -48,6 +51,13 @@ class Mage_Paypal_Model_Info const CENTINEL_VPAS = 'centinel_vpas_result'; const CENTINEL_ECI = 'centinel_eci_result'; + const PAYMENT_STATUS = 'payment_status'; + const PENDING_REASON = 'pending_reason'; + const IS_FRAUD = 'is_fraud_detected'; + const PAYMENT_STATUS_GLOBAL = 'paypal_payment_status'; + const PENDING_REASON_GLOBAL = 'paypal_pending_reason'; + const IS_FRAUD_GLOBAL = 'paypal_is_fraud_detected'; + /** * All payment information map * @@ -68,6 +78,36 @@ class Mage_Paypal_Model_Info self::CENTINEL_ECI => self::CENTINEL_ECI, ); + /** + * System information map + * + * @var array + */ + protected $_systemMap = array( + self::PAYMENT_STATUS => self::PAYMENT_STATUS_GLOBAL, + self::PENDING_REASON => self::PENDING_REASON_GLOBAL, + self::IS_FRAUD => self::IS_FRAUD_GLOBAL, + ); + + /** + * PayPal payment status possible values + * + * @var string + */ + const PAYMENTSTATUS_NONE = 'none'; + const PAYMENTSTATUS_COMPLETED = 'completed'; + const PAYMENTSTATUS_DENIED = 'denied'; + const PAYMENTSTATUS_EXPIRED = 'expired'; + const PAYMENTSTATUS_FAILED = 'failed'; + const PAYMENTSTATUS_INPROGRESS = 'in_progress'; + const PAYMENTSTATUS_PENDING = 'pending'; + const PAYMENTSTATUS_REFUNDED = 'refunded'; + const PAYMENTSTATUS_REFUNDEDPART = 'partially_refunded'; + const PAYMENTSTATUS_REVERSED = 'reversed'; + const PAYMENTSTATUS_UNREVERSED = 'canceled_reversal'; + const PAYMENTSTATUS_PROCESSED = 'processed'; + const PAYMENTSTATUS_VOIDED = 'voided'; + /** * Map of payment information available to customer * @@ -128,7 +168,11 @@ public function getPublicPaymentInfo(Mage_Payment_Model_Info $payment, $labelVal */ public function importToPayment($from, Mage_Payment_Model_Info $payment) { - Varien_Object_Mapper::accumulateByMap($from, array($payment, 'setAdditionalInformation'), $this->_paymentMap); + $fullMap = array_merge($this->_paymentMap, $this->_systemMap); + if (is_object($from)) { + $from = array($from, 'getDataUsingMethod'); + } + Varien_Object_Mapper::accumulateByMap($from, array($payment, 'setAdditionalInformation'), $fullMap); } /** @@ -141,12 +185,183 @@ public function importToPayment($from, Mage_Payment_Model_Info $payment) */ public function &exportFromPayment(Mage_Payment_Model_Info $payment, $to, array $map = null) { + $fullMap = array_merge($this->_paymentMap, $this->_systemMap); Varien_Object_Mapper::accumulateByMap(array($payment, 'getAdditionalInformation'), $to, - $map ? $map : array_flip($this->_paymentMap) + $map ? $map : array_flip($fullMap) ); return $to; } + /** + * Check whether the payment is in review state + * + * @param Mage_Payment_Model_Info $payment + * @return bool + */ + public static function isPaymentReviewRequired(Mage_Payment_Model_Info $payment) + { + $paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL); + if (self::PAYMENTSTATUS_PENDING === $paymentStatus) { + $pendingReason = $payment->getAdditionalInformation(self::PENDING_REASON_GLOBAL); + return !in_array($pendingReason, array('authorization', 'order')); + } + return false; + } + + /** + * Check whether fraud order review detected and can be reviewed + * + * @param Mage_Payment_Model_Info $payment + * @return bool + */ + public static function isFraudReviewAllowed(Mage_Payment_Model_Info $payment) + { + return self::isPaymentReviewRequired($payment) + && 1 == $payment->getAdditionalInformation(self::IS_FRAUD_GLOBAL); + } + + /** + * Check whether the payment is completed + * + * @param Mage_Payment_Model_Info $payment + * @return bool + */ + public static function isPaymentCompleted(Mage_Payment_Model_Info $payment) + { + $paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL); + return self::PAYMENTSTATUS_COMPLETED === $paymentStatus; + } + + /** + * Check whether the payment was processed successfully + * + * @param Mage_Payment_Model_Info $payment + * @return bool + */ + public static function isPaymentSuccessful(Mage_Payment_Model_Info $payment) + { + $paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL); + if (in_array($paymentStatus, array( + self::PAYMENTSTATUS_COMPLETED, self::PAYMENTSTATUS_INPROGRESS, self::PAYMENTSTATUS_REFUNDED, + self::PAYMENTSTATUS_REFUNDEDPART, self::PAYMENTSTATUS_UNREVERSED, self::PAYMENTSTATUS_PROCESSED, + ))) { + return true; + } + $pendingReason = $payment->getAdditionalInformation(self::PENDING_REASON_GLOBAL); + return self::PAYMENTSTATUS_PENDING === $paymentStatus + && in_array($pendingReason, array('authorization', 'order')); + } + + /** + * Check whether the payment was processed unsuccessfully or failed + * + * @param Mage_Payment_Model_Info $payment + * @return bool + */ + public static function isPaymentFailed(Mage_Payment_Model_Info $payment) + { + $paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL); + return in_array($paymentStatus, array( + self::PAYMENTSTATUS_DENIED, self::PAYMENTSTATUS_EXPIRED, self::PAYMENTSTATUS_FAILED, + self::PAYMENTSTATUS_REVERSED, self::PAYMENTSTATUS_VOIDED, + )); + } + + /** + * Explain pending payment reason code + * + * @param string $code + * @return string + * @see https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables + * @see https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetTransactionDetails + */ + public static function explainPendingReason($code) + { + switch ($code) { + case 'address': + return Mage::helper('paypal')->__('Customer did not include a confirmed address.'); + case 'authorization': + case 'order': + return Mage::helper('paypal')->__('The payment is authorized but not settled.'); + case 'echeck': + return Mage::helper('paypal')->__('The payment eCheck is not yet cleared.'); + case 'intl': + return Mage::helper('paypal')->__('Merchant holds a non-U.S. account and does not have a withdrawal mechanism.'); + case 'multi-currency': // break is intentionally omitted + case 'multi_currency': // break is intentionally omitted + case 'multicurrency': + return Mage::helper('paypal')->__('The payment curency does not match any of the merchant\'s balances currency.'); + case 'paymentreview': + return Mage::helper('paypal')->__('The payment is pending while it is being reviewed by PayPal for risk.'); + case 'unilateral': + return Mage::helper('paypal')->__('The payment is pending because it was made to an email address that is not yet registered or confirmed.'); + case 'verify': + return Mage::helper('paypal')->__('The merchant account is not yet verified.'); + case 'upgrade': + return Mage::helper('paypal')->__('The payment was made via credit card. In order to receive funds merchant must upgrade account to Business or Premier status.'); + case 'none': // break is intentionally omitted + case 'other': // break is intentionally omitted + default: + return Mage::helper('paypal')->__('Unknown reason. Please contact PayPal customer service.'); + } + } + + /** + * Explain the refund or chargeback reason code + * + * @param $code + * @return string + * @see https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables + * @see https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetTransactionDetails + */ + public static function explainReasonCode($code) + { + switch ($code) { + case 'chargeback': + return Mage::helper('paypal')->__('Chargeback by customer.'); + case 'guarantee': + return Mage::helper('paypal')->__('Customer triggered a money-back guarantee.'); + case 'buyer-complaint': + return Mage::helper('paypal')->__('Customer complaint.'); + case 'refund': + return Mage::helper('paypal')->__('Refund issued by merchant.'); + case 'adjustment_reversal': + return Mage::helper('paypal')->__('Reversal of an adjustment.'); + case 'chargeback_reimbursement': + return Mage::helper('paypal')->__('Reimbursement for a chargeback.'); + case 'chargeback_settlement': + return Mage::helper('paypal')->__('Settlement of a chargeback.'); + case 'none': // break is intentionally omitted + case 'other': + default: + return Mage::helper('paypal')->__('Unknown reason. Please contact PayPal customer service.'); + } + } + + /** + * Whether a reversal/refund can be disputed with PayPal + * + * @param string $code + * @return bool; + */ + public static function isReversalDisputable($code) + { + switch ($code) { + case 'none': + case 'other': + case 'chargeback': + case 'buyer-complaint': + case 'adjustment_reversal': + return true; + case 'guarantee': + case 'refund': + case 'chargeback_reimbursement': + case 'chargeback_settlement': + default: + return false; + } + } + /** * Render info item * @@ -205,7 +420,7 @@ protected function _getLabel($key) case 'paypal_fraud_filters': return Mage::helper('paypal')->__('Triggered Fraud Filters'); case 'paypal_correlation_id': - return Mage::helper('paypal')->__('Last Corellation ID'); + return Mage::helper('paypal')->__('Last Correlation ID'); case 'paypal_avs_code': return Mage::helper('paypal')->__('Address Verification System Response'); case 'paypal_cvv2_match': diff --git a/app/code/core/Mage/Paypal/Model/Ipn.php b/app/code/core/Mage/Paypal/Model/Ipn.php index 7e5d6df9a6..ae03803b1e 100644 --- a/app/code/core/Mage/Paypal/Model/Ipn.php +++ b/app/code/core/Mage/Paypal/Model/Ipn.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,26 +29,25 @@ */ class Mage_Paypal_Model_Ipn { - const STATUS_CREATED = 'Created'; - const STATUS_COMPLETED = 'Completed'; - const STATUS_DENIED = 'Denied'; - const STATUS_FAILED = 'Failed'; - const STATUS_REVERSED = 'Reversed'; - const STATUS_REFUNDED = 'Refunded'; - const STATUS_CANCELED_REV = 'Canceled_Reversal'; - const STATUS_PENDING = 'Pending'; - const STATUS_PROCESSED = 'Processed'; - const STATUS_EXPIRED = 'Expired'; - const STATUS_VOIDED = 'Voided'; - - const AUTH_STATUS_IN_PROGRESS = 'In_Progress'; - const AUTH_STATUS_COMPLETED = 'Completed'; + /** + * Default log filename + * + * @var string + */ + const DEFAULT_LOG_FILE = 'paypal_unknown_ipn.log'; /* * @param Mage_Sales_Model_Order */ protected $_order = null; + /* + * Recurring profile instance + * + * @var Mage_Sales_Model_Recurring_Profile + */ + protected $_recurringProfile = null; + /** * * @var Mage_Paypal_Model_Config @@ -56,103 +55,111 @@ class Mage_Paypal_Model_Ipn protected $_config = null; /** - * IPN request data - * @var array + * PayPal info instance + * + * @var Mage_Paypal_Model_Info */ - protected $_ipnFormData = array(); + protected $_info = null; /** - * Config model setter - * @param Mage_Paypal_Model_Config $config - * @return Mage_Paypal_Model_Ipn + * IPN request data + * @var array */ - public function setConfig(Mage_Paypal_Model_Config $config) - { - $this->_config = $config; - return $this; - } + protected $_request = array(); /** - * IPN request data setter - * @param array $data - * @return Mage_Paypal_Model_Ipn + * Collected debug information + * + * @var array */ - public function setIpnFormData(array $data) - { - $this->_ipnFormData = $data; - return $this; - } + protected $_debugData = array(); /** * IPN request data getter + * * @param string $key * @return array|string */ - public function getIpnFormData($key = null) + public function getRequestData($key = null) { if (null === $key) { - return $this->_ipnFormData; + return $this->_request; } - return isset($this->_ipnFormData[$key]) ? $this->_ipnFormData[$key] : null; + return isset($this->_request[$key]) ? $this->_request[$key] : null; } /** * Get ipn data, send verification to PayPal, run corresponding handler + * + * @param array $request + * @param Zend_Http_Client_Adapter_Interface $httpAdapter + * @throws Exception */ - public function processIpnRequest() + public function processIpnRequest(array $request, Zend_Http_Client_Adapter_Interface $httpAdapter = null) { - if (!$this->_ipnFormData) { - return; + $this->_request = $request; + $this->_config = Mage::getModel('paypal/config'); // empty config model, without specific payment method + if (isset($request['test_ipn']) && 1 == $request['test_ipn']) { + $this->_config->sandboxFlag = true; } + $this->_config->debug = true; - // debug requested - if ($this->_config->debugFlag) { - Mage::getModel('paypal/api_debug') - ->setApiEndpoint($this->_config->getPaypalUrl()) - ->setRequestBody(var_export($this->_ipnFormData, 1)) - ->save(); - } + $this->_debugData = array('ipn' => $request); + ksort($this->_debugData['ipn']); - $sReq = ''; - $sReqDebug = ''; - foreach ($this->_ipnFormData as $k => $v) { - $sReq .= '&'.$k.'='.urlencode(stripslashes($v)); - $sReqDebug .= '&'.$k.'='; - } - // append ipn command - $sReq .= "&cmd=_notify-validate"; - $sReq = substr($sReq, 1); - - $http = new Varien_Http_Adapter_Curl(); - $http->write(Zend_Http_Client::POST, $this->_config->getPaypalUrl(), '1.1', array(), $sReq); - $response = $http->read(); - - // debug postback request & response - if ($this->_config->debugFlag) { - Mage::getModel('paypal/api_debug') - ->setApiEndpoint($this->_config->getPaypalUrl()) - ->setRequestBody($sReq) - ->setResponseBody($response) - ->save(); + try { + if ($httpAdapter) { + $this->_postBack($httpAdapter); + } + if (isset($this->_request['txn_type']) && 'recurring_payment' == $this->_request['txn_type']) { + $this->_processRecurringProfile(); + } else { + $this->_processOrder(); + } + } catch (Exception $e) { + $this->_debugData['exception'] = $e->getMessage(); + $this->_debug(); + throw $e; } + $this->_debug(); + } - if ($error = $http->getError()) { - $this->_notifyAdmin(Mage::helper('paypal')->__('PayPal IPN postback HTTP error: %s', $error)); - return; - } + /** + * Post back to PayPal to check whether this request is a valid one + * + * @param Zend_Http_Client_Adapter_Interface $httpAdapter + */ + protected function _postBack(Zend_Http_Client_Adapter_Interface $httpAdapter) + { + $sReq = ''; + foreach ($this->_request as $k => $v) { + $sReq .= '&'.$k.'='.urlencode(stripslashes($v)); + } + $sReq .= "&cmd=_notify-validate"; + $sReq = substr($sReq, 1); + $this->_debugData['postback'] = $sReq; + $this->_debugData['postback_to'] = $this->_config->getPaypalUrl(); - $response = preg_split('/^\r?$/m', $response, 2); - $response = trim($response[1]); - if ($response == 'VERIFIED') { - $this->processIpnVerified(); - } else { - // TODO: possible PCI compliance issue - the $sReq may contain data that is supposed to be encrypted - $this->_notifyAdmin(Mage::helper('paypal')->__('PayPal IPN postback Validation error: %s', $sReq)); - } + $httpAdapter->write(Zend_Http_Client::POST, $this->_config->getPaypalUrl(), '1.1', array(), $sReq); + try { + $response = $httpAdapter->read(); + } catch (Exception $e) { + $this->_debugData['http_error'] = array('error' => $e->getMessage(), 'code' => $e->getCode()); + throw $e; + } + $this->_debugData['postback_result'] = $response; + + $response = preg_split('/^\r?$/m', $response, 2); + $response = trim($response[1]); + if ($response != 'VERIFIED') { + throw new Exception('PayPal IPN postback failure. See ' . self::DEFAULT_LOG_FILE . ' for details.'); + } + unset($this->_debugData['postback'], $this->_debugData['postback_result']); } /** - * Load and validate order + * Load and validate order, instantiate proper configuration + * * * @return Mage_Sales_Model_Order * @throws Exception @@ -161,37 +168,65 @@ protected function _getOrder() { if (empty($this->_order)) { // get proper order - $id = $this->getIpnFormData('invoice'); - $order = Mage::getModel('sales/order'); - $order->loadByIncrementId($id); - if (!$order->getId()) { - // throws Exception intentionally, because cannot be logged to order comments - throw new Exception(Mage::helper('paypal')->__('Wrong Order ID (%s) specified.', $id)); + $id = $this->_request['invoice']; + $this->_order = Mage::getModel('sales/order')->loadByIncrementId($id); + if (!$this->_order->getId()) { + throw new Exception(sprintf('Wrong order ID: "%s".', $id)); } - $this->_order = $order; - $this->_config = Mage::getModel('paypal/config', array($order->getPayment()->getMethod())); - $this->_verifyOrder($order); + // re-initialize config with the method code and store id + $methodCode = $this->_order->getPayment()->getMethod(); + $this->_config = Mage::getModel('paypal/config', array($methodCode, $this->_order->getStoreId())); + if (!$this->_config->isMethodActive($methodCode) || !$this->_config->isMethodAvailable()) { + throw new Exception(sprintf('Method "%s" is not available.', $methodCode)); + } + + $this->_verifyOrder(); } return $this->_order; } + /** + * Load recurring profile + * + * @return Mage_Sales_Model_Recurring_Profile + * @throws Exception + */ + protected function _getRecurringProfile() + { + if (empty($this->_recurringProfile)) { + // get proper recurring profile + $internalReferenceId = $this->_request['recurring_payment_id']; + $this->_recurringProfile = Mage::getModel('sales/recurring_profile')->loadByInternalReferenceId($internalReferenceId); + if (!$this->_recurringProfile->getId()) { + throw new Exception(sprintf('Wrong recurring profile INTERNAL_REFERENCE_ID: "%s".', $internalReferenceId)); + } + // re-initialize config with the method code and store id + $methodCode = $this->_recurringProfile->getMethodCode(); + $this->_config = Mage::getModel('paypal/config', array($methodCode, $this->_recurringProfile->getStoreId())); + if (!$this->_config->isMethodActive($methodCode) || !$this->_config->isMethodAvailable()) { + throw new Exception(sprintf('Method "%s" is not available.', $methodCode)); + } + } + return $this->_recurringProfile; + } + /** * Validate incoming request data, as PayPal recommends * - * @param Mage_Sales_Model_Order $order - * @throws Mage_Core_Exception + * @throws Exception + * @see https://cms.paypal.com/cgi-bin/marketingweb?cmd=_render-content&content_ID=developer/e_howto_admin_IPNIntro */ - protected function _verifyOrder(Mage_Sales_Model_Order $order) + protected function _verifyOrder() { // verify merchant email intended to receive notification $merchantEmail = $this->_config->businessAccount; if ($merchantEmail) { - $receiverEmail = $this->getIpnFormData('business'); + $receiverEmail = $this->getRequestData('business'); if (!$receiverEmail) { - $receiverEmail = $this->getIpnFormData('receiver_email'); + $receiverEmail = $this->getRequestData('receiver_email'); } if ($merchantEmail != $receiverEmail) { - Mage::throwException(Mage::helper('paypal')->__('Requested %s and configured %s merchant emails do not match.', $receiverEmail, $merchantEmail)); + throw new Exception(sprintf('Requested %s and configured %s merchant emails do not match.', $receiverEmail, $merchantEmail)); } } } @@ -201,108 +236,153 @@ protected function _verifyOrder(Mage_Sales_Model_Order $order) * Everything should be added to order comments. In positive processing cases customer will get email notifications. * Admin will be notified on errors. */ - public function processIpnVerified() + protected function _processOrder() { - $wasPaymentInformationChanged = false; + $this->_order = null; + $this->_getOrder(); + + $this->_info = Mage::getSingleton('paypal/info'); try { - try { - $order = $this->_getOrder(); - $wasPaymentInformationChanged = $this->_importPaymentInformation($order->getPayment()); - $paymentStatus = $this->getIpnFormData('payment_status'); - switch ($paymentStatus) { - // paid with german bank - case self::STATUS_CREATED: - // break intentionally omitted - // paid with PayPal - case self::STATUS_COMPLETED: - $this->_registerPaymentCapture(); - break; - - // the holded payment was denied on paypal side - case self::STATUS_DENIED: - $this->_registerPaymentFailure( - Mage::helper('paypal')->__('Merchant denied this pending payment.') - ); - break; - // customer attempted to pay via bank account, but failed - case self::STATUS_FAILED: - // cancel order - $this->_registerPaymentFailure(Mage::helper('paypal')->__('Customer failed to pay.')); - break; - - // refund forced by PayPal - case self::STATUS_REVERSED: - // break intentionally omitted - // refund by merchant on PayPal side - case self::STATUS_REFUNDED: - $this->_registerPaymentRefund(); - break; - - // refund that was forced by PayPal, returnred back. - case self::STATUS_CANCELED_REV: - // Magento cannot handle this for now. Just notify admin. - // potentially @see Mage_Sales_Model_Order_Creditmemo::cancel() - $history = $this->_explainRefundReason()->save(); - $this->_notifyAdmin($history->getComment()); - break; - - // payment was obtained, but money were not captured yet - case self::STATUS_PENDING: - $this->_registerPaymentPending(); - break; - - // no really useful information here, just add status comment - case self::STATUS_PROCESSED: - $this->_createIpnComment(''); - break; - - // authorization expired, must void - case self::STATUS_EXPIRED: - $this->_registerPaymentVoid(Mage::helper('paypal')->__('Authorization expired.')); - break; - // void by merchant on PayPal side - case self::STATUS_VOIDED: - $this->_registerPaymentVoid(Mage::helper('paypal')->__('Authorization was voided by merchant.')); - break; - } + // handle payment_status + $paymentStatus = $this->_filterPaymentStatus($this->_request['payment_status']); + + switch ($paymentStatus) { + // paid + case Mage_Paypal_Model_Info::PAYMENTSTATUS_COMPLETED: + $this->_registerPaymentCapture(); + break; + + // the holded payment was denied on paypal side + case Mage_Paypal_Model_Info::PAYMENTSTATUS_DENIED: + $this->_registerPaymentDenial(); + break; + + // customer attempted to pay via bank account, but failed + case Mage_Paypal_Model_Info::PAYMENTSTATUS_FAILED: + // cancel order + $this->_registerPaymentFailure(); + break; + + // refund forced by PayPal + case Mage_Paypal_Model_Info::PAYMENTSTATUS_REVERSED: // break is intentionally omitted + case Mage_Paypal_Model_Info::PAYMENTSTATUS_UNREVERSED: // or returned back :) + $this->_registerPaymentReversal(); + break; + + // refund by merchant on PayPal side + case Mage_Paypal_Model_Info::PAYMENTSTATUS_REFUNDED: + $this->_registerPaymentRefund(); + break; + + // payment was obtained, but money were not captured yet + case Mage_Paypal_Model_Info::PAYMENTSTATUS_PENDING: + $this->_registerPaymentPending(); + break; + + // MassPayments success + case Mage_Paypal_Model_Info::PAYMENTSTATUS_PROCESSED: + $this->_registerMasspaymentsSuccess(); + break; + + // authorization expire/void + case Mage_Paypal_Model_Info::PAYMENTSTATUS_EXPIRED: // break is intentionally omitted + case Mage_Paypal_Model_Info::PAYMENTSTATUS_VOIDED: + $this->_registerPaymentVoid(); + break; + + default: + throw new Exception("Cannot handle payment status '{$paymentStatus}'."); } - catch (Mage_Core_Exception $e) { - $history = $this->_createIpnComment(Mage::helper('paypal')->__('Note: %s', $e->getMessage())) - ->save(); - $this->_notifyAdmin($history->getComment(), $e); + } catch (Mage_Core_Exception $e) { + $comment = $this->_createIpnComment(Mage::helper('paypal')->__('Note: %s', $e->getMessage()), true); + $comment->save(); + throw $e; + } + } + + /** + * Process notification from recurring profile payments + */ + protected function _processRecurringProfile() + { + $this->_recurringProfile = null; + $this->_getRecurringProfile(); + + try { + // handle payment_status + $paymentStatus = $this->_filterPaymentStatus($this->_request['payment_status']); + + switch ($paymentStatus) { + // paid + case Mage_Paypal_Model_Info::PAYMENTSTATUS_COMPLETED: + $this->_registerRecurringProfilePaymentCapture(); + break; + + default: + throw new Exception("Cannot handle payment status '{$paymentStatus}'."); } - } catch (Exception $e) { - Mage::logException($e); + } catch (Mage_Core_Exception $e) { +// TODO: add to payment profile comments +// $comment = $this->_createIpnComment(Mage::helper('paypal')->__('Note: %s', $e->getMessage()), true); +// $comment->save(); + throw $e; } - if ($wasPaymentInformationChanged) { - $order->getPayment()->save(); + } + + /** + * Register recurring payment notification, create and process order + */ + protected function _registerRecurringProfilePaymentCapture() + { + $price = $this->getRequestData('mc_gross') - $this->getRequestData('tax') - $this->getRequestData('shipping'); + $productItemInfo = new Varien_Object; + if ($this->getRequestData('period_type') == 'Trial') { + $productItemInfo->setPaymentType(Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_TRIAL); + } elseif ($this->getRequestData('period_type') == 'Regular') { + $productItemInfo->setPaymentType(Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_REGULAR); + } + $productItemInfo->setTaxAmount($this->getRequestData('tax')); + $productItemInfo->setShippingAmount($this->getRequestData('shipping')); + $productItemInfo->setPrice($price); + + $order = $this->_recurringProfile->createOrder($productItemInfo); + + $payment = $order->getPayment(); + $payment->setTransactionId($this->getRequestData('txn_id')) + ->setPreparedMessage($this->_createIpnComment('')) + ->setIsTransactionClosed(0); + $order->save(); + $this->_recurringProfile->addOrderRelation($order->getId()); + $payment->registerCaptureNotification($this->getRequestData('mc_gross')); + $order->save(); + + // notify customer + if ($invoice = $payment->getCreatedInvoice()) { + $message = Mage::helper('paypal')->__('Notified customer about invoice #%s.', $invoice->getIncrementId()); + $comment = $order->sendNewOrderEmail()->addStatusHistoryComment($message) + ->setIsCustomerNotified(true) + ->save(); } } /** - * Process completed payment - * If an existing authorized invoice with specified txn_id exists - mark it as paid and save, - * otherwise create a completely authorized/captured invoice - * - * Everything after saving order is not critical, thus done outside the transaction. - * - * @throws Mage_Core_Exception + * Process completed payment (either full or partial) */ protected function _registerPaymentCapture() { - $order = $this->_getOrder(); - $payment = $order->getPayment(); - $payment->setTransactionId($this->getIpnFormData('txn_id')) - ->setPreparedMessage($this->_createIpnComment('', false)) - ->setParentTransactionId($this->getIpnFormData('parent_txn_id')) - ->setShouldCloseParentTransaction(self::AUTH_STATUS_COMPLETED === $this->getIpnFormData('auth_status')) + $this->_importPaymentInformation(); + $payment = $this->_order->getPayment(); + $payment->setTransactionId($this->getRequestData('txn_id')) + ->setPreparedMessage($this->_createIpnComment('')) + ->setParentTransactionId($this->getRequestData('parent_txn_id')) + ->setShouldCloseParentTransaction('Completed' === $this->getRequestData('auth_status')) ->setIsTransactionClosed(0) - ->registerCaptureNotification($this->getIpnFormData('mc_gross')); - $order->save(); + ->registerCaptureNotification($this->getRequestData('mc_gross')); + $this->_order->save(); // notify customer if ($invoice = $payment->getCreatedInvoice()) { - $comment = $order->sendNewOrderEmail()->addStatusHistoryComment( + $comment = $this->_order->sendNewOrderEmail()->addStatusHistoryComment( Mage::helper('paypal')->__('Notified customer about invoice #%s.', $invoice->getIncrementId()) ) ->setIsCustomerNotified(true) @@ -310,39 +390,52 @@ protected function _registerPaymentCapture() } } + /** + * Process denied payment notification + */ + protected function _registerPaymentDenial() + { + $this->_importPaymentInformation(); + $this->_order->getPayment() + ->setTransactionId($this->getRequestData('txn_id')) + ->setNotificationResult(true) + ->setIsTransactionClosed(true) + ->registerPaymentReviewAction(Mage_Sales_Model_Order_Payment::REVIEW_ACTION_DENY, false); + $this->_order->save(); + } + /** * Treat failed payment as order cancellation */ - protected function _registerPaymentFailure($explanationMessage = '') + protected function _registerPaymentFailure() { - $order = $this->_getOrder(); - $order->registerCancellation($this->_createIpnComment($explanationMessage, false), false) + $this->_importPaymentInformation(); + $this->_order + ->registerCancellation($this->_createIpnComment(''), false) ->save(); } /** - * - * + * Process a refund or a chargeback */ protected function _registerPaymentRefund() { - // refund issued by merchant, cannot be reversed in future. Unlike reversals - $isRefundFinal = (int)(self::STATUS_REVERSED !== $this->getIpnFormData('payment_status')); - - $order = $this->_getOrder(); - $payment = $order->getPayment() - ->setPreparedMessage($this->_explainRefundReason(false)) - ->setTransactionId($this->getIpnFormData('txn_id')) - ->setParentTransactionId($this->getIpnFormData('parent_txn_id')) + $this->_importPaymentInformation(); + $reason = $this->getRequestData('reason_code'); + $isRefundFinal = !$this->_info->isReversalDisputable($reason); + $payment = $this->_order->getPayment() + ->setPreparedMessage($this->_createIpnComment($this->_info->explainReasonCode($reason))) + ->setTransactionId($this->getRequestData('txn_id')) + ->setParentTransactionId($this->getRequestData('parent_txn_id')) ->setIsTransactionClosed($isRefundFinal) - ->registerRefundNotification(-1 * $this->getIpnFormData('mc_gross')); - $order->save(); + ->registerRefundNotification(-1 * $this->getRequestData('mc_gross')); + $this->_order->save(); // TODO: there is no way to close a capture right now if ($creditmemo = $payment->getCreatedCreditmemo()) { $creditmemo->sendEmail(); - $comment = $order->addStatusHistoryComment( + $comment = $this->_order->addStatusHistoryComment( Mage::helper('paypal')->__('Notified customer about creditmemo #%s.', $creditmemo->getIncrementId()) ) ->setIsCustomerNotified(true) @@ -351,168 +444,122 @@ protected function _registerPaymentRefund() } /** - * @see pending_reason at https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_admin_IPNReference + * Process payment reversal notification + */ + protected function _registerPaymentReversal() + { + /** + * PayPal may send such payment status when triggered IPR denial + * Note that this check is done on the old payment info object, before importing new payment information + */ + if ($this->_info->isPaymentReviewRequired($this->_order->getPayment())) { + $this->_registerPaymentDenial(); + return; + } + + if ('chargeback_reimbursement' == $this->getRequestData('reason_code')) { + // TODO: chargebacks reversals are not implemented + return; + } + + // treat as a usual charegeback + $this->_registerPaymentRefund(); + } + + /** + * Process payment pending notification + * + * @throws Exception */ public function _registerPaymentPending() { - $order = $this->_getOrder(); - $message = null; - switch ($this->getIpnFormData('pending_reason')) { - case 'address': // for some reason PayPal gives "address" reason, when Fraud Management Filter triggered - $message = Mage::helper('paypal')->__('Customer used non-confirmed address.'); - break; - case 'echeck': - $message = Mage::helper('paypal')->__('Waiting until Customer\'s eCheck will be cleared.'); - // possible requires processing on our side as well - break; - case 'intl': - $message = Mage::helper('paypal')->__('Merchant account doesn\'t have a withdrawal mechanism. Merchant must manually accept or deny this payment from your Account Overview.'); - break; - case 'multi-currency': - $message = Mage::helper('paypal')->__('Multi-currency issue. Merchant must manually accept or deny this payment from PayPal Account Overview.'); - break; - case 'order': - Mage::throwException('"Order" authorizations are not implemented. Please use "simple" authorization.'); - case 'authorization': - $this->_registerPaymentAuthorization(); - break; - case 'paymentreview': - $message = Mage::helper('paypal')->__('Payment is being reviewed by PayPal for risk.'); - break; - case 'unilateral': - $message = Mage::helper('paypal')->__('Payment was made to an email address that is not yet registered or confirmed.'); - break; - case 'upgrade': - $message = Mage::helper('paypal')->__('Merchant must upgrade account to Business or Premier status.'); - break; - case 'verify': - $message = Mage::helper('paypal')->__('Merchant account is not verified.'); - break; - case 'other': - $message = Mage::helper('paypal')->__('Please contact PayPal Customer Service.'); - break; + $reason = $this->getRequestData('pending_reason'); + if ('authorization' === $reason) { + $this->_registerPaymentAuthorization(); + return; + } + if ('order' === $reason) { + throw new Exception('The "order" authorizations are not implemented.'); } - if ($message) { - $history = $this->_createIpnComment($message); - $history->save(); + + // case when was placed using PayPal standard + if (Mage_Sales_Model_Order::STATE_PENDING_PAYMENT == $this->_order->getState()) { + $this->_registerPaymentCapture(); + return; } + + $this->_importPaymentInformation(); + + $this->_order->getPayment() + ->setPreparedMessage($this->_createIpnComment($this->_info->explainPendingReason($reason))) + ->setTransactionId($this->getRequestData('txn_id')) + ->setIsTransactionClosed(0) + ->registerPaymentReviewAction(Mage_Sales_Model_Order_Payment::REVIEW_ACTION_UPDATE, false); + $this->_order->save(); } /** - * Register authorization of a payment: create a non-paid invoice + * Register authorized payment */ protected function _registerPaymentAuthorization() { - // authorize payment - $order = $this->_getOrder(); - $payment = $order->getPayment() - ->setPreparedMessage($this->_createIpnComment('', false)) - ->setTransactionId($this->getIpnFormData('txn_id')) - ->setParentTransactionId($this->getIpnFormData('parent_txn_id')) - ->setIsTransactionClosed(0) - ->registerAuthorizationNotification($this->getIpnFormData('mc_gross')); + $this->_importPaymentInformation(); - $order->save(); + $this->_order->getPayment() + ->setPreparedMessage($this->_createIpnComment('')) + ->setTransactionId($this->getRequestData('txn_id')) + ->setParentTransactionId($this->getRequestData('parent_txn_id')) + ->setIsTransactionClosed(0) + ->registerAuthorizationNotification($this->getRequestData('mc_gross')); + $this->_order->save(); } /** - * Process transaction voiding. - * We just can void only authorized transaction - * Check if transaction authorized and not captured + * Process voided authorization */ - protected function _registerPaymentVoid($explanationMessage = '') + protected function _registerPaymentVoid() { - $order = $this->_getOrder(); + $this->_importPaymentInformation(); - $txnId = $this->getIpnFormData('txn_id'); // this is the authorization transaction ID - $order->getPayment() - ->setPreparedMessage($this->_createIpnComment($explanationMessage, false)) - ->setParentTransactionId($txnId) + $this->_order->getPayment() + ->setPreparedMessage($this->_createIpnComment('')) + ->setParentTransactionId($this->getRequestData('txn_id')) // this is the authorization transaction ID ->registerVoidNotification(); - $order->save(); + $this->_order->save(); } /** - * Generate a "PayPal Verified" comment with additional explanation. + * TODO + * The status "Processed" is used when all Masspayments are successful + */ + protected function _registerMasspaymentsSuccess() + { + $comment = $this->_createIpnComment('', true); + $comment->save(); + } + + /** + * Generate an "IPN" comment with additional explanation. * Returns the generated comment or order status history object * * @param string $comment * @param bool $addToHistory * @return string|Mage_Sales_Model_Order_Status_History */ - protected function _createIpnComment($comment = '', $addToHistory = true) + protected function _createIpnComment($comment = '', $addToHistory = false) { - $paymentStatus = $this->getIpnFormData('payment_status'); - $message = Mage::helper('paypal')->__('IPN verification "%s".', $paymentStatus); + $paymentStatus = $this->getRequestData('payment_status'); + $message = Mage::helper('paypal')->__('IPN "%s".', $paymentStatus); if ($comment) { $message .= ' ' . $comment; } if ($addToHistory) { - $message = $this->_getOrder()->addStatusHistoryComment($message); + $message = $this->_order->addStatusHistoryComment($message); $message->setIsCustomerNotified(null); } return $message; } - /** - * Notify Administrator about exceptional situation - * - * @param $message - * @param Exception $exception - */ - protected function _notifyAdmin($message, Exception $exception = null) - { - // prevent notification failure cause order procesing failure - try { - Mage::log($message); - if ($exception) { - Mage::logException($exception); - } - // @TODO: dump the message and IPN form data - } catch (Exception $e) { - Mage::logException($e); - } - } - - /** - * Generate a message basing on request reason_code - * Should be invoked only on refunds - * @see payment_status at https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_admin_IPNReference - * - * @return Mage_Sales_Model_Order_Status_History - */ - private function _explainRefundReason($addToHistory = true) - { - $message = Mage::helper('paypal')->__('unknown reason'); - switch ($this->getIpnFormData('reason_code')) { - case 'adjustment_reversal': - $message = Mage::helper('paypal')->__('reversal of an adjustment'); - break; - case 'buyer-complaint': - $message = Mage::helper('paypal')->__('customer complaint'); - break; - case 'chargeback': - $message = Mage::helper('paypal')->__('customer triggered a chargeback'); - break; - case 'chargeback_reimbursement': - $message = Mage::helper('paypal')->__('chargeback reimbursed'); - break; - case 'chargeback_settlement': - $message = Mage::helper('paypal')->__('chargeback settled'); - break; - case 'guarantee': - $message = Mage::helper('paypal')->__('customer triggered money-back guarantee'); - break; - case 'other': - $message = Mage::helper('paypal')->__('no reason'); - break; - case 'refund': - $message = Mage::helper('paypal')->__('merchant refunded payment'); - break; - } - return $this->_createIpnComment(Mage::helper('paypal')->__('Explanation: %s.', $message), $addToHistory); - } - /** * Map payment information from IPN to payment object * Returns true if there were changes in information @@ -520,10 +567,12 @@ private function _explainRefundReason($addToHistory = true) * @param Mage_Payment_Model_Info $payment * @return bool */ - protected function _importPaymentInformation(Mage_Payment_Model_Info $payment) + protected function _importPaymentInformation() { + $payment = $this->_order->getPayment(); $was = $payment->getAdditionalInformation(); + // collect basic information $from = array(); foreach (array( Mage_Paypal_Model_Info::PAYER_ID, @@ -531,26 +580,91 @@ protected function _importPaymentInformation(Mage_Payment_Model_Info $payment) Mage_Paypal_Model_Info::PAYER_STATUS, Mage_Paypal_Model_Info::ADDRESS_STATUS, Mage_Paypal_Model_Info::PROTECTION_EL, + Mage_Paypal_Model_Info::PAYMENT_STATUS, + Mage_Paypal_Model_Info::PENDING_REASON, ) as $privateKey => $publicKey) { if (is_int($privateKey)) { $privateKey = $publicKey; } - $value = $this->getIpnFormData($privateKey); + $value = $this->getRequestData($privateKey); if ($value) { $from[$publicKey] = $value; } } + if (isset($from['payment_status'])) { + $from['payment_status'] = $this->_filterPaymentStatus($this->getRequestData('payment_status')); + } // collect fraud filters $fraudFilters = array(); - for ($i = 1; $value = $this->getIpnFormData("fraud_management_pending_filters_{$i}"); $i++) { + for ($i = 1; $value = $this->getRequestData("fraud_management_pending_filters_{$i}"); $i++) { $fraudFilters[] = $value; } if ($fraudFilters) { $from[Mage_Paypal_Model_Info::FRAUD_FILTERS] = $fraudFilters; } - Mage::getSingleton('paypal/info')->importToPayment($from, $payment); + $this->_info->importToPayment($from, $payment); + + /** + * Detect pending payment, frauds + * TODO: implement logic in one place + * @see Mage_Paypal_Model_Pro::importPaymentInfo() + */ + if ($this->_info->isPaymentReviewRequired($payment)) { + $payment->setIsTransactionPending(true); + if ($fraudFilters) { + $payment->setIsFraudDetected(true); + } + } + if ($this->_info->isPaymentSuccessful($payment)) { + $payment->setIsTransactionApproved(true); + } elseif ($this->_info->isPaymentFailed($payment)) { + $payment->setIsTransactionDenied(true); + } + return $was != $payment->getAdditionalInformation(); } + + /** + * Filter payment status from NVP into paypal/info format + * + * @param string $ipnPaymentStatus + * @return string + */ + protected function _filterPaymentStatus($ipnPaymentStatus) + { + switch ($ipnPaymentStatus) { + case 'Created': // break is intentionally omitted + case 'Completed': return Mage_Paypal_Model_Info::PAYMENTSTATUS_COMPLETED; + case 'Denied': return Mage_Paypal_Model_Info::PAYMENTSTATUS_DENIED; + case 'Expired': return Mage_Paypal_Model_Info::PAYMENTSTATUS_EXPIRED; + case 'Failed': return Mage_Paypal_Model_Info::PAYMENTSTATUS_FAILED; + case 'Pending': return Mage_Paypal_Model_Info::PAYMENTSTATUS_PENDING; + case 'Refunded': return Mage_Paypal_Model_Info::PAYMENTSTATUS_REFUNDED; + case 'Reversed': return Mage_Paypal_Model_Info::PAYMENTSTATUS_REVERSED; + case 'Canceled_Reversal': return Mage_Paypal_Model_Info::PAYMENTSTATUS_UNREVERSED; + case 'Processed': return Mage_Paypal_Model_Info::PAYMENTSTATUS_PROCESSED; + case 'Voided': return Mage_Paypal_Model_Info::PAYMENTSTATUS_VOIDED; + } + return ''; +// documented in NVP, but not documented in IPN: +//Mage_Paypal_Model_Info::PAYMENTSTATUS_NONE +//Mage_Paypal_Model_Info::PAYMENTSTATUS_INPROGRESS +//Mage_Paypal_Model_Info::PAYMENTSTATUS_REFUNDEDPART + } + + /** + * Log debug data to file + * + * @param mixed $debugData + */ + protected function _debug() + { + if ($this->_config->debug) { + $file = $this->_config->getMethodCode() ? "payment_{$this->_config->getMethodCode()}.log" + : self::DEFAULT_LOG_FILE; + Mage::getModel('core/log_adapter', $file)->log($this->_debugData); + } + } } diff --git a/app/code/core/Mage/Paypal/Model/Method/Agreement.php b/app/code/core/Mage/Paypal/Model/Method/Agreement.php new file mode 100644 index 0000000000..bddeb2f080 --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/Method/Agreement.php @@ -0,0 +1,347 @@ + + */ +class Mage_Paypal_Model_Method_Agreement extends Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract + implements Mage_Payment_Model_Billing_Agreement_MethodInterface +{ + /** + * Method code + * + * @var string + */ + protected $_code = Mage_Paypal_Model_Config::METHOD_BILLING_AGREEMENT; + + /** + * Method instance settings + * + */ + protected $_canAuthorize = true; + protected $_canCapture = true; + protected $_canCapturePartial = true; + protected $_canRefund = true; + protected $_canRefundInvoicePartial = true; + protected $_canVoid = true; + protected $_canUseCheckout = false; + protected $_canFetchTransactionInfo = true; + protected $_canReviewPayment = true; + + /** + * Website Payments Pro instance + * + * @var Mage_Paypal_Model_Pro + */ + protected $_pro = null; + + /** + * Initialize Mage_Paypal_Model_Pro model + * + * @param array $params + */ + public function __construct($params = array()) + { + $proInstance = array_shift($params); + if ($proInstance && ($proInstance instanceof Mage_Paypal_Model_Pro)) { + $this->_pro = $proInstance; + } else { + $this->_pro = Mage::getModel('paypal/pro'); + } + $this->_pro->setMethod($this->_code); + } + + /** + * Store setter + * Also updates store ID in config object + * + * @param Mage_Core_Model_Store|int $store + */ + public function setStore($store) + { + $this->setData('store', $store); + if (null === $store) { + $store = Mage::app()->getStore()->getId(); + } + $this->_pro->getConfig()->setStoreId(is_object($store) ? $store->getId() : $store); + return $this; + } + + /** + * Init billing agreement + * + * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement + * @return Mage_Paypal_Model_Method_Agreement + */ + public function initBillingAgreementToken(Mage_Payment_Model_Billing_AgreementAbstract $agreement) + { + $api = $this->_pro->getApi() + ->setReturnUrl($agreement->getReturnUrl()) + ->setCancelUrl($agreement->getCancelUrl()) + ->setBillingType($this->_pro->getApi()->getBillingAgreementType()); + + $api->callSetCustomerBillingAgreement(); + $agreement->setRedirectUrl( + $this->_pro->getConfig()->getStartBillingAgreementUrl($api->getToken()) + ); + return $this; + } + + /** + * Retrieve billing agreement customer details by token + * + * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement + * @return array + */ + public function getBillingAgreementTokenInfo(Mage_Payment_Model_Billing_AgreementAbstract $agreement) + { + $api = $this->_pro->getApi() + ->setToken($agreement->getToken()); + $api->callGetBillingAgreementCustomerDetails(); + $responseData = array( + 'token' => $api->getData('token'), + 'email' => $api->getData('email'), + 'payer_id' => $api->getData('payer_id'), + 'payer_status' => $api->getData('payer_status') + ); + $agreement->addData($responseData); + return $responseData; + } + + /** + * Create billing agreement by token specified in request + * + * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement + * @return Mage_Paypal_Model_Method_Agreement + */ + public function placeBillingAgreement(Mage_Payment_Model_Billing_AgreementAbstract $agreement) + { + $api = $this->_pro->getApi() + ->setToken($agreement->getToken()); + $api->callCreateBillingAgreement(); + $agreement->setBillingAgreementId($api->getData('billing_agreement_id')); + return $this; + } + + /** + * Update billing agreement status + * + * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement + * @return Mage_Paypal_Model_Method_Agreement + */ + public function updateBillingAgreementStatus(Mage_Payment_Model_Billing_AgreementAbstract $agreement) + { + $targetStatus = $agreement->getStatus(); + $api = $this->_pro->getApi() + ->setReferenceId($agreement->getReferenceId()) + ->setBillingAgreementStatus($targetStatus); + try { + $api->callUpdateBillingAgreement(); + } catch (Mage_Core_Exception $e) { + // when BA was already canceled, just pretend that the operation succeeded + if (!(Mage_Sales_Model_Billing_Agreement::STATUS_CANCELED == $targetStatus + && $api->getIsBillingAgreementAlreadyCancelled())) { + throw $e; + } + } + return $this; + } + + /** + * Authorize payment + * + * @param Varien_Object $payment + * @param float $amount + * @return Mage_Paypal_Model_Method_Agreement + */ + public function authorize(Varien_Object $payment, $amount) + { + return $this->_placeOrder($payment, $amount); + } + + /** + * Void payment + * + * @param Mage_Sales_Model_Order_Payment $payment + * @return Mage_Paypal_Model_Method_Agreement + */ + public function void(Varien_Object $payment) + { + $this->_pro->void($payment); + return $this; + } + + /** + * Capture payment + * + * @param Mage_Sales_Model_Order_Payment $payment + * @param float $amount + * @return Mage_Paypal_Model_Method_Agreement + */ + public function capture(Varien_Object $payment, $amount) + { + if (false === $this->_pro->capture($payment, $amount)) { + $this->_placeOrder($payment, $amount); + } + return $this; + } + + /** + * Refund capture + * + * @param Mage_Sales_Model_Order_Payment $payment + * @param float $amount + * @return Mage_Paypal_Model_Method_Agreement + */ + public function refund(Varien_Object $payment, $amount) + { + $this->_pro->refund($payment, $amount); + return $this; + } + + /** + * Cancel payment + * + * @param Mage_Sales_Model_Order_Payment $payment + * @return Mage_Paypal_Model_Method_Agreement + */ + public function cancel(Varien_Object $payment) + { + $this->_pro->cancel($payment); + return $this; + } + + /** + * Whether payment can be reviewed + * + * @param Mage_Sales_Model_Order_Payment $payment + * @return bool + */ + public function canReviewPayment(Mage_Payment_Model_Info $payment) + { + return parent::canReviewPayment($payment) && $this->_pro->canReviewPayment($payment); + } + + /** + * Attempt to accept a pending payment + * + * @param Mage_Sales_Model_Order_Payment $payment + * @return bool + */ + public function acceptPayment(Mage_Payment_Model_Info $payment) + { + parent::acceptPayment($payment); + return $this->_pro->reviewPayment($payment, Mage_Paypal_Model_Pro::PAYMENT_REVIEW_ACCEPT); + } + + /** + * Attempt to deny a pending payment + * + * @param Mage_Sales_Model_Order_Payment $payment + * @return bool + */ + public function denyPayment(Mage_Payment_Model_Info $payment) + { + parent::denyPayment($payment); + return $this->_pro->reviewPayment($payment, Mage_Paypal_Model_Pro::PAYMENT_REVIEW_DENY); + } + + /** + * Fetch transaction details info + * + * @param Mage_Payment_Model_Info $payment + * @param string $transactionId + * @return array + */ + public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId) + { + return $this->_pro->fetchTransactionInfo($payment, $transactionId); + } + + /** + * Place an order with authorization or capture action + * + * @param Mage_Sales_Model_Order_Payment $payment + * @param float $amount + * @return Mage_Paypal_Model_Method_Agreement + */ + protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount) + { + $order = $payment->getOrder(); + $billingAgreement = Mage::getModel('sales/billing_agreement')->load( + $payment->getAdditionalInformation(Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract::TRANSPORT_BILLING_AGREEMENT_ID) + ); + + $api = $this->_pro->getApi() + ->setReferenceId($billingAgreement->getReferenceId()) + ->setPaymentAction($this->_pro->getConfig()->paymentAction) + ->setAmount($amount) + ->setNotifyUrl(Mage::getUrl('paypal/ipn/')); + + // add line items + if ($this->_pro->getConfig()->lineItemsEnabled) { + list($items, $totals) = Mage::helper('paypal')->prepareLineItems($order); + if (Mage::helper('paypal')->areCartLineItemsValid($items, $totals, $amount)) { + $api->setLineItems($items)->setLineItemTotals($totals); + } + } + + // call api and import transaction and other payment information + $api->callDoReferenceTransaction(); + $this->_pro->importPaymentInfo($api, $payment); + $api->callGetTransactionDetails(); + $this->_pro->importPaymentInfo($api, $payment); + + $payment->setTransactionId($api->getTransactionId()) + ->setIsTransactionClosed(0); + + if ($api->getBillingAgreementId()) { + $billingAgreement->addOrderRelation($order->getId()); + } + + return $this; + } + + + protected function _isAvailable($quote) + { + return $this->_pro->getConfig()->isMethodAvailable($this->_code); + } + + /** + * Payment action getter compatible with payment model + * + * @see Mage_Sales_Model_Payment::place() + * @return string + */ + public function getConfigPaymentAction() + { + return $this->_pro->getConfig()->getPaymentAction(); + } + +} diff --git a/app/code/core/Mage/Paypal/Model/Mysql4/Report/Settlement.php b/app/code/core/Mage/Paypal/Model/Mysql4/Report/Settlement.php new file mode 100644 index 0000000000..03f71e0f5c --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/Mysql4/Report/Settlement.php @@ -0,0 +1,93 @@ +_init('paypal/settlement_report', 'report_id'); + $this->_rowsTable = Mage::getSingleton('core/resource')->getTableName('paypal/settlement_report_row'); + } + + /** + * Save report rows collected in settlement model + * + * @param Mage_Paypal_Model_Report_Settlement $object + * @return Mage_Paypal_Model_Mysql4_Report_Settlement + */ + protected function _afterSave(Mage_Core_Model_Abstract $object) + { + $rows = $object->getRows(); + if (is_array($rows)){ + try { + $this->_getWriteAdapter()->beginTransaction(); + if ($object->getId()) { + $this->_getWriteAdapter()->query(sprintf('DELETE FROM %s WHERE report_id = :report', $this->_rowsTable), array('report' => $object->getId())); + } + foreach ($rows as $key => $row) { + $rows[$key]['report_id'] = $object->getId(); + } + $this->_getWriteAdapter()->insertMultiple($this->_rowsTable, $rows); + $this->_getWriteAdapter()->commit(); + } + catch (Exception $e) { + $this->_getWriteAdapter()->rollback(); + } + } + return $this; + } + + /** + * Check if report with same account and report date already fetched + * + * @param Mage_Paypal_Model_Report_Settlement $report + * @param string $accountId + * @param string $reportDate + * @return bool + */ + public function loadByAccountAndDate(Mage_Paypal_Model_Report_Settlement $report, $accountId, $reportDate) + { + $select = $this->_getReadAdapter()->select() + ->from($this->getMainTable()) + ->where('account_id=?', $accountId) + ->where('report_date=?', $reportDate); + if ($data = $this->_getReadAdapter()->fetchRow($select)) { + $report->addData($data); + } + return $this; + } +} diff --git a/app/code/core/Mage/Paypal/Model/Api/Debug.php b/app/code/core/Mage/Paypal/Model/Mysql4/Report/Settlement/Row.php similarity index 77% rename from app/code/core/Mage/Paypal/Model/Api/Debug.php rename to app/code/core/Mage/Paypal/Model/Mysql4/Report/Settlement/Row.php index 4d07e08da6..bc1be215b1 100644 --- a/app/code/core/Mage/Paypal/Model/Api/Debug.php +++ b/app/code/core/Mage/Paypal/Model/Mysql4/Report/Settlement/Row.php @@ -20,17 +20,17 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** - * Paypal Debug model +/* + * Resource for report rows */ -class Mage_Paypal_Model_Api_Debug extends Mage_Core_Model_Abstract +class Mage_Paypal_Model_Mysql4_Report_Settlement_Row extends Mage_Core_Model_Mysql4_Abstract { protected function _construct() { - $this->_init('paypal/api_debug'); + $this->_init('paypal/settlement_report_row', 'row_id'); } } diff --git a/app/code/core/Mage/Paypal/Model/Mysql4/Report/Settlement/Row/Collection.php b/app/code/core/Mage/Paypal/Model/Mysql4/Report/Settlement/Row/Collection.php new file mode 100644 index 0000000000..772f55d898 --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/Mysql4/Report/Settlement/Row/Collection.php @@ -0,0 +1,68 @@ +_init('paypal/report_settlement_row'); + } + + /** + * Join reports info table + */ + protected function _initSelect() + { + parent::_initSelect(); + $this->getSelect() + ->join( + array('report' => $this->getTable('paypal/settlement_report')), + 'report.report_id = main_table.report_id', + array('report.account_id', 'report.report_date') + ); + return $this; + } + + /** + * Filter items collection by account ID + * + * @param string $accountID The account hash as returned by paypal + * @return Mage_Paypal_Model_Mysql4_Report_Settlement_Row_Collection + */ + public function addAccountFilter($accountId) + { + $this->getSelect()->where('report.account_id = ?', $accountId); + return $this; + } +} diff --git a/app/code/core/Mage/Paypal/Model/Mysql4/Setup.php b/app/code/core/Mage/Paypal/Model/Mysql4/Setup.php index 2922a68dc6..b8d3e9a29a 100644 --- a/app/code/core/Mage/Paypal/Model/Mysql4/Setup.php +++ b/app/code/core/Mage/Paypal/Model/Mysql4/Setup.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Paypal/Model/Observer.php b/app/code/core/Mage/Paypal/Model/Observer.php new file mode 100644 index 0000000000..f0c7f0cd71 --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/Observer.php @@ -0,0 +1,56 @@ + + */ + +class Mage_Paypal_Model_Observer +{ + /** + * Goes to reports.paypal.com and fetches Settlement reports. + * @return Mage_Paypal_Model_Observer + */ + public function fetchReports() + { + try { + $reports = Mage::getModel('paypal/report_settlement'); + /* @var $reports Mage_Paypal_Model_Report_Settlement */ + $credentials = $reports->getSftpCredentials(true); + foreach ($credentials as $config) { + try { + $reports->fetchAndSave($config); + } catch (Exception $e) { + Mage::logException($e); + } + } + } catch (Exception $e) { + Mage::logException($e); + } + } +} diff --git a/app/code/core/Mage/Paygate/Model/Payflow/Pro.php b/app/code/core/Mage/Paypal/Model/Payflowpro.php similarity index 76% rename from app/code/core/Mage/Paygate/Model/Payflow/Pro.php rename to app/code/core/Mage/Paypal/Model/Payflowpro.php index 1950219049..e50a0c747a 100644 --- a/app/code/core/Mage/Paygate/Model/Payflow/Pro.php +++ b/app/code/core/Mage/Paypal/Model/Payflowpro.php @@ -19,8 +19,8 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Mage - * @package Mage_Paygate - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @package Mage_Paypal + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,11 +28,11 @@ * Payflow Pro payment gateway model * * @category Mage - * @package Mage_Paygate + * @package Mage_Paypal * @author Magento Core Team */ -class Mage_Paygate_Model_Payflow_Pro extends Mage_Payment_Model_Method_Cc +class Mage_Paypal_Model_Payflowpro extends Mage_Payment_Model_Method_Cc { const TRXTYPE_AUTH_ONLY = 'A'; const TRXTYPE_SALE = 'S'; @@ -51,6 +51,9 @@ class Mage_Paygate_Model_Payflow_Pro extends Mage_Payment_Model_Method_Cc const RESPONSE_DELIM_CHAR = ','; + const TRANSACTION_URL = 'https://payflowpro.paypal.com/transaction'; + const TRANSACTION_URL_TEST_MODE = 'https://pilot-payflowpro.paypal.com/transaction'; + protected $_clientTimeout = 45; const RESPONSE_CODE_APPROVED = 0; @@ -58,7 +61,7 @@ class Mage_Paygate_Model_Payflow_Pro extends Mage_Payment_Model_Method_Cc const RESPONSE_CODE_DECLINED = 12; const RESPONSE_CODE_CAPTURE_ERROR = 111; - protected $_code = 'verisign'; + protected $_code = Mage_Paypal_Model_Config::METHOD_PAYFLOWPRO; /** * Availability options @@ -103,6 +106,73 @@ class Mage_Paygate_Model_Payflow_Pro extends Mage_Payment_Model_Method_Cc 'centinel_xid' => 'XID', ); + /** + * Check whether payment method can be used + * @param Mage_Sales_Model_Quote + * @return bool + */ + public function isAvailable($quote = null) + { + $storeId = Mage::app()->getStore($this->getStore())->getId(); + $config = Mage::getModel('paypal/config')->setStoreId($storeId); + if ($config->isMethodAvailable($this->getCode()) && parent::isAvailable($quote)) { + return true; + } + return false; + } + + /** + * Custom getter for payment configuration + * + * @param string $field + * @param int $storeId + * @return mixed + */ + public function getConfigData($field, $storeId = null) + { + $value = null; + switch ($field) + { + case 'url': + $value = $this->getTransactionUrl(); + break; + default: + $value = parent::getConfigData($field, $storeId); + } + return $value; + } + + /** + * Getter for URL to perform Payflow requests, based on test mode by default + * + * @param bool $testMode Ability to specify test mode using + * @return string + */ + public function getTransactionUrl($testMode = null) + { + $testMode = is_null($testMode) ? $this->getConfigData('sandbox_flag') : (bool)$testMode; + if ($testMode) { + return self::TRANSACTION_URL_TEST_MODE; + } + return self::TRANSACTION_URL; + } + + /** + * Payment action getter compatible with payment model + * + * @see Mage_Sales_Model_Payment::place() + * @return string + */ + public function getConfigPaymentAction() + { + switch ($this->getConfigData('payment_action')) { + case Mage_Paypal_Model_Config::PAYMENT_ACTION_AUTH: + return Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE; + case Mage_Paypal_Model_Config::PAYMENT_ACTION_SALE: + return Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE; + } + } + public function authorize(Varien_Object $payment, $amount) { $error = false; @@ -123,7 +193,6 @@ public function authorize(Varien_Object $payment, $amount) case self::RESPONSE_CODE_FRAUDSERVICE_FILTER: $payment->setIsTransactionPending(true); - $payment->getTransactionPendingStatus($this->getConfigData('fraud_order_status')); break; default: @@ -131,12 +200,12 @@ public function authorize(Varien_Object $payment, $amount) $error = $result->getRespmsg(); } else { - $error = Mage::helper('paygate')->__('Error in authorizing the payment'); + $error = Mage::helper('paypal')->__('Error in authorizing the payment.'); } break; } }else{ - $error = Mage::helper('paygate')->__('Invalid amount for authorization'); + $error = Mage::helper('paypal')->__('Invalid amount for authorization.'); } if ($error !== false) { @@ -176,14 +245,13 @@ public function capture(Varien_Object $payment, $amount) case self::RESPONSE_CODE_FRAUDSERVICE_FILTER: $payment->setIsTransactionPending(true); - $payment->getTransactionPendingStatus($this->getConfigData('fraud_order_status')); break; default: if ($result->getRespmsg()) { $error = $result->getRespmsg(); } else { - $error = Mage::helper('paygate')->__('Error in capturing the payment'); + $error = Mage::helper('paypal')->__('Error in capturing the payment.'); } break; } @@ -212,7 +280,7 @@ public function canVoid(Varien_Object $payment) if($result->getResultCode()==self::RESPONSE_CODE_APPROVED){ if($result->getTransstate()>1000){ $payment->setStatus(self::STATUS_ERROR); - $payment->setStatusDescription(Mage::helper('paygate')->__('Voided transaction')); + $payment->setStatusDescription(Mage::helper('paypal')->__('Voided transaction.')); }elseif(in_array($result->getTransstate(),$this->_validVoidTransState)){ $payment->setStatus(self::STATUS_VOID); } @@ -220,11 +288,11 @@ public function canVoid(Varien_Object $payment) $payment->setStatus(self::STATUS_ERROR); $payment->setStatusDescription($result->getRespmsg()? $result->getRespmsg(): - Mage::helper('paygate')->__('Error in retrieving the transaction')); + Mage::helper('paypal')->__('Error in retrieving the transaction.')); } }else{ $payment->setStatus(self::STATUS_ERROR); - $payment->setStatusDescription(Mage::helper('paygate')->__('Invalid transaction id')); + $payment->setStatusDescription(Mage::helper('paypal')->__('Invalid transaction ID.')); } return $this; @@ -256,7 +324,7 @@ public function void(Varien_Object $payment) } }else{ $payment->setStatus(self::STATUS_ERROR); - $error = Mage::helper('paygate')->__('Invalid transaction id'); + $error = Mage::helper('paypal')->__('Invalid transaction ID.'); } if ($error !== false) { @@ -293,11 +361,11 @@ public function refund(Varien_Object $payment, $amount) }else{ $error = ($result->getRespmsg()? $result->getRespmsg(): - Mage::helper('paygate')->__('Error in refunding the payment.')); + Mage::helper('paypal')->__('Error in refunding the payment.')); } }else{ - $error = Mage::helper('paygate')->__('Error in refunding the payment'); + $error = Mage::helper('paypal')->__('Error in refunding the payment.'); } if ($error !== false) { @@ -309,31 +377,10 @@ public function refund(Varien_Object $payment, $amount) protected function _postRequest(Varien_Object $request) { - if ($this->getConfigData('debug')) { - $requestDebug = clone $request; - - - foreach ($this->_debugReplacePrivateDataKeys as $key) { - if ($requestDebug->hasData($key)) { - $requestDebug->setData($key, '***'); - } - } - - foreach( $requestDebug->getData() as $key => $value ) { - $value = (string)$value; - $requestData[] = strtoupper($key) . '[' . strlen($value) . ']=' . $value; - } - - $requestData = join('&', $requestData); - - $debug = Mage::getModel('paygate/authorizenet_debug') - ->setRequestBody($requestData) - ->setRequestSerialized(serialize($requestDebug->getData())) - ->setRequestDump(print_r($requestDebug->getData(),1)) - ->save(); - } + $debugData = array('request' => $request->getData()); $client = new Varien_Http_Client(); + $result = $this->_getResultObject(); $_config = array( 'maxredirects'=>5, @@ -354,17 +401,26 @@ protected function _postRequest(Varien_Object $request) ->setParameterPost($request->getData()) ->setHeaders('X-VPS-VIT-CLIENT-CERTIFICATION-ID: 33baf5893fc2123d8b191d2d011b7fdc') ->setHeaders('X-VPS-Request-ID: ' . $request->getRequestId()) - ->setHeaders('X-VPS-CLIENT-TIMEOUT: ' . $this->_clientTimeout) - ; + ->setHeaders('X-VPS-CLIENT-TIMEOUT: ' . $this->_clientTimeout); + + try { + /** + * we are sending request to payflow pro without url encoding + * so we set up _urlEncodeBody flag to false + */ + $response = $client->setUrlEncodeBody(false)->request(); + } + catch (Exception $e) { + $result->setResponseCode(-1) + ->setResponseReasonCode($e->getCode()) + ->setResponseReasonText($e->getMessage()); + + $debugData['result'] = $result->getData(); + $this->_debug($debugData); + throw $e; + } - /* - * we are sending request to payflow pro without url encoding - * so we set up _urlEncodeBody flag to false - */ - $response = $client->setUrlEncodeBody(false) - ->request(); - $result = Mage::getModel('paygate/payflow_pro_result'); $response = strstr($response->getBody(), 'RESULT'); $valArray = explode('&', $response); @@ -377,13 +433,8 @@ protected function _postRequest(Varien_Object $request) $result->setResultCode($result->getResult()) ->setRespmsg($result->getRespmsg()); - if (!empty($debug)) { - $debug - ->setResponseBody($response) - ->setResultSerialized(serialize($result->getData())) - ->setResultDump(print_r($result->getData(),1)) - ->save(); - } + $debugData['result'] = $result->getData(); + $this->_debug($debugData); return $result; } @@ -398,7 +449,7 @@ protected function _buildRequest(Varien_Object $payment) $payment->setTender(self::TENDER_CC); } - $request = Mage::getModel('paygate/payflow_pro_request') + $request = $this->_getRequestObject() ->setUser($this->getConfigData('user')) ->setVendor($this->getConfigData('vendor')) ->setPartner($this->getConfigData('partner')) @@ -406,8 +457,7 @@ protected function _buildRequest(Varien_Object $payment) ->setTender($payment->getTender()) ->setTrxtype($payment->getTrxtype()) ->setVerbosity($this->getConfigData('verbosity')) - ->setRequestId($this->_generateRequestId()) - ; + ->setRequestId($this->_generateRequestId()); if ($this->getIsCentinelValidationEnabled()){ $params = array(); @@ -476,7 +526,7 @@ protected function _buildBasicRequest(Varien_Object $payment) $payment->setTender(self::TENDER_CC); } - $request = Mage::getModel('paygate/payflow_pro_request') + $request = $this->_getRequestObject() ->setUser($this->getConfigData('user')) ->setVendor($this->getConfigData('vendor')) ->setPartner($this->getConfigData('partner')) @@ -488,4 +538,26 @@ protected function _buildBasicRequest(Varien_Object $payment) ->setOrigid($payment->getTransactionId()); return $request; } + + /** + * Return generic object instance for API requests + * + * @return Varien_Object + */ + protected function _getRequestObject() + { + $request = new Varien_Object(); + return $request; + } + + /** + * Return wrapper object instance for API response results + * + * @return Varien_Object + */ + protected function _getResultObject() + { + $result = new Varien_Object(); + return $result; + } } diff --git a/app/code/core/Mage/Paypal/Model/Pro.php b/app/code/core/Mage/Paypal/Model/Pro.php index f13f6d66c5..0f96c0b179 100644 --- a/app/code/core/Mage/Paypal/Model/Pro.php +++ b/app/code/core/Mage/Paypal/Model/Pro.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -30,6 +30,14 @@ */ class Mage_Paypal_Model_Pro { + /** + * Possible payment review actions (for FMF only) + * + * @var string + */ + const PAYMENT_REVIEW_ACCEPT = 'accept'; + const PAYMENT_REVIEW_DENY = 'deny'; + /** * Config instance * @@ -44,6 +52,13 @@ class Mage_Paypal_Model_Pro */ protected $_api = null; + /** + * PayPal info object + * + * @var Mage_Paypal_Model_Info + */ + protected $_infoInstance = null; + /** * API model type * @@ -71,7 +86,7 @@ public function setMethod($code, $storeId = null) if (null !== $storeId) { $params[] = $storeId; } - $this->_config = $this->_config = Mage::getModel($this->_configType, $params); + $this->_config = Mage::getModel($this->_configType, $params); } else { $this->_config->setMethod($code); if (null !== $storeId) { @@ -121,6 +136,52 @@ public function getApi() return $this->_api; } + /** + * Instantiate and return info model + * + * @return Mage_Paypal_Model_Info + */ + public function getInfo() + { + if (null === $this->_infoInstance) { + $this->_infoInstance = Mage::getModel('paypal/info'); + } + return $this->_infoInstance; + } + + /** + * Transfer transaction/payment information from API instance to order payment + * + * @param Mage_Paypal_Model_Api_Abstract $from + * @param Mage_Payment_Model_Info $to + * @return Mage_Paypal_Model_Pro + */ + public function importPaymentInfo(Varien_Object $from, Mage_Payment_Model_Info $to) + { + // update PayPal-specific payment information in the payment object + $this->getInfo()->importToPayment($from, $to); + + /** + * Detect payment review and/or frauds + * PayPal pro API returns fraud results only in the payment call response + */ + if ($from->getDataUsingMethod(Mage_Paypal_Model_Info::IS_FRAUD)) { + $to->setIsTransactionPending(true); + $to->setIsFraudDetected(true); + } elseif ($this->getInfo()->isPaymentReviewRequired($to)) { + $to->setIsTransactionPending(true); + } + + // give generic info about transaction state + if ($this->getInfo()->isPaymentSuccessful($to)) { + $to->setIsTransactionApproved(true); + } elseif ($this->getInfo()->isPaymentFailed($to)) { + $to->setIsTransactionDenied(true); + } + + return $this; + } + /** * Void transaction * @@ -131,7 +192,7 @@ public function void(Varien_Object $payment) if ($authTransactionId = $this->_getParentTransactionId($payment)) { $api = $this->getApi(); $api->setPayment($payment)->setAuthorizationId($authTransactionId)->callDoVoid(); - Mage::getModel('paypal/info')->importToPayment($api, $payment); + $this->importPaymentInfo($api, $payment); } else { Mage::throwException(Mage::helper('paypal')->__('Authorization transaction is required to void.')); } @@ -151,15 +212,6 @@ public function capture(Varien_Object $payment, $amount) if (!$authTransactionId) { return false; } - /** - * check transaction status before capture - */ - $api = $this->getApi() - ->setTransactionId($authTransactionId); - if (!$this->_isCaptureNeeded()) { - return; - } - $api = $this->getApi() ->setAuthorizationId($authTransactionId) ->setIsCaptureComplete($payment->getShouldCloseParentTransaction()) @@ -173,8 +225,6 @@ public function capture(Varien_Object $payment, $amount) $this->_importCaptureResultToPayment($api, $payment); } - - /** * Refund a capture transaction * @@ -201,7 +251,7 @@ public function refund(Varien_Object $payment, $amount) $api->callRefundTransaction(); $this->_importRefundResultToPayment($api, $payment, $canRefundMore); } else { - Mage::throwException(Mage::helper('paypal')->__('Impossible to issue a refund transaction, because capture transaction does not exist.')); + Mage::throwException(Mage::helper('paypal')->__('Impossible to issue a refund transaction because the capture transaction does not exist.')); } } @@ -217,6 +267,160 @@ public function cancel(Varien_Object $payment) } } + /** + * + * @param Mage_Sales_Model_Order_Payment $payment + * @return bool + */ + public function canReviewPayment(Mage_Payment_Model_Info $payment) + { + return Mage_Paypal_Model_Info::isFraudReviewAllowed($payment); + } + + /** + * Perform the payment review + * + * @param Mage_Payment_Model_Info $payment + * @param string $action + * @return bool + */ + public function reviewPayment(Mage_Payment_Model_Info $payment, $action) + { + $api = $this->getApi()->setTransactionId($payment->getLastTransId()); + + // check whether the review is still needed + $api->callGetTransactionDetails(); + $this->importPaymentInfo($api, $payment); + if (!$this->getInfo()->isPaymentReviewRequired($payment)) { + return false; + } + + // perform the review action + $api->setAction($action)->callManagePendingTransactionStatus(); + $api->callGetTransactionDetails(); + $this->importPaymentInfo($api, $payment); + return true; + } + + /** + * Fetch transaction details info + * + * @param Mage_Payment_Model_Info $payment + * @param string $transactionId + * @return array + */ + public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId) + { + $api = $this->getApi() + ->setTransactionId($transactionId) + ->setRawResponseNeeded(true); + $api->callGetTransactionDetails(); + $this->importPaymentInfo($api, $payment); + $data = $api->getRawSuccessResponseData(); + return ($data) ? $data : array(); + } + + /** + * Validate RP data + * + * @param Mage_Payment_Model_Recurring_Profile $profile + * @throws Mage_Core_Exception + */ + public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile) + { + $errors = array(); + if (strlen($profile->getSubscriberName()) > 32) { // up to 32 single-byte chars + $errors[] = Mage::helper('paypal')->__('Subscriber name is too long.'); + } + $refId = $profile->getInternalReferenceId(); // up to 127 single-byte alphanumeric + if (strlen($refId) > 127) { // || !preg_match('/^[a-z\d\s]+$/i', $refId) + $errors[] = Mage::helper('paypal')->__('Merchant reference ID format is not supported.'); + } + $scheduleDescr = $profile->getScheduleDescription(); // up to 127 single-byte alphanumeric + if (strlen($refId) > 127) { // || !preg_match('/^[a-z\d\s]+$/i', $scheduleDescr) + $errors[] = Mage::helper('paypal')->__('Schedule description is too long.'); + } + if ($errors) { + Mage::throwException(implode(' ', $errors)); + } + } + + /** + * Submit RP to the gateway + * + * @param Mage_Payment_Model_Recurring_Profile $profile + * @param Mage_Payment_Model_Info $paymentInfo + * @throws Mage_Core_Exception + */ + public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, Mage_Payment_Model_Info $paymentInfo) + { + $api = $this->getApi(); + Varien_Object_Mapper::accumulateByMap($profile, $api, array( + 'token', // EC fields + // TODO: DP fields + // profile fields + 'subscriber_name', 'start_datetime', 'internal_reference_id', 'schedule_description', + 'suspension_threshold', 'bill_failed_later', 'period_unit', 'period_frequency', 'period_max_cycles', + 'billing_amount' => 'amount', 'trial_period_unit', 'trial_period_frequency', 'trial_period_max_cycles', + 'trial_billing_amount', 'currency_code', 'shipping_amount', 'tax_amount', 'init_amount', 'init_may_fail', + )); + $api->callCreateRecurringPaymentsProfile(); + $profile->setReferenceId($api->getRecurringProfileId()); + if ($api->getIsProfileActive()) { + $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE); + } elseif ($api->getIsProfilePending()) { + $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_PENDING); + } + } + + /** + * Fetch RP details + * + * @param string $referenceId + * @param Varien_Object $result + */ + public function getRecurringProfileDetails($referenceId, Varien_Object $result) + { + $api = $this->getApi(); + $api->setRecurringProfileId($referenceId) + ->callGetRecurringPaymentsProfileDetails($result) + ; + } + + /** + * Update RP data + * + * @param Mage_Payment_Model_Recurring_Profile $profile + */ + public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile) + { + $api = $this->getApi(); + $action = null; + switch ($profile->getNewState()) { + case Mage_Sales_Model_Recurring_Profile::STATE_CANCELED: $action = 'cancel'; break; + case Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED: $action = 'suspend'; break; + case Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE: $action = 'activate'; break; + } + $state = $profile->getState(); + $api->setRecurringProfileId($profile->getReferenceId()) + ->setIsAlreadyCanceled($state == Mage_Sales_Model_Recurring_Profile::STATE_CANCELED) + ->setIsAlreadySuspended($state == Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED) + ->setIsAlreadyActive($state == Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE) + ->setAction($action) + ->callManageRecurringPaymentsProfileStatus() + ; + } + + /** + * Manage status + * + * @param Mage_Payment_Model_Recurring_Profile $profile + */ + public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile) + { + + } + /** * Import capture results to payment * @@ -226,7 +430,7 @@ public function cancel(Varien_Object $payment) protected function _importCaptureResultToPayment($api, $payment) { $payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(false); - Mage::getModel('paypal/info')->importToPayment($api, $payment); + $this->importPaymentInfo($api, $payment); } /** @@ -242,22 +446,7 @@ protected function _importRefundResultToPayment($api, $payment, $canRefundMore) ->setIsTransactionClosed(1) // refund initiated by merchant ->setShouldCloseParentTransaction(!$canRefundMore) ; - Mage::getModel('paypal/info')->importToPayment($api, $payment); - } - - /** - * Is capture request needed on this transaction - * - * @return true - */ - protected function _isCaptureNeeded() - { - $this->_api->callGetTransactionDetails(); - if ($this->_api->isPaymentComplete()) { - Mage::getModel('paypal/info')->importToPayment($api, $payment); - return false; - } - return true; + $this->importPaymentInfo($api, $payment); } /** diff --git a/app/code/core/Mage/Paypal/Model/Report/Settlement.php b/app/code/core/Mage/Paypal/Model/Report/Settlement.php new file mode 100644 index 0000000000..c2c77c003f --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/Report/Settlement.php @@ -0,0 +1,378 @@ +_init('paypal/report_settlement'); + } + + /** + * Stop saving process if file with same report date, account ID and last modified date was already ferched + * + * @return Mage_Core_Model_Abstract + */ + protected function _beforeSave() + { + $this->_dataSaveAllowed = true; + if ($this->getId()) { + if ($this->getLastModified() == $this->getReportLastModified()) { + $this->_dataSaveAllowed = false; + } + } + $this->setLastModified($this->getReportLastModified()); + return parent::_beforeSave(); + } + + /** + * Goes to specified host/path and fetches reports from there. + * Save reports to database. + * + * @param array $config SFTP credentials + * @return int Number of report rows that were fetched and saved successfully + */ + public function fetchAndSave($config) + { + $connection = new Varien_Io_Sftp(); + $connection->open(array( + 'host' => $config['hostname'], + 'username' => $config['username'], + 'password' => $config['password'] + )); + $connection->cd($config['path']); + $fetched = 0; + $listing = $this->_filterReportsList($connection->rawls()); + foreach ($listing as $filename => $attributes) { + $localCsv = tempnam(Mage::getConfig()->getOptions()->getTmpDir(), 'PayPal_STL'); + if ($connection->read($filename, $localCsv)) { + if (!is_writable($localCsv)) { + Mage::throwException(Mage::helper('paypal')->__('Cannot create target file for reading reports.')); + } + + $encoded = file_get_contents($localCsv); + $decoded = iconv(self::FILES_IN_CHARSET, self::FILES_OUT_CHARSET.'//IGNORE', $encoded); + file_put_contents($localCsv, $decoded); + + // Set last modified date, this value will be overwritten during parsing + if (isset($attributes['mtime'])) { + $lastModified = new Zend_Date($attributes['mtime']); + $this->setReportLastModified($lastModified->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)); + } + + $this->setReportDate($this->_fileNameToDate($filename)) + ->setFilename($filename) + ->parseCsv($localCsv) + ->save(); + + if ($this->_dataSaveAllowed) { + $fetched += count($this->_rows); + } + // clean object and remove parsed file + $this->unsetData(); + unlink($localCsv); + } + } + return $fetched; + } + + /** + * Parse CSV file and collect report rows + * + * @param string $localCsv Path to CSV file + * @return Mage_Paypal_Model_Report_Settlement + */ + public function parseCsv($localCsv) + { + $this->_rows = array(); + + $section_columns = array('' => 0, + 'TransactionID' => 1, + 'InvoiceID' => 2, + 'PayPalReferenceID' => 3, + 'PayPalReferenceIDType' => 4, + 'TransactionEventCode' => 5, + 'TransactionInitiationDate' => 6, + 'TransactionCompletionDate' => 7, + 'TransactionDebitOrCredit' => 8, + 'GrossTransactionAmount' => 9, + 'GrossTransactionCurrency' => 10, + 'FeeDebitOrCredit' => 11, + 'FeeAmount' => 12, + 'FeeCurrency' => 13, + 'CustomField' => 14, + 'ConsumerID' => 15, + ); + $rowmap = array( + 'TransactionID' => 'transaction_id', + 'InvoiceID' => 'invoice_id', + 'PayPalReferenceID' => 'paypal_reference_id', + 'PayPalReferenceIDType' => 'paypal_reference_id_type', + 'TransactionEventCode' => 'transaction_event_code', + 'TransactionInitiationDate' => 'transaction_initiation_date', + 'TransactionCompletionDate' => 'transaction_completion_date', + 'TransactionDebitOrCredit' => 'transaction_debit_or_credit', + 'GrossTransactionAmount' => 'gross_transaction_amount', + 'GrossTransactionCurrency' => 'gross_transaction_currency', + 'FeeDebitOrCredit' => 'fee_debit_or_credit', + 'FeeAmount' => 'fee_amount', + 'FeeCurrency' => 'fee_currency', + 'CustomField' => 'custom_field', + 'ConsumerID' => 'consumer_id', + ); + $flipped_section_columns = array_flip($section_columns); + $fp = fopen($localCsv, 'r'); + while($line = fgetcsv($fp)) { + if (empty($line)) { // The line was empty, so skip it. + continue; + } + $lineType = $line[0]; + switch($lineType) { + case 'RH': // Report header. + $lastModified = new Zend_Date($line[1]); + $this->setReportLastModified($lastModified->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)); + //$this->setAccountId($columns[2]); -- probably we'll just take that from the section header... + break; + case 'FH': // File header. + // Nothing interesting here, move along + break; + case 'SH': // Section header. + $this->setAccountId($line[3]); + $this->loadByAccountAndDate(); + break; + case 'CH': // Section columns. + // In case ever the column order is changed, we will have the items recorded properly + // anyway. We have named, not numbered columns. + for ($i = 1; $i < count($line); $i++) { + $section_columns[$line[$i]] = $i; + } + $flipped_section_columns = array_flip($section_columns); + break; + case 'SB': // Section body. + $bodyitem = array(); + for($i = 1; $i < count($line); $i++) { + $bodyitem[$rowmap[$flipped_section_columns[$i]]] = $line[$i]; + } + $this->_rows[] = $bodyitem; + break; + case 'SC': // Section records count. + case 'RC': // Report records count. + case 'SF': // Section footer. + case 'FF': // File footer. + case 'RF': // Report footer. + // Nothing to see here, move along + break; + } + } + return $this; + } + + /** + * Load report by unique key (accoutn + report date) + * + * @return Mage_Paypal_Model_Report_Settlement + */ + public function loadByAccountAndDate() + { + $this->getResource()->loadByAccountAndDate($this, $this->getAccountId(), $this->getReportDate()); + return $this; + } + + /** + * Return collected rows for further processing. + * + * @return array + */ + public function getRows() + { + return $this->_rows; + } + + /** + * Return name for row column + * + * @param string $field Field name in row model + * @return string + */ + public function getFieldLabel($field) + { + switch ($field) { + case 'report_date': + return Mage::helper('paypal')->__('Report Date'); + case 'account_id': + return Mage::helper('paypal')->__('Merchant Account'); + case 'transaction_id': + return Mage::helper('paypal')->__('Transaction ID'); + case 'invoice_id': + return Mage::helper('paypal')->__('Invoice ID'); + case 'paypal_reference_id': + return Mage::helper('paypal')->__('PayPal Reference ID'); + case 'paypal_reference_id_type': + return Mage::helper('paypal')->__('PayPal Reference ID Type'); + case 'transaction_event_code': + return Mage::helper('paypal')->__('Event Code'); + case 'transaction_event': + return Mage::helper('paypal')->__('Event'); + case 'transaction_initiation_date': + return Mage::helper('paypal')->__('Initiation Date'); + case 'transaction_completion_date': + return Mage::helper('paypal')->__('Completion Date'); + case 'transaction_debit_or_credit': + return Mage::helper('paypal')->__('Debit or Credit'); + case 'gross_transaction_amount': + return Mage::helper('paypal')->__('Gross Amount'); + case 'fee_debit_or_credit': + return Mage::helper('paypal')->__('Fee Debit or Credit'); + case 'fee_amount': + return Mage::helper('paypal')->__('Fee Amount'); + case 'custom_field': + return Mage::helper('paypal')->__('Custom'); + default: + return $field; + } + } + + /** + * Iterate through website configurations and collect all SFTP configurations + * Filter config values if necessary + * + * @param bool $automaticMode Whether to skip settings with disabled Automatic Fetching or not + * @return array + */ + public function getSftpCredentials($automaticMode = false) + { + $configs = array(); + $uniques = array(); + foreach(Mage::app()->getStores() as $store) { + /*@var $store Mage_Core_Model_Store */ + $active = (bool)$store->getConfig('paypal/fetch_reports/active'); + if (!$active && $automaticMode) { + continue; + } + $cfg = array( + 'hostname' => $store->getConfig('paypal/fetch_reports/ftp_ip'), + 'path' => $store->getConfig('paypal/fetch_reports/ftp_path'), + 'username' => $store->getConfig('paypal/fetch_reports/ftp_login'), + 'password' => $store->getConfig('paypal/fetch_reports/ftp_password'), + 'sandbox' => $store->getConfig('paypal/fetch_reports/ftp_sandbox'), + ); + if (empty($cfg['username']) || empty($cfg['password'])) { + continue; + } + if (empty($cfg['hostname']) || $cfg['sandbox']) { + $cfg['hostname'] = $cfg['sandbox'] ? self::SANDBOX_REPORTS_HOSTNAME : self::REPORTS_HOSTNAME; + } + if (empty($cfg['path']) || $cfg['sandbox']) { + $cfg['path'] = self::REPORTS_PATH; + } + // avoid duplicates + if (in_array(serialize($cfg), $uniques)) { + continue; + } + $uniques[] = serialize($cfg); + $configs[] = $cfg; + } + return $configs; + } + + /** + * Converts a filename to date of report. + * + * @param string $filename + * @return string + */ + protected function _fileNameToDate($filename) + { + // Currently filenames look like STL-YYYYMMDD, so that is what we care about. + $dateSnippet = substr(basename($filename), 4, 8); + $result = substr($dateSnippet, 0, 4).'-'.substr($dateSnippet, 4, 2).'-'.substr($dateSnippet, 6, 2); + return $result; + } + + /** + * Filter SFTP file list by filename format + * + * @param array $list List of files as per $connection->rawls() + * @return array Trimmed down list of files + */ + protected function _filterReportsList($list) + { + $result = array(); + $pattern = '/^STL-(\d{8,8})\.(\d{2,2})\.(.{3,3})\.CSV$/'; + foreach ($list as $filename => $data) { + if (preg_match($pattern, $filename)) { + $result[$filename] = $data; + } + } + return $result; + } +} diff --git a/app/code/core/Mage/Paypal/Model/Report/Settlement/Row.php b/app/code/core/Mage/Paypal/Model/Report/Settlement/Row.php new file mode 100644 index 0000000000..c5dbe5a4d0 --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/Report/Settlement/Row.php @@ -0,0 +1,258 @@ + label + * + * @var array + */ + protected static $_eventList = array(); + + /** + * Casted amount keys registry + * + * @var array + */ + protected $_castedAmounts = array(); + + /** + * Initialize resource model + */ + protected function _construct() + { + $this->_init('paypal/report_settlement_row'); + } + + /** + * Return description of Reference ID Type + * If no code specified, return full list of codes with their description + * + * @param string code + * @return string|array + */ + public function getReferenceType($code = null) + { + $types = array( + 'TXN' => Mage::helper('paypal')->__('Transaction ID'), + 'ODR' => Mage::helper('paypal')->__('Order ID'), + 'SUB' => Mage::helper('paypal')->__('Subscription ID'), + 'PAP' => Mage::helper('paypal')->__('Preapproved Payment ID') + ); + if($code === null) { + asort($types); + return $types; + } + if (isset($types[$code])) { + return $types[$code]; + } + return $code; + } + + /** + * Get native description for transaction code + * + * @param string code + * @return string + */ + public function getTransactionEvent($code) + { + $this->_generateEventLabels(); + if (isset(self::$_eventList[$code])) { + return self::$_eventList[$code]; + } + return $code; + } + + /** + * Get full list of codes with their description + * + * @return &array + */ + public function &getTransactionEvents() + { + $this->_generateEventLabels(); + return self::$_eventList; + } + + /** + * Return description of "Debit or Credit" value + * If no code specified, return full list of codes with their description + * + * @param string code + * @return string|array + */ + public function getDebitCreditText($code = null) + { + $options = array( + 'CR' => Mage::helper('paypal')->__('Credit'), + 'DR' => Mage::helper('paypal')->__('Debit'), + ); + if($code === null) { + return $options; + } + if (isset($options[$code])) { + return $options[$code]; + } + return $code; + } + + /** + * Invoke casting some amounts + * + * @param mixed $key + * @param mixed $index + * @return mixed + */ + public function getData($key = '', $index = null) + { + $this->_castAmount('fee_amount', 'fee_debit_or_credit'); + $this->_castAmount('gross_transaction_amount', 'transaction_debit_or_credit'); + return parent::getData($key, $index); + } + + /** + * Cast amounts of the specified keys + * + * PayPal settlement reports contain amounts in cents, hence the values need to be divided by 100 + * Also if the "credit" value is detected, it will be casted to negative amount + * + * @param string $key + * @param string $creditKey + */ + public function _castAmount($key, $creditKey) + { + if (isset($this->_castedAmounts[$key]) || !isset($this->_data[$key]) || !isset($this->_data[$creditKey])) { + return; + } + if (empty($this->_data[$key])) { + return; + } + $amount = $this->_data[$key] / 100; + if ('CR' === $this->_data[$creditKey]) { + $amount = -1 * $amount; + } + $this->_data[$key] = $amount; + $this->_castedAmounts[$key] = true; + } + + /** + * Fill/translate and sort all event codes/labels + */ + protected function _generateEventLabels() + { + if (!self::$_eventList) { + self::$_eventList = array( + 'T0000' => Mage::helper('paypal')->__('General: received payment of a type not belonging to the other T00xx categories'), + 'T0001' => Mage::helper('paypal')->__('Mass Pay Payment'), + 'T0002' => Mage::helper('paypal')->__('Subscription Payment, either payment sent or payment received'), + 'T0003' => Mage::helper('paypal')->__('Preapproved Payment (BillUser API), either sent or received'), + 'T0004' => Mage::helper('paypal')->__('eBay Auction Payment'), + 'T0005' => Mage::helper('paypal')->__('Direct Payment API'), + 'T0006' => Mage::helper('paypal')->__('Express Checkout APIs'), + 'T0007' => Mage::helper('paypal')->__('Website Payments Standard Payment'), + 'T0008' => Mage::helper('paypal')->__('Postage Payment to either USPS or UPS'), + 'T0009' => Mage::helper('paypal')->__('Gift Certificate Payment: purchase of Gift Certificate'), + 'T0010' => Mage::helper('paypal')->__('Auction Payment other than through eBay'), + 'T0011' => Mage::helper('paypal')->__('Mobile Payment (made via a mobile phone)'), + 'T0012' => Mage::helper('paypal')->__('Virtual Terminal Payment'), + 'T0100' => Mage::helper('paypal')->__('General: non-payment fee of a type not belonging to the other T01xx categories'), + 'T0101' => Mage::helper('paypal')->__('Fee: Web Site Payments Pro Account Monthly'), + 'T0102' => Mage::helper('paypal')->__('Fee: Foreign ACH Withdrawal'), + 'T0103' => Mage::helper('paypal')->__('Fee: WorldLink Check Withdrawal'), + 'T0104' => Mage::helper('paypal')->__('Fee: Mass Pay Request'), + 'T0200' => Mage::helper('paypal')->__('General Currency Conversion'), + 'T0201' => Mage::helper('paypal')->__('User-initiated Currency Conversion'), + 'T0202' => Mage::helper('paypal')->__('Currency Conversion required to cover negative balance'), + 'T0300' => Mage::helper('paypal')->__('General Funding of PayPal Account '), + 'T0301' => Mage::helper('paypal')->__('PayPal Balance Manager function of PayPal account'), + 'T0302' => Mage::helper('paypal')->__('ACH Funding for Funds Recovery from Account Balance'), + 'T0303' => Mage::helper('paypal')->__('EFT Funding (German banking)'), + 'T0400' => Mage::helper('paypal')->__('General Withdrawal from PayPal Account'), + 'T0401' => Mage::helper('paypal')->__('AutoSweep'), + 'T0500' => Mage::helper('paypal')->__('General: Use of PayPal account for purchasing as well as receiving payments'), + 'T0501' => Mage::helper('paypal')->__('Virtual PayPal Debit Card Transaction'), + 'T0502' => Mage::helper('paypal')->__('PayPal Debit Card Withdrawal from ATM'), + 'T0503' => Mage::helper('paypal')->__('Hidden Virtual PayPal Debit Card Transaction'), + 'T0504' => Mage::helper('paypal')->__('PayPal Debit Card Cash Advance'), + 'T0600' => Mage::helper('paypal')->__('General: Withdrawal from PayPal Account'), + 'T0700' => Mage::helper('paypal')->__('General (Purchase with a credit card)'), + 'T0701' => Mage::helper('paypal')->__('Negative Balance'), + 'T0800' => Mage::helper('paypal')->__('General: bonus of a type not belonging to the other T08xx categories'), + 'T0801' => Mage::helper('paypal')->__('Debit Card Cash Back'), + 'T0802' => Mage::helper('paypal')->__('Merchant Referral Bonus'), + 'T0803' => Mage::helper('paypal')->__('Balance Manager Account Bonus'), + 'T0804' => Mage::helper('paypal')->__('PayPal Buyer Warranty Bonus'), + 'T0805' => Mage::helper('paypal')->__('PayPal Protection Bonus'), + 'T0806' => Mage::helper('paypal')->__('Bonus for first ACH Use'), + 'T0900' => Mage::helper('paypal')->__('General Redemption'), + 'T0901' => Mage::helper('paypal')->__('Gift Certificate Redemption'), + 'T0902' => Mage::helper('paypal')->__('Points Incentive Redemption'), + 'T0903' => Mage::helper('paypal')->__('Coupon Redemption'), + 'T0904' => Mage::helper('paypal')->__('Reward Voucher Redemption'), + 'T1000' => Mage::helper('paypal')->__('General. Product no longer supported'), + 'T1100' => Mage::helper('paypal')->__('General: reversal of a type not belonging to the other T11xx categories'), + 'T1101' => Mage::helper('paypal')->__('ACH Withdrawal'), + 'T1102' => Mage::helper('paypal')->__('Debit Card Transaction'), + 'T1103' => Mage::helper('paypal')->__('Reversal of Points Usage'), + 'T1104' => Mage::helper('paypal')->__('ACH Deposit (Reversal)'), + 'T1105' => Mage::helper('paypal')->__('Reversal of General Account Hold'), + 'T1106' => Mage::helper('paypal')->__('Account-to-Account Payment, initiated by PayPal'), + 'T1107' => Mage::helper('paypal')->__('Payment Refund initiated by merchant'), + 'T1108' => Mage::helper('paypal')->__('Fee Reversal'), + 'T1110' => Mage::helper('paypal')->__('Hold for Dispute Investigation'), + 'T1111' => Mage::helper('paypal')->__('Reversal of hold for Dispute Investigation'), + 'T1200' => Mage::helper('paypal')->__('General: adjustment of a type not belonging to the other T12xx categories'), + 'T1201' => Mage::helper('paypal')->__('Chargeback'), + 'T1202' => Mage::helper('paypal')->__('Reversal'), + 'T1203' => Mage::helper('paypal')->__('Charge-off'), + 'T1204' => Mage::helper('paypal')->__('Incentive'), + 'T1205' => Mage::helper('paypal')->__('Reimbursement of Chargeback'), + 'T1300' => Mage::helper('paypal')->__('General (Authorization)'), + 'T1301' => Mage::helper('paypal')->__('Reauthorization'), + 'T1302' => Mage::helper('paypal')->__('Void'), + 'T1400' => Mage::helper('paypal')->__('General (Dividend)'), + 'T1500' => Mage::helper('paypal')->__('General: temporary hold of a type not belonging to the other T15xx categories'), + 'T1501' => Mage::helper('paypal')->__('Open Authorization'), + 'T1502' => Mage::helper('paypal')->__('ACH Deposit (Hold for Dispute or Other Investigation)'), + 'T1503' => Mage::helper('paypal')->__('Available Balance'), + 'T1600' => Mage::helper('paypal')->__('Funding'), + 'T1700' => Mage::helper('paypal')->__('General: Withdrawal to Non-Bank Entity'), + 'T1701' => Mage::helper('paypal')->__('WorldLink Withdrawal'), + 'T1800' => Mage::helper('paypal')->__('Buyer Credit Payment'), + 'T1900' => Mage::helper('paypal')->__('General Adjustment without businessrelated event'), + 'T2000' => Mage::helper('paypal')->__('General (Funds Transfer from PayPal Account to Another)'), + 'T2001' => Mage::helper('paypal')->__('Settlement Consolidation'), + 'T9900' => Mage::helper('paypal')->__('General: event not yet categorized'), + ); + asort(self::$_eventList); + } + } +} diff --git a/app/code/core/Mage/Paypal/Model/Session.php b/app/code/core/Mage/Paypal/Model/Session.php index 0eaaf2cc5e..7b8f87eb67 100644 --- a/app/code/core/Mage/Paypal/Model/Session.php +++ b/app/code/core/Mage/Paypal/Model/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Paypal/Model/Standard.php b/app/code/core/Mage/Paypal/Model/Standard.php index b06d415c09..cb5a77accd 100644 --- a/app/code/core/Mage/Paypal/Model/Standard.php +++ b/app/code/core/Mage/Paypal/Model/Standard.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -117,34 +117,35 @@ public function getOrderPlaceRedirectUrl() */ public function getStandardCheckoutFormFields() { + $orderIncrementId = $this->getCheckout()->getLastRealOrderId(); + $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId); $api = Mage::getModel('paypal/api_standard')->setConfigObject($this->getConfig()); - $quote = $this->getQuote(); - $api->setOrderId($this->getCheckout()->getLastRealOrderId()) // TODO reserved order id - ->setCurrencyCode($quote->getBaseCurrencyCode()) + $api->setOrderId($orderIncrementId) + ->setCurrencyCode($order->getBaseCurrencyCode()) //->setPaymentAction() - ->setNotifyUrl(Mage::getUrl('paypal/ipn/standard')) + ->setNotifyUrl(Mage::getUrl('paypal/ipn/')) ->setReturnUrl(Mage::getUrl('paypal/standard/success')) - ->setCancelUrl(Mage::getUrl('paypal/standard/cancel')) - ; + ->setCancelUrl(Mage::getUrl('paypal/standard/cancel')); // export address - $isQuoteVirtual = $quote->getIsVirtual(); - $address = $isQuoteVirtual ? $quote->getBillingAddress() : $quote->getShippingAddress(); - if ($isQuoteVirtual) { + $isOrderVirtual = $order->getIsVirtual(); + $address = $isOrderVirtual ? $order->getBillingAddress() : $order->getShippingAddress(); + if ($isOrderVirtual) { $api->setNoShipping(true); - } elseif ($address->getEmail()) { + } + elseif ($address->getEmail()) { $api->setAddress($address); } - list($items, $totals, $discountAmount, $shippingAmount) = Mage::helper('paypal')->prepareLineItems($quote, false, true); + list($items, $totals, $discountAmount, $shippingAmount) = Mage::helper('paypal')->prepareLineItems($order, false, true); // prepare line items if required in config if ($this->_config->lineItemsEnabled) { $api->setLineItems($items)->setLineItemTotals($totals)->setDiscountAmount($discountAmount); } // or values specific for aggregated order else { - $grandTotal = $quote->getBaseGrandTotal(); - if (!$isQuoteVirtual) { + $grandTotal = $order->getBaseGrandTotal(); + if (!$isOrderVirtual) { $api->setShippingAmount($shippingAmount); $grandTotal -= $shippingAmount; } @@ -176,14 +177,39 @@ public function getConfig() { if (null === $this->_config) { $params = array($this->_code); - if ($this->getStore()) { - $params[] = (int)$this->getStore(); + if ($store = $this->getStore()) { + $params[] = is_object($store) ? $store->getId() : $store; } $this->_config = Mage::getModel('paypal/config', $params); } return $this->_config; } + /** + * Check whether payment method can be used + * @param Mage_Sales_Model_Quote + * @return bool + */ + public function isAvailable($quote = null) + { + if ($this->getConfig()->isMethodAvailable() && parent::isAvailable($quote)) { + return true; + } + return false; + } + + /** + * Custom getter for payment configuration + * + * @param string $field + * @param int $storeId + * @return mixed + */ + public function getConfigData($field, $storeId = null) + { + return $this->getConfig()->$field; + } + /** * Aggregated cart summary label getter * diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Backend/Cron.php b/app/code/core/Mage/Paypal/Model/System/Config/Backend/Cron.php new file mode 100644 index 0000000000..5af3bd0164 --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/System/Config/Backend/Cron.php @@ -0,0 +1,53 @@ +load('paypal/fetch_reports/time', 'path')->getValue()); + if (Mage::getModel('core/config_data')->load('paypal/fetch_reports/active', 'path')->getValue()) { + $interval = Mage::getModel('core/config_data')->load(self::CRON_MODEL_PATH_INTERVAL, 'path')->getValue(); + $cronExprString = "{$time[1]} {$time[0]} */{$interval} * *"; + } + + Mage::getModel('core/config_data') + ->load(self::CRON_STRING_PATH, 'path') + ->setValue($cronExprString) + ->setPath(self::CRON_STRING_PATH) + ->save(); + + return parent::_afterSave(); + } +} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Backend/MerchantCountry.php b/app/code/core/Mage/Paypal/Model/System/Config/Backend/MerchantCountry.php new file mode 100644 index 0000000000..b601be5871 --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/System/Config/Backend/MerchantCountry.php @@ -0,0 +1,53 @@ +getValue(); + if (empty($value)) { + if ($this->getWebsite()) { + $defaultCountry = Mage::app()->getWebsite($this->getWebsite())->getConfig(self::XML_PATH_COUNTRY_DEFAULT); + } else { + $defaultCountry = Mage::getStoreConfig(self::XML_PATH_COUNTRY_DEFAULT, $this->getStore()); + } + $this->setValue($defaultCountry); + } + } +} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/BuyerCountry.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/BuyerCountry.php new file mode 100644 index 0000000000..f4874456f3 --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/System/Config/Source/BuyerCountry.php @@ -0,0 +1,42 @@ +getSupportedBuyerCountryCodes(); + $options = Mage::getResourceModel('directory/country_collection') + ->addCountryCodeFilter($supported, 'iso2') + ->loadData() + ->toOptionArray($isMultiselect ? false : Mage::helper('adminhtml')->__('--Please Select--')); + + return $options; + } +} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/FetchingSchedule.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/FetchingSchedule.php new file mode 100644 index 0000000000..1b8891c064 --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/System/Config/Source/FetchingSchedule.php @@ -0,0 +1,44 @@ + Mage::helper('paypal')->__("Daily"), + 3 => Mage::helper('paypal')->__("Every 3 days"), + 7 => Mage::helper('paypal')->__("Every 7 days"), + 10 => Mage::helper('paypal')->__("Every 10 days"), + 14 => Mage::helper('paypal')->__("Every 14 days"), + 30 => Mage::helper('paypal')->__("Every 30 days"), + 40 => Mage::helper('paypal')->__("Every 40 days"), + ); + } +} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/Logo.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/Logo.php new file mode 100644 index 0000000000..89f2ebe8a9 --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/System/Config/Source/Logo.php @@ -0,0 +1,38 @@ + Mage::helper('paypal')->__('No Logo')); + $result += Mage::getModel('paypal/config')->getAdditionalOptionsLogoTypes(); + return $result; + } +} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/MerchantCountry.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/MerchantCountry.php new file mode 100644 index 0000000000..beb1e995e1 --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/System/Config/Source/MerchantCountry.php @@ -0,0 +1,42 @@ +getSupportedMerchantCountryCodes(); + $options = Mage::getResourceModel('directory/country_collection') + ->addCountryCodeFilter($supported, 'iso2') + ->loadData() + ->toOptionArray($isMultiselect ? false : Mage::helper('adminhtml')->__('--Please Select--')); + + return $options; + } +} diff --git a/app/code/core/Mage/Paypal/controllers/Adminhtml/Paypal/ReportsController.php b/app/code/core/Mage/Paypal/controllers/Adminhtml/Paypal/ReportsController.php new file mode 100644 index 0000000000..57d159e02e --- /dev/null +++ b/app/code/core/Mage/Paypal/controllers/Adminhtml/Paypal/ReportsController.php @@ -0,0 +1,143 @@ + + */ +class Mage_Paypal_Adminhtml_Paypal_ReportsController extends Mage_Adminhtml_Controller_Action +{ + + /** + * Grid action + */ + public function indexAction() + { + $this->_initAction() + ->_addContent($this->getLayout()->createBlock('paypal/adminhtml_settlement_report')) + ->renderLayout(); + } + + /** + * Ajax callback for grid actions + */ + public function gridAction() + { + $this->loadLayout(); + $this->getResponse()->setBody( + $this->getLayout()->createBlock('paypal/adminhtml_settlement_report_grid')->toHtml() + ); + } + + /** + * View transaction details action + */ + public function detailsAction() + { + $rowId = $this->getRequest()->getParam('id'); + $row = Mage::getModel('paypal/report_settlement_row')->load($rowId); + if (!$row->getId()) { + $this->_redirect('*/*/'); + return; + } + Mage::register('current_transaction', $row); + $this->_initAction() + ->_title($this->__('View Transaction')) + ->_addContent($this->getLayout()->createBlock('paypal/adminhtml_settlement_details', 'settlementDetails')) + ->renderLayout(); + } + + /** + * Forced fetch reports action + */ + public function fetchAction() + { + try { + $reports = Mage::getModel('paypal/report_settlement'); + /* @var $reports Mage_Paypal_Model_Report_Settlement */ + $credentials = $reports->getSftpCredentials(); + if (empty($credentials)) { + Mage::throwException(Mage::helper('paypal')->__('Nothing to fetch because of an empty configuration.')); + } + foreach ($credentials as $config) { + try { + $fetched = $reports->fetchAndSave($config); + $this->_getSession()->addSuccess( + Mage::helper('paypal')->__("Fetched %s report rows from '%s@%s'.", $fetched, $config['username'], $config['hostname']) + ); + } catch (Exception $e) { + $this->_getSession()->addError( + Mage::helper('paypal')->__("Failed to fetch reports from '%s@%s'.", $config['username'], $config['hostname']) + ); + Mage::logException($e); + } + } + } catch (Mage_Core_Exception $e) { + $this->_getSession()->addError($e->getMessage()); + } catch (Exception $e) { + Mage::logException($e); + } + $this->_redirect('*/*/index'); + } + + /** + * Initialize titles, navigation + * @return Mage_Paypal_Adminhtml_Paypal_ReportsController + */ + protected function _initAction() + { + $this->_title($this->__('Reports'))->_title($this->__('Sales'))->_title($this->__('PayPal Settlement Reports')); + $this->loadLayout() + ->_setActiveMenu('report/sales') + ->_addBreadcrumb(Mage::helper('paypal')->__('Reports'), Mage::helper('paypal')->__('Reports')) + ->_addBreadcrumb(Mage::helper('paypal')->__('Sales'), Mage::helper('paypal')->__('Sales')) + ->_addBreadcrumb(Mage::helper('paypal')->__('PayPal Settlement Reports'), Mage::helper('paypal')->__('PayPal Settlement Reports')); + return $this; + } + + /** + * ACL check + * @return bool + */ + protected function _isAllowed() + { + switch ($this->getRequest()->getActionName()) { + case 'index': + case 'details': + return Mage::getSingleton('admin/session')->isAllowed('report/salesroot/paypal_settlement_reports/view'); + break; + case 'fetch': + return Mage::getSingleton('admin/session')->isAllowed('report/salesroot/paypal_settlement_reports/fetch'); + break; + default: + return Mage::getSingleton('admin/session')->isAllowed('report/salesroot/paypal_settlement_reports'); + break; + } + } +} diff --git a/app/code/core/Mage/Paypal/controllers/ExpressController.php b/app/code/core/Mage/Paypal/controllers/ExpressController.php index 98d2d4fac1..2ede66bfc7 100644 --- a/app/code/core/Mage/Paypal/controllers/ExpressController.php +++ b/app/code/core/Mage/Paypal/controllers/ExpressController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Paypal/controllers/IpnController.php b/app/code/core/Mage/Paypal/controllers/IpnController.php index 6071666f0a..a39d1da2aa 100644 --- a/app/code/core/Mage/Paypal/controllers/IpnController.php +++ b/app/code/core/Mage/Paypal/controllers/IpnController.php @@ -20,13 +20,29 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Unified IPN controller for all supported PayPal methods */ -class Mage_Paypal_IpnController extends Mage_Paypal_Controller_Ipn_Abstract +class Mage_Paypal_IpnController extends Mage_Core_Controller_Front_Action { + /** + * Instantiate IPN model and pass IPN request to it + */ + public function indexAction() + { + if (!$this->getRequest()->isPost()) { + return; + } + + try { + $data = $this->getRequest()->getPost(); + Mage::getModel('paypal/ipn')->processIpnRequest($data, new Varien_Http_Adapter_Curl()); + } catch (Exception $e) { + Mage::logException($e); + } + } } diff --git a/app/code/core/Mage/Paypal/controllers/StandardController.php b/app/code/core/Mage/Paypal/controllers/StandardController.php index 5056cdd83e..b6c37dfe9f 100644 --- a/app/code/core/Mage/Paypal/controllers/StandardController.php +++ b/app/code/core/Mage/Paypal/controllers/StandardController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -83,6 +83,7 @@ public function redirectAction() $session->setPaypalStandardQuoteId($session->getQuoteId()); $this->getResponse()->setBody($this->getLayout()->createBlock('paypal/standard_redirect')->toHtml()); $session->unsQuoteId(); + $session->unsRedirectUrl(); } /** diff --git a/app/code/core/Mage/Paypal/etc/adminhtml.xml b/app/code/core/Mage/Paypal/etc/adminhtml.xml index 40c581aeab..b887e0813f 100644 --- a/app/code/core/Mage/Paypal/etc/adminhtml.xml +++ b/app/code/core/Mage/Paypal/etc/adminhtml.xml @@ -21,11 +21,26 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> + + + + + + + PayPal Settlement Reports + adminhtml/paypal_reports + 100 + + + + + + @@ -41,6 +56,25 @@ + + + + + + PayPal Settlement Reports + + + View + + + Fetch + + + + + + + diff --git a/app/code/core/Mage/Paypal/etc/config.xml b/app/code/core/Mage/Paypal/etc/config.xml index fcc26ee583..096258cf33 100644 --- a/app/code/core/Mage/Paypal/etc/config.xml +++ b/app/code/core/Mage/Paypal/etc/config.xml @@ -21,14 +21,14 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - 0.7.4 + 1.4.0.1 @@ -41,6 +41,8 @@ Mage_Paypal_Model_Mysql4 paypal_api_debug
        + paypal_settlement_report
        + paypal_settlement_report_row
        @@ -66,14 +68,24 @@ - - SS - Maestro/Solo - 40 - + + SM + Switch/Maestro + 60 + + + SO + Solo + 61 + + + + PayPal + +
        @@ -105,6 +117,9 @@ + + paypal/express/callbackshippingoptions + @@ -119,42 +134,105 @@ + - dynamic - ec-shortcut - - - + + + + + + + + 1 + + - + paypal/express - PayPal - Sale - 0 - Sole + PayPal Express Checkout + Authorization + Mark 1 + 1 + 1 + never + paypal - - Sale + paypal/direct - Debit or Credit Card - AE,VI,MC,DI - 0 - 1 + PayPal Direct Payment + Authorization + VI,MC + 1 + paypal - + paypal/standard - PayPal - 0 + PayPal Website Payments Standard Sale 1 + paypal + + PayPal Express Checkout Payflow Edition + Authorization + 1 + 1 + 1 + paypal + + + PayPal Direct Payment Payflow Edition + Authorization + VI,MC + 1 + paypal + + + paypal/payflowpro + Payflow Pro + Authorization + AE,VI + 1 + C + MEDIUM + + + paypal + + + 1 + 1 + paypal/method_agreement + PayPal Billing Agreement + paypal + + + + + paypal/observer::fetchReports + + + + + + + + + Mage_Paypal_Adminhtml + + + + +
        diff --git a/app/code/core/Mage/Paypal/etc/system.xml b/app/code/core/Mage/Paypal/etc/system.xml index 4984204ddb..3f24d8d8ae 100644 --- a/app/code/core/Mage/Paypal/etc/system.xml +++ b/app/code/core/Mage/Paypal/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -29,520 +29,1377 @@ - - - Sign up for PayPal Merchant Account now!]]> + + paypal/adminhtml_system_config_fieldset_hint + 0 + 1 + 1 + 1 + + + + + + paypal-section + paypal-header + sales + text + 350 + 1 + 1 + 1 + + + + paypal-config + 1 + text + 0 + 1 + 1 + + + + paypal/general/merchant_country + If not specified, Default Country from General Config will be used + select + paypal/system_config_source_merchantCountry + paypal/system_config_backend_merchantCountry + 1 + 1 + 5 + + + + Start accepting payments via PayPal!]]> + Don't have a PayPal account? Simply enter your email address. + paypal/general/business_account + 1 + 1 + 10 + validate-email + + + + + + + + text + paypal/adminhtml_system_config_fieldset_global + 1 + 1 + 1 + + + + Add an Express Checkout button to your existing shopping cart for quick and easy credit card payments. PayPal handles all payment processing. + + + payment/paypal_express/active + checkbox + 10 + 1 + 1 + + + + PayPal processes all of your orders, and you get paid. + + + payment/paypal_standard/active + checkbox + 20 + 1 + 1 + + + + Process credit cards directly on your website with PayPal’s all-in-one online payment processing solution. + + + payment/paypal_direct/active + checkbox + 25 + 1 + 1 + + + + Accept PayPal payments in your shopping cart. PayPal will process your credit card payments through the Payflow Pro Gateway. + payment/paypaluk_direct/active + checkbox + 30 + 1 + 1 + + + + Don’t have a PayPal merchant account? You can still accept credit card payments through the Payflow Pro Gateway. + + payment/verisign/active + checkbox + 35 + 1 + 1 + + + + Accept payments without customers leaving your website. Many popular web-hosting services and shopping carts come with the Payflow payment gateways built in, so they are easy to set up. + payment/paypaluk_express/active + 1 + checkbox + 40 + 1 + 1 + + + + + + + paypal-config + text + 10 + 1 + 1 + + + + paypal/wpp/api_username + obscure + adminhtml/system_config_backend_encrypted + 5 + 1 + 1 + + + + paypal/wpp/api_password + obscure + adminhtml/system_config_backend_encrypted + 10 + 1 + 1 + + + + paypal/wpp/api_signature + adminhtml/system_config_backend_encrypted + obscure + 15 + 1 + 1 + + + + Get Credentials from PayPal + + paypal/adminhtml_system_config_apiWizard + 20 + 1 + 1 + + + + paypal/wpp/sandbox_flag + select + adminhtml/system_config_source_yesno + 25 + 1 + 1 + + + + paypal/wpp/use_proxy + select + adminhtml/system_config_source_yesno + 30 + 1 + 1 + + + + paypal/wpp/proxy_host + text + 35 + 1 + 1 + 1 + + + + paypal/wpp/proxy_port + text + 40 + 1 + 1 + 1 + + + + + + + paypal-config + text + 20 + 1 + 1 + 1 + + + <label>Title</label> + <comment>It is recommended to set this value to "PayPal" per store views.</comment> + <config_path>payment/paypal_express/title</config_path> + <frontend_type>text</frontend_type> + <sort_order>5</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + payment/paypal_express/sort_order + text + 10 + 1 + 1 + 1 + + + + payment/paypal_express/payment_action + select + paypal/config::getPaymentActions + 15 + 1 + 1 + + + + payment/paypal_express/allowspecific + select + adminhtml/system_config_source_payment_allspecificcountries + 20 + 1 + 1 + + + + payment/paypal_express/specificcountry + multiselect + paypal/system_config_source_buyerCountry + 25 + 1 + 1 + 1 + + + + payment/paypal_express/debug + select + adminhtml/system_config_source_yesno + 30 + 1 + 1 + + + + payment/paypal_express/line_items_enabled + select + adminhtml/system_config_source_yesno + 35 + 1 + 1 + + + + payment/paypal_express/transfer_shipping_options + If this option is enabled, customer can change shipping address and shipping method on PayPal website. In live mode works via HTTPS protocol only. + Does not work if there are more than 10 shipping options available. + select + adminhtml/system_config_source_yesno + 40 + 1 + 1 + 1 + + + + payment/paypal_express/visible_on_cart + Also affects mini-shopping cart. + select + adminhtml/system_config_source_yesno + 45 + 1 + 1 + 1 + + + + payment/paypal_express/visible_on_product + select + adminhtml/system_config_source_yesno + 50 + 1 + 1 + 1 + + + + paypal/wpp/button_flavor + select + paypal/config::getExpressCheckoutButtonFlavors + 55 + 1 + 1 + 1 + + + + Ability for buyer to purchase without PayPal account. + payment/paypal_express/solution_type + select + paypal/config::getExpressCheckoutSolutionTypes + 60 + 1 + 1 + + + + Whether to create a billing agreement, if there are no active billing agreements available. + + payment/paypal_express/allow_ba_signup + select + paypal/config::getExpressCheckoutBASignupOptions + 70 + 1 + 1 + + + + + + + paypal-config + text + 30 + 1 + 1 + 1 + + + <label>Title</label> + <comment>It is recommended to set this value to "PayPal" per store views.</comment> + <config_path>payment/paypal_standard/title</config_path> + <frontend_type>text</frontend_type> + <sort_order>5</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + payment/paypal_standard/sort_order + text + 10 + 1 + 1 + 1 + + + + payment/paypal_standard/payment_action + select + paypal/config::getPaymentActions + 15 + 1 + 1 + + + + payment/paypal_standard/allowspecific + select + adminhtml/system_config_source_payment_allspecificcountries + 20 + 1 + 1 + + + + payment/paypal_standard/specificcountry + multiselect + paypal/system_config_source_buyerCountry + 25 + 1 + 1 + 1 + + + + payment/paypal_standard/sandbox_flag + select + adminhtml/system_config_source_yesno + 30 + 1 + 1 + + + + payment/paypal_standard/debug + select + adminhtml/system_config_source_yesno + 35 + 1 + 1 + + + + payment/paypal_standard/line_items_enabled + select + adminhtml/system_config_source_yesno + 35 + 1 + 1 + + + + payment/paypal_standard/line_items_summary + Uses store frontend name by default. + text + 40 + 1 + 1 + 1 + 0 + + + + + + + paypal-config + text + 40 + 1 + 1 + 1 + + + <label>Title</label> + <comment>It is recommended to set this value to "Debit or Credit Card" per store views.</comment> + <config_path>payment/paypal_direct/title</config_path> + <frontend_type>text</frontend_type> + <sort_order>5</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + payment/paypal_direct/sort_order + text + 10 + 1 + 1 + 1 + + + + payment/paypal_direct/payment_action + select + paypal/config::getPaymentActions + 15 + 1 + 1 + + + + payment/paypal_direct/allowspecific + select + adminhtml/system_config_source_payment_allspecificcountries + 20 + 1 + 1 + + + + payment/paypal_direct/specificcountry + multiselect + paypal/system_config_source_buyerCountry + 25 + 1 + 1 + 1 + + + + payment/paypal_direct/debug + select + adminhtml/system_config_source_yesno + 30 + 1 + 1 + + + + payment/paypal_direct/line_items_enabled + select + adminhtml/system_config_source_yesno + 35 + 1 + 1 + + + + adminhtml/system_config_form_field_heading + 40 + 1 + 1 + + + + payment/paypal_direct/cctypes + multiselect + paypal/config::getWppCcTypesAsOptionArray + 45 + 1 + 1 + + + + payment/paypal_direct/useccv + select + adminhtml/system_config_source_yesno + 50 + 1 + 1 + + + + adminhtml/system_config_form_field_heading + 55 + 1 + 1 + + + + payment/paypal_direct/centinel + select + adminhtml/system_config_source_yesno + 60 + 1 + 1 + + + + payment/paypal_direct/centinel_is_mode_strict + Severe Validation Removes Chargeback Liability on Merchant + select + adminhtml/system_config_source_yesno + 65 + 1 + 1 + 1 + + + + payment/paypal_direct/centinel_api_url + If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement. + text + adminhtml/system_config_source_yesno + 70 + 1 + 1 + 1 + + + + + + text - 101 + 45 1 1 1 - + + + payment/paypal_billing_agreement/active select adminhtml/system_config_source_yesno 5 1 1 - 0 <label>Title</label> + <config_path>payment/paypal_billing_agreement/title</config_path> <frontend_type>text</frontend_type> <sort_order>10</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> + + + payment/paypal_billing_agreement/sort_order + text + 15 + 1 + 1 + 1 + + + + payment/paypal_billing_agreement/payment_action + select + paypal/config::getPaymentActions + 20 + 1 + 1 + + + + payment/paypal_billing_agreement/allowspecific + select + adminhtml/system_config_source_payment_allspecificcountries + 25 + 1 + 1 + + + + payment/paypal_billing_agreement/specificcountry + multiselect + paypal/system_config_source_buyerCountry + 30 + 1 + 1 + 1 + + + + payment/paypal_billing_agreement/debug + select + adminhtml/system_config_source_yesno + 35 + 1 + 1 + + + + payment/paypal_billing_agreement/line_items_enabled + select + adminhtml/system_config_source_yesno + 40 + 1 + 1 + + + + payment/paypal_billing_agreement/allow_billing_agreement_wizard + select + adminhtml/system_config_source_yesno + 45 + 1 + 1 + + + + + + + + + text + 55 + 1 + 1 + 1 + + + <label>Title</label> + <comment>It is recommended to set this value to "Debit or Credit Card" per store views.</comment> + <config_path>payment/paypaluk_direct/title</config_path> + <frontend_type>text</frontend_type> + <sort_order>5</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + payment/paypaluk_direct/sort_order + text + 10 + 1 + 1 + 1 + + + + payment/paypaluk_direct/payment_action + select + paypal/config::getPaymentActions + 15 + 1 + 1 + + + + payment/paypaluk_direct/allowspecific + select + adminhtml/system_config_source_payment_allspecificcountries + 20 + 1 + 1 + + + + payment/paypaluk_direct/specificcountry + multiselect + paypal/system_config_source_buyerCountry + 25 + 1 + 1 + 1 + + + + payment/paypaluk_direct/debug + select + adminhtml/system_config_source_yesno + 30 + 1 + 1 + + + + payment/paypaluk_direct/line_items_enabled + select + adminhtml/system_config_source_yesno + 35 + 1 + 1 + + + + adminhtml/system_config_form_field_heading + 40 + 1 + 1 + + + + paypal/wpuk/partner + text + 45 + 1 + 1 + + + + obscure + paypal/wpuk/user + adminhtml/system_config_backend_encrypted + 50 + 1 + 1 + + + + paypal/wpuk/vendor + text + 55 + 1 + 1 + + + + paypal/wpuk/pwd + obscure + adminhtml/system_config_backend_encrypted + 60 + 1 + 1 + + + + paypal/wpuk/sandbox_flag + select + adminhtml/system_config_source_yesno + 65 + 1 + 1 + + + + paypal/wpuk/use_proxy + select + adminhtml/system_config_source_yesno + 70 + 1 + 1 + + + + paypal/wpuk/proxy_host + text + 75 + 1 + 1 + 1 + + + + paypal/wpuk/proxy_port + text + 80 + 1 + 1 + 1 + + + + adminhtml/system_config_form_field_heading + 85 + 1 + 1 + + payment/paypaluk_direct/cctypes multiselect - paypal/config::getDirectCcTypesAsOptionArray - 15 + paypal/config::getWppPeCcTypesAsOptionArray + 90 1 1 - 0 - + + + payment/paypaluk_direct/useccv + select + adminhtml/system_config_source_yesno + 95 + 1 + 1 + + + + adminhtml/system_config_form_field_heading + 100 + 1 + 1 + + payment/paypaluk_direct/centinel select adminhtml/system_config_source_yesno - 20 + 105 1 1 - 0 - + + payment/paypaluk_direct/centinel_is_mode_strict Severe Validation Removes Chargeback Liability on Merchant select adminhtml/system_config_source_yesno - 25 + 110 1 1 - 0 1 - - - Leave Empty for Default Value + + + payment/paypaluk_direct/centinel_api_url + If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement. text adminhtml/system_config_source_yesno - 30 + 115 1 1 - 0 1 + + - - - select - adminhtml/system_config_source_yesno - 35 + + + text + 60 + 1 + 1 + 1 + + + <label>Title</label> + <comment>It is recommended to set this value to "Debit or Credit Card" per store views.</comment> + <config_path>payment/verisign/title</config_path> + <frontend_type>text</frontend_type> + <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - </line_items_enabled> + <show_in_store>1</show_in_store> + + + + payment/verisign/sort_order + text + 10 + 1 + 1 + 1 + + payment/verisign/payment_action select paypal/config::getPaymentActions - 40 + 15 1 1 - 0 - - + + + payment/verisign/allowspecific + select + 20 + adminhtml/system_config_source_payment_allspecificcountries + 1 + 1 + + + + payment/verisign/specificcountry + multiselect + 25 + paypal/system_config_source_buyerCountry + 1 + 1 + 1 + + + + payment/verisign/debug select - adminhtml/system_config_source_order_status_processing + adminhtml/system_config_source_yesno + 30 + 1 + 1 + + + + adminhtml/system_config_form_field_heading + 35 + 1 + 1 + + + + payment/verisign/partner + text + 40 + 1 + 1 + + + + payment/verisign/user + obscure + adminhtml/system_config_backend_encrypted 45 1 1 - 0 - - - - select + + + + payment/verisign/vendor + text 50 - adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 - - - - multiselect + + + + payment/verisign/pwd + obscure + adminhtml/system_config_backend_encrypted 55 - adminhtml/system_config_source_country 1 1 - 0 - 1 - - - - text + + + + payment/verisign/sandbox_flag + select + adminhtml/system_config_source_yesno 60 1 1 - 0 - - - - - - Sign up for PayPal Merchant Account now!]]> - text - 101 - 1 - 1 - 1 - - - + + + + payment/verisign/use_proxy select adminhtml/system_config_source_yesno - 10 + 65 1 1 - 0 - - - <label>Title</label> + </use_proxy> + <proxy_host translate="label"> + <label>Proxy Host</label> + <config_path>payment/verisign/proxy_host</config_path> <frontend_type>text</frontend_type> - <sort_order>20</sort_order> + <sort_order>70</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - - - - select - adminhtml/system_config_source_yesno - 30 + 1 + + + + payment/verisign/proxy_port + text + 75 1 1 - 0 - - - - select - adminhtml/system_config_source_yesno - 40 + 1 + + + + adminhtml/system_config_form_field_heading + 80 1 1 - - - - select - paypal/config::getExpressCheckoutSolutionTypes - 50 + + + + payment/verisign/cctypes + multiselect + paypal/config::getPayflowproCcTypesAsOptionArray + 85 1 1 - 0 - - - + + + + payment/verisign/useccv select - paypal/config::getPaymentActions - 70 + adminhtml/system_config_source_yesno + 90 1 1 - 0 - - - - select - adminhtml/system_config_source_order_status_processing - 80 + + + + adminhtml/system_config_form_field_heading + 95 1 1 - 0 - - - + + + + payment/verisign/centinel select + adminhtml/system_config_source_yesno 100 - adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 - - - - multiselect - 110 - adminhtml/system_config_source_country + + + + payment/verisign/centinel_is_mode_strict + Severe validation removes chargeback liability on merchant. + select + adminhtml/system_config_source_yesno + 105 1 1 - 0 - 1 - - - + 1 +
        + + + payment/verisign/centinel_api_url + A value is required for live mode. Refer to your CardinalCommerce agreement. text - 120 + adminhtml/system_config_source_yesno + 110 1 1 - 0 -
        + 1 + - - - - Sign up for PayPal Merchant Account now!]]> + + + + text - 102 + 65 1 1 1 - - - select - adminhtml/system_config_source_yesno - 10 - 1 - 1 - 0 - <label>Title</label> + <config_path>payment/paypaluk_express/title</config_path> <frontend_type>text</frontend_type> - <sort_order>20</sort_order> + <sort_order>5</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> - - - select - adminhtml/system_config_source_yesno - 30 - 1 - 1 - - - - Uses Store Frontend Name by default + + + payment/paypaluk_express/sort_order text - 35 + 10 1 1 - 1 - 0 - + + payment/paypaluk_express/payment_action select paypal/config::getPaymentActions - 40 + 15 1 1 - 0 - - - select - adminhtml/system_config_source_order_status_processing - 50 - 1 - 1 - 0 - + payment/paypaluk_express/allowspecific select - 60 + 20 adminhtml/system_config_source_payment_allspecificcountries 1 1 - 0 + payment/paypaluk_express/specificcountry multiselect - 70 - adminhtml/system_config_source_country + 25 + paypal/system_config_source_buyerCountry 1 1 - 0 1 - - - text - 100 + + + payment/paypaluk_express/debug + select + adminhtml/system_config_source_yesno + 30 1 1 - 0 - - - - - - - - sales - text - 350 - 1 - 1 - 1 - - - - Sign up for PayPal Merchant Account now!]]> - text - 5 - 1 - 1 - 0 - - - - Merchant Email. - obscure - adminhtml/system_config_backend_encrypted - 5 + + + + payment/paypaluk_express/line_items_enabled + select + adminhtml/system_config_source_yesno + 35 1 1 - 0 - - - + + + + Also affects mini-shopping cart. + payment/paypaluk_express/visible_on_cart select adminhtml/system_config_source_yesno - 10 + 40 1 1 - 0 - - - + + + + payment/paypaluk_express/visible_on_product select adminhtml/system_config_source_yesno - 15 + 45 1 1 - 0 - + - - - - Sign up for PayPal Merchant Account now!
        - See Demo]]>
        + + + + text - 10 + 70 1 1 - 0 - - - obscure - adminhtml/system_config_backend_encrypted + + + adminhtml/system_config_form_field_heading 5 1 1 - 0 - - - + + + + paypal/fetch_reports/ftp_login obscure adminhtml/system_config_backend_encrypted 10 1 1 - 0 - - - + + + + paypal/fetch_reports/ftp_password obscure adminhtml/system_config_backend_encrypted 15 1 1 - 0 - - - - adminhtml/system_config_backend_encrypted - obscure + + + + paypal/fetch_reports/ftp_sandbox + select + adminhtml/system_config_source_yesno 20 1 1 - 0 - - - - select - adminhtml/system_config_source_yesno + + + + By default it is "reports.paypal.com". + Use colon to specify port. For example: "test.example.com:5224". + paypal/fetch_reports/ftp_ip + text 25 1 1 - 0 - - - + 0 + + + + By default it is "/ppreports/outgoing". + paypal/fetch_reports/ftp_path text 30 1 1 - 0 - 1 - - - - text + 0 + + + + adminhtml/system_config_form_field_heading 35 1 1 - 0 - 1 - - - + + + + paypal/fetch_reports/active select adminhtml/system_config_source_yesno 40 1 1 - 0 - - - + + + + PayPal retains reports for 45 days. + paypal/fetch_reports/schedule select - adminhtml/system_config_source_yesno + paypal/system_config_source_fetchingSchedule 45 1 - 1 - 0 - + + + + paypal/fetch_reports/time + time + + 50 + 1 + -
        + +
        diff --git a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-install-0.7.0.php index d293206b75..5628411b64 100644 --- a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-install-1.4.0.0.php b/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-install-1.4.0.0.php new file mode 100644 index 0000000000..077481d389 --- /dev/null +++ b/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-install-1.4.0.0.php @@ -0,0 +1,48 @@ +startSetup(); + +$installer->run(" +CREATE TABLE `{$this->getTable('paypal_api_debug')}` ( + `debug_id` int(10) unsigned NOT NULL auto_increment, + `debug_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `request_body` text, + `response_body` text, + PRIMARY KEY (`debug_id`), + KEY `debug_at` (`debug_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + +$installer->addAttribute('quote_payment', 'paypal_payer_id', array()); +$installer->addAttribute('quote_payment', 'paypal_payer_status', array()); +$installer->addAttribute('quote_payment', 'paypal_correlation_id', array()); +$installer->addAttribute('order', 'paypal_ipn_customer_notified', array('type'=>'int', 'visible' => false, 'default' => 0)); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-0.7.1-0.7.2.php index d7f92a6d5c..68f9ff3bc3 100644 --- a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; diff --git a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-0.7.2-0.7.3.php index dac78b9070..e86515e2f5 100644 --- a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-0.7.2-0.7.3.php +++ b/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-0.7.2-0.7.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Paypal - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; diff --git a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-0.7.3-0.7.4.php b/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-0.7.3-0.7.4.php deleted file mode 100644 index a2530bba30..0000000000 --- a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-0.7.3-0.7.4.php +++ /dev/null @@ -1,134 +0,0 @@ -getConnection(); - -$paymentMethods = array( - 'paypal_standard', - 'paypal_express', - 'paypal_direct' -); -$entityTypeCode = 'order_payment'; -$attributesIds = array( - 'method' => false, - 'additional_data' => false, - 'additional_information' => false -); - -/* get order_payment entity type code*/ -$entityTypeId = $connection->fetchOne(" - SELECT entity_type_id - FROM {$this->getTable('eav_entity_type')} - WHERE entity_type_code = '{$entityTypeCode}'; -"); - -/* get order_payment attribute codes*/ -foreach ($attributesIds as $attributeCode => $attributeId) { - $attributesIds[$attributeCode] = $connection->fetchOne(" - SELECT attribute_id - FROM {$this->getTable('eav_attribute')} - WHERE attribute_code = '{$attributeCode}' and entity_type_id = {$entityTypeId}; - "); -} - -/* get count of paypal order payments*/ -$methodIds = "'" . implode("','", $paymentMethods) . "'"; -$paymentsCount = $connection->fetchOne(" - SELECT count(entity_id) as count - FROM {$this->getTable('sales_order_entity_varchar')} - WHERE attribute_id = {$attributesIds['method']} and value in ({$methodIds}); -"); - -$connection->beginTransaction(); -try { - - /* process payment attributes*/ - for ($i=0; $i<=$paymentsCount; $i+=$processingItemsCountForOneIteration) { - - /* get payment ids for current iteration*/ - $currentPaymentIds = $installer->getConnection()->fetchCol(" - SELECT entity_id - FROM {$this->getTable('sales_order_entity_varchar')} - WHERE attribute_id = {$attributesIds['method']} and value in ({$methodIds}) - LIMIT {$i}, {$processingItemsCountForOneIteration}; - "); - - if (!count($currentPaymentIds)) { - continue; - } - - $currentPaymentIdsCondition = implode(',', $currentPaymentIds); - - /* get data for current payment ids*/ - $data = $installer->getConnection()->fetchAll(" - SELECT - e.entity_id, - ev_additional_data.value as additional_data - FROM {$this->getTable('sales_order_entity')} as e - LEFT JOIN {$this->getTable('sales_order_entity_text')} as ev_additional_data on (ev_additional_data.entity_id = e.entity_id and ev_additional_data.attribute_id = {$attributesIds['additional_data']}) - WHERE e.entity_id in ({$currentPaymentIdsCondition}) - "); - - /* prepare query data items */ - $insertQueryItems = array(); - foreach ($data as $item) { - if ($item['additional_data'] != '') { - $additionalInformationFields = array(); - $additionalInformationFields['paypal_payer_email'] = $item['additional_data']; - $additionalInformation = serialize($additionalInformationFields); - - $insertQueryItems[] = array( - $entityTypeId, - $attributesIds['additional_information'], - $item['entity_id'], - $additionalInformation - ); - } - } - - if (!count($insertQueryItems)) { - continue; - } - - $connection->insertArray( - $this->getTable('sales_order_entity_text'), - array('entity_type_id', 'attribute_id', 'entity_id', 'value'), - $insertQueryItems - ); - } - -} catch (Exception $e) { - $connection->rollBack(); - throw $e; -} -$connection->commit(); diff --git a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php b/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php new file mode 100644 index 0000000000..1d4fc68dbd --- /dev/null +++ b/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php @@ -0,0 +1,72 @@ +startSetup(); + +$installer->run(" + +CREATE TABLE `{$installer->getTable('paypal_settlement_report')}` ( + `report_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `report_date` date NOT NULL, + `account_id` varchar(64) NOT NULL, + `filename` varchar(24) NOT NULL, + `last_modified` datetime NOT NULL, + PRIMARY KEY (`report_id`), + UNIQUE KEY `UNQ_REPORT_DATE_ACCOUNT` (`report_date`,`account_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('paypal_settlement_report_row')}` ( + `row_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `report_id` int(10) unsigned NOT NULL, + `transaction_id` varchar(19) NOT NULL, + `invoice_id` varchar(127) DEFAULT NULL, + `paypal_reference_id` varchar(19) NOT NULL, + `paypal_reference_id_type` enum('ODR','TXN','SUB','PAP','') NOT NULL, + `transaction_event_code` char(5) NOT NULL DEFAULT '', + `transaction_initiation_date` datetime DEFAULT NULL, + `transaction_completion_date` datetime DEFAULT NULL, + `transaction_debit_or_credit` enum('CR','DR') NOT NULL DEFAULT 'CR', + `gross_transaction_amount` decimal(20,6) NOT NULL DEFAULT '0.000000', + `gross_transaction_currency` char(3) NOT NULL DEFAULT '', + `fee_debit_or_credit` enum('CR','DR') NOT NULL, + `fee_amount` decimal(20,6) NOT NULL DEFAULT '0.000000', + `fee_currency` char(3) NOT NULL, + `custom_field` varchar(255) DEFAULT NULL, + `consumer_id` varchar(127) NOT NULL DEFAULT '', + PRIMARY KEY (`row_id`), + KEY `IDX_REPORT_ID` (`report_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +ALTER TABLE `{$installer->getTable('paypal_settlement_report_row')}` + ADD CONSTRAINT `FK_PAYPAL_SETTLEMENT_ROW_REPORT` FOREIGN KEY (`report_id`) REFERENCES `{$installer->getTable('paypal_settlement_report')}` (`report_id`) ON DELETE CASCADE ON UPDATE CASCADE; + +"); + +$installer->endSetup(); diff --git a/app/code/core/Mage/PaypalUk/Block/Express/Form.php b/app/code/core/Mage/PaypalUk/Block/Express/Form.php index bf3efdade0..e4751397cf 100644 --- a/app/code/core/Mage/PaypalUk/Block/Express/Form.php +++ b/app/code/core/Mage/PaypalUk/Block/Express/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_PaypalUk - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -31,6 +31,6 @@ class Mage_PaypalUk_Block_Express_Form extends Mage_Paypal_Block_Express_Form * Payment method code * @var string */ - protected $_methodCode = Mage_PaypalUk_Model_Config::METHOD_WPP_PE_EXPRESS; + protected $_methodCode = Mage_Paypal_Model_Config::METHOD_WPP_PE_EXPRESS; } diff --git a/app/code/core/Mage/PaypalUk/controllers/IpnController.php b/app/code/core/Mage/PaypalUk/Block/Express/Shortcut.php similarity index 60% rename from app/code/core/Mage/PaypalUk/controllers/IpnController.php rename to app/code/core/Mage/PaypalUk/Block/Express/Shortcut.php index 4081cf3a25..570c80ac9f 100644 --- a/app/code/core/Mage/PaypalUk/controllers/IpnController.php +++ b/app/code/core/Mage/PaypalUk/Block/Express/Shortcut.php @@ -20,35 +20,33 @@ * * @category Mage * @package Mage_PaypalUk - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Unified IPN controller for all supported PayPal methods + * Paypal expess checkout shortcut link */ -class Mage_PaypalUk_IpnController extends Mage_Paypal_Controller_Ipn_Abstract +class Mage_PaypalUk_Block_Express_Shortcut extends Mage_Paypal_Block_Express_Shortcut { /** - * Config Model Type + * Payment method code * * @var string */ - protected $_configType = 'paypaluk/config'; + protected $_paymentMethodCode = Mage_Paypal_Model_Config::METHOD_WPP_PE_EXPRESS; /** - * Process IPN for PayPal Express + * Start express action + * + * @var string */ - public function expressAction() - { - return $this->_ipnAction(Mage_PaypalUk_Model_Config::METHOD_WPP_PE_EXPRESS); - } + protected $_startAction = 'paypaluk/express/start'; /** - * Process IPN for PayPal Direct + * Express checkout model factory name + * + * @var string */ - public function directAction() - { - return $this->_ipnAction(Mage_PaypalUk_Model_Config::METHOD_WPP_PE_DIRECT); - } + protected $_checkoutType = 'paypaluk/express_checkout'; } diff --git a/app/code/core/Mage/PaypalUk/Helper/Data.php b/app/code/core/Mage/PaypalUk/Helper/Data.php index 3efa49c186..1ab309e468 100644 --- a/app/code/core/Mage/PaypalUk/Helper/Data.php +++ b/app/code/core/Mage/PaypalUk/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_PaypalUk - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/PaypalUk/Model/Api/Nvp.php b/app/code/core/Mage/PaypalUk/Model/Api/Nvp.php index 48a40079d8..e111572e22 100644 --- a/app/code/core/Mage/PaypalUk/Model/Api/Nvp.php +++ b/app/code/core/Mage/PaypalUk/Model/Api/Nvp.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_PaypalUk - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -234,7 +234,7 @@ class Mage_PaypalUk_Model_Api_Nvp extends Mage_Paypal_Model_Api_Nvp 'SHIPTOSTREET' => 'street', 'SHIPTOSTREET2' => 'street2', 'SHIPTOZIP' => 'postcode', - 'SHIPTOPHONENUM' => 'telephone', + 'SHIPTOPHONENUM' => 'telephone', // does not supported by PaypalUk ); /** @@ -251,7 +251,7 @@ class Mage_PaypalUk_Model_Api_Nvp extends Mage_Paypal_Model_Api_Nvp 'SALUTATION' => 'prefix', 'SUFFIX' => 'suffix', - 'COUNTRYCODE' => 'country_id', // iso-3166 two-character code + 'COUNTRY' => 'country_id', // iso-3166 two-character code 'STATE' => 'region', 'CITY' => 'city', 'STREET' => 'street', @@ -287,7 +287,7 @@ class Mage_PaypalUk_Model_Api_Nvp extends Mage_Paypal_Model_Api_Nvp */ public function getApiEndpoint() { - return sprintf('https://%spayflowpro.verisign.com/transaction', $this->_config->sandboxFlag ? 'pilot-' : ''); + return sprintf('https://%spayflowpro.paypal.com/transaction', $this->_config->sandboxFlag ? 'pilot-' : ''); } /** @@ -337,7 +337,7 @@ public function getVendor() */ public function getTender() { - if ($this->_config->getMethodCode() == Mage_PaypalUk_Model_Config::METHOD_WPP_PE_EXPRESS) { + if ($this->_config->getMethodCode() == Mage_Paypal_Model_Config::METHOD_WPP_PE_EXPRESS) { return self::TENDER_PAYPAL; } return self::TENDER_CC; @@ -391,7 +391,7 @@ protected function _mapPaypalMethodName($methodName) case Mage_Paypal_Model_Api_Nvp::GET_EXPRESS_CHECKOUT_DETAILS: case Mage_Paypal_Model_Api_Nvp::SET_EXPRESS_CHECKOUT: case Mage_Paypal_Model_Api_Nvp::DO_DIRECT_PAYMENT: - return ($this->_config->payment_action == Mage_PaypalUk_Model_Config::PAYMENT_ACTION_AUTH) ? + return ($this->_config->payment_action == Mage_Paypal_Model_Config::PAYMENT_ACTION_AUTH) ? self::TRXTYPE_AUTH_ONLY: self::TRXTYPE_SALE; case Mage_Paypal_Model_Api_Nvp::DO_CAPTURE: @@ -433,7 +433,7 @@ protected function _handleCallErrors($response) $message = $response['RESPMSG']; $e = new Exception(sprintf('PayPal gateway errors: %s.', $message)); Mage::logException($e); - Mage::throwException(Mage::helper('paypal')->__('PayPal geteway rejected request. %s', $message)); + Mage::throwException(Mage::helper('paypal')->__('PayPal gateway rejected the request. %s', $message)); } } @@ -482,4 +482,26 @@ protected function _importFraudFiltersResult(array $from, array $collectedWarnin } $this->setIsPaymentPending(true); } + + /** + * Return each call request fields (PayFlow edition doesn't support Unilateral payments) + * + * @param string $methodName Current method name + * @return array + */ + protected function _prepareEachCallRequest($methodName) + { + return $this->_eachCallRequest; + } + + /** + * Overwrite parent logic, simply return input data (PayFlow edition doesn't support Unilateral payments) + * + * @param array $requestFields Standard set of values + * @return array + */ + protected function _prepareExpressCheckoutCallRequest(&$requestFields) + { + return $requestFields; + } } diff --git a/app/code/core/Mage/PaypalUk/Model/Config.php b/app/code/core/Mage/PaypalUk/Model/Config.php deleted file mode 100644 index b36db2ace7..0000000000 --- a/app/code/core/Mage/PaypalUk/Model/Config.php +++ /dev/null @@ -1,198 +0,0 @@ - 'DP', - ); - - /** - * Payment actions - * - * @var string - */ - const PAYMENT_ACTION_SALE = 'Sale'; - const PAYMENT_ACTION_ORDER = 'Order'; - const PAYMENT_ACTION_AUTH = 'Authorization'; - - /** - * Map any supported payment method into a config path by specified field name - * - * @param string $fieldName - * @return string|null - */ - protected function _getSpecificConfigPath($fieldName) - { - $path = null; - if (self::METHOD_WPP_PE_DIRECT === $this->_methodCode) { - $path = $this->_mapDirectFieldset($fieldName); - } - if (self::METHOD_WPP_PE_EXPRESS === $this->_methodCode) { - $path = $this->_mapExpressFieldset($fieldName); - } - - if (!$path) { - $path = $this->_mapWpukFieldset($fieldName); - } - if (!$path) { - $path = $this->_mapWppStyleFieldset($fieldName); - } - return $path; - } - - /** - * Map PayPal Direct (Payflow Edition) config fields - * - * @param string $fieldName - * @return string|null - */ - protected function _mapDirectFieldset($fieldName) - { - switch ($fieldName) - { - case 'active': - case 'allowspecific': - case 'cctypes': - case 'centinel': - case 'centinel_is_mode_strict': - case 'centinel_api_url': - case 'fraud_filter': - case 'line_items_enabled': - case 'order_status': - case 'payment_action': - case 'sort_order': - case 'specificcountry': - case 'title': - return 'payment/' . self::METHOD_WPP_PE_DIRECT . "/{$fieldName}"; - } - } - - /** - * Mapper from PayPalUk-specific payment actions to Magento payment actions - * - * @return string|null - */ - public function getPaymentAction() - { - switch ($this->paymentAction) { - case self::PAYMENT_ACTION_AUTH: - return Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE; - case self::PAYMENT_ACTION_SALE: - return Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE; - case self::PAYMENT_ACTION_ORDER: - return; - } - } - - /** - * Payment actions source getter - * - * @return array - */ - public function getPaymentActions() - { - return array( - self::PAYMENT_ACTION_AUTH => Mage::helper('paypal')->__('Authorization'), - self::PAYMENT_ACTION_SALE => Mage::helper('paypal')->__('Sale'), - ); - } - - /** - * PayPal Direct cc types source getter - * - * @return array - */ - public function getDirectCcTypesAsOptionArray() - { - $model = Mage::getModel('payment/source_cctype')->setAllowedTypes(array('VI', 'MC', 'AE', 'DI', 'SS', 'OT')); - return $model->toOptionArray(); - } - - /** - * Map PayPal Website Payments Pro common config fields - * - * @param string $fieldName - * @return string|null - */ - protected function _mapWpukFieldset($fieldName) - { - switch ($fieldName) - { - case 'url': - case 'partner': - case 'user': - case 'vendor': - case 'pwd': - case 'debug_flag': - case 'sandbox_flag': - return "paypal/wpuk/{$fieldName}"; - } - } - - /** - * Map PayPal Express config fields - * - * @param string $fieldName - * @return string|null - */ - protected function _mapExpressFieldset($fieldName) - { - switch ($fieldName) - { - case 'active': - case 'allowspecific': - case 'fraud_filter': - case 'invoice_email_copy': - case 'line_items_enabled': - case 'order_status': - case 'payment_action': - case 'solution_type': - case 'sort_order': - case 'specificcountry': - case 'title': - case 'visible_on_cart': - return 'payment/' . self::METHOD_WPP_PE_EXPRESS . "/{$fieldName}"; - } - } -} diff --git a/app/code/core/Mage/PaypalUk/Model/Direct.php b/app/code/core/Mage/PaypalUk/Model/Direct.php index c8f2d368bb..6e8f1e49ab 100644 --- a/app/code/core/Mage/PaypalUk/Model/Direct.php +++ b/app/code/core/Mage/PaypalUk/Model/Direct.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_PaypalUk - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,7 +29,7 @@ */ class Mage_PaypalUk_Model_Direct extends Mage_Paypal_Model_Direct { - protected $_code = 'paypaluk_direct'; + protected $_code = Mage_Paypal_Model_Config::METHOD_WPP_PE_DIRECT; /** * Website Payments Pro instance type @@ -39,11 +39,31 @@ class Mage_PaypalUk_Model_Direct extends Mage_Paypal_Model_Direct protected $_proType = 'paypaluk/pro'; /** - * Ipn notify action + * Return available CC types for gateway based on merchant country * - * @var string + * @return string */ - protected $_notifyAction = 'paypaluk/ipn/direct'; + public function getAllowedCcTypes() + { + return $this->_pro->getConfig()->cctypes; + } + + /** + * Merchant country limitation for 3d secure feature, rewrite for parent implementation + * + * @return bool + */ + public function getIsCentinelValidationEnabled() + { + if (!parent::getIsCentinelValidationEnabled()) { + return false; + } + // available only for US and UK merchants + if (in_array($this->_pro->getConfig()->getMerchantCountry(), array('US', 'GB'))) { + return true; + } + return false; + } /** * Import direct payment results to payment @@ -57,7 +77,20 @@ protected function _importResultToPayment($api, $payment) ->setIsTransactionPending($api->getIsPaymentPending()) ->setTransactionAdditionalInfo(Mage_PaypalUk_Model_Pro::TRANSPORT_PAYFLOW_TXN_ID, $api->getTransactionId()) ; - $payment->setPreparedMessage(Mage::helper('paypaluk')->__('Payflow PNREF: #%s.', $api->getTransactionId())); - Mage::getModel($this->_infoType)->importToPayment($api, $payment); + $payment->setPreparedMessage(Mage::helper('paypaluk')->__('Payflow PPREF: #%s.', $api->getTransactionId())); + $this->_pro->importPaymentInfo($api, $payment); + } + + /** + * Format credit card expiration date based on month and year values + * Format: mmyy + * + * @param string|int $month + * @param string|int $year + * @return string + */ + protected function _getFormattedCcExpirationDate($month, $year) + { + return sprintf('%02d', $month) . sprintf('%02d', substr($year, -2, 2)); } } diff --git a/app/code/core/Mage/PaypalUk/Model/Express.php b/app/code/core/Mage/PaypalUk/Model/Express.php index 13d1da45fd..51d64c3296 100644 --- a/app/code/core/Mage/PaypalUk/Model/Express.php +++ b/app/code/core/Mage/PaypalUk/Model/Express.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_PaypalUk - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,8 +29,10 @@ */ class Mage_PaypalUk_Model_Express extends Mage_Paypal_Model_Express { - protected $_code = Mage_PaypalUk_Model_Config::METHOD_WPP_PE_EXPRESS; + protected $_code = Mage_Paypal_Model_Config::METHOD_WPP_PE_EXPRESS; protected $_formBlockType = 'paypaluk/express_form'; + protected $_canCreateBillingAgreement = false; + protected $_canManageRecurringProfiles = false; /** * Website Payments Pro instance type @@ -40,11 +42,31 @@ class Mage_PaypalUk_Model_Express extends Mage_Paypal_Model_Express protected $_proType = 'paypaluk/pro'; /** - * Notify Url + * Express Checkout payment method instance * - * @var string + * @var Mage_Paypal_Model_Express */ - protected $_ipnAction = 'paypaluk/ipn/express'; + protected $_ecInstance = null; + + /** + * EC PE won't be available if the EC is available + * + * @param Mage_Sales_Model_Quote $quote + * @return bool + */ + public function isAvailable($quote = null) + { + if (!parent::isAvailable($quote)) { + return false; + } + if (!$this->_ecInstance) { + $this->_ecInstance = Mage::helper('payment')->getMethodInstance(Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS); + } + if ($quote) { + $this->_ecInstance->setStore($quote->getStoreId()); + } + return !$this->_ecInstance->isAvailable(); + } /** * Import payment info to payment @@ -61,7 +83,7 @@ protected function _importToPayment($api, $payment) ->setIsTransactionPending($api->getIsPaymentPending()) ->setTransactionAdditionalInfo(Mage_PaypalUk_Model_Pro::TRANSPORT_PAYFLOW_TXN_ID, $api->getTransactionId()) ; - $payment->setPreparedMessage(Mage::helper('paypaluk')->__('Payflow PNREF: #%s.', $api->getTransactionId())); + $payment->setPreparedMessage(Mage::helper('paypaluk')->__('Payflow PPREF: #%s.', $api->getTransactionId())); Mage::getModel('paypal/info')->importToPayment($api, $payment); } diff --git a/app/code/core/Mage/PaypalUk/Model/Express/Checkout.php b/app/code/core/Mage/PaypalUk/Model/Express/Checkout.php index dcdae40003..58fe6ea259 100644 --- a/app/code/core/Mage/PaypalUk/Model/Express/Checkout.php +++ b/app/code/core/Mage/PaypalUk/Model/Express/Checkout.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_PaypalUk - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -41,6 +41,6 @@ class Mage_PaypalUk_Model_Express_Checkout extends Mage_Paypal_Model_Express_Che * Payment method tpye * @var unknown_type */ - protected $_methodType = Mage_PaypalUk_Model_Config::METHOD_WPP_PE_EXPRESS; + protected $_methodType = Mage_Paypal_Model_Config::METHOD_WPP_PE_EXPRESS; } diff --git a/app/code/core/Mage/PaypalUk/Model/Pro.php b/app/code/core/Mage/PaypalUk/Model/Pro.php index 59d8bf0e8d..0c976e0c5a 100644 --- a/app/code/core/Mage/PaypalUk/Model/Pro.php +++ b/app/code/core/Mage/PaypalUk/Model/Pro.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_PaypalUk - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,7 +42,7 @@ class Mage_PaypalUk_Model_Pro extends Mage_Paypal_Model_Pro * * @var string */ - protected $_configType = 'paypaluk/config'; + protected $_configType = 'paypal/config'; /** * Payflow trx_id key in transaction info diff --git a/app/code/core/Mage/PaypalUk/Model/Session.php b/app/code/core/Mage/PaypalUk/Model/Session.php index 5542d791ae..f1e6c495f7 100644 --- a/app/code/core/Mage/PaypalUk/Model/Session.php +++ b/app/code/core/Mage/PaypalUk/Model/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_PaypalUk - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/PaypalUk/controllers/ExpressController.php b/app/code/core/Mage/PaypalUk/controllers/ExpressController.php index 54dc135577..d7ea7125ae 100644 --- a/app/code/core/Mage/PaypalUk/controllers/ExpressController.php +++ b/app/code/core/Mage/PaypalUk/controllers/ExpressController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_PaypalUk - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -35,14 +35,14 @@ class Mage_PaypalUk_ExpressController extends Mage_Paypal_Controller_Express_Abs * * @var string */ - protected $_configType = 'paypaluk/config'; + protected $_configType = 'paypal/config'; /** * Config method type * * @var string */ - protected $_configMethod = Mage_PaypalUk_Model_Config::METHOD_WPP_PE_EXPRESS; + protected $_configMethod = Mage_Paypal_Model_Config::METHOD_WPP_PE_EXPRESS; /** * Checkout mode type diff --git a/app/code/core/Mage/PaypalUk/etc/config.xml b/app/code/core/Mage/PaypalUk/etc/config.xml index 3d7f88a41b..037f679b33 100644 --- a/app/code/core/Mage/PaypalUk/etc/config.xml +++ b/app/code/core/Mage/PaypalUk/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_PaypalUk - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -103,26 +103,12 @@ - - - PayPalUK - - - - - authorize paypaluk/express - PaypalUk Express - 0 - authorize paypaluk/direct - PaypalUk Direct - AE,VI,MC,DI - 0 diff --git a/app/code/core/Mage/PaypalUk/sql/paypaluk_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/PaypalUk/sql/paypaluk_setup/mysql4-install-0.7.0.php index 3cad7e8fa2..117ba424ff 100644 --- a/app/code/core/Mage/PaypalUk/sql/paypaluk_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/PaypalUk/sql/paypaluk_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_PaypalUk - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Poll/Block/ActivePoll.php b/app/code/core/Mage/Poll/Block/ActivePoll.php index 16aff355b1..204ba8b09d 100755 --- a/app/code/core/Mage/Poll/Block/ActivePoll.php +++ b/app/code/core/Mage/Poll/Block/ActivePoll.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Poll - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Poll/Block/Poll.php b/app/code/core/Mage/Poll/Block/Poll.php index 6520935312..8a8bb1cc3e 100644 --- a/app/code/core/Mage/Poll/Block/Poll.php +++ b/app/code/core/Mage/Poll/Block/Poll.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Poll - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Poll/Helper/Data.php b/app/code/core/Mage/Poll/Helper/Data.php index 3bbea4a835..9c9c83f923 100644 --- a/app/code/core/Mage/Poll/Helper/Data.php +++ b/app/code/core/Mage/Poll/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Poll - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Poll/Model/Mysql4/Poll.php b/app/code/core/Mage/Poll/Model/Mysql4/Poll.php index 8435846249..10b67f7cdc 100644 --- a/app/code/core/Mage/Poll/Model/Mysql4/Poll.php +++ b/app/code/core/Mage/Poll/Model/Mysql4/Poll.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Poll - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Poll/Model/Mysql4/Poll/Answer.php b/app/code/core/Mage/Poll/Model/Mysql4/Poll/Answer.php index 628d8a2e6e..330ce8ea81 100644 --- a/app/code/core/Mage/Poll/Model/Mysql4/Poll/Answer.php +++ b/app/code/core/Mage/Poll/Model/Mysql4/Poll/Answer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Poll - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Poll/Model/Mysql4/Poll/Answer/Collection.php b/app/code/core/Mage/Poll/Model/Mysql4/Poll/Answer/Collection.php index debfa2cfd5..a7816eec1c 100644 --- a/app/code/core/Mage/Poll/Model/Mysql4/Poll/Answer/Collection.php +++ b/app/code/core/Mage/Poll/Model/Mysql4/Poll/Answer/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Poll - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Poll/Model/Mysql4/Poll/Collection.php b/app/code/core/Mage/Poll/Model/Mysql4/Poll/Collection.php index a0131ee259..64e22939c7 100644 --- a/app/code/core/Mage/Poll/Model/Mysql4/Poll/Collection.php +++ b/app/code/core/Mage/Poll/Model/Mysql4/Poll/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Poll - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Poll/Model/Mysql4/Poll/Vote.php b/app/code/core/Mage/Poll/Model/Mysql4/Poll/Vote.php index a7948cf838..1ba3c1fa51 100644 --- a/app/code/core/Mage/Poll/Model/Mysql4/Poll/Vote.php +++ b/app/code/core/Mage/Poll/Model/Mysql4/Poll/Vote.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Poll - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Poll/Model/Poll.php b/app/code/core/Mage/Poll/Model/Poll.php index bb9c4227c3..c1f1c1ca0a 100644 --- a/app/code/core/Mage/Poll/Model/Poll.php +++ b/app/code/core/Mage/Poll/Model/Poll.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Poll - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Poll/Model/Poll/Answer.php b/app/code/core/Mage/Poll/Model/Poll/Answer.php index f7548ae52e..cc17a65db3 100644 --- a/app/code/core/Mage/Poll/Model/Poll/Answer.php +++ b/app/code/core/Mage/Poll/Model/Poll/Answer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Poll - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Poll/Model/Poll/Vote.php b/app/code/core/Mage/Poll/Model/Poll/Vote.php index a26f96bee6..035dcbba24 100644 --- a/app/code/core/Mage/Poll/Model/Poll/Vote.php +++ b/app/code/core/Mage/Poll/Model/Poll/Vote.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Poll - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Poll/controllers/VoteController.php b/app/code/core/Mage/Poll/controllers/VoteController.php index 016793227e..b33b59f017 100644 --- a/app/code/core/Mage/Poll/controllers/VoteController.php +++ b/app/code/core/Mage/Poll/controllers/VoteController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Poll - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Poll/etc/adminhtml.xml b/app/code/core/Mage/Poll/etc/adminhtml.xml index d36d7c0876..84ccb7366e 100644 --- a/app/code/core/Mage/Poll/etc/adminhtml.xml +++ b/app/code/core/Mage/Poll/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Poll - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Poll/etc/config.xml b/app/code/core/Mage/Poll/etc/config.xml index 157a21ad26..c0169d2f0e 100644 --- a/app/code/core/Mage/Poll/etc/config.xml +++ b/app/code/core/Mage/Poll/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Poll - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Poll/etc/system.xml b/app/code/core/Mage/Poll/etc/system.xml index b7edcf98db..618bcfa9d3 100644 --- a/app/code/core/Mage/Poll/etc/system.xml +++ b/app/code/core/Mage/Poll/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Poll - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -32,7 +32,7 @@ - + select adminhtml/system_config_source_yesno 1 diff --git a/app/code/core/Mage/Poll/sql/poll_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Poll/sql/poll_setup/mysql4-install-0.7.0.php index 8f41bebc82..4e9f13ba2c 100644 --- a/app/code/core/Mage/Poll/sql/poll_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Poll/sql/poll_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Poll - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Poll/sql/poll_setup/mysql4-upgrade-0.6.0-0.6.1.php b/app/code/core/Mage/Poll/sql/poll_setup/mysql4-upgrade-0.6.0-0.6.1.php index 8b24fe60f3..e70e038f42 100644 --- a/app/code/core/Mage/Poll/sql/poll_setup/mysql4-upgrade-0.6.0-0.6.1.php +++ b/app/code/core/Mage/Poll/sql/poll_setup/mysql4-upgrade-0.6.0-0.6.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Poll - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Poll/sql/poll_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/Poll/sql/poll_setup/mysql4-upgrade-0.7.1-0.7.2.php index 1d656bf2c8..4d26e07e24 100644 --- a/app/code/core/Mage/Poll/sql/poll_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/Poll/sql/poll_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Poll - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/ProductAlert/Block/Email/Abstract.php b/app/code/core/Mage/ProductAlert/Block/Email/Abstract.php index 40564472db..c6b9a17e85 100644 --- a/app/code/core/Mage/ProductAlert/Block/Email/Abstract.php +++ b/app/code/core/Mage/ProductAlert/Block/Email/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/ProductAlert/Block/Email/Price.php b/app/code/core/Mage/ProductAlert/Block/Email/Price.php index 6eb79414bf..034b1b4ead 100644 --- a/app/code/core/Mage/ProductAlert/Block/Email/Price.php +++ b/app/code/core/Mage/ProductAlert/Block/Email/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/ProductAlert/Block/Email/Stock.php b/app/code/core/Mage/ProductAlert/Block/Email/Stock.php index ea61a5247f..432914e98c 100644 --- a/app/code/core/Mage/ProductAlert/Block/Email/Stock.php +++ b/app/code/core/Mage/ProductAlert/Block/Email/Stock.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/ProductAlert/Block/Price.php b/app/code/core/Mage/ProductAlert/Block/Price.php index 7b6f8f840a..801454ed70 100644 --- a/app/code/core/Mage/ProductAlert/Block/Price.php +++ b/app/code/core/Mage/ProductAlert/Block/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/ProductAlert/Block/Stock.php b/app/code/core/Mage/ProductAlert/Block/Stock.php index bb7f24a5a6..bdc502a9c3 100644 --- a/app/code/core/Mage/ProductAlert/Block/Stock.php +++ b/app/code/core/Mage/ProductAlert/Block/Stock.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/ProductAlert/Helper/Data.php b/app/code/core/Mage/ProductAlert/Helper/Data.php index 7d6f8e11ae..b39bf1a52c 100644 --- a/app/code/core/Mage/ProductAlert/Helper/Data.php +++ b/app/code/core/Mage/ProductAlert/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/ProductAlert/Model/Email.php b/app/code/core/Mage/ProductAlert/Model/Email.php index 2a2daa0f61..64bd21c348 100644 --- a/app/code/core/Mage/ProductAlert/Model/Email.php +++ b/app/code/core/Mage/ProductAlert/Model/Email.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/ProductAlert/Model/Mysql4/Price.php b/app/code/core/Mage/ProductAlert/Model/Mysql4/Price.php index 66c3a15160..fb3c1ab042 100644 --- a/app/code/core/Mage/ProductAlert/Model/Mysql4/Price.php +++ b/app/code/core/Mage/ProductAlert/Model/Mysql4/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/ProductAlert/Model/Mysql4/Price/Collection.php b/app/code/core/Mage/ProductAlert/Model/Mysql4/Price/Collection.php index e14809c15b..06f69fadbb 100644 --- a/app/code/core/Mage/ProductAlert/Model/Mysql4/Price/Collection.php +++ b/app/code/core/Mage/ProductAlert/Model/Mysql4/Price/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/ProductAlert/Model/Mysql4/Price/Customer/Collection.php b/app/code/core/Mage/ProductAlert/Model/Mysql4/Price/Customer/Collection.php index d1a9e029d1..079fe76798 100644 --- a/app/code/core/Mage/ProductAlert/Model/Mysql4/Price/Customer/Collection.php +++ b/app/code/core/Mage/ProductAlert/Model/Mysql4/Price/Customer/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/ProductAlert/Model/Mysql4/Stock.php b/app/code/core/Mage/ProductAlert/Model/Mysql4/Stock.php index 65903633e0..e4be42e27e 100644 --- a/app/code/core/Mage/ProductAlert/Model/Mysql4/Stock.php +++ b/app/code/core/Mage/ProductAlert/Model/Mysql4/Stock.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/ProductAlert/Model/Mysql4/Stock/Collection.php b/app/code/core/Mage/ProductAlert/Model/Mysql4/Stock/Collection.php index 7d4d9b8b94..22eeeaf304 100644 --- a/app/code/core/Mage/ProductAlert/Model/Mysql4/Stock/Collection.php +++ b/app/code/core/Mage/ProductAlert/Model/Mysql4/Stock/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/ProductAlert/Model/Mysql4/Stock/Customer/Collection.php b/app/code/core/Mage/ProductAlert/Model/Mysql4/Stock/Customer/Collection.php index 2da5ffa130..7f5b367c17 100644 --- a/app/code/core/Mage/ProductAlert/Model/Mysql4/Stock/Customer/Collection.php +++ b/app/code/core/Mage/ProductAlert/Model/Mysql4/Stock/Customer/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/ProductAlert/Model/Observer.php b/app/code/core/Mage/ProductAlert/Model/Observer.php index c2d55dca74..6390bcb13c 100644 --- a/app/code/core/Mage/ProductAlert/Model/Observer.php +++ b/app/code/core/Mage/ProductAlert/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/ProductAlert/Model/Price.php b/app/code/core/Mage/ProductAlert/Model/Price.php index 22fd35b4f2..ac1c3d8d74 100644 --- a/app/code/core/Mage/ProductAlert/Model/Price.php +++ b/app/code/core/Mage/ProductAlert/Model/Price.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/ProductAlert/Model/Stock.php b/app/code/core/Mage/ProductAlert/Model/Stock.php index a7f2031a30..9a64a3b697 100644 --- a/app/code/core/Mage/ProductAlert/Model/Stock.php +++ b/app/code/core/Mage/ProductAlert/Model/Stock.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/ProductAlert/controllers/AddController.php b/app/code/core/Mage/ProductAlert/controllers/AddController.php index 29f3504225..e2bbc8cf4f 100644 --- a/app/code/core/Mage/ProductAlert/controllers/AddController.php +++ b/app/code/core/Mage/ProductAlert/controllers/AddController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -65,7 +65,7 @@ public function priceAction() $product = Mage::getModel('catalog/product')->load($productId); if (!$product->getId()) { /* @var $product Mage_Catalog_Model_Product */ - $session->addError($this->__('Not enough parameters')); + $session->addError($this->__('Not enough parameters.')); $this->_redirectUrl($backUrl); return ; } @@ -77,10 +77,10 @@ public function priceAction() ->setPrice($product->getFinalPrice()) ->setWebsiteId(Mage::app()->getStore()->getWebsiteId()); $model->save(); - $session->addSuccess($this->__('Alert subscription was saved successfully')); + $session->addSuccess($this->__('The alert subscription has been saved.')); } catch (Exception $e) { - $session->addException($e, $this->__('Please try again later')); + $session->addException($e, $this->__('Unable to update the alert subscription.')); } $this->_redirectReferer(); } @@ -98,7 +98,7 @@ public function stockAction() if (!$product = Mage::getModel('catalog/product')->load($productId)) { /* @var $product Mage_Catalog_Model_Product */ - $session->addError($this->__('Not enough parameters')); + $session->addError($this->__('Not enough parameters.')); $this->_redirectUrl($backUrl); return ; } @@ -109,10 +109,10 @@ public function stockAction() ->setProductId($product->getId()) ->setWebsiteId(Mage::app()->getStore()->getWebsiteId()); $model->save(); - $session->addSuccess($this->__('Alert subscription was saved successfully')); + $session->addSuccess($this->__('Alert subscription has been saved.')); } catch (Exception $e) { - $session->addException($e, $this->__('Please try again later')); + $session->addException($e, $this->__('Unable to update the alert subscription.')); } $this->_redirectReferer(); } diff --git a/app/code/core/Mage/ProductAlert/controllers/UnsubscribeController.php b/app/code/core/Mage/ProductAlert/controllers/UnsubscribeController.php index 38782f306d..bf86ace58c 100644 --- a/app/code/core/Mage/ProductAlert/controllers/UnsubscribeController.php +++ b/app/code/core/Mage/ProductAlert/controllers/UnsubscribeController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -60,7 +60,7 @@ public function priceAction() $product = Mage::getModel('catalog/product')->load($productId); if (!$product->getId() || !$product->isVisibleInCatalog()) { /* @var $product Mage_Catalog_Model_Product */ - Mage::getSingleton('customer/session')->addError($this->__('Product not found')); + Mage::getSingleton('customer/session')->addError($this->__('The product is not found.')); $this->_redirect('customer/account/'); return ; } @@ -75,10 +75,10 @@ public function priceAction() $model->delete(); } - $session->addSuccess($this->__('Alert subscription was deleted successfully')); + $session->addSuccess($this->__('The alert subscription has been deleted.')); } catch (Exception $e) { - $session->addException($e, $this->__('Please try again later')); + $session->addException($e, $this->__('Unable to update the alert subscription.')); } $this->_redirectUrl($product->getProductUrl()); } @@ -93,10 +93,10 @@ public function priceAllAction() $session->getCustomerId(), Mage::app()->getStore()->getWebsiteId() ); - $session->addSuccess($this->__('You will no longer receive price alerts for this product')); + $session->addSuccess($this->__('You will no longer receive price alerts for this product.')); } catch (Exception $e) { - $session->addException($e, $this->__('Please try again later')); + $session->addException($e, $this->__('Unable to update the alert subscription.')); } $this->_redirect('customer/account/'); } @@ -115,7 +115,7 @@ public function stockAction() $product = Mage::getModel('catalog/product')->load($productId); /* @var $product Mage_Catalog_Model_Product */ if (!$product->getId() || !$product->isVisibleInCatalog()) { - Mage::getSingleton('customer/session')->addError($this->__('Product not found')); + Mage::getSingleton('customer/session')->addError($this->__('The product was not found.')); $this->_redirect('customer/account/'); return ; } @@ -129,10 +129,10 @@ public function stockAction() if ($model->getId()) { $model->delete(); } - $session->addSuccess($this->__('You will no longer receive stock alerts for this product')); + $session->addSuccess($this->__('You will no longer receive stock alerts for this product.')); } catch (Exception $e) { - $session->addException($e, $this->__('Please try again later')); + $session->addException($e, $this->__('Unable to update the alert subscription.')); } $this->_redirectUrl($product->getProductUrl()); } @@ -147,10 +147,10 @@ public function stockAllAction() $session->getCustomerId(), Mage::app()->getStore()->getWebsiteId() ); - $session->addSuccess($this->__('You will no longer receive stock alerts')); + $session->addSuccess($this->__('You will no longer receive stock alerts.')); } catch (Exception $e) { - $session->addException($e, $this->__('Please try again later')); + $session->addException($e, $this->__('Unable to update the alert subscription.')); } $this->_redirect('customer/account/'); } diff --git a/app/code/core/Mage/ProductAlert/etc/config.xml b/app/code/core/Mage/ProductAlert/etc/config.xml index abf9a2eeab..87b96d11b6 100644 --- a/app/code/core/Mage/ProductAlert/etc/config.xml +++ b/app/code/core/Mage/ProductAlert/etc/config.xml @@ -1,4 +1,4 @@ - + diff --git a/app/code/core/Mage/ProductAlert/etc/system.xml b/app/code/core/Mage/ProductAlert/etc/system.xml index 8462f64d2d..c61b71b9a1 100644 --- a/app/code/core/Mage/ProductAlert/etc/system.xml +++ b/app/code/core/Mage/ProductAlert/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -38,7 +38,7 @@ 1 - + select adminhtml/system_config_source_yesno 1 @@ -47,7 +47,7 @@ 1 - + select adminhtml/system_config_source_yesno 3 @@ -57,7 +57,7 @@ - + select adminhtml/system_config_source_email_template 2 @@ -66,7 +66,7 @@ 1 - + select adminhtml/system_config_source_email_template 4 diff --git a/app/code/core/Mage/ProductAlert/sql/productalert_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/ProductAlert/sql/productalert_setup/mysql4-install-0.7.0.php index 56f196c382..c6ff144a03 100644 --- a/app/code/core/Mage/ProductAlert/sql/productalert_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/ProductAlert/sql/productalert_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/ProductAlert/sql/productalert_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/ProductAlert/sql/productalert_setup/mysql4-upgrade-0.7.1-0.7.2.php index b3bb5d020e..b523687166 100644 --- a/app/code/core/Mage/ProductAlert/sql/productalert_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/ProductAlert/sql/productalert_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_ProductAlert - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Protx/Block/Standard/Failure.php b/app/code/core/Mage/Protx/Block/Standard/Failure.php new file mode 100644 index 0000000000..3116d652a0 --- /dev/null +++ b/app/code/core/Mage/Protx/Block/Standard/Failure.php @@ -0,0 +1,56 @@ + + */ + +class Mage_Protx_Block_Standard_Failure extends Mage_Core_Block_Template +{ + /** + * Return StatusDetail field value from Response + * + * @return string + */ + public function getErrorMessage () + { + $error = Mage::getSingleton('checkout/session')->getErrorMessage(); + Mage::getSingleton('checkout/session')->unsErrorMessage(); + return $error; + } + + /** + * Get continue shopping url + */ + public function getContinueShoppingUrl() + { + return Mage::getUrl('checkout/cart'); + } +} diff --git a/app/code/core/Mage/Protx/Block/Standard/Form.php b/app/code/core/Mage/Protx/Block/Standard/Form.php new file mode 100644 index 0000000000..a5f40c0507 --- /dev/null +++ b/app/code/core/Mage/Protx/Block/Standard/Form.php @@ -0,0 +1,43 @@ + + */ + +class Mage_Protx_Block_Standard_Form extends Mage_Payment_Block_Form +{ + protected function _construct() + { + $this->setTemplate('protx/standard/form.phtml'); + parent::_construct(); + } +} diff --git a/app/code/core/Mage/Protx/Block/Standard/Redirect.php b/app/code/core/Mage/Protx/Block/Standard/Redirect.php new file mode 100644 index 0000000000..08a42fee4c --- /dev/null +++ b/app/code/core/Mage/Protx/Block/Standard/Redirect.php @@ -0,0 +1,58 @@ + + */ + +class Mage_Protx_Block_Standard_Redirect extends Mage_Core_Block_Abstract +{ + protected function _toHtml() + { + $standard = Mage::getModel('protx/standard'); + $form = new Varien_Data_Form(); + $form->setAction($standard->getProtxUrl()) + ->setId('protx_standard_checkout') + ->setName('protx_standard_checkout') + ->setMethod('POST') + ->setUseContainer(true); + foreach ($standard->setOrder($this->getOrder())->getStandardCheckoutFormFields() as $field => $value) { + $form->addField($field, 'hidden', array('name' => $field, 'value' => $value)); + } + $html = ''; + $html.= $this->__('You will be redirected to protx in a few seconds.'); + $html.= $form->toHtml(); + $html.= ''; + $html.= ''; + + return $html; + } +} diff --git a/app/code/core/Mage/Protx/Helper/Data.php b/app/code/core/Mage/Protx/Helper/Data.php new file mode 100644 index 0000000000..dbfcbbe300 --- /dev/null +++ b/app/code/core/Mage/Protx/Helper/Data.php @@ -0,0 +1,38 @@ + + */ +class Mage_Protx_Helper_Data extends Mage_Core_Helper_Abstract +{ + +} diff --git a/app/code/core/Mage/Protx/Model/Api/Debug.php b/app/code/core/Mage/Protx/Model/Api/Debug.php new file mode 100644 index 0000000000..1cab4969b7 --- /dev/null +++ b/app/code/core/Mage/Protx/Model/Api/Debug.php @@ -0,0 +1,41 @@ + + */ +class Mage_Protx_Model_Api_Debug extends Mage_Core_Model_Abstract +{ + protected function _construct() + { + $this->_init('protx/api_debug'); + } +} diff --git a/app/code/core/Mage/Protx/Model/Config.php b/app/code/core/Mage/Protx/Model/Config.php new file mode 100644 index 0000000000..cafb36131f --- /dev/null +++ b/app/code/core/Mage/Protx/Model/Config.php @@ -0,0 +1,179 @@ + + */ + +class Mage_Protx_Model_Config extends Varien_Object +{ + const MODE_SIMULATOR = 'SIMULATOR'; + const MODE_TEST = 'TEST'; + const MODE_LIVE = 'LIVE'; + + const PAYMENT_TYPE_PAYMENT = 'PAYMENT'; + const PAYMENT_TYPE_DEFERRED = 'DEFERRED'; + const PAYMENT_TYPE_AUTHENTICATE = 'AUTHENTICATE'; + const PAYMENT_TYPE_AUTHORISE = 'AUTHORISE'; + + + /** + * Return config var + * + * @param string Var key + * @param string Default value for non-existing key + * @return mixed + */ + public function getConfigData($key, $default=false) + { + if (!$this->hasData($key)) { + $value = Mage::getStoreConfig('payment/protx_standard/'.$key); + if (is_null($value) || false===$value) { + $value = $default; + } + $this->setData($key, $value); + } + return $this->getData($key); + } + + /** + * Return Protocol version + * + * @return string Protocol version + */ + public function getVersion () + { + return '2.22'; + } + + /** + * Return Store description sent to Protx + * + * @return string Description + */ + public function getDescription () + { + return $this->getConfigData('description'); + } + + /** + * Return Protx registered merchant account name + * + * @return string Merchant account name + */ + public function getVendorName () + { + return $this->getConfigData('vendor_name'); + } + + /** + * Return Protx merchant password + * + * @return string Merchant password + */ + public function getVendorPassword () + { + return $this->getConfigData('vendor_password'); + } + + /** + * Return preferred payment type (see SELF::PAYMENT_TYPE_* constants) + * + * @return string payment type + */ + public function getPaymentType () + { + return $this->getConfigData('payment_action'); + } + + /** + * Return working mode (see SELF::MODE_* constants) + * + * @return string Working mode + */ + public function getMode () + { + return $this->getConfigData('mode'); + } + + /** + * Return new order status + * + * @return string New order status + */ + public function getNewOrderStatus () + { + return $this->getConfigData('order_status'); + } + + /** + * Return debug flag + * + * @return boolean Debug flag (0/1) + */ + public function getDebug () + { + return $this->getConfigData('debug_flag'); + } + + /** + * Return key for simple XOR crypt, using Vendor encrypted password by Protx + * + * @return string Key for simple XOR crypt + */ + public function getCryptKey () + { + return $this->getVendorPassword(); + } + + /** + * Returns status of vendore notification + * + * @return bool + */ + public function getVendorNotification() + { + return $this->getConfigData('vendor_notification'); + } + + /** + * Returns status of vendore email + * + * @return bool + */ + public function getVendorEmail() + { + if ($email = $this->getConfigData('vendor_email')) { + return $email; + } else { + return Mage::getStoreConfig('trans_email/ident_general/email'); + } + } +} diff --git a/app/code/core/Mage/Protx/Model/Mysql4/Api/Debug.php b/app/code/core/Mage/Protx/Model/Mysql4/Api/Debug.php new file mode 100644 index 0000000000..7a11706de6 --- /dev/null +++ b/app/code/core/Mage/Protx/Model/Mysql4/Api/Debug.php @@ -0,0 +1,42 @@ + + */ + +class Mage_Protx_Model_Mysql4_Api_Debug extends Mage_Core_Model_Mysql4_Abstract +{ + protected function _construct() + { + $this->_init('protx/api_debug', 'transaction_id'); + } +} diff --git a/app/code/core/Mage/Protx/Model/Mysql4/Api/Debug/Collection.php b/app/code/core/Mage/Protx/Model/Mysql4/Api/Debug/Collection.php new file mode 100644 index 0000000000..e8ab637450 --- /dev/null +++ b/app/code/core/Mage/Protx/Model/Mysql4/Api/Debug/Collection.php @@ -0,0 +1,41 @@ + + */ +class Mage_Protx_Model_Mysql4_Api_Debug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract +{ + protected function _construct() + { + $this->_init('protx/api_debug'); + } +} diff --git a/app/code/core/Mage/Protx/Model/Mysql4/Setup.php b/app/code/core/Mage/Protx/Model/Mysql4/Setup.php new file mode 100644 index 0000000000..48cafa2669 --- /dev/null +++ b/app/code/core/Mage/Protx/Model/Mysql4/Setup.php @@ -0,0 +1,39 @@ + + */ + +class Mage_Protx_Model_Mysql4_Setup extends Mage_Sales_Model_Mysql4_Setup +{ + +} diff --git a/app/code/core/Mage/Protx/Model/Session.php b/app/code/core/Mage/Protx/Model/Session.php new file mode 100644 index 0000000000..89a5f1ca73 --- /dev/null +++ b/app/code/core/Mage/Protx/Model/Session.php @@ -0,0 +1,42 @@ + + */ + +class Mage_Protx_Model_Session extends Mage_Core_Model_Session_Abstract +{ + public function __construct() + { + $this->init('protx'); + } +} diff --git a/app/code/core/Mage/Protx/Model/Source/ModeAction.php b/app/code/core/Mage/Protx/Model/Source/ModeAction.php new file mode 100644 index 0000000000..3177836d8c --- /dev/null +++ b/app/code/core/Mage/Protx/Model/Source/ModeAction.php @@ -0,0 +1,49 @@ + + */ + +class Mage_Protx_Model_Source_ModeAction +{ + public function toOptionArray() + { + return array( + array('value' => Mage_Protx_Model_Config::MODE_SIMULATOR, 'label' => Mage::helper('protx')->__('Simulator')), + array('value' => Mage_Protx_Model_Config::MODE_TEST, 'label' => Mage::helper('protx')->__('Test')), + array('value' => Mage_Protx_Model_Config::MODE_LIVE, 'label' => Mage::helper('protx')->__('Live')), + ); + } +} + + + diff --git a/app/code/core/Mage/Protx/Model/Source/PaymentAction.php b/app/code/core/Mage/Protx/Model/Source/PaymentAction.php new file mode 100644 index 0000000000..f9709f621f --- /dev/null +++ b/app/code/core/Mage/Protx/Model/Source/PaymentAction.php @@ -0,0 +1,46 @@ + + */ + +class Mage_Protx_Model_Source_PaymentAction +{ + public function toOptionArray() + { + return array( + array('value' => Mage_Protx_Model_Config::PAYMENT_TYPE_PAYMENT, 'label' => Mage::helper('protx')->__('PAYMENT')), + array('value' => Mage_Protx_Model_Config::PAYMENT_TYPE_DEFERRED, 'label' => Mage::helper('protx')->__('DEFERRED')), + array('value' => Mage_Protx_Model_Config::PAYMENT_TYPE_AUTHENTICATE, 'label' => Mage::helper('protx')->__('AUTHENTICATE')), + ); + } +} diff --git a/app/code/core/Mage/Protx/Model/Standard.php b/app/code/core/Mage/Protx/Model/Standard.php new file mode 100644 index 0000000000..5aa634faec --- /dev/null +++ b/app/code/core/Mage/Protx/Model/Standard.php @@ -0,0 +1,462 @@ + + */ +class Mage_Protx_Model_Standard extends Mage_Payment_Model_Method_Abstract +{ + protected $_code = 'protx_standard'; + protected $_formBlockType = 'protx/standard_form'; + + protected $_isGateway = false; + protected $_canAuthorize = true; + protected $_canCapture = true; + protected $_canCapturePartial = false; + protected $_canRefund = false; + protected $_canVoid = false; + protected $_canUseInternal = false; + protected $_canUseCheckout = true; + protected $_canUseForMultishipping = false; + + protected $_order = null; + + + /** + * Get Config model + * + * @return object Mage_Protx_Model_Config + */ + public function getConfig() + { + return Mage::getSingleton('protx/config'); + } + + /** + * @deprecated after 1.4.1.0 + * + * @return boolean + */ + public function getDebug () + { + return $this->getDebugFlag(); + } + + /** + * Returns Target URL + * + * @return string Target URL + */ + public function getProtxUrl () + { + switch ($this->getConfig()->getMode()) { + case Mage_Protx_Model_Config::MODE_LIVE: + $url = 'https://ukvps.protx.com/vspgateway/service/vspform-register.vsp'; + break; + case Mage_Protx_Model_Config::MODE_TEST: + $url = 'https://ukvpstest.protx.com/vspgateway/service/vspform-register.vsp'; + break; + default: // simulator mode + $url = 'https://ukvpstest.protx.com/VSPSimulator/VSPFormGateway.asp'; + break; + } + return $url; + } + + /** + * Return URL for Protx success response + * + * @return string URL + */ + protected function getSuccessURL () + { + return Mage::getUrl('protx/standard/successresponse'); + } + + /** + * Return URL for Protx failure response + * + * @return string URL + */ + protected function getFailureURL () + { + return Mage::getUrl('protx/standard/failureresponse'); + } + + /** + * Transaction unique ID sent to Protx and sent back by Protx for order restore + * Using created order ID + * + * @return string Transaction unique number + */ + protected function getVendorTxCode () + { + return $this->getOrder()->getRealOrderId(); + } + + /** + * Returns cart formatted + * String format: + * Number of lines:Name1:Quantity1:CostNoTax1:Tax1:CostTax1:Total1:Name2:Quantity2:CostNoTax2... + * + * @return string Formatted cart items + */ + protected function getFormattedCart () + { + $items = $this->getOrder()->getAllItems(); + $resultParts = array(); + $totalLines = 0; + if ($items) { + foreach($items as $item) { + if ($item->getParentItem()) { + continue; + } + $quantity = $item->getQtyOrdered(); + + $cost = sprintf('%.2f', $item->getBasePrice() - $item->getBaseDiscountAmount()); + $tax = sprintf('%.2f', $item->getBaseTaxAmount()); + $costPlusTax = sprintf('%.2f', $cost + $tax/$quantity); + + $totalCostPlusTax = sprintf('%.2f', $quantity * $cost + $tax); + + $resultParts[] = str_replace(':', ' ', $item->getName()); + $resultParts[] = $quantity; + $resultParts[] = $cost; + $resultParts[] = $tax; + $resultParts[] = $costPlusTax; + $resultParts[] = $totalCostPlusTax; + $totalLines++; //counting actual formatted items + } + } + + // add delivery + $shipping = $this->getOrder()->getBaseShippingAmount(); + if ((int)$shipping > 0) { + $totalLines++; + $resultParts = array_merge($resultParts, array('Shipping','','','','',sprintf('%.2f', $shipping))); + } + + $result = $totalLines . ':' . implode(':', $resultParts); + return $result; + } + + /** + * Format Crypted string with all order data for request to Protx + * + * @return string Crypted string + */ + protected function getCrypted () + { + $order = $this->getOrder(); + if (!($order instanceof Mage_Sales_Model_Order)) { + Mage::throwException($this->_getHelper()->__('Cannot retrieve order object')); + } + + $shipping = $order->getShippingAddress(); + $billing = $order->getBillingAddress(); + + $amount = $order->getBaseGrandTotal(); + + $currency = $order->getBaseCurrencyCode(); + + $queryPairs = array(); + + $transactionId = $this->getVendorTxCode(); + $queryPairs['VendorTxCode'] = $transactionId; + + + $queryPairs['Amount'] = sprintf('%.2f', $amount); + $queryPairs['Currency'] = $currency; + + // Up to 100 chars of free format description + $description = $this->getConfig()->getDescription() != '' + ? $this->getConfig()->getDescription() + : Mage::app()->getStore()->getFrontendName() . ' ' . ' payment'; + $queryPairs['Description'] = $description; + + $queryPairs['SuccessURL'] = $this->getSuccessURL(); + $queryPairs['FailureURL'] = $this->getFailureURL(); + + $queryPairs['CustomerName'] = $billing->getFirstname().' '.$billing->getLastname(); + $queryPairs['CustomerEMail'] = $order->getCustomerEmail(); + $queryPairs['ContactNumber'] = $billing->getTelephone(); + $queryPairs['ContactFax'] = $billing->getFax(); + + if ($this->getConfig()->getVendorNotification()) { + $queryPairs['VendorEMail'] = $this->getConfig()->getVendorEmail(); + } else { + $queryPairs['VendorEMail'] = ''; + } + + $queryPairs['eMailMessage'] = ''; + + $queryPairs['BillingAddress'] = $billing->format('oneline'); + $queryPairs['BillingPostCode'] = $billing->getPostcode(); + + if ($shipping) { + $queryPairs['DeliveryAddress'] = $shipping->getFormated(); + $queryPairs['DeliveryPostCode'] = $shipping->getPostcode(); + } else { + $queryPairs['DeliveryAddress'] = ''; + $queryPairs['DeliveryPostCode'] = ''; + } + + $queryPairs['Basket'] = $this->getFormattedCart(); + + // For charities registered for Gift Aid + $queryPairs['AllowGiftAid'] = '0'; + + /** + * Allow fine control over AVS/CV2 checks and rules by changing this value. 0 is Default + * It can be changed dynamically, per transaction, if you wish. See the VSP Server Protocol document + */ + if ($this->getConfig()->getPaymentType() !== Mage_Protx_Model_Config::PAYMENT_TYPE_AUTHENTICATE) { + $queryPairs['ApplyAVSCV2'] = '0'; + } + + /** + * Allow fine control over 3D-Secure checks and rules by changing this value. 0 is Default + * It can be changed dynamically, per transaction, if you wish. See the VSP Server Protocol document + */ + $queryPairs['Apply3DSecure'] = '0'; + + $this->_debug(array('request' => $queryPairs)); + + // Encrypt the plaintext string for inclusion in the hidden field + $result = $this->arrayToCrypt($queryPairs); + return $result; + } + + /** + * Form block description + * + * @return object + */ + public function createFormBlock($name) + { + $block = $this->getLayout()->createBlock('protx/form_standard', $name); + $block->setMethod($this->_code); + $block->setPayment($this->getPayment()); + return $block; + } + + /** + * Return Order Place Redirect URL + * + * @return string Order Redirect URL + */ + public function getOrderPlaceRedirectUrl() + { + return Mage::getUrl('protx/standard/redirect'); + } + + /** + * Return encrypted string with simple XOR algorithm + * + * @param string String to be encrypted + * @return string Encrypted string + */ + protected function simpleXOR ($string) + { + $result = ''; + $cryptKey = $this->getConfig()->getCryptKey(); + + if (!$cryptKey) { + return $string; + } + + // Initialise key array + $keyList = array(); + + // Convert $cryptKey into array of ASCII values + for($i = 0; $i < strlen($cryptKey); $i++){ + $keyList[$i] = ord(substr($cryptKey, $i, 1)); + } + + // Step through string a character at a time + for($i = 0; $i < strlen($string); $i++) { + /** + * Get ASCII code from string, get ASCII code from key (loop through with MOD), + * XOR the two, get the character from the result + * % is MOD (modulus), ^ is XOR + */ + $result .= chr(ord(substr($string, $i, 1)) ^ ($keyList[$i % strlen($cryptKey)])); + } + return $result; + } + + /** + * Extract possible response values into array from query string + * + * @param string Query string i.e. var1=value1&var2=value3... + * @return array + */ + protected function getToken($queryString) { + + // List the possible tokens + $Tokens = array( + "Status", + "StatusDetail", + "VendorTxCode", + "VPSTxId", + "TxAuthNo", + "Amount", + "AVSCV2", + "AddressResult", + "PostCodeResult", + "CV2Result", + "GiftAid", + "3DSecureStatus", + "CAVV" + ); + + // Initialise arrays + $output = array(); + $resultArray = array(); + + // Get the next token in the sequence + $c = count($Tokens); + for ($i = $c - 1; $i >= 0 ; $i--){ + // Find the position in the string + $start = strpos($queryString, $Tokens[$i]); + // If it's present + if ($start !== false){ + // Record position and token name + $resultArray[$i]['start'] = $start; + $resultArray[$i]['token'] = $Tokens[$i]; + } + } + + // Sort in order of position + sort($resultArray); + + // Go through the result array, getting the token values + $c = count($resultArray); + for ($i = 0; $i < $c; $i++){ + // Get the start point of the value + $valueStart = $resultArray[$i]['start'] + strlen($resultArray[$i]['token']) + 1; + // Get the length of the value + if ($i == $c-1) { + $output[$resultArray[$i]['token']] = substr($queryString, $valueStart); + } else { + $valueLength = $resultArray[$i+1]['start'] - $resultArray[$i]['start'] - strlen($resultArray[$i]['token']) - 2; + $output[$resultArray[$i]['token']] = substr($queryString, $valueStart, $valueLength); + } + + } + + return $output; + } + + /** + * Convert array (key => value, key => value, ...) to crypt string + * + * @param array Array to be converted + * @return string Crypt string + */ + public function arrayToCrypt ($array) + { + $parts = array(); + if (is_array($array)) { + foreach ($array as $k => $v) { + $parts[] = $k . '=' . $v; + } + } + $result = implode('&', $parts); + $result = $this->simpleXOR($result); + $result = $this->base64Encode($result); + return $result; + } + + /** + * Reverse arrayToCrypt + * + * @param string Crypt string + * @return array + */ + public function cryptToArray ($crypted) + { + $decoded = $this->base64Decode($crypted); + $uncrypted = $this->simpleXOR($decoded); + $tokens = $this->getToken($uncrypted); + return $tokens; + } + + /** + * Custom base64_encode() + * + * @param String + * @return String + */ + protected function base64Encode($plain) + { + return base64_encode($plain); + } + + /** + * Custom base64_decode() + * + * @param String + * @return String + */ + protected function base64Decode($scrambled) + { + // Fix plus to space conversion issue + $scrambled = str_replace(" ","+",$scrambled); + return base64_decode($scrambled); + } + + /** + * Return Standard Checkout Form Fields for request to Protx + * + * @return array Array of hidden form fields + */ + public function getStandardCheckoutFormFields () + { + $fields = array( + 'VPSProtocol' => $this->getConfig()->getVersion(), + 'TxType' => $this->getConfig()->getPaymentType(), + 'Vendor' => $this->getConfig()->getVendorName(), + 'Crypt' => $this->getCrypted() + ); + return $fields; + } + + /** + * Define if debugging is enabled + * + * @return bool + */ + public function getDebugFlag() + { + return $this->getConfigData('debug_flag'); + } +} diff --git a/app/code/core/Mage/Protx/controllers/StandardController.php b/app/code/core/Mage/Protx/controllers/StandardController.php new file mode 100644 index 0000000000..297b9a305f --- /dev/null +++ b/app/code/core/Mage/Protx/controllers/StandardController.php @@ -0,0 +1,271 @@ + + */ +class Mage_Protx_StandardController extends Mage_Core_Controller_Front_Action +{ + public $isValidResponse = false; + + /** + * Get singleton with protx strandard + * + * @return object Mage_Protx_Model_Standard + */ + public function getStandard() + { + return Mage::getSingleton('protx/standard'); + } + + /** + * Get Config model + * + * @return object Mage_Protx_Model_Config + */ + public function getConfig() + { + return $this->getStandard()->getConfig(); + } + + /** + * @deprecated after 1.4.1.0 + * + * @return boolean + */ + public function getDebug() + { + return $this->getStandard()->getDebugFlag(); + } + + /** + * When a customer chooses Protx on Checkout/Payment page + * + */ + public function redirectAction() + { + $session = Mage::getSingleton('checkout/session'); + $session->setProtxStandardQuoteId($session->getQuoteId()); + + $order = Mage::getModel('sales/order'); + $order->loadByIncrementId($session->getLastRealOrderId()); + $order->addStatusToHistory( + $order->getStatus(), + Mage::helper('protx')->__('Customer was redirected to Protx') + ); + $order->save(); + + $this->getResponse() + ->setBody($this->getLayout() + ->createBlock('protx/standard_redirect') + ->setOrder($order) + ->toHtml()); + + $session->unsQuoteId(); + } + + /** + * Success response from Protx + */ + public function successResponseAction() + { + $this->preResponse(); + + if (!$this->isValidResponse) { + $this->_redirect(''); + return ; + } + + $transactionId = $this->responseArr['VendorTxCode']; + + $this->getStandard()->debugData(array('result' => $this->responseArr)); + + $order = Mage::getModel('sales/order'); + $order->loadByIncrementId($transactionId); + + if (!$order->getId()) { + /* + * need to have logic when there is no order with the order id from protx + */ + return false; + } + + $order->addStatusToHistory( + $order->getStatus(), + Mage::helper('protx')->__('The customer has returned from Protx.') + ); + + $order->sendNewOrderEmail(); + + $this->responseArr['Amount'] = str_replace(',', '', $this->responseArr['Amount']); + + if (sprintf('%.2f', $this->responseArr['Amount']) != sprintf('%.2f', $order->getBaseGrandTotal())) { + // cancel order + $order->cancel(); + $order->addStatusToHistory( + $order->getStatus(), + Mage::helper('protx')->__('Order total amount does not match protx gross total amount') + ); + } else { + $order->getPayment()->setTransactionId($this->responseArr['VPSTxId']); + + if ($this->getConfig()->getPaymentType() == Mage_Protx_Model_Config::PAYMENT_TYPE_PAYMENT) { + if ($this->saveInvoice($order)) { + $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true); + } else { + $newOrderStatus = $this->getConfig()->getNewOrderStatus() ? + $this->getConfig()->getNewOrderStatus() : Mage_Sales_Model_Order::STATE_NEW; + } + } else { + $order->addStatusToHistory( + $order->getStatus(), + Mage::helper('protx')->__($this->responseArr['StatusDetail']) + ); + } + } + + $order->save(); + + $session = Mage::getSingleton('checkout/session'); + $session->setQuoteId($session->getProtxStandardQuoteId(true)); + Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save(); + $this->_redirect('checkout/onepage/success'); + } + + /** + * Save invoice for order + * + * @param Mage_Sales_Model_Order $order + * @return boolean Can save invoice or not + */ + protected function saveInvoice (Mage_Sales_Model_Order $order) + { + if ($order->canInvoice()) { + $invoice = $order->prepareInvoice(); + + $invoice->register()->capture(); + Mage::getModel('core/resource_transaction') + ->addObject($invoice) + ->addObject($invoice->getOrder()) + ->save(); + return true; + } + + return false; + } + + /** + * Failure response from Protx + */ + public function failureResponseAction () + { + $this->preResponse(); + + if (!$this->isValidResponse) { + $this->_redirect(''); + return ; + } + + $transactionId = $this->responseArr['VendorTxCode']; + + $this->getStandard()->debugData(array('result' => $this->responseArr)); + + $order = Mage::getModel('sales/order'); + $order->loadByIncrementId($transactionId); + + if (!$order->getId()) { + /** + * need to have logic when there is no order with the order id from protx + */ + return false; + } + + // cancel order in anyway + $order->cancel(); + + $session = Mage::getSingleton('checkout/session'); + $session->setQuoteId($session->getProtxStandardQuoteId(true)); + + // Customer clicked CANCEL Butoon + if ($this->responseArr['Status'] == 'ABORT') { + $history = Mage::helper('protx')->__('The order %s was canceled by the customer.', $order->getId()); + $redirectTo = 'checkout/cart'; + } else { + $history = Mage::helper('protx')->__($this->responseArr['StatusDetail']); + $session->setErrorMessage($this->responseArr['StatusDetail']); + $redirectTo = 'protx/standard/failure'; + } + + $history = Mage::helper('protx')->__('The customer has returned from Protx.') . ' ' . $history; + $order->addStatusToHistory($order->getStatus(), $history); + $order->save(); + + $this->_redirect($redirectTo); + } + + /** + * Expected GET HTTP Method + */ + protected function preResponse () + { + $responseCryptString = $this->getRequest()->crypt; + + if ($responseCryptString != '') { + $rArr = $this->getStandard()->cryptToArray($responseCryptString); + $ok = is_array($rArr) + && isset($rArr['Status']) && $rArr['Status'] != '' + && isset($rArr['VendorTxCode']) && $rArr['VendorTxCode'] != '' + && isset($rArr['Amount']) && $rArr['Amount'] != ''; + + if ($ok) { + $this->responseArr = $rArr; + $this->isValidResponse = true; + } + } + } + + /** + * Failure Action + */ + public function failureAction () + { + $session = Mage::getSingleton('checkout/session'); + + if (!$session->getErrorMessage()) { + $this->_redirect('checkout/cart'); + return; + } + + $this->loadLayout(); + $this->_initLayoutMessages('protx/session'); + $this->renderLayout(); + } +} diff --git a/app/code/core/Mage/Protx/etc/config.xml b/app/code/core/Mage/Protx/etc/config.xml new file mode 100644 index 0000000000..430a306cb3 --- /dev/null +++ b/app/code/core/Mage/Protx/etc/config.xml @@ -0,0 +1,109 @@ + + + + + + 0.1.0 + + + + + + Mage_Protx_Model + protx_mysql4 + + + Mage_Protx_Model_Mysql4 + + protx_api_debug
        +
        +
        +
        + + + + Mage_Protx + + + + + Mage_Protx_Block + +
        + + + /protx/standard + + + + standard + + Mage_Protx + protx + + + + + + + + Mage_Protx.csv + + + + + + + + protx.xml + + + + + + + + + + Mage_Protx.csv + + + + + + + + + Payment + protx/standard + Protx Standard + 0 + + + +
        diff --git a/app/code/core/Mage/Protx/etc/system.xml b/app/code/core/Mage/Protx/etc/system.xml new file mode 100644 index 0000000000..56a311ff03 --- /dev/null +++ b/app/code/core/Mage/Protx/etc/system.xml @@ -0,0 +1,167 @@ + + + + + + + + + text + 101 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 1 + 1 + 1 + 0 + + + + select + protx/source_paymentAction + 2 + 1 + 1 + 0 + + + <label>Title</label> + <frontend_type>text</frontend_type> + <sort_order>3</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + Store name will be used if left empty. + text + 3 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_order_status_processing + 4 + 1 + 1 + 0 + + + + text + 5 + 1 + 1 + 0 + + + + text + 6 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 7 + 1 + 1 + 0 + + + + General contact email will be used if left empty. + text + 8 + 1 + 1 + 0 + + + + select + protx/source_modeAction + 9 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 10 + 1 + 1 + 0 + + + + allowspecific + 50 + adminhtml/system_config_source_payment_allspecificcountries + 1 + 1 + 0 + + + + multiselect + 51 + adminhtml/system_config_source_country + 1 + 1 + 0 + + + + text + 100 + 1 + 1 + 0 + + + + + + + diff --git a/app/code/core/Mage/Protx/sql/protx_setup/mysql4-install-0.1.0.php b/app/code/core/Mage/Protx/sql/protx_setup/mysql4-install-0.1.0.php new file mode 100644 index 0000000000..4da3e5c7d0 --- /dev/null +++ b/app/code/core/Mage/Protx/sql/protx_setup/mysql4-install-0.1.0.php @@ -0,0 +1,46 @@ +startSetup(); + +$installer->run(" +CREATE TABLE `{$this->getTable('protx_api_debug')}` ( + `debug_id` int(10) unsigned NOT NULL auto_increment, + `transaction_id` varchar(255) NOT NULL default '', + `debug_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `request_body` text, + `response_body` text, + PRIMARY KEY (`debug_id`), + KEY `debug_at` (`debug_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + "); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Rating/Block/Entity/Detailed.php b/app/code/core/Mage/Rating/Block/Entity/Detailed.php index d50e8cddc1..efa109ecc9 100644 --- a/app/code/core/Mage/Rating/Block/Entity/Detailed.php +++ b/app/code/core/Mage/Rating/Block/Entity/Detailed.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rating/Helper/Data.php b/app/code/core/Mage/Rating/Helper/Data.php index ba8713d61a..2ff7708ec8 100644 --- a/app/code/core/Mage/Rating/Helper/Data.php +++ b/app/code/core/Mage/Rating/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rating/Model/Mysql4/Rating.php b/app/code/core/Mage/Rating/Model/Mysql4/Rating.php index 62de1ad3f7..d94ac54dd6 100644 --- a/app/code/core/Mage/Rating/Model/Mysql4/Rating.php +++ b/app/code/core/Mage/Rating/Model/Mysql4/Rating.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rating/Model/Mysql4/Rating/Collection.php b/app/code/core/Mage/Rating/Model/Mysql4/Rating/Collection.php index 0029a6d5b4..dda67fc903 100644 --- a/app/code/core/Mage/Rating/Model/Mysql4/Rating/Collection.php +++ b/app/code/core/Mage/Rating/Model/Mysql4/Rating/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rating/Model/Mysql4/Rating/Entity.php b/app/code/core/Mage/Rating/Model/Mysql4/Rating/Entity.php index 226adcb6f2..86910af27b 100644 --- a/app/code/core/Mage/Rating/Model/Mysql4/Rating/Entity.php +++ b/app/code/core/Mage/Rating/Model/Mysql4/Rating/Entity.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rating/Model/Mysql4/Rating/Option.php b/app/code/core/Mage/Rating/Model/Mysql4/Rating/Option.php index 4427e0cc82..e17ca96034 100644 --- a/app/code/core/Mage/Rating/Model/Mysql4/Rating/Option.php +++ b/app/code/core/Mage/Rating/Model/Mysql4/Rating/Option.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rating/Model/Mysql4/Rating/Option/Collection.php b/app/code/core/Mage/Rating/Model/Mysql4/Rating/Option/Collection.php index f28a8e008b..4634175a4f 100644 --- a/app/code/core/Mage/Rating/Model/Mysql4/Rating/Option/Collection.php +++ b/app/code/core/Mage/Rating/Model/Mysql4/Rating/Option/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rating/Model/Mysql4/Rating/Option/Vote.php b/app/code/core/Mage/Rating/Model/Mysql4/Rating/Option/Vote.php index 56104d710e..46fd340bd4 100644 --- a/app/code/core/Mage/Rating/Model/Mysql4/Rating/Option/Vote.php +++ b/app/code/core/Mage/Rating/Model/Mysql4/Rating/Option/Vote.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rating/Model/Mysql4/Rating/Option/Vote/Collection.php b/app/code/core/Mage/Rating/Model/Mysql4/Rating/Option/Vote/Collection.php index 0ab99b6b10..d8739d7cd1 100644 --- a/app/code/core/Mage/Rating/Model/Mysql4/Rating/Option/Vote/Collection.php +++ b/app/code/core/Mage/Rating/Model/Mysql4/Rating/Option/Vote/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rating/Model/Observer.php b/app/code/core/Mage/Rating/Model/Observer.php index ae45fa0da2..8376607137 100644 --- a/app/code/core/Mage/Rating/Model/Observer.php +++ b/app/code/core/Mage/Rating/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rating/Model/Rating.php b/app/code/core/Mage/Rating/Model/Rating.php index 536d588841..2b174d1774 100644 --- a/app/code/core/Mage/Rating/Model/Rating.php +++ b/app/code/core/Mage/Rating/Model/Rating.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rating/Model/Rating/Entity.php b/app/code/core/Mage/Rating/Model/Rating/Entity.php index 2bf1c0dde0..0bccab681e 100644 --- a/app/code/core/Mage/Rating/Model/Rating/Entity.php +++ b/app/code/core/Mage/Rating/Model/Rating/Entity.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rating/Model/Rating/Option.php b/app/code/core/Mage/Rating/Model/Rating/Option.php index 58f500b4b0..ed2bf2b9cf 100644 --- a/app/code/core/Mage/Rating/Model/Rating/Option.php +++ b/app/code/core/Mage/Rating/Model/Rating/Option.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rating/Model/Rating/Option/Vote.php b/app/code/core/Mage/Rating/Model/Rating/Option/Vote.php index bbd238ccfd..e99c1c2f75 100644 --- a/app/code/core/Mage/Rating/Model/Rating/Option/Vote.php +++ b/app/code/core/Mage/Rating/Model/Rating/Option/Vote.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rating/etc/adminhtml.xml b/app/code/core/Mage/Rating/etc/adminhtml.xml index 96468f3e0b..a6001b36e1 100644 --- a/app/code/core/Mage/Rating/etc/adminhtml.xml +++ b/app/code/core/Mage/Rating/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Rating/etc/config.xml b/app/code/core/Mage/Rating/etc/config.xml index 169fc42777..e048957c6e 100644 --- a/app/code/core/Mage/Rating/etc/config.xml +++ b/app/code/core/Mage/Rating/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Rating/sql/rating_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Rating/sql/rating_setup/mysql4-install-0.7.0.php index be8205d02c..b834dcef3f 100644 --- a/app/code/core/Mage/Rating/sql/rating_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Rating/sql/rating_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rating/sql/rating_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/Rating/sql/rating_setup/mysql4-upgrade-0.7.0-0.7.1.php index 7b117c7575..3d8f69b225 100644 --- a/app/code/core/Mage/Rating/sql/rating_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/Rating/sql/rating_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rating/sql/rating_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/Rating/sql/rating_setup/mysql4-upgrade-0.7.1-0.7.2.php index 0f9d8252d6..9e41058742 100644 --- a/app/code/core/Mage/Rating/sql/rating_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/Rating/sql/rating_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rating - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Block/Product/Abstract.php b/app/code/core/Mage/Reports/Block/Product/Abstract.php index 6a2829be99..b7917bcd96 100644 --- a/app/code/core/Mage/Reports/Block/Product/Abstract.php +++ b/app/code/core/Mage/Reports/Block/Product/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -109,12 +109,17 @@ public function getItemsCollection() $this->_collection = $this->_getModel() ->getCollection() ->addAttributeToSelect($attributes) - ->addIndexFilter() ->excludeProductIds($this->_getModel()->getExcludeProductIds()) + ->addUrlRewrite() ->setAddedAtOrder() ->setPageSize($this->getPageSize()) ->setCurPage(1); - + $ids = $this->getProductIds(); + if (empty($ids)) { + $this->_collection->addIndexFilter(); + } else { + $this->_collection->addFilterByIds($ids); + } Mage::getSingleton('catalog/product_visibility') ->addVisibleInSiteFilterToCollection($this->_collection); } diff --git a/app/code/core/Mage/Reports/Block/Product/Compared.php b/app/code/core/Mage/Reports/Block/Product/Compared.php index 12332c2515..51f540b49f 100644 --- a/app/code/core/Mage/Reports/Block/Product/Compared.php +++ b/app/code/core/Mage/Reports/Block/Product/Compared.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Block/Product/Viewed.php b/app/code/core/Mage/Reports/Block/Product/Viewed.php index 6749f216d6..13b7e7dae6 100644 --- a/app/code/core/Mage/Reports/Block/Product/Viewed.php +++ b/app/code/core/Mage/Reports/Block/Product/Viewed.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -55,6 +55,18 @@ public function getPageSize() return Mage::getStoreConfig(self::XML_PATH_RECENTLY_VIEWED_COUNT); } + /** + * Added predefined ids support + */ + public function getCount() + { + $ids = $this->getProductIds(); + if (!empty($ids)) { + return count($ids); + } + return parent::getCount(); + } + /** * Prepare to html * check has viewed products @@ -66,9 +78,7 @@ protected function _toHtml() if (!$this->getCount()) { return ''; } - $this->setRecentlyViewedProducts($this->getItemsCollection()); - return parent::_toHtml(); } } diff --git a/app/code/core/Mage/Reports/Block/Product/Widget/Compared.php b/app/code/core/Mage/Reports/Block/Product/Widget/Compared.php index 5bd1cf817a..a38ad80520 100644 --- a/app/code/core/Mage/Reports/Block/Product/Widget/Compared.php +++ b/app/code/core/Mage/Reports/Block/Product/Widget/Compared.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Block/Product/Widget/Viewed.php b/app/code/core/Mage/Reports/Block/Product/Widget/Viewed.php index 275a8be364..dae845198d 100644 --- a/app/code/core/Mage/Reports/Block/Product/Widget/Viewed.php +++ b/app/code/core/Mage/Reports/Block/Product/Widget/Viewed.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Exception.php b/app/code/core/Mage/Reports/Exception.php index 6497b1db23..ac2e6372bd 100644 --- a/app/code/core/Mage/Reports/Exception.php +++ b/app/code/core/Mage/Reports/Exception.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Helper/Data.php b/app/code/core/Mage/Reports/Helper/Data.php index ed0c43d440..89f1f3c09f 100644 --- a/app/code/core/Mage/Reports/Helper/Data.php +++ b/app/code/core/Mage/Reports/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -47,7 +47,7 @@ public function getIntervals($from, $to, $period = self::REPORT_PERIOD_TYPE_DAY) return $intervals; } - $start = Mage::app()->getLocale()->date($from, Varien_Date::DATE_INTERNAL_FORMAT); + $start = new Zend_Date($from, Varien_Date::DATE_INTERNAL_FORMAT); if ($period == self::REPORT_PERIOD_TYPE_DAY) { $dateStart = $start; @@ -61,7 +61,7 @@ public function getIntervals($from, $to, $period = self::REPORT_PERIOD_TYPE_DAY) $dateStart = new Zend_Date(date("Y", $start->getTimestamp()), Varien_Date::DATE_INTERNAL_FORMAT); } - $dateEnd = Mage::app()->getLocale()->date($to, Varien_Date::DATE_INTERNAL_FORMAT); + $dateEnd = new Zend_Date($to, Varien_Date::DATE_INTERNAL_FORMAT); while ($dateStart->compare($dateEnd) <= 0) { switch ($period) { diff --git a/app/code/core/Mage/Reports/Model/Config.php b/app/code/core/Mage/Reports/Model/Config.php index 29c8ed5d07..2e285edf5e 100644 --- a/app/code/core/Mage/Reports/Model/Config.php +++ b/app/code/core/Mage/Reports/Model/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Event.php b/app/code/core/Mage/Reports/Model/Event.php index 0ff822080e..3a1ad681e6 100644 --- a/app/code/core/Mage/Reports/Model/Event.php +++ b/app/code/core/Mage/Reports/Model/Event.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Event/Observer.php b/app/code/core/Mage/Reports/Model/Event/Observer.php index 3430f7f65b..636abbe802 100644 --- a/app/code/core/Mage/Reports/Model/Event/Observer.php +++ b/app/code/core/Mage/Reports/Model/Event/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Event/Type.php b/app/code/core/Mage/Reports/Model/Event/Type.php index ce3d9c432b..a9493156c3 100644 --- a/app/code/core/Mage/Reports/Model/Event/Type.php +++ b/app/code/core/Mage/Reports/Model/Event/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Flag.php b/app/code/core/Mage/Reports/Model/Flag.php index c87fc7efe6..3a883692f0 100644 --- a/app/code/core/Mage/Reports/Model/Flag.php +++ b/app/code/core/Mage/Reports/Model/Flag.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -39,7 +39,8 @@ class Mage_Reports_Model_Flag extends Mage_Core_Model_Flag const REPORT_SHIPPING_FLAG_CODE = 'report_shipping_aggregated'; const REPORT_INVOICE_FLAG_CODE = 'report_invoiced_aggregated'; const REPORT_REFUNDED_FLAG_CODE = 'report_refunded_aggregated'; - const REPORT_COUPNS_FLAG_CODE = 'report_coupons_aggregated'; + const REPORT_COUPONS_FLAG_CODE = 'report_coupons_aggregated'; + const REPORT_BESTSELLERS_FLAG_CODE = 'report_bestsellers_aggregated'; /** * Setter for flag code diff --git a/app/code/core/Mage/Reports/Model/Grouped/Collection.php b/app/code/core/Mage/Reports/Model/Grouped/Collection.php index 612a1a4fdc..ba045f0b6f 100644 --- a/app/code/core/Mage/Reports/Model/Grouped/Collection.php +++ b/app/code/core/Mage/Reports/Model/Grouped/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Reports_Model_Grouped_Collection extends Varien_Data_Collection diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Accounts/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Accounts/Collection.php index 1de637660f..a9c02549f3 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Accounts/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Accounts/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Coupons/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Coupons/Collection.php index fbb7a5c5e9..c459b86ba5 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Coupons/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Coupons/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Customer/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Customer/Collection.php index 9de10ee1f4..b84bd1d3df 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Customer/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Customer/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -34,6 +34,18 @@ class Mage_Reports_Model_Mysql4_Customer_Collection extends Mage_Customer_Model_Entity_Customer_Collection { + /** + * Add order statistics flag + * + * @var boolean + */ + protected $_addOrderStatistics = false; + /** + * Add order statistics is filter flag + * + * @var boolean + */ + protected $_addOrderStatisticsIsFilter = false; protected $_customerIdTableName; protected $_customerIdFieldName; @@ -76,23 +88,15 @@ public function addCustomerName() */ public function joinOrders($from = '', $to = '') { - $order = Mage::getResourceSingleton('sales/order'); - /* @var $order Mage_Sales_Model_Entity_Order */ - $attr = $order->getAttribute('customer_id'); - /* @var $attr Mage_Eav_Model_Entity_Attribute_Abstract */ - $attrId = $attr->getAttributeId(); - $this->_customerIdTableName = $attr->getBackend()->getTable(); - $this->_customerIdFieldName = $attr->getBackend()->isStatic() ? 'customer_id' : 'value'; - if ($from != '' && $to != '') { - $dateFilter = " and {$this->_customerIdTableName}.created_at BETWEEN '{$from}' AND '{$to}'"; + $dateFilter = " and orders.created_at BETWEEN '{$from}' AND '{$to}'"; } else { $dateFilter = ''; } $this->getSelect() - ->joinLeft($this->_customerIdTableName, - "{$this->_customerIdTableName}.{$this->_customerIdFieldName}=e.entity_id".$dateFilter, + ->joinLeft(array('orders'=>$this->getTable('sales/order')), + "orders.customer_id=e.entity_id".$dateFilter, array()); return $this; @@ -105,15 +109,10 @@ public function joinOrders($from = '', $to = '') */ public function addOrdersCount() { - $joinCondition = "{$this->_customerIdTableName}.entity_id=order_state.entity_id"; - $joinCondition .= " AND order_state.state <> '" . Mage_Sales_Model_Order::STATE_CANCELED . "'"; $this->getSelect() - ->columns(array("orders_count" => "COUNT(order_state.entity_id)")) - ->joinLeft( - array('order_state' => $this->getTable('sales/order')), - $joinCondition, - array()) + ->columns(array("orders_count" => "COUNT(orders.entity_id)")) + ->where('orders.state <> ?', Mage_Sales_Model_Order::STATE_CANCELED) ->group("e.entity_id"); return $this; @@ -132,8 +131,8 @@ public function addSumAvgTotals($storeId = 0) * calculate average and total amount */ $expr = ($storeId == 0) - ? "({$this->_customerIdTableName}.base_subtotal-IFNULL({$this->_customerIdTableName}.base_subtotal_canceled,0)-IFNULL({$this->_customerIdTableName}.base_subtotal_refunded,0))*{$this->_customerIdTableName}.base_to_global_rate" - : "{$this->_customerIdTableName}.base_subtotal-IFNULL({$this->_customerIdTableName}.base_subtotal_canceled,0)-IFNULL({$this->_customerIdTableName}.base_subtotal_refunded,0)"; + ? "(orders.base_subtotal-IFNULL(orders.base_subtotal_canceled,0)-IFNULL(orders.base_subtotal_refunded,0))*orders.base_to_global_rate" + : "{orders.base_subtotal-IFNULL(orders.base_subtotal_canceled,0)-IFNULL(orders.base_subtotal_refunded,0)"; $this->getSelect() ->columns(array("orders_avg_amount" => "AVG({$expr})")) @@ -149,6 +148,60 @@ public function orderByTotalAmount($dir = 'desc') return $this; } + /** + * Add order statistics + * + * @return Mage_Reports_Model_Mysql4_Customer_Collection + */ + public function addOrdersStatistics($isFilter = false) + { + $this->_addOrderStatistics = true; + $this->_addOrderStatisticsIsFilter = $isFilter; + return $this; + } + + /** + * Add orders statistics to collection items + * + * @return Mage_Reports_Model_Mysql4_Customer_Collection + */ + protected function _addOrdersStatistics() + { + $customerIds = $this->getColumnValues($this->getResource()->getIdFieldName()); + + if ($this->_addOrderStatistics && !empty($customerIds)) { + $totalExpr = ($this->_addOrderStatisticsIsFilter) + ? '(orders.base_subtotal-IFNULL(orders.base_subtotal_canceled,0)-IFNULL(orders.base_subtotal_refunded,0))*orders.base_to_global_rate' + : 'orders.base_subtotal-IFNULL(orders.base_subtotal_canceled,0)-IFNULL(orders.base_subtotal_refunded,0)'; + $select = $this->getConnection()->select(); + $select->from(array('orders'=>$this->getTable('sales/order')), array( + 'orders_avg_amount' => "AVG({$totalExpr})", + 'orders_sum_amount' => "SUM({$totalExpr})", + 'orders_count' => 'COUNT(orders.entity_id)', + 'customer_id' + ))->where('orders.state <> ?', Mage_Sales_Model_Order::STATE_CANCELED) + ->where('orders.customer_id IN(?)', $customerIds) + ->group('orders.customer_id'); + + foreach ($this->getConnection()->fetchAll($select) as $ordersInfo) { + $this->getItemById($ordersInfo['customer_id'])->addData($ordersInfo); + } + } + + return $this; + } + + /** + * Collection after load operations like adding orders statistics + * + * @return Mage_Reports_Model_Mysql4_Customer_Collection + */ + protected function _afterLoad() + { + $this->_addOrdersStatistics(); + return $this; + } + public function orderByCustomerRegistration($dir = 'desc') { $this->addAttributeToSort('entity_id', $dir); @@ -165,7 +218,7 @@ public function getSelectCountSql() $countSelect->reset(Zend_Db_Select::GROUP); $countSelect->reset(Zend_Db_Select::HAVING); $countSelect->columns("count(DISTINCT e.entity_id)"); - $sql = $countSelect->__toString(); - return $sql; + + return $countSelect; } } diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Customer/Orders/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Customer/Orders/Collection.php index 7eccd92a98..f3f67d30ae 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Customer/Orders/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Customer/Orders/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Customer/Totals/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Customer/Totals/Collection.php index 9c0d47079a..0024cecad0 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Customer/Totals/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Customer/Totals/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Entity/Summary/Collection/Abstract.php b/app/code/core/Mage/Reports/Model/Mysql4/Entity/Summary/Collection/Abstract.php index 43513f72b7..167f2d191a 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Entity/Summary/Collection/Abstract.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Entity/Summary/Collection/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Event.php b/app/code/core/Mage/Reports/Model/Mysql4/Event.php index 00698fa03b..bcd4be4395 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Event.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Event.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Event/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Event/Collection.php index 3cf34a6cf4..f308fda973 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Event/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Event/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Event/Type.php b/app/code/core/Mage/Reports/Model/Mysql4/Event/Type.php index 1ef8bcc80b..d3eca23569 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Event/Type.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Event/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Event/Type/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Event/Type/Collection.php index fdea1a4dcb..5ad7f05819 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Event/Type/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Event/Type/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Invoiced/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Invoiced/Collection.php index b376436de1..6319575301 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Invoiced/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Invoiced/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Order/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Order/Collection.php index 140ac3b621..6c21d7664d 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Order/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Order/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -32,29 +32,117 @@ * @package Mage_Reports * @author Magento Core Team */ -class Mage_Reports_Model_Mysql4_Order_Collection extends Mage_Sales_Model_Entity_Order_Collection +class Mage_Reports_Model_Mysql4_Order_Collection extends Mage_Sales_Model_Mysql4_Order_Collection { + protected $_isLive = false; + /** + * Check range for live mode + * + * @param $range + * @return boolean + */ + public function checkIsLive($range) + { + $this->_isLive = !Mage::getStoreConfig('sales/dashboard/use_aggregated_data'); + return $this; + } + + /** + * Retrieve is live flag for rep + * + * @return boolean + */ + public function isLive() + { + return $this->_isLive; + } + + /** + * Prepare report summary + * + * @param string $range + * @param mixed $customStart + * @param mixed $customEnd + * @param int $isFilter + * @return Mage_Reports_Model_Mysql4_Order_Collection + */ public function prepareSummary($range, $customStart, $customEnd, $isFilter=0) { + $this->checkIsLive($range); + if ($this->_isLive) { + $this->_prepareSummaryLive($range, $customStart, $customEnd, $isFilter); + } else { + $this->_prepareSummaryAggregated($range, $customStart, $customEnd, $isFilter); + } + + return $this; + } + /** + * Prepare report summary from live data + * + * @param string $range + * @param mixed $customStart + * @param mixed $customEnd + * @param int $isFilter + * @return Mage_Reports_Model_Mysql4_Order_Collection + */ + protected function _prepareSummaryLive($range, $customStart, $customEnd, $isFilter=0) + { + $this->setMainTable('sales/order'); if ($isFilter==0) { - $this->addExpressionAttributeToSelect('revenue', - 'SUM({{base_grand_total}}*{{base_to_global_rate}})', - array('base_grand_total', 'base_to_global_rate')); + $this->getSelect()->columns(array( + 'revenue' => 'SUM(main_table.base_grand_total*main_table.base_to_global_rate)' + )); } else{ - $this->addExpressionAttributeToSelect('revenue', - 'SUM({{base_grand_total}})', - array('base_grand_total')); + $this->getSelect()->columns(array( + 'revenue' => 'SUM(main_table.base_grand_total)' + )); } - $this->addExpressionAttributeToSelect('quantity', 'COUNT({{attribute}})', 'entity_id') - ->addExpressionAttributeToSelect('range', $this->_getRangeExpression($range), 'created_at') - ->addAttributeToFilter('created_at', $this->getDateRange($range, $customStart, $customEnd)) - ->groupByAttribute('range') - ->addAttributeToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_CANCELED)) - ->getSelect()->order('range', 'asc'); + $this->getSelect()->columns(array( + 'quantity' => 'COUNT(main_table.entity_id)', + 'range' => $this->_getRangeExpressionForAttribute($range, 'created_at'), + ))->order('range', 'asc') + ->group('range'); + + $this->addFieldToFilter('created_at', $this->getDateRange($range, $customStart, $customEnd)) + ->addFieldToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_CANCELED)); + return $this; + } + + /** + * Prepare report summary from aggregated data + * + * @param string $range + * @param mixed $customStart + * @param mixed $customEnd + * @param int $isFilter + * @return Mage_Reports_Model_Mysql4_Order_Collection + */ + protected function _prepareSummaryAggregated($range, $customStart, $customEnd) + { + $this->setMainTable('sales/order_aggregated_created'); + $this->getSelect()->columns(array( + 'revenue' => 'SUM(main_table.total_revenue_amount)', + 'quantity' => 'SUM(main_table.orders_count)', + 'range' => $this->_getRangeExpressionForAttribute($range, 'main_table.period'), + ))->order('range', 'asc') + ->group('range'); + + $this->getSelect()->where( + $this->_getConditionSql('main_table.period', $this->getDateRange($range, $customStart, $customEnd)) + ); + + $statuses = Mage::getSingleton('sales/config') + ->getOrderStatusesForState(Mage_Sales_Model_Order::STATE_CANCELED); + + if (empty($statuses)) { + $statuses = array(0); + } + $this->getSelect()->where('main_table.order_status NOT IN(?)', $statuses); return $this; } @@ -84,6 +172,18 @@ protected function _getRangeExpression($range) return $expression; } + /** + * Retriev range exression adapteted for attribute + * + * @param string $range + * @param unknown_type $attribute + */ + protected function _getRangeExpressionForAttribute($range, $attribute) + { + $expression = $this->_getRangeExpression($range); + return str_replace('{{attribute}}', $this->getConnection()->quoteIdentifier($attribute), $expression); + } + public function getDateRange($range, $customStart, $customEnd, $returnObjects = false) { $dateEnd = new Zend_Date(Mage::getModel('core/date')->gmtTimestamp()); @@ -151,80 +251,146 @@ public function addItemCountExpr() // array('items_count'=>new Zend_Db_Expr('COUNT(items.entity_id)')) // ) // ->group('e.entity_id'); - $this->getSelect()->join( - array('items'=>$this->getTable('sales/order_item')), - 'items.order_id=e.entity_id', - array('items_count'=>new Zend_Db_Expr('COUNT(items.item_id)', 'parent_item')) - ) - ->where('items.parent_item_id is NULL') - ->group('e.entity_id'); + $this->getSelect()->columns(array('items_count'=>'total_item_count'), 'main_table'); return $this; } + /** + * Calculate totals report + * + * @param int $isFilter + * @return Mage_Reports_Model_Mysql4_Order_Collection + */ public function calculateTotals($isFilter = 0) { + if ($this->isLive()) { + $this->_calculateTotalsLive($isFilter); + } else { + $this->_calculateTotalsAggregated($isFilter); + } + + return $this; + } + + /** + * Calculate totals live report + * + * @param int $isFilter + * @return Mage_Reports_Model_Mysql4_Order_Collection + */ + protected function _calculateTotalsLive($isFilter = 0) + { + $this->setMainTable('sales/order'); + $this->removeAllFieldsFromSelect(); + if ($isFilter == 0) { - $this->addExpressionAttributeToSelect( - 'revenue', - 'SUM(({{base_subtotal}}-IFNULL({{base_subtotal_refunded}},0)-IFNULL({{base_subtotal_canceled}},0)-IFNULL({{base_discount_amount}},0)+IFNULL({{base_discount_refunded}},0))*{{base_to_global_rate}})', - array('base_subtotal', 'base_to_global_rate', 'base_subtotal_refunded', 'base_subtotal_canceled','base_discount_amount','base_discount_refunded')) - ->addExpressionAttributeToSelect( - 'tax', - 'SUM(({{base_tax_amount}}-IFNULL({{base_tax_refunded}},0)-IFNULL({{base_tax_canceled}},0))*{{base_to_global_rate}})', - array('base_tax_amount', 'base_tax_canceled', 'base_tax_refunded', 'base_to_global_rate')) - ->addExpressionAttributeToSelect( - 'shipping', - 'SUM(({{base_shipping_amount}}-IFNULL({{base_shipping_refunded}},0)-IFNULL({{base_shipping_canceled}},0))*{{base_to_global_rate}})', - array('base_shipping_amount', 'base_shipping_refunded', 'base_shipping_canceled', 'base_to_global_rate')); + $this->getSelect()->columns(array( + 'revenue' => 'SUM((main_table.base_subtotal-IFNULL(main_table.base_subtotal_refunded,0)-IFNULL(main_table.base_subtotal_canceled,0)-IFNULL(main_table.base_discount_amount,0)+IFNULL(main_table.base_discount_refunded,0))*main_table.base_to_global_rate)', + 'tax' => 'SUM((main_table.base_tax_amount-IFNULL(main_table.base_tax_refunded,0)-IFNULL(main_table.base_tax_canceled,0))*main_table.base_to_global_rate)', + 'shipping' => 'SUM((main_table.base_shipping_amount-IFNULL(main_table.base_shipping_refunded,0)-IFNULL(main_table.base_shipping_canceled,0))*main_table.base_to_global_rate)', + )); } else { - $this->addExpressionAttributeToSelect( - 'revenue', - 'SUM({{base_subtotal}}-IFNULL({{base_subtotal_refunded}},0)-IFNULL({{base_subtotal_canceled}},0)-IFNULL({{base_discount_amount}},0)+IFNULL({{base_discount_refunded}},0))', - array('base_subtotal', 'base_subtotal_refunded', 'base_subtotal_canceled','base_discount_amount','base_discount_refunded')) - ->addExpressionAttributeToSelect( - 'tax', - 'SUM({{base_tax_amount}}-IFNULL({{base_tax_refunded}},0)-IFNULL({{base_tax_canceled}},0))', - array('base_tax_amount', 'base_tax_refunded', 'base_tax_canceled')) - ->addExpressionAttributeToSelect( - 'shipping', - 'SUM({{base_shipping_amount}}-IFNULL({{base_shipping_refunded}},0)-IFNULL({{base_shipping_canceled}},0))', - array('base_shipping_amount', 'base_shipping_refunded', 'base_shipping_canceled')); + $this->getSelect()->columns(array( + 'revenue' => 'SUM((main_table.base_subtotal-IFNULL(main_table.base_subtotal_refunded,0)-IFNULL(main_table.base_subtotal_canceled,0)-IFNULL(main_table.base_discount_amount,0)+IFNULL(main_table.base_discount_refunded,0)))', + 'tax' => 'SUM((main_table.base_tax_amount-IFNULL(main_table.base_tax_refunded,0)-IFNULL(main_table.base_tax_canceled,0)))', + 'shipping' => 'SUM((main_table.base_shipping_amount-IFNULL(main_table.base_shipping_refunded,0)-IFNULL(main_table.base_shipping_canceled,0)))', + )); } - $this->addExpressionAttributeToSelect('quantity', 'COUNT({{entity_id}})', array('entity_id')) - ->addAttributeToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_CANCELED)) - ->groupByAttribute('entity_type_id'); + $this->getSelect()->columns(array( + 'quantity' => 'COUNT(main_table.entity_id)', + )); + + $this->addFieldToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_CANCELED)); return $this; } + /** + * Calculate totals agregated report + * + * @param int $isFilter + * @return Mage_Reports_Model_Mysql4_Order_Collection + */ + protected function _calculateTotalsAggregated($isFilter = 0) + { + $this->setMainTable('sales/order_aggregated_created'); + $this->removeAllFieldsFromSelect(); + + $this->getSelect()->columns(array( + 'revenue' => 'SUM(main_table.total_revenue_amount)', + 'tax' => 'SUM(main_table.total_tax_amount_actual)', + 'shipping' => 'SUM(main_table.total_shipping_amount_actual)', + 'quantity' => 'SUM(orders_count)', + )); + + $statuses = Mage::getSingleton('sales/config') + ->getOrderStatusesForState(Mage_Sales_Model_Order::STATE_CANCELED); + + if (empty($statuses)) { + $statuses = array(0); + } + + $this->getSelect()->where('main_table.order_status NOT IN(?)', $statuses); + + return $this; + } + + /** + * Calculate lifitime sales + * + * @param int $isFilter + * @return Mage_Reports_Model_Mysql4_Order_Collection + */ public function calculateSales($isFilter = 0) { - if ($isFilter == 0) { - $expr = "({{base_subtotal}}-IFNULL({{base_subtotal_refunded}},0)-IFNULL({{base_subtotal_canceled}},0)-IFNULL({{base_discount_amount}},0)+IFNULL({{base_discount_refunded}},0))*{{base_to_global_rate}}"; - $attrs = array('base_subtotal', 'base_to_global_rate', 'base_subtotal_refunded', 'base_subtotal_canceled','base_discount_amount','base_discount_refunded'); - $this->addExpressionAttributeToSelect('lifetime', "SUM({$expr})", $attrs) - ->addExpressionAttributeToSelect('average', "AVG({$expr})", $attrs); - } else { - $expr = "({{base_subtotal}}-IFNULL({{base_subtotal_refunded}},0)-IFNULL({{base_subtotal_canceled}},0)-IFNULL({{base_discount_amount}},0)+IFNULL({{base_discount_amount}},0))"; - $attrs = array('base_subtotal', 'base_subtotal_refunded', 'base_subtotal_canceled','base_discount_amount','base_discount_refunded'); - $this->addExpressionAttributeToSelect('lifetime', "SUM($expr)", $attrs) - ->addExpressionAttributeToSelect('average', "AVG($expr)", $attrs); + $statuses = Mage::getSingleton('sales/config') + ->getOrderStatusesForState(Mage_Sales_Model_Order::STATE_CANCELED); + + if (empty($statuses)) { + $statuses = array(0); } - $this->addAttributeToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_CANCELED)) - ->groupByAttribute('entity_type_id'); + if (Mage::getStoreConfig('sales/dashboard/use_aggregated_data')) { + $this->setMainTable('sales/order_aggregated_created'); + $this->removeAllFieldsFromSelect(); + + $this->getSelect()->columns(array( + 'lifetime' => 'SUM(main_table.total_revenue_amount)', + 'average' => "IF(SUM(main_table.orders_count) > 0, SUM(main_table.total_revenue_amount)/SUM(main_table.orders_count), 0)" + )); + + if (!$isFilter) { + $this->addFieldToFilter('store_id', + array('eq' => Mage::app()->getStore(Mage_Core_Model_Store::ADMIN_CODE)->getId()) + ); + } + $this->getSelect()->where('main_table.order_status NOT IN(?)', $statuses); + } else { + $this->setMainTable('sales/order'); + $this->removeAllFieldsFromSelect(); + $expr = 'IFNULL(main_table.base_subtotal, 0) - IFNULL(main_table.base_subtotal_refunded, 0)' + . ' - IFNULL(main_table.base_subtotal_canceled, 0) - IFNULL(main_table.base_discount_amount, 0)' + . ' + IFNULL(main_table.base_discount_refunded, 0)'; + + $this->getSelect()->columns(array( + 'lifetime' => "SUM({$expr})", + 'average' => "AVG({$expr})" + )); + $this->getSelect()->where('main_table.status NOT IN(?)', $statuses) + ->where('main_table.state NOT IN(?)', array(Mage_Sales_Model_Order::STATE_NEW, Mage_Sales_Model_Order::STATE_PENDING_PAYMENT)); + } return $this; } public function setDateRange($from, $to) { $this->_reset() - ->addAttributeToSelect('*') - ->addAttributeToFilter('created_at', array('from' => $from, 'to' => $to)) - ->addExpressionAttributeToSelect('orders', 'COUNT(DISTINCT({{entity_id}}))', array('entity_id')) - ->addAttributeToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_CANCELED)) - ->getSelect()->group('("*")'); + ->addFieldToFilter('created_at', array('from' => $from, 'to' => $to)) + ->addFieldToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_CANCELED)) + ->getSelect() + ->columns(array('orders'=>'COUNT(DISTINCT(main_table.entity_id))')) + ->group('("*")'); /** * getting qty count for each order @@ -252,16 +418,7 @@ public function setDateRange($from, $to) // "order_items2.entity_id = `order_items`.entity_id and order_items2.attribute_id = {$attrId}", array()) // ->columns(array("items" => "sum(order_items2.{$fieldName})")); - $countSql = clone $this->getSelect(); - $countSql->reset(); - - $countSql->from(array("order_items" => $this->getTable('sales/order_item')), array("sum(`order_items2`.`qty_ordered`)")) - ->joinLeft(array("order_items2" => $this->getTable('sales/order_item')), - "order_items2.item_id = `order_items`.item_id", array()) - ->where("`order_items`.`order_id` = `e`.`entity_id`") - ->where("`order_items2`.`parent_item_id` is NULL"); - - $this->getSelect()->columns(array("items" => "SUM((".$countSql."))")); + $this->getSelect()->columns(array("items" => 'SUM(' . $this->getConnection()->quoteIdentifier('main_table.total_qty_ordered') . ')')); return $this; } @@ -270,72 +427,27 @@ public function setStoreIds($storeIds) { $vals = array_values($storeIds); if (count($storeIds) >= 1 && $vals[0] != '') { - $this->addAttributeToFilter('store_id', array('in' => (array)$storeIds)) - ->addExpressionAttributeToSelect( - 'subtotal', - 'SUM({{base_subtotal}})', - array('base_subtotal')) - ->addExpressionAttributeToSelect( - 'tax', - 'SUM({{base_tax_amount}})', - array('base_tax_amount')) - ->addExpressionAttributeToSelect( - 'shipping', - 'SUM({{base_shipping_amount}})', - array('base_shipping_amount')) - ->addExpressionAttributeToSelect( - 'discount', - 'SUM({{base_discount_amount}})', - array('base_discount_amount')) - ->addExpressionAttributeToSelect( - 'total', - 'SUM({{base_grand_total}})', - array('base_grand_total')) - ->addExpressionAttributeToSelect( - 'invoiced', - 'SUM({{base_total_paid}})', - array('base_total_paid')) - ->addExpressionAttributeToSelect( - 'refunded', - 'SUM({{base_total_refunded}})', - array('base_total_refunded')) - ->addExpressionAttributeToSelect( - 'profit', - 'SUM(IFNULL({{base_subtotal_invoiced}}, 0)) + SUM(IFNULL({{base_discount_refunded}}, 0)) - SUM(IFNULL({{base_subtotal_refunded}}, 0)) - SUM(IFNULL({{base_discount_invoiced}}, 0)) - SUM(IFNULL({{base_total_invoiced_cost}}, 0))', - array('base_subtotal_invoiced', 'base_discount_refunded', 'base_subtotal_refunded', 'base_discount_invoiced', 'base_total_invoiced_cost')); + $this->getSelect()->columns(array( + 'subtotal' => 'SUM(main_table.base_subtotal)', + 'tax' => 'SUM(main_table.base_tax_amount)', + 'shipping' => 'SUM(main_table.base_shipping_amount)', + 'discount' => 'SUM(main_table.base_discount_amount)', + 'total' => 'SUM(main_table.base_grand_total)', + 'invoiced' => 'SUM(main_table.base_total_paid)', + 'refunded' => 'SUM(main_table.base_total_refunded)', + 'profit' => 'SUM(IFNULL(main_table.base_subtotal_invoiced, 0)) + SUM(IFNULL(main_table.base_discount_refunded, 0)) - SUM(IFNULL(main_table.base_subtotal_refunded, 0)) - SUM(IFNULL(main_table.base_discount_invoiced, 0)) - SUM(IFNULL(main_table.base_total_invoiced_cost, 0))', + )); } else { - $this->addExpressionAttributeToSelect( - 'subtotal', - 'SUM({{base_subtotal}}*{{base_to_global_rate}})', - array('base_subtotal', 'base_to_global_rate')) - ->addExpressionAttributeToSelect( - 'tax', - 'SUM({{base_tax_amount}}*{{base_to_global_rate}})', - array('base_tax_amount', 'base_to_global_rate')) - ->addExpressionAttributeToSelect( - 'shipping', - 'SUM({{base_shipping_amount}}*{{base_to_global_rate}})', - array('base_shipping_amount', 'base_to_global_rate')) - ->addExpressionAttributeToSelect( - 'discount', - 'SUM({{base_discount_amount}}*{{base_to_global_rate}})', - array('base_discount_amount', 'base_to_global_rate')) - ->addExpressionAttributeToSelect( - 'total', - 'SUM({{base_grand_total}}*{{base_to_global_rate}})', - array('base_grand_total', 'base_to_global_rate')) - ->addExpressionAttributeToSelect( - 'invoiced', - 'SUM({{base_total_paid}}*{{base_to_global_rate}})', - array('base_total_paid', 'base_to_global_rate')) - ->addExpressionAttributeToSelect( - 'refunded', - 'SUM({{base_total_refunded}}*{{base_to_global_rate}})', - array('base_total_refunded', 'base_to_global_rate')) - ->addExpressionAttributeToSelect( - 'profit', - 'SUM(IFNULL({{base_subtotal_invoiced}}, 0)*{{base_to_global_rate}}) + SUM(IFNULL({{base_discount_refunded}}, 0)*{{base_to_global_rate}}) - SUM(IFNULL({{base_subtotal_refunded}}, 0)*{{base_to_global_rate}}) - SUM(IFNULL({{base_discount_invoiced}}, 0)*{{base_to_global_rate}}) - SUM(IFNULL({{base_total_invoiced_cost}}, 0)*{{base_to_global_rate}})', - array('base_subtotal_invoiced', 'base_discount_refunded', 'base_subtotal_refunded', 'base_discount_invoiced', 'base_total_invoiced_cost', 'base_to_global_rate')); + $this->getSelect()->columns(array( + 'subtotal' => 'SUM(main_table.base_subtotal * main_table.base_to_global_rate)', + 'tax' => 'SUM(main_table.base_tax_amount * main_table.base_to_global_rate)', + 'shipping' => 'SUM(main_table.base_shipping_amount * main_table.base_to_global_rate)', + 'discount' => 'SUM(main_table.base_discount_amount * main_table.base_to_global_rate)', + 'total' => 'SUM(main_table.base_grand_total * main_table.base_to_global_rate)', + 'invoiced' => 'SUM(main_table.base_total_paid * main_table.base_to_global_rate)', + 'refunded' => 'SUM(main_table.base_total_refunded * main_table.base_to_global_rate)', + 'profit' => 'SUM(IFNULL(main_table.base_subtotal_invoiced, 0)* main_table.base_to_global_rate) + SUM(IFNULL(main_table.base_discount_refunded, 0)* main_table.base_to_global_rate) - SUM(IFNULL(main_table.base_subtotal_refunded, 0)* main_table.base_to_global_rate) - SUM(IFNULL(main_table.base_discount_invoiced, 0)* main_table.base_to_global_rate) - SUM(IFNULL(main_table.base_total_invoiced_cost, 0)* main_table.base_to_global_rate)', + )); } return $this; @@ -348,7 +460,7 @@ public function setStoreIds($storeIds) */ public function groupByCustomer() { - $this->groupByAttribute('customer_id'); + $this->getSelect()->group('main_table.customer_id'); return $this; } @@ -358,12 +470,9 @@ public function groupByCustomer() * * @return Mage_Reports_Model_Mysql4_Order_Collection */ - public function joinCustomerName() + public function joinCustomerName($alias = 'name') { - //TODO: add full name logic - $this->joinAttribute('firstname', 'customer/firstname', 'customer_id'); - $this->joinAttribute('lastname', 'customer/lastname', 'customer_id'); - $this->getSelect()->columns(array('name' => 'CONCAT(_table_firstname.value," ", _table_lastname.value)')); + $this->getSelect()->columns(array($alias => 'CONCAT(main_table.customer_firstname," ", main_table.customer_lastname)')); return $this; } @@ -374,9 +483,30 @@ public function joinCustomerName() */ public function addOrdersCount() { - $this->addAttributeToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_CANCELED)); + $this->addFieldToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_CANCELED)); $this->getSelect() - ->columns(array("orders_count" => "COUNT(e.entity_id)")); + ->columns(array("orders_count" => "COUNT(main_table.entity_id)")); + + return $this; + } + + /** + * Add revenue + * + * @param boolean $convertCurrency + * @return Mage_Reports_Model_Mysql4_Order_Collection + */ + public function addRevenueToSelect($convertCurrency = false) + { + if ($convertCurrency) { + $this->getSelect()->columns(array( + 'revenue' => '(main_table.base_grand_total * main_table.base_to_global_rate)' + )); + } else { + $this->getSelect()->columns(array( + 'revenue' => 'base_grand_total' + )); + } return $this; } @@ -393,8 +523,8 @@ public function addSumAvgTotals($storeId = 0) * calculate average and total amount */ $expr = ($storeId == 0) - ? '(e.base_subtotal-IFNULL(e.base_subtotal_refunded,0)-IFNULL(e.base_subtotal_canceled,0))*e.base_to_global_rate' - : 'e.base_subtotal-IFNULL(e.base_subtotal_canceled,0)-IFNULL(e.base_subtotal_refunded,0)'; + ? '(main_table.base_subtotal-IFNULL(main_table.base_subtotal_refunded,0)-IFNULL(main_table.base_subtotal_canceled,0))*main_table.base_to_global_rate' + : 'main_table.base_subtotal-IFNULL(main_table.base_subtotal_canceled,0)-IFNULL(main_table.base_subtotal_refunded,0)'; $this->getSelect() ->columns(array("orders_avg_amount" => "AVG({$expr})")) @@ -425,7 +555,17 @@ public function orderByOrdersCount($dir = 'desc') public function orderByCustomerRegistration($dir = 'desc') { - $this->addAttributeToSort('customer_id', $dir); + $this->setOrder('customer_id', $dir); + return $this; + } + + /** + * Sort order by order created_at date + * @param string $dir + */ + public function orderByCreatedAt($dir = 'desc') + { + $this->setOrder('created_at', $dir); return $this; } @@ -438,13 +578,24 @@ public function getSelectCountSql() $countSelect->reset(Zend_Db_Select::COLUMNS); $countSelect->reset(Zend_Db_Select::GROUP); $countSelect->reset(Zend_Db_Select::HAVING); - $countSelect->columns("count(DISTINCT e.entity_id)"); + $countSelect->columns("count(DISTINCT main_table.entity_id)"); $sql = $countSelect->__toString(); return $sql; } + /** + * Initialize initial fields to select + * + * @return Mage_Reports_Model_Mysql4_Order_Collection + */ + protected function _initInitialFieldsToSelect() + { + // No fields should be initialized + return $this; + } + /** * Add period filter by created_at attribute * @@ -455,7 +606,15 @@ public function addCreateAtPeriodFilter($period) { list($from, $to) = $this->getDateRange($period, 0, 0, true); - $this->addAttributeToFilter('created_at', array( + $this->checkIsLive($period); + + if ($this->isLive()) { + $fieldToFilter = 'created_at'; + } else { + $fieldToFilter = 'period'; + } + + $this->addFieldToFilter($fieldToFilter, array( 'from' => $from->toString(Varien_Date::DATETIME_INTERNAL_FORMAT), 'to' => $to->toString(Varien_Date::DATETIME_INTERNAL_FORMAT) )); diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Product/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Product/Collection.php index 1f8dea27eb..3744e8270a 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Product/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Product/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -184,7 +184,6 @@ public function addOrderedQty($from = '', $to = '') $qtyOrderedTableName = $this->getTable('sales/order_item'); $qtyOrderedFieldName = 'qty_ordered'; - $productIdTableName = $this->getTable('sales/order_item'); $productIdFieldName = 'product_id'; $compositeTypeIds = Mage::getSingleton('catalog/product_type')->getCompositeTypes(); @@ -201,37 +200,16 @@ public function addOrderedQty($from = '', $to = '') array('ordered_qty' => "SUM(order_items.{$qtyOrderedFieldName})") ); - $order = Mage::getResourceSingleton('sales/order'); - /* @var $order Mage_Sales_Model_Entity_Order */ - $stateAttr = $order->getAttribute('state'); - if ($stateAttr->getBackend()->isStatic()) { - - $_joinCondition = $this->getConnection()->quoteInto( + $_joinCondition = $this->getConnection()->quoteInto( 'order.entity_id = order_items.order_id AND order.state<>?', Mage_Sales_Model_Order::STATE_CANCELED - ); - $_joinCondition .= $dateFilter; - - $this->getSelect()->joinInner( - array('order' => $this->getTable('sales/order')), - $_joinCondition, - array() - ); - } else { - - $_joinCondition = 'order.entity_id = order_state.entity_id'; - $_joinCondition .= $this->getConnection()->quoteInto(' AND order_state.attribute_id=? ', $stateAttr->getId()); - $_joinCondition .= $this->getConnection()->quoteInto(' AND order_state.value<>? ', Mage_Sales_Model_Order::STATE_CANCELED); + ); + $_joinCondition .= $dateFilter; + $this->getSelect()->joinInner( + array('order' => $this->getTable('sales/order')), + $_joinCondition, + array() + ); - $this->getSelect() - ->joinInner( - array('order' => $this->getTable('sales/order')), - 'order.entity_id = order_items.order_id' . $dateFilter, - array()) - ->joinInner( - array('order_state' => $stateAttr->getBackend()->getTable()), - $_joinCondition, - array()); - } $this->getSelect() ->joinInner(array('e' => $this->getProductEntityTableName()), diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Product/Downloads/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Product/Downloads/Collection.php index afb9fb899f..294b75062a 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Product/Downloads/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Product/Downloads/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Abstract.php b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Abstract.php index d84d9303b5..9501cd360c 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Abstract.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -152,4 +152,32 @@ public function clean() } return $this; } + + /** + * Add information about product ids to visitor/customer + * + * @param $object + * @param $productIds + */ + public function registerIds($object, $productIds) + { + $row = array( + 'visitor_id' => $object->getVisitorId(), + 'customer_id' => $object->getCustomerId(), + 'store_id' => $object->getStoreId(), + 'added_at' => now(), + ); + $data = array(); + foreach ($productIds as $productId) { + $productId = (int) $productId; + if ($productId) { + $row['product_id'] = $productId; + $data[] = $row; + } + } + if (!empty($data)) { + $this->_getWriteAdapter()->insertOnDuplicate($this->getMainTable(), $data, array('product_id')); + } + return $this; + } } diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Collection/Abstract.php b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Collection/Abstract.php index 6f3a85bea5..e425c825b7 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Collection/Abstract.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Collection/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,6 +42,27 @@ abstract class Mage_Reports_Model_Mysql4_Product_Index_Collection_Abstract */ abstract protected function _getTableName(); + /** + * Join index table + */ + protected function _joinIdxTable() + { + if (!$this->getFlag('is_idx_table_joined')) { + $this->joinTable( + array('idx_table' => $this->_getTableName()), + 'product_id=entity_id', + array( + 'product_id' => 'product_id', + 'item_store_id' => 'store_id', + 'added_at' => 'added_at' + ), + $this->_getWhereCondition() + ); + $this->setFlag('is_idx_table_joined', true); + } + return $this; + } + /** * Add Viewed Products Index to Collection * @@ -49,22 +70,24 @@ abstract protected function _getTableName(); */ public function addIndexFilter() { - $this->joinTable( - array('idx_table' => $this->_getTableName()), - 'product_id=entity_id', - array( - 'product_id' => 'product_id', - 'item_store_id' => 'store_id', - 'added_at' => 'added_at' - ), - $this->_getWhereCondition() - ); - + $this->_joinIdxTable(); $this->_productLimitationFilters['store_table'] = 'idx_table'; - $this->setFlag('url_data_object', true); $this->setFlag('do_not_use_category_id', true); + return $this; + } + /** + * Add filter by product ids + * @param array $ids + */ + public function addFilterByIds($ids) + { + if (empty($ids)) { + $this->getSelect()->where('0'); + } else { + $this->getSelect()->where('entity_id IN(?)', $ids); + } return $this; } @@ -95,7 +118,9 @@ protected function _getWhereCondition() */ public function setAddedAtOrder($dir = 'desc') { - $this->setOrder("added_at", $dir); + if ($this->getFlag('is_idx_table_joined')) { + $this->getSelect()->order('added_at '.$dir); + } return $this; } @@ -110,6 +135,7 @@ public function excludeProductIds($productIds) if (empty($productIds)) { return $this; } + $this->_joinIdxTable(); $this->getSelect()->where('idx_table.product_id NOT IN(?)', $productIds); return $this; } diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Compared.php b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Compared.php index 97a2306421..c527399cc1 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Compared.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Compared.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Compared/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Compared/Collection.php index 700de10e4a..93fd653f2d 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Compared/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Compared/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Viewed.php b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Viewed.php index dc7656738d..073e70eb43 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Viewed.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Viewed.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Viewed/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Viewed/Collection.php index 797b73f066..fc6cc21b53 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Viewed/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Viewed/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Product/Lowstock/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Product/Lowstock/Collection.php index df86c37aef..27c54501e8 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Product/Lowstock/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Product/Lowstock/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Product/Ordered/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Product/Ordered/Collection.php index f5f250827f..3966c1d18f 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Product/Ordered/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Product/Ordered/Collection.php @@ -20,18 +20,15 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Products Ordered (Bestsellers) Report collection * - * @category Mage - * @package Mage_Reports - * @author Magento Core Team + * @deprecated after 1.4.0.1 */ - class Mage_Reports_Model_Mysql4_Product_Ordered_Collection extends Mage_Reports_Model_Mysql4_Product_Collection { protected function _joinFields($from = '', $to = '') diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Product/Sold/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Product/Sold/Collection.php index fb65f3b588..113e5d52d2 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Product/Sold/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Product/Sold/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Product/Viewed/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Product/Viewed/Collection.php index 7eeb6f82a8..75acb1af3c 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Product/Viewed/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Product/Viewed/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Quote/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Quote/Collection.php index 2f07609afe..27016efd9a 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Quote/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Quote/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Refunded/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Refunded/Collection.php index 4f6333acd1..c0ba7a919e 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Refunded/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Refunded/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Report/Abstract.php b/app/code/core/Mage/Reports/Model/Mysql4/Report/Abstract.php new file mode 100644 index 0000000000..386a932ca7 --- /dev/null +++ b/app/code/core/Mage/Reports/Model/Mysql4/Report/Abstract.php @@ -0,0 +1,352 @@ +_flag === null) { + $this->_flag = Mage::getModel('reports/flag'); + } + return $this->_flag; + } + + /** + * Saves flag + * + * @param string $code + * @param mixed $value + * @return Mage_Reports_Model_Mysql4_Report_Abstract + */ + protected function _setFlagData($code, $value = null) + { + $this->_getFlag() + ->setReportFlagCode($code) + ->unsetData() + ->loadSelf(); + + if ($value !== null) { + $this->_getFlag()->setFlagData($value); + } + + // touch last_update + $this->_getFlag()->setLastUpdate($this->formatDate(time())); + + $this->_getFlag()->save(); + + return $this; + } + + /** + * Retrieve flag data + * + * @param string $code + * @return mixed + */ + protected function _getFlagData($code) + { + $this->_getFlag() + ->setReportFlagCode($code) + ->unsetData() + ->loadSelf(); + + return $this->_getFlag()->getFlagData(); + } + + /** + * Trancate table + * + * @param string $table + * @return Mage_Reports_Model_Mysql4_Report_Abstract + */ + protected function _truncateTable($table) + { + $this->_getWriteAdapter()->query('TRUNCATE TABLE ' . $this->_getWriteAdapter()->quoteIdentifier($table)); + return $this; + } + + /** + * Clear report table by specified date range. + * If specified source table parameters, + * condition will be generated by source table subselect. + * + * @param string $table + * @param string|null $from + * @param string|null $to + * @param Zend_Db_Select|string|null $subSelect + * @param string|null $sourceWhereColumn + * @param string|null $sourceAdditionalWhere + * @param boolean $doNotUseTrancate + * @return Mage_Reports_Model_Mysql4_Report_Abstract + */ + protected function _clearTableByDateRange($table, $from = null, $to = null, $subSelect = null, $doNotUseTruncate = false) + { + if ($from === null && $to === null && !$doNotUseTruncate) { + $this->_truncateTable($table); + return $this; + } + + if ($subSelect !== null) { + $deleteCondition = $this->_makeConditionFromDateRangeSelect($subSelect, 'period'); + } else { + $condition = array(); + if ($from !== null) { + $dt = new Zend_Date($from); + $dt = $this->formatDate($dt->getDate()); + $condition[] = $this->_getWriteAdapter()->quoteInto('period >= ?', $dt); + } + + if ($to !== null) { + $dt = new Zend_Date($to); + $dt = $this->formatDate($dt->getDate()); + $condition[] = $this->_getWriteAdapter()->quoteInto('period <= ?', $dt); + } + $deleteCondition = implode(' AND ', $condition); + } + + $this->_getWriteAdapter()->delete($table, $deleteCondition); + return $this; + } + + /** + * Generate table date range select + * + * @param string $table + * @param string $column + * @param string $whereColumn + * @param string|null $from + * @param string|null $to + * @param array $additionalWhere + * @return Varien_Db_Select + */ + protected function _getTableDateRangeSelect($table, $column, $whereColumn, $from = null, $to = null, + $additionalWhere = array(), $alias = 'date_range_table') + { + $select = $this->_getWriteAdapter()->select() + ->from( + array($alias => $table), + 'DATE('. $this->_getWriteAdapter()->quoteIdentifier($alias . '.' . $column) . ')' + ) + ->distinct(true); + + if ($from !== null) { + $select->where($alias . '.' . $whereColumn . ' >= ?', $from); + } + + if ($to !== null) { + $select->where($alias . '.' . $whereColumn . ' <= ?', $to); + } + + if (!empty($additionalWhere)) { + foreach ($additionalWhere as $condition) { + if (is_array($condition) && count($condition) == 2) { + $condition = $this->_getWriteAdapter()->quoteInto($condition[0], $condition[1]); + } elseif (is_array($condition)) { // Invalid condition + continue; + } + $condition = str_replace('{{table}}', $this->_getWriteAdapter()->quoteIdentifier($alias), $condition); + $select->where($condition); + } + } + + return $select; + } + + /** + * Make condition for using in where section + * from select statement with single date column + * + * @param string|Zend_Db_Select Query string or instance retrieved from _getTableDateRangeSelect or _getTableDateRangeRelatedSelect + * @param string Name of period column + * @result string|false + */ + protected function _makeConditionFromDateRangeSelect($select, $periodColumn) + { + static $selectResultCache = array(); + $cacheKey = (string)$select; + + if (!array_key_exists($cacheKey, $selectResultCache)) { + try { + $selectResult = array(); + $query = $this->_getReadAdapter()->query($select); + while ($date = $query->fetchColumn()) { + $selectResult[] = $date; + } + } catch (Exception $e) { + $selectResult = false; + } + $selectResultCache[$cacheKey] = $selectResult; + } else { + $selectResult = $selectResultCache[$cacheKey]; + } + + if ($selectResult === false) { + return false; + } + + $whereCondition = array(); + foreach ($selectResult as $date) { + $whereCondition[] = "{$periodColumn} BETWEEN '{$date} 00:00:00' AND '{$date} 23:59:59'"; + } + $whereCondition = implode(' OR ', $whereCondition); + if ($whereCondition == '') { + $whereCondition = '1<>1'; // FALSE condition! + } + + return $whereCondition; + } + + /** + * Generate table date range select + * + * @param string $table + * @param string $relatedTable + * @param array $joinCondition + * @param string $column + * @param string $whereColumn + * @param string|null $from + * @param string|null $to + * @param array $additionalWhere + * @return Varien_Db_Select + */ + protected function _getTableDateRangeRelatedSelect($table, $relatedTable, $joinCondition, $column, $whereColumn, $from = null, $to = null, + $additionalWhere = array(), $alias = 'date_range_table', $relatedAlias = 'related_date_range_table') + { + $joinConditionSql = ''; + + foreach ($joinCondition as $fkField => $pkField) { + if ($joinConditionSql) { + $joinConditionSql .= ' AND '; + } + + $joinConditionSql .= $this->_getWriteAdapter()->quoteIdentifier($alias . '.' . $fkField) + . ' = ' . $this->_getWriteAdapter()->quoteIdentifier($relatedAlias . '.' . $pkField); + } + + $select = $this->_getWriteAdapter()->select() + ->from( + array($alias => $table), + 'DATE('. $this->_getWriteAdapter()->quoteIdentifier($alias . '.' . $column) . ')' + ) + ->joinInner( + array($relatedAlias => $relatedTable), + $joinConditionSql, + array() + ) + ->distinct(true); + + if ($from !== null) { + $select->where($relatedAlias . '.' . $whereColumn . ' >= ?', $from); + } + + if ($to !== null) { + $select->where($relatedAlias . '.' . $whereColumn . ' <= ?', $to); + } + + if (!empty($additionalWhere)) { + foreach ($additionalWhere as $condition) { + if (is_array($condition) && count($condition) == 2) { + $condition = $this->_getWriteAdapter()->quoteInto($condition[0], $condition[1]); + } elseif (is_array($condition)) { // Invalid condition + continue; + } + $condition = str_replace( + array('{{table}}', '{{related_table}}'), + array( + $this->_getWriteAdapter()->quoteIdentifier($alias), + $this->_getWriteAdapter()->quoteIdentifier($relatedAlias) + ), + $condition + ); + $select->where($condition); + } + } + + return $select; + } + + /** + * Check range dates and transforms it to strings + * + * @param mixed $from + * @param mixed $to + * @return Mage_Reports_Model_Mysql4_Report_Abstract + */ + protected function _checkDates(&$from, &$to) + { + if ($from !== null) { + $from = $this->formatDate($from); + } + + if ($to !== null) { + $to = $this->formatDate($to); + } + + return $this; + } + + /** + * Retrieve store timezone offset from UTC in the form acceptable by SQL's CONVERT_TZ() + * + * @return string + */ + protected function _getStoreTimezoneUtcOffset($store = null) + { + return Mage::app()->getLocale()->storeDate($store)->toString(Zend_Date::GMT_DIFF_SEP); + } + + /** + * Retrieve date in UTC timezone + * + * @return Zend_Date|null + */ + protected function _dateToUtc($date) + { + if ($date === null) { + return null; + } + $dateUtc = new Zend_Date($date); + $dateUtc->setTimezone('Etc/UTC'); + return $dateUtc; + } +} diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Report/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Report/Collection.php index e2853b2849..09a092a2d6 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Report/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Report/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Review/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Review/Collection.php index b9baff68c7..23e020d05c 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Review/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Review/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Review/Customer/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Review/Customer/Collection.php index 8c9ee0f0cd..2b1d73406b 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Review/Customer/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Review/Customer/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Review/Product/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Review/Product/Collection.php index 22d0e3e778..64001c727c 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Review/Product/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Review/Product/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Shipping/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Shipping/Collection.php index 13668dd162..3b11c55956 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Shipping/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Shipping/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Shopcart/Product/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Shopcart/Product/Collection.php index e7e3376439..22db7e00a2 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Shopcart/Product/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Shopcart/Product/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Tag/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Tag/Collection.php index d7c46bf374..536422863e 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Tag/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Tag/Collection.php @@ -20,23 +20,50 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Report Products Tags collection * - * @author Magento Core Team + * @author Magento Core Team */ -class Mage_Reports_Model_Mysql4_Tag_Collection extends Mage_Tag_Model_Mysql4_Tag_Collection +class Mage_Reports_Model_Mysql4_Tag_Collection extends Mage_Tag_Model_Mysql4_Popular_Collection { + /** + * Add group by tag + * + * @deprecated after 1.4.0.1 + * @return Mage_Reports_Model_Mysql4_Tag_Collection + */ public function addGroupByTag() { return $this; } - + /** + * Add tag popularity to select by specified store ids + * + * @param int|array $storeIds + * @return Mage_Reports_Model_Mysql4_Tag_Collection + */ + public function addPopularity($storeIds) + { + $select = $this->getSelect() + ->joinLeft( + array('tr'=>$this->getTable('tag/relation')), + 'main_table.tag_id = tr.tag_id', + array( + 'popularity' => 'COUNT(tr.tag_id)' + ) + ); + if (!empty($storeIds)) { + $select->where('tr.store_id IN(?)', $storeIds); + } + $select->group('main_table.tag_id'); + return $this; + } } diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Tag/Customer/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Tag/Customer/Collection.php index 4e7dab5431..c631342b1e 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Tag/Customer/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Tag/Customer/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Tag/Product/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Tag/Product/Collection.php index a3c61e436e..9e913af9cd 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Tag/Product/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Tag/Product/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Tax/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Tax/Collection.php index 6729c82d1f..5fe36d6eae 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Tax/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Tax/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,6 +28,7 @@ /** * Reports tax collection * + * @deprecated 1.7 * @category Mage * @package Mage_Reports * @author Magento Core Team diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Wishlist/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Wishlist/Collection.php index cd04f779b3..c9be47ac75 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Wishlist/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Wishlist/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Wishlist/Product/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Wishlist/Product/Collection.php index 4a5db39c36..fe486f34f5 100644 --- a/app/code/core/Mage/Reports/Model/Mysql4/Wishlist/Product/Collection.php +++ b/app/code/core/Mage/Reports/Model/Mysql4/Wishlist/Product/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Product/Index/Abstract.php b/app/code/core/Mage/Reports/Model/Product/Index/Abstract.php index 628b8b4e04..6da922b9e9 100644 --- a/app/code/core/Mage/Reports/Model/Product/Index/Abstract.php +++ b/app/code/core/Mage/Reports/Model/Product/Index/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -209,4 +209,16 @@ public function clean() $this->_getResource()->clean($this); return $this; } + + /** + * Add product ids to current visitor/customer log + * @param array $productIds + * @return Mage_Reports_Model_Product_Index_Abstract + */ + public function registerIds($productIds) + { + $this->_getResource()->registerIds($this, $productIds); + $this->_getSession()->unsData($this->_countCacheKey); + return $this; + } } diff --git a/app/code/core/Mage/Reports/Model/Product/Index/Compared.php b/app/code/core/Mage/Reports/Model/Product/Index/Compared.php index 2cb106939d..9d2a82cbac 100644 --- a/app/code/core/Mage/Reports/Model/Product/Index/Compared.php +++ b/app/code/core/Mage/Reports/Model/Product/Index/Compared.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Product/Index/Viewed.php b/app/code/core/Mage/Reports/Model/Product/Index/Viewed.php index 74054db18e..96ac496cf2 100644 --- a/app/code/core/Mage/Reports/Model/Product/Index/Viewed.php +++ b/app/code/core/Mage/Reports/Model/Product/Index/Viewed.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Report.php b/app/code/core/Mage/Reports/Model/Report.php index eb944464a2..a155719771 100644 --- a/app/code/core/Mage/Reports/Model/Report.php +++ b/app/code/core/Mage/Reports/Model/Report.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Session.php b/app/code/core/Mage/Reports/Model/Session.php index 87ae82fa99..7d249a045e 100644 --- a/app/code/core/Mage/Reports/Model/Session.php +++ b/app/code/core/Mage/Reports/Model/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Test.php b/app/code/core/Mage/Reports/Model/Test.php index 0909b0bc60..650c116aa6 100644 --- a/app/code/core/Mage/Reports/Model/Test.php +++ b/app/code/core/Mage/Reports/Model/Test.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/Model/Totals.php b/app/code/core/Mage/Reports/Model/Totals.php index 6c074903a8..4576291e13 100644 --- a/app/code/core/Mage/Reports/Model/Totals.php +++ b/app/code/core/Mage/Reports/Model/Totals.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/etc/adminhtml.xml b/app/code/core/Mage/Reports/etc/adminhtml.xml index f368e529af..fd5f4414d6 100644 --- a/app/code/core/Mage/Reports/etc/adminhtml.xml +++ b/app/code/core/Mage/Reports/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -35,33 +35,29 @@ Sales - Sales + Orders adminhtml/report_sales/sales Tax adminhtml/report_sales/tax + + Invoiced + adminhtml/report_sales/invoiced + Shipping adminhtml/report_sales/shipping - - Total Invoiced - adminhtml/report_sales/invoiced - - Total Refunded + Refunds adminhtml/report_sales/refunded Coupons adminhtml/report_sales/coupons - - Refresh Statistics - adminhtml/report_sales/refreshstatistics - @@ -84,10 +80,10 @@ Products - + Bestsellers - adminhtml/report_product/ordered - + adminhtml/report_sales/bestsellers + Products Ordered adminhtml/report_product/sold @@ -177,6 +173,11 @@ Order Totals adminhtml/report/totals --> + + 65535 + Refresh Statistics + adminhtml/report_statistics + @@ -284,6 +285,9 @@ Search Terms + + Statistics + diff --git a/app/code/core/Mage/Reports/etc/config.xml b/app/code/core/Mage/Reports/etc/config.xml index e8fc96ebb1..db979b1fa2 100644 --- a/app/code/core/Mage/Reports/etc/config.xml +++ b/app/code/core/Mage/Reports/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Reports/etc/system.xml b/app/code/core/Mage/Reports/etc/system.xml index 98c6529f46..d47fe620de 100644 --- a/app/code/core/Mage/Reports/etc/system.xml +++ b/app/code/core/Mage/Reports/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -47,7 +47,7 @@ 0 - + text 20 1 @@ -55,7 +55,7 @@ 1 - + text 30 1 @@ -96,7 +96,7 @@ select adminhtml/report_config_form_field_mtdStart - Select day of the month + Select day of the month. 2 1 0 diff --git a/app/code/core/Mage/Reports/etc/widget.xml b/app/code/core/Mage/Reports/etc/widget.xml index c54bb3e605..77ef3d3744 100644 --- a/app/code/core/Mage/Reports/etc/widget.xml +++ b/app/code/core/Mage/Reports/etc/widget.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-install-0.7.1.php b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-install-0.7.1.php index 3bcbb70738..cbef439bb4 100644 --- a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-install-0.7.1.php +++ b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-install-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.0-0.7.1.php index 696e4cc8fc..a416001427 100644 --- a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.1-0.7.2.php index 0bf48fac17..3d37a212f1 100644 --- a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.2-0.7.3.php index 6fb46a3424..ac7b0f7fec 100644 --- a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.2-0.7.3.php +++ b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.2-0.7.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.3-0.7.4.php b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.3-0.7.4.php index 84b4a08277..32a65e597e 100644 --- a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.3-0.7.4.php +++ b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.3-0.7.4.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.4-0.7.5.php b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.4-0.7.5.php index b7066cc18d..c0e0cec3ef 100644 --- a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.4-0.7.5.php +++ b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.4-0.7.5.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.5-0.7.7.php b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.5-0.7.7.php index dfc9539ef8..055d4e4cb1 100644 --- a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.5-0.7.7.php +++ b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.5-0.7.7.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.7-0.7.8.php b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.7-0.7.8.php index ead29b3f9c..c144809754 100644 --- a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.7-0.7.8.php +++ b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.7-0.7.8.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.8-0.7.9.php b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.8-0.7.9.php index 80ff6e021b..06020ac719 100644 --- a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.8-0.7.9.php +++ b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.8-0.7.9.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.9-0.7.10.php b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.9-0.7.10.php index 57d020744f..ffd603799a 100644 --- a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.9-0.7.10.php +++ b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.9-0.7.10.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Reports - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Block/Customer/List.php b/app/code/core/Mage/Review/Block/Customer/List.php index 4f5bef1b67..e4d09226ba 100644 --- a/app/code/core/Mage/Review/Block/Customer/List.php +++ b/app/code/core/Mage/Review/Block/Customer/List.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Block/Customer/Recent.php b/app/code/core/Mage/Review/Block/Customer/Recent.php index d225bc2ae1..45661ab167 100644 --- a/app/code/core/Mage/Review/Block/Customer/Recent.php +++ b/app/code/core/Mage/Review/Block/Customer/Recent.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Block/Customer/View.php b/app/code/core/Mage/Review/Block/Customer/View.php index 2ad4834ffc..59f2a14b2f 100644 --- a/app/code/core/Mage/Review/Block/Customer/View.php +++ b/app/code/core/Mage/Review/Block/Customer/View.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Block/Form.php b/app/code/core/Mage/Review/Block/Form.php index 1785c54285..9952abbd27 100644 --- a/app/code/core/Mage/Review/Block/Form.php +++ b/app/code/core/Mage/Review/Block/Form.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Block/Helper.php b/app/code/core/Mage/Review/Block/Helper.php index 7db00c179c..57eed9f2ce 100644 --- a/app/code/core/Mage/Review/Block/Helper.php +++ b/app/code/core/Mage/Review/Block/Helper.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Block/Product/View.php b/app/code/core/Mage/Review/Block/Product/View.php index af78d83f80..1cb66ac719 100644 --- a/app/code/core/Mage/Review/Block/Product/View.php +++ b/app/code/core/Mage/Review/Block/Product/View.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Block/Product/View/List.php b/app/code/core/Mage/Review/Block/Product/View/List.php index d0fe5d0f8a..82829a24b1 100644 --- a/app/code/core/Mage/Review/Block/Product/View/List.php +++ b/app/code/core/Mage/Review/Block/Product/View/List.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Block/View.php b/app/code/core/Mage/Review/Block/View.php index 4ec754dc13..83fadec2c0 100644 --- a/app/code/core/Mage/Review/Block/View.php +++ b/app/code/core/Mage/Review/Block/View.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Helper/Data.php b/app/code/core/Mage/Review/Helper/Data.php index 6b83817bd9..73764762b7 100644 --- a/app/code/core/Mage/Review/Helper/Data.php +++ b/app/code/core/Mage/Review/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Model/Mysql4/Review.php b/app/code/core/Mage/Review/Model/Mysql4/Review.php index cad5196a75..5a1b402b27 100644 --- a/app/code/core/Mage/Review/Model/Mysql4/Review.php +++ b/app/code/core/Mage/Review/Model/Mysql4/Review.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Model/Mysql4/Review/Collection.php b/app/code/core/Mage/Review/Model/Mysql4/Review/Collection.php index 585b50a15c..fcdfb2d3d0 100644 --- a/app/code/core/Mage/Review/Model/Mysql4/Review/Collection.php +++ b/app/code/core/Mage/Review/Model/Mysql4/Review/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Model/Mysql4/Review/Product/Collection.php b/app/code/core/Mage/Review/Model/Mysql4/Review/Product/Collection.php index 4d9157338b..f44bb001c6 100644 --- a/app/code/core/Mage/Review/Model/Mysql4/Review/Product/Collection.php +++ b/app/code/core/Mage/Review/Model/Mysql4/Review/Product/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Model/Mysql4/Review/Status/Collection.php b/app/code/core/Mage/Review/Model/Mysql4/Review/Status/Collection.php index 40a5604f37..71c6c566b1 100644 --- a/app/code/core/Mage/Review/Model/Mysql4/Review/Status/Collection.php +++ b/app/code/core/Mage/Review/Model/Mysql4/Review/Status/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Model/Mysql4/Review/Summary.php b/app/code/core/Mage/Review/Model/Mysql4/Review/Summary.php index 6c941f203a..4c4ef27b80 100644 --- a/app/code/core/Mage/Review/Model/Mysql4/Review/Summary.php +++ b/app/code/core/Mage/Review/Model/Mysql4/Review/Summary.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Model/Mysql4/Review/Summary/Collection.php b/app/code/core/Mage/Review/Model/Mysql4/Review/Summary/Collection.php index 44066c8f08..5883fa90b1 100644 --- a/app/code/core/Mage/Review/Model/Mysql4/Review/Summary/Collection.php +++ b/app/code/core/Mage/Review/Model/Mysql4/Review/Summary/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Model/Observer.php b/app/code/core/Mage/Review/Model/Observer.php index 8f95dfd5eb..e5f5830b7d 100644 --- a/app/code/core/Mage/Review/Model/Observer.php +++ b/app/code/core/Mage/Review/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Model/Review.php b/app/code/core/Mage/Review/Model/Review.php index 5ef3ea954f..127288934c 100644 --- a/app/code/core/Mage/Review/Model/Review.php +++ b/app/code/core/Mage/Review/Model/Review.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Model/Review/Summary.php b/app/code/core/Mage/Review/Model/Review/Summary.php index 3cb91956df..9e6d9c6062 100644 --- a/app/code/core/Mage/Review/Model/Review/Summary.php +++ b/app/code/core/Mage/Review/Model/Review/Summary.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/Model/Session.php b/app/code/core/Mage/Review/Model/Session.php index fd36232c50..36fa438a9a 100644 --- a/app/code/core/Mage/Review/Model/Session.php +++ b/app/code/core/Mage/Review/Model/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/controllers/CustomerController.php b/app/code/core/Mage/Review/controllers/CustomerController.php index 9055583f3e..c506d637bb 100644 --- a/app/code/core/Mage/Review/controllers/CustomerController.php +++ b/app/code/core/Mage/Review/controllers/CustomerController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/controllers/ProductController.php b/app/code/core/Mage/Review/controllers/ProductController.php index 65e2b57648..922542ea85 100644 --- a/app/code/core/Mage/Review/controllers/ProductController.php +++ b/app/code/core/Mage/Review/controllers/ProductController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -185,11 +185,11 @@ public function postAction() } $review->aggregate(); - $session->addSuccess($this->__('Your review has been accepted for moderation')); + $session->addSuccess($this->__('Your review has been accepted for moderation.')); } catch (Exception $e) { $session->setFormData($data); - $session->addError($this->__('Unable to post review. Please, try again later.')); + $session->addError($this->__('Unable to post the review.')); } } else { @@ -200,7 +200,7 @@ public function postAction() } } else { - $session->addError($this->__('Unable to post review. Please, try again later.')); + $session->addError($this->__('Unable to post the review.')); } } } diff --git a/app/code/core/Mage/Review/etc/adminhtml.xml b/app/code/core/Mage/Review/etc/adminhtml.xml index 21deadbd50..2eca506a2c 100644 --- a/app/code/core/Mage/Review/etc/adminhtml.xml +++ b/app/code/core/Mage/Review/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Review/etc/config.xml b/app/code/core/Mage/Review/etc/config.xml index c50a00861c..0d7a606035 100644 --- a/app/code/core/Mage/Review/etc/config.xml +++ b/app/code/core/Mage/Review/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Review/etc/system.xml b/app/code/core/Mage/Review/etc/system.xml index 13b4433ca7..ed64ba17ed 100644 --- a/app/code/core/Mage/Review/etc/system.xml +++ b/app/code/core/Mage/Review/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -38,7 +38,7 @@ 0 - + select adminhtml/system_config_source_yesno 1 diff --git a/app/code/core/Mage/Review/sql/review_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Review/sql/review_setup/mysql4-install-0.7.0.php index 7e80faee07..f6e839d4ed 100644 --- a/app/code/core/Mage/Review/sql/review_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Review/sql/review_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.0-0.7.1.php index aaf88406b6..2ab751176a 100644 --- a/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.1-0.7.2.php index d1bc7ad842..69d585a7fc 100644 --- a/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.2-0.7.3.php index f0da5e176f..43854b0a80 100644 --- a/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.2-0.7.3.php +++ b/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.2-0.7.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.3-0.7.4.php b/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.3-0.7.4.php index 017046865e..1a6f63b0ea 100644 --- a/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.3-0.7.4.php +++ b/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.3-0.7.4.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.4-0.7.5.php b/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.4-0.7.5.php index d7c37a30c9..5685706908 100644 --- a/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.4-0.7.5.php +++ b/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.4-0.7.5.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.5-0.7.6.php b/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.5-0.7.6.php index 42f1091df1..e8fd8bf2cb 100644 --- a/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.5-0.7.6.php +++ b/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.5-0.7.6.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Review - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rss/Block/Abstract.php b/app/code/core/Mage/Rss/Block/Abstract.php index e5a3c58df2..18a1ab5f19 100644 --- a/app/code/core/Mage/Rss/Block/Abstract.php +++ b/app/code/core/Mage/Rss/Block/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Rss_Block_Abstract extends Mage_Core_Block_Template diff --git a/app/code/core/Mage/Rss/Block/Catalog/Abstract.php b/app/code/core/Mage/Rss/Block/Catalog/Abstract.php index 82e72eb098..c687b90bc0 100644 --- a/app/code/core/Mage/Rss/Block/Catalog/Abstract.php +++ b/app/code/core/Mage/Rss/Block/Catalog/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Rss_Block_Catalog_Abstract extends Mage_Rss_Block_Abstract diff --git a/app/code/core/Mage/Rss/Block/Catalog/Category.php b/app/code/core/Mage/Rss/Block/Catalog/Category.php index 0054a79de2..8715abcf77 100644 --- a/app/code/core/Mage/Rss/Block/Catalog/Category.php +++ b/app/code/core/Mage/Rss/Block/Catalog/Category.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -39,8 +39,9 @@ protected function _construct() * setting cache to save the rss for 10 minutes */ $this->setCacheKey('rss_catalog_category_' - .$this->getRequest()->getParam('cid').'_' - .$this->getRequest()->getParam('store_id') + . $this->getRequest()->getParam('cid') . '_' + . $this->getRequest()->getParam('store_id') . '_' + . Mage::getModel('customer/session')->getId() ); $this->setCacheLifetime(600); } diff --git a/app/code/core/Mage/Rss/Block/Catalog/New.php b/app/code/core/Mage/Rss/Block/Catalog/New.php index 6f9e477716..d50ed7c478 100644 --- a/app/code/core/Mage/Rss/Block/Catalog/New.php +++ b/app/code/core/Mage/Rss/Block/Catalog/New.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -46,7 +46,7 @@ protected function _toHtml() { $storeId = $this->_getStoreId(); - $newurl = Mage::getUrl('rss/catalog/new'); + $newurl = Mage::getUrl('rss/catalog/new/store_id/' . $storeId); $title = Mage::helper('rss')->__('New Products from %s',Mage::app()->getStore()->getGroup()->getName()); $lang = Mage::getStoreConfig('general/locale/code'); @@ -70,11 +70,13 @@ protected function _toHtml() $products = $product->getCollection() ->setStoreId($storeId) ->addStoreFilter() + ->addAttributeToFilter('news_from_date', array('date'=>true, 'to'=> $todayDate)) ->addAttributeToFilter(array(array('attribute'=>'news_to_date', 'date'=>true, 'from'=>$todayDate), array('attribute'=>'news_to_date', 'is' => new Zend_Db_Expr('null'))),'','left') ->addAttributeToSort('news_from_date','desc') - ->addAttributeToSelect(array('name', 'short_description', 'description', 'price', 'thumbnail'), 'inner') - ->addAttributeToSelect(array('special_price', 'special_from_date', 'special_to_date'), 'left') + ->addAttributeToSelect(array('name', 'short_description', 'description', 'thumbnail'), 'inner') + ->addAttributeToSelect(array('price', 'special_price', 'special_from_date', 'special_to_date'), 'left') + ->applyFrontendPriceLimitations() ; $products->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds()); diff --git a/app/code/core/Mage/Rss/Block/Catalog/NotifyStock.php b/app/code/core/Mage/Rss/Block/Catalog/NotifyStock.php index c4b081f39b..fc6c61a0f1 100644 --- a/app/code/core/Mage/Rss/Block/Catalog/NotifyStock.php +++ b/app/code/core/Mage/Rss/Block/Catalog/NotifyStock.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rss/Block/Catalog/Review.php b/app/code/core/Mage/Rss/Block/Catalog/Review.php index 279fd2c89b..e9b861b9d0 100644 --- a/app/code/core/Mage/Rss/Block/Catalog/Review.php +++ b/app/code/core/Mage/Rss/Block/Catalog/Review.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rss/Block/Catalog/Salesrule.php b/app/code/core/Mage/Rss/Block/Catalog/Salesrule.php index a0fd06de29..aebe2510f3 100644 --- a/app/code/core/Mage/Rss/Block/Catalog/Salesrule.php +++ b/app/code/core/Mage/Rss/Block/Catalog/Salesrule.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rss/Block/Catalog/Special.php b/app/code/core/Mage/Rss/Block/Catalog/Special.php index 3c97bf04e2..ddb5571a12 100644 --- a/app/code/core/Mage/Rss/Block/Catalog/Special.php +++ b/app/code/core/Mage/Rss/Block/Catalog/Special.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -82,7 +82,7 @@ protected function _toHtml() $specials->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds()); - $newurl = Mage::getUrl('rss/catalog/new'); + $newurl = Mage::getUrl('rss/catalog/special/store_id/' . $storeId); $title = Mage::helper('rss')->__('%s - Special Products', Mage::app()->getStore()->getFrontendName()); $lang = Mage::getStoreConfig('general/locale/code'); diff --git a/app/code/core/Mage/Rss/Block/Catalog/Tag.php b/app/code/core/Mage/Rss/Block/Catalog/Tag.php index a6eb69076e..5246221cf0 100644 --- a/app/code/core/Mage/Rss/Block/Catalog/Tag.php +++ b/app/code/core/Mage/Rss/Block/Catalog/Tag.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -47,7 +47,7 @@ protected function _toHtml() //store id is store view id $storeId = $this->_getStoreId(); $tagModel = Mage::registry('tag_model'); - $newurl = Mage::getUrl('rss/catalog/new'); + $newurl = Mage::getUrl('rss/catalog/tag/tagName/' . $tagModel->getName()); $title = Mage::helper('rss')->__('Products tagged with %s', $tagModel->getName()); $lang = Mage::getStoreConfig('general/locale/code'); diff --git a/app/code/core/Mage/Rss/Block/List.php b/app/code/core/Mage/Rss/Block/List.php index 986b07bc0f..07ccb9a1d8 100644 --- a/app/code/core/Mage/Rss/Block/List.php +++ b/app/code/core/Mage/Rss/Block/List.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -38,6 +38,23 @@ class Mage_Rss_Block_List extends Mage_Core_Block_Template protected $_rssFeeds = array(); + /** + * Add Link elements to head + * + * @return Mage_Rss_Block_List + */ + protected function _prepareLayout() + { + $head = $this->getLayout()->getBlock('head'); + $feeds = $this->getRssMiscFeeds(); + if ($head && !empty($feeds)) { + foreach ($feeds as $feed) { + $head->addItem('rss', $feed['url'], 'title="'.$feed['label'].'"'); + } + } + return parent::_prepareLayout(); + } + /** * Retrieve rss feeds * diff --git a/app/code/core/Mage/Rss/Block/Order/Details.php b/app/code/core/Mage/Rss/Block/Order/Details.php index 8f4fbed7f3..1fbaf0a379 100644 --- a/app/code/core/Mage/Rss/Block/Order/Details.php +++ b/app/code/core/Mage/Rss/Block/Order/Details.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Rss_Block_Order_Details extends Mage_Core_Block_Template diff --git a/app/code/core/Mage/Rss/Block/Order/New.php b/app/code/core/Mage/Rss/Block/Order/New.php index 25e92fa2c6..47241b8889 100644 --- a/app/code/core/Mage/Rss/Block/Order/New.php +++ b/app/code/core/Mage/Rss/Block/Order/New.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -87,7 +87,7 @@ public function addNewOrderXmlCallback($args) $rssObj = $args['rssObj']; $order = $args['order']; $detailBlock = $args['detailBlock']; - $order->unsetData()->load($args['row']['entity_id']); + $order->reset()->load($args['row']['entity_id']); if ($order && $order->getId()) { $title = Mage::helper('rss')->__('Order #%s created at %s', $order->getIncrementId(), $this->formatDate($order->getCreatedAt())); $url = Mage::helper('adminhtml')->getUrl('adminhtml/sales_order/view', array('_secure' => true, 'order_id' => $order->getId(), '_nosecret' => true)); diff --git a/app/code/core/Mage/Rss/Block/Order/Status.php b/app/code/core/Mage/Rss/Block/Order/Status.php index 3fbebb30d7..06ba250511 100644 --- a/app/code/core/Mage/Rss/Block/Order/Status.php +++ b/app/code/core/Mage/Rss/Block/Order/Status.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rss/Block/Wishlist.php b/app/code/core/Mage/Rss/Block/Wishlist.php index bd9ba2d6e9..a27b2ed377 100644 --- a/app/code/core/Mage/Rss/Block/Wishlist.php +++ b/app/code/core/Mage/Rss/Block/Wishlist.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -108,7 +108,9 @@ protected function _toHtml() $description = '' - . '
        ' . $this->htmlEscape($product->getShortDescription()) . '

        '; + . '

        ' + . $this->helper('catalog/output')->productAttribute($product, $product->getShortDescription(), 'short_description') + . '

        '; if ($product->getPrice() != $product->getFinalPrice()) { $description .= Mage::helper('catalog')->__('Regular Price:') . ' ' . Mage::helper('core')->currency($product->getPrice()) . ' ' @@ -122,13 +124,13 @@ protected function _toHtml() $description .= '

        '; if ($this->hasDescription($product)) { $description .= '

        ' . Mage::helper('wishlist')->__('Comment:') - . ' ' . $this->getEscapedDescription($product) . '

        '; + . ' ' . $this->helper('catalog/output')->productAttribute($product, $product->getDescription(), 'description') . '

        '; } $description .= '

        '; $rssObj->_addEntry(array( - 'title' => $product->getName(), + 'title' => $this->helper('catalog/output')->productAttribute($product, $product->getName(), 'name'), 'link' => $this->getProductUrl($product), 'description' => $description, )); diff --git a/app/code/core/Mage/Rss/Helper/Catalog.php b/app/code/core/Mage/Rss/Helper/Catalog.php index 6c6cc2b162..31eb1c502d 100644 --- a/app/code/core/Mage/Rss/Helper/Catalog.php +++ b/app/code/core/Mage/Rss/Helper/Catalog.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rss/Helper/Data.php b/app/code/core/Mage/Rss/Helper/Data.php index e53504e332..881f804e77 100644 --- a/app/code/core/Mage/Rss/Helper/Data.php +++ b/app/code/core/Mage/Rss/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rss/Helper/Order.php b/app/code/core/Mage/Rss/Helper/Order.php index 903d61b8a6..e911c6525c 100644 --- a/app/code/core/Mage/Rss/Helper/Order.php +++ b/app/code/core/Mage/Rss/Helper/Order.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rss/Model/Mysql4/Order.php b/app/code/core/Mage/Rss/Model/Mysql4/Order.php index c750b7033c..d9765cc683 100644 --- a/app/code/core/Mage/Rss/Model/Mysql4/Order.php +++ b/app/code/core/Mage/Rss/Model/Mysql4/Order.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** diff --git a/app/code/core/Mage/Rss/Model/Observer.php b/app/code/core/Mage/Rss/Model/Observer.php index eaf32d7b34..78cb75f553 100644 --- a/app/code/core/Mage/Rss/Model/Observer.php +++ b/app/code/core/Mage/Rss/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rss/Model/Rss.php b/app/code/core/Mage/Rss/Model/Rss.php index 6aa3f40c1f..56db6d1b39 100644 --- a/app/code/core/Mage/Rss/Model/Rss.php +++ b/app/code/core/Mage/Rss/Model/Rss.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rss/Model/Session.php b/app/code/core/Mage/Rss/Model/Session.php index ef073a537f..7e287bcd54 100644 --- a/app/code/core/Mage/Rss/Model/Session.php +++ b/app/code/core/Mage/Rss/Model/Session.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rss/Model/System/Config/Backend/Links.php b/app/code/core/Mage/Rss/Model/System/Config/Backend/Links.php new file mode 100644 index 0000000000..697bdf47ec --- /dev/null +++ b/app/code/core/Mage/Rss/Model/System/Config/Backend/Links.php @@ -0,0 +1,44 @@ +isValueChanged()) { + Mage::app()->getCacheInstance()->invalidateType(Mage_Core_Block_Abstract::CACHE_GROUP); + } + } + +} diff --git a/app/code/core/Mage/Rss/controllers/CatalogController.php b/app/code/core/Mage/Rss/controllers/CatalogController.php index 22bca32cdb..845e67c970 100644 --- a/app/code/core/Mage/Rss/controllers/CatalogController.php +++ b/app/code/core/Mage/Rss/controllers/CatalogController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rss/controllers/IndexController.php b/app/code/core/Mage/Rss/controllers/IndexController.php index c10836e0b1..d678018b92 100644 --- a/app/code/core/Mage/Rss/controllers/IndexController.php +++ b/app/code/core/Mage/Rss/controllers/IndexController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rss/controllers/OrderController.php b/app/code/core/Mage/Rss/controllers/OrderController.php index 49f116b4aa..1cb6bc291f 100644 --- a/app/code/core/Mage/Rss/controllers/OrderController.php +++ b/app/code/core/Mage/Rss/controllers/OrderController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rss/etc/adminhtml.xml b/app/code/core/Mage/Rss/etc/adminhtml.xml index 7ed5210424..83add6828a 100644 --- a/app/code/core/Mage/Rss/etc/adminhtml.xml +++ b/app/code/core/Mage/Rss/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Rss/etc/config.xml b/app/code/core/Mage/Rss/etc/config.xml index f27c3303ae..a2247d1d6a 100644 --- a/app/code/core/Mage/Rss/etc/config.xml +++ b/app/code/core/Mage/Rss/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Rss/etc/system.xml b/app/code/core/Mage/Rss/etc/system.xml index 4407d1d526..cf6de6d336 100644 --- a/app/code/core/Mage/Rss/etc/system.xml +++ b/app/code/core/Mage/Rss/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Rss - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -48,6 +48,7 @@ select adminhtml/system_config_source_enabledisable + rss/system_config_backend_links 10 1 1 diff --git a/app/code/core/Mage/Rule/Block/Actions.php b/app/code/core/Mage/Rule/Block/Actions.php index a051c84a59..4ab4b7e13f 100644 --- a/app/code/core/Mage/Rule/Block/Actions.php +++ b/app/code/core/Mage/Rule/Block/Actions.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rule/Block/Conditions.php b/app/code/core/Mage/Rule/Block/Conditions.php index 0def00a422..c0171808f9 100644 --- a/app/code/core/Mage/Rule/Block/Conditions.php +++ b/app/code/core/Mage/Rule/Block/Conditions.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rule/Block/Editable.php b/app/code/core/Mage/Rule/Block/Editable.php index 816074b10a..5b6894b115 100644 --- a/app/code/core/Mage/Rule/Block/Editable.php +++ b/app/code/core/Mage/Rule/Block/Editable.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -45,7 +45,7 @@ public function render(Varien_Data_Form_Element_Abstract $element) $html.= ''; - $html.= htmlspecialchars($valueName); + $html.= htmlspecialchars(Mage::helper('core/string')->truncate($valueName, 33, '...')); $html.= ' '; diff --git a/app/code/core/Mage/Rule/Block/Newchild.php b/app/code/core/Mage/Rule/Block/Newchild.php index c87efbbd79..ec72445205 100644 --- a/app/code/core/Mage/Rule/Block/Newchild.php +++ b/app/code/core/Mage/Rule/Block/Newchild.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rule/Block/Rule.php b/app/code/core/Mage/Rule/Block/Rule.php index 0cdde739e7..c2aaed1f69 100644 --- a/app/code/core/Mage/Rule/Block/Rule.php +++ b/app/code/core/Mage/Rule/Block/Rule.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rule/Helper/Data.php b/app/code/core/Mage/Rule/Helper/Data.php index 9baa1f35d3..942c7e8a6e 100644 --- a/app/code/core/Mage/Rule/Helper/Data.php +++ b/app/code/core/Mage/Rule/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rule/Model/Action/Abstract.php b/app/code/core/Mage/Rule/Model/Action/Abstract.php index e9cae757d5..307b272da7 100644 --- a/app/code/core/Mage/Rule/Model/Action/Abstract.php +++ b/app/code/core/Mage/Rule/Model/Action/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rule/Model/Action/Collection.php b/app/code/core/Mage/Rule/Model/Action/Collection.php index ac16432f3d..48bff70de2 100644 --- a/app/code/core/Mage/Rule/Model/Action/Collection.php +++ b/app/code/core/Mage/Rule/Model/Action/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rule/Model/Action/Interface.php b/app/code/core/Mage/Rule/Model/Action/Interface.php index 0c52ea197a..082a938471 100644 --- a/app/code/core/Mage/Rule/Model/Action/Interface.php +++ b/app/code/core/Mage/Rule/Model/Action/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rule/Model/Condition/Abstract.php b/app/code/core/Mage/Rule/Model/Condition/Abstract.php index 101970ba90..a2d6a95c45 100644 --- a/app/code/core/Mage/Rule/Model/Condition/Abstract.php +++ b/app/code/core/Mage/Rule/Model/Condition/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rule/Model/Condition/Combine.php b/app/code/core/Mage/Rule/Model/Condition/Combine.php index e5c9643aad..8d5e9181bd 100644 --- a/app/code/core/Mage/Rule/Model/Condition/Combine.php +++ b/app/code/core/Mage/Rule/Model/Condition/Combine.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -272,4 +272,12 @@ public function getConditions() { return $this->getData($this->getPrefix()); } + + /** + * Getter for "Conditions Combination" select option for recursive combines + */ + protected function _getRecursiveChildSelectOption() + { + return array('value' => $this->getType(), 'label' => Mage::helper('rule')->__('Conditions Combination')); + } } diff --git a/app/code/core/Mage/Rule/Model/Condition/Interface.php b/app/code/core/Mage/Rule/Model/Condition/Interface.php index 4f09ee22b2..7db329cd75 100644 --- a/app/code/core/Mage/Rule/Model/Condition/Interface.php +++ b/app/code/core/Mage/Rule/Model/Condition/Interface.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rule/Model/Environment.php b/app/code/core/Mage/Rule/Model/Environment.php index 6c80ef9533..63b01c4e6a 100644 --- a/app/code/core/Mage/Rule/Model/Environment.php +++ b/app/code/core/Mage/Rule/Model/Environment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rule/Model/Mysql4/Rule.php b/app/code/core/Mage/Rule/Model/Mysql4/Rule.php index 69d449db62..3ad530ca65 100644 --- a/app/code/core/Mage/Rule/Model/Mysql4/Rule.php +++ b/app/code/core/Mage/Rule/Model/Mysql4/Rule.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rule/Model/Mysql4/Rule/Collection.php b/app/code/core/Mage/Rule/Model/Mysql4/Rule/Collection.php index 4966a041f2..f3a9e56e64 100644 --- a/app/code/core/Mage/Rule/Model/Mysql4/Rule/Collection.php +++ b/app/code/core/Mage/Rule/Model/Mysql4/Rule/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rule/Model/Renderer/Actions.php b/app/code/core/Mage/Rule/Model/Renderer/Actions.php index 3c03b42a7a..cd5338404e 100644 --- a/app/code/core/Mage/Rule/Model/Renderer/Actions.php +++ b/app/code/core/Mage/Rule/Model/Renderer/Actions.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rule/Model/Renderer/Conditions.php b/app/code/core/Mage/Rule/Model/Renderer/Conditions.php index f91a86f30a..fedb4eede9 100644 --- a/app/code/core/Mage/Rule/Model/Renderer/Conditions.php +++ b/app/code/core/Mage/Rule/Model/Renderer/Conditions.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rule/Model/Rule.php b/app/code/core/Mage/Rule/Model/Rule.php index 76e98e2db5..3a6aa424e4 100644 --- a/app/code/core/Mage/Rule/Model/Rule.php +++ b/app/code/core/Mage/Rule/Model/Rule.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Rule/etc/config.xml b/app/code/core/Mage/Rule/etc/config.xml index ac76d115ec..50a4cf90dc 100644 --- a/app/code/core/Mage/Rule/etc/config.xml +++ b/app/code/core/Mage/Rule/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Rule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement.php b/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement.php new file mode 100644 index 0000000000..abfbed0a5e --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement.php @@ -0,0 +1,46 @@ + + */ +class Mage_Sales_Block_Adminhtml_Billing_Agreement extends Mage_Adminhtml_Block_Widget_Grid_Container +{ + /** + * Initialize billing agreements grid container + * + */ + public function __construct() + { + $this->_controller = 'adminhtml_billing_agreement'; + $this->_blockGroup = 'sales'; + $this->_headerText = Mage::helper('sales')->__('Billing Agreements'); + parent::__construct(); + $this->_removeButton('add'); + } +} diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/Grid.php b/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/Grid.php new file mode 100644 index 0000000000..bbdf909875 --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/Grid.php @@ -0,0 +1,154 @@ + + */ +class Mage_Sales_Block_Adminhtml_Billing_Agreement_Grid extends Mage_Adminhtml_Block_Widget_Grid +{ + /** + * Set grid params + * + */ + public function __construct() + { + parent::__construct(); + $this->setId('billing_agreements'); + $this->setUseAjax(true); + $this->setDefaultSort('agreement_id'); + $this->setDefaultDir('DESC'); + $this->setSaveParametersInSession(true); + } + + /** + * Retrieve grid url + * + * @return string + */ + public function getGridUrl() + { + return $this->getUrl('*/sales_billing_agreement/grid', array('_current' => true)); + } + + /** + * Retrieve row url + * + * @return string + */ + public function getRowUrl($item) + { + return $this->getUrl('*/sales_billing_agreement/view', array('agreement' => $item->getAgreementId())); + } + + /** + * Prepare collection for grid + * + * @return Mage_Adminhtml_Block_Widget_Grid + */ + protected function _prepareCollection() + { + $collection = Mage::getResourceModel('sales/billing_agreement_collection') + ->addCustomerDetails(); + $this->setCollection($collection); + return parent::_prepareCollection(); + } + + /** + * Add columns to grid + * + * @return Mage_Adminhtml_Block_Widget_Grid + */ + protected function _prepareColumns() + { + $this->addColumn('agreement_id', array( + 'header' => Mage::helper('sales')->__('ID'), + 'index' => 'agreement_id', + 'type' => 'text' + )); + + $this->addColumn('customer_email', array( + 'header' => Mage::helper('sales')->__('Customer Email'), + 'index' => 'customer_email', + 'type' => 'text' + )); + + $this->addColumn('customer_firstname', array( + 'header' => Mage::helper('sales')->__('Customer Name'), + 'index' => 'customer_firstname', + 'type' => 'text' + )); + + $this->addColumn('customer_lastname', array( + 'header' => Mage::helper('sales')->__('Customer Last Name'), + 'index' => 'customer_lastname', + 'type' => 'text' + )); + + $this->addColumn('method_code', array( + 'header' => Mage::helper('sales')->__('Payment Method'), + 'index' => 'method_code', + 'type' => 'options', + 'options' => Mage::helper('payment')->getAllBillingAgreementMethods() + )); + + $this->addColumn('reference_id', array( + 'header' => Mage::helper('sales')->__('Reference ID'), + 'index' => 'reference_id', + 'type' => 'text' + )); + + $this->addColumn('status', array( + 'header' => Mage::helper('sales')->__('Status'), + 'index' => 'status', + 'type' => 'options', + 'options' => Mage::getSingleton('sales/billing_agreement')->getStatusesArray() + )); + + $this->addColumn('created_at', array( + 'header' => Mage::helper('sales')->__('Created At'), + 'index' => 'created_at', + 'width' => 1, + 'type' => 'datetime', + 'align' => 'center', + 'default' => $this->__('N/A'), + 'html_decorators' => array('nobr') + )); + + $this->addColumn('updated_at', array( + 'header' => Mage::helper('sales')->__('Updated At'), + 'index' => 'updated_at', + 'width' => 1, + 'type' => 'datetime', + 'align' => 'center', + 'default' => $this->__('N/A'), + 'html_decorators' => array('nobr') + )); + + return parent::_prepareColumns(); + } +} diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View.php b/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View.php new file mode 100644 index 0000000000..b75759d4c1 --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View.php @@ -0,0 +1,109 @@ + + */ +class Mage_Sales_Block_Adminhtml_Billing_Agreement_View extends Mage_Adminhtml_Block_Widget_Form_Container +{ + /** + * Initialize view container + * + */ + public function __construct() + { + $this->_objectId = 'agreement'; + $this->_controller = 'adminhtml_billing_agreement'; + $this->_mode = 'view'; + $this->_blockGroup = 'sales'; + + parent::__construct(); + + if (!$this->_isAllowed('sales/billing_agreement/actions/manage')) { + $this->_removeButton('delete'); + } + $this->_removeButton('reset'); + $this->_removeButton('save'); + $this->setId('billing_agreement_view'); + + $this->_addButton('back', array( + 'label' => Mage::helper('adminhtml')->__('Back'), + 'onclick' => 'setLocation(\'' . $this->getBackUrl() . '\')', + 'class' => 'back', + ), -1); + + if ($this->_getBillingAgreement()->canCancel() && $this->_isAllowed('sales/billing_agreement/actions/manage')) { + $this->_addButton('cancel', array( + 'label' => Mage::helper('adminhtml')->__('Cancel'), + 'onclick' => "confirmSetLocation('{$this->__('Are you sure you want to do this?')}', '{$this->_getCancelUrl()}')", + 'class' => 'cancel', + ), -1); + } + } + + /** + * Retrieve header text + * + * @return string + */ + public function getHeaderText() + { + return $this->__('Billing Agreement #%s', $this->_getBillingAgreement()->getReferenceId()); + } + + /** + * Retrieve cancel billing agreement url + * + * @return string + */ + protected function _getCancelUrl() + { + return $this->getUrl('*/*/cancel', array('agreement' => $this->_getBillingAgreement()->getAgreementId())); + } + + /** + * Retrieve billing agreement model + * + * @return Mage_Sales_Model_Billing_Agreement + */ + protected function _getBillingAgreement() + { + return Mage::registry('current_billing_agreement'); + } + + /** + * Check current user permissions for specified action + * + * @param string $action + * @return bool + */ + protected function _isAllowed($action) + { + return Mage::getSingleton('admin/session')->isAllowed($action); + } +} diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View/Form.php b/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View/Form.php new file mode 100644 index 0000000000..d4769a7fcc --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View/Form.php @@ -0,0 +1,43 @@ + + */ +class Mage_Sales_Block_Adminhtml_Billing_Agreement_View_Form extends Mage_Adminhtml_Block_Template +{ + /** + * Define custom template + * + */ + protected function _construct() + { + parent::_construct(); + $this->setTemplate('sales/billing/agreement/view/form.phtml'); + } +} diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View/Tab/Info.php b/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View/Tab/Info.php new file mode 100644 index 0000000000..613461bb76 --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View/Tab/Info.php @@ -0,0 +1,120 @@ + + */ +class Mage_Sales_Block_Adminhtml_Billing_Agreement_View_Tab_Info extends Mage_Adminhtml_Block_Abstract + implements Mage_Adminhtml_Block_Widget_Tab_Interface +{ + /** + * Set custom template + * + */ + protected function _construct() + { + parent::_construct(); + $this->setTemplate('sales/billing/agreement/view/tab/info.phtml'); + } + + /** + * Return Tab label + * + * @return string + */ + public function getTabLabel() + { + return $this->__('Genereal Information'); + } + + /** + * Return Tab title + * + * @return string + */ + public function getTabTitle() + { + return $this->__('Genereal Information'); + } + + /** + * Can show tab in tabs + * + * @return boolean + */ + public function canShowTab() + { + return true; + } + + /** + * Tab is hidden + * + * @return boolean + */ + public function isHidden() + { + return false; + } + + /** + * Retrieve billing agreement model + * + * @return Mage_Sales_Model_Billing_Agreement + */ + protected function _getBillingAgreement() + { + return Mage::registry('current_billing_agreement'); + } + + /** + * Set data to block + * + * @return string + */ + protected function _toHtml() + { + $agreement = $this->_getBillingAgreement(); + $this->setReferenceId($agreement->getReferenceId()); + $customer = Mage::getModel('customer/customer')->load($agreement->getCustomerId()); + $this->setCustomerUrl( + $this->getUrl('*/customer/edit', array('id' => $customer->getId())) + ); + $this->setCustomerEmail($customer->getEmail()); + $this->setStatus($agreement->getStatusLabel()); + $this->setCreatedAt( + $this->helper('core')->formatDate($agreement->getCreatedAt(), 'short', true) + ); + $this->setUpdatedAt( + ($agreement->getUpdatedAt()) + ? $this->helper('core')->formatDate($agreement->getUpdatedAt(), 'short', true) : $this->__('N/A') + ); + + return parent::_toHtml(); + } +} diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View/Tab/Orders.php b/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View/Tab/Orders.php new file mode 100644 index 0000000000..4e4242f1a3 --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View/Tab/Orders.php @@ -0,0 +1,127 @@ + + */ +class Mage_Sales_Block_Adminhtml_Billing_Agreement_View_Tab_Orders extends Mage_Adminhtml_Block_Sales_Order_Grid + implements Mage_Adminhtml_Block_Widget_Tab_Interface +{ + /** + * Initialize grid params + * + */ + public function __construct() + { + parent::__construct(); + $this->setId('billing_agreement_orders'); + } + + /** + * Prepare related orders collection + * + * @return Mage_Adminhtml_Block_Widget_Grid + */ + protected function _prepareCollection() + { + $collection = Mage::getResourceModel('sales/order_grid_collection'); + $collection->addBillingAgreementsFilter(Mage::registry('current_billing_agreement')->getId()); + $this->setCollection($collection); + return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection(); + } + + /** + * Return Tab label + * + * @return string + */ + public function getTabLabel() + { + return $this->__('Related Orders'); + } + + /** + * Return Tab title + * + * @return string + */ + public function getTabTitle() + { + return $this->__('Related Orders'); + } + + /** + * Can show tab in tabs + * + * @return boolean + */ + public function canShowTab() + { + return true; + } + + /** + * Tab is hidden + * + * @return boolean + */ + public function isHidden() + { + return false; + } + + /** + * Retrieve grid url + * + * @return string + */ + public function getGridUrl() + { + return $this->getUrl('*/*/ordersGrid', array('_current'=>true)); + } + + /** + * Remove import/export field from grid + * + * @return bool + */ + public function getExportTypes() + { + return false; + } + + /** + * Disable massaction in grid + * + * @return Mage_Sales_Block_Adminhtml_Billing_Agreement_View_Tab_Orders + */ + protected function _prepareMassaction() + { + return $this; + } +} diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View/Tabs.php b/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View/Tabs.php new file mode 100644 index 0000000000..5ff26c1ee6 --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View/Tabs.php @@ -0,0 +1,45 @@ + + */ +class Mage_Sales_Block_Adminhtml_Billing_Agreement_View_Tabs extends Mage_Adminhtml_Block_Widget_Tabs +{ + /** + * Initialize tab + * + */ + public function __construct() + { + parent::__construct(); + $this->setId('billing_agreement_view_tabs'); + $this->setDestElementId('billing_agreement_view'); + $this->setTitle($this->__('Billing Agreement View')); + } +} diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Customer/Edit/Tab/Agreement.php b/app/code/core/Mage/Sales/Block/Adminhtml/Customer/Edit/Tab/Agreement.php new file mode 100644 index 0000000000..9c3d1b3160 --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Customer/Edit/Tab/Agreement.php @@ -0,0 +1,139 @@ + + */ +class Mage_Sales_Block_Adminhtml_Customer_Edit_Tab_Agreement + extends Mage_Sales_Block_Adminhtml_Billing_Agreement_Grid + implements Mage_Adminhtml_Block_Widget_Tab_Interface +{ + /** + * Columns, that should be removed from grid + * + * @var array + */ + protected $_columnsToRemove = array('customer_email', 'customer_firstname', 'customer_lastname'); + + /** + * Disable filters and paging + * + */ + public function __construct() + { + parent::__construct(); + $this->setId('customer_edit_tab_agreements'); + } + + /** + * Return Tab label + * + * @return string + */ + public function getTabLabel() + { + return $this->__('Billing Agreements'); + } + + /** + * Return Tab title + * + * @return string + */ + public function getTabTitle() + { + return $this->__('Billing Agreements'); + } + + /** + * Can show tab in tabs + * + * @return boolean + */ + public function canShowTab() + { + $customer = Mage::registry('current_customer'); + return (bool)$customer->getId(); + } + + /** + * Tab is hidden + * + * @return boolean + */ + public function isHidden() + { + return false; + } + + public function getGridUrl() + { + return $this->getUrl('*/sales_billing_agreement/customerGrid', array('_current'=>true)); + } + + /** + * Defines after which tab, this tab should be rendered + * + * @return string + */ + public function getAfter() + { + return 'orders'; + } + + /** + * Prepare collection for grid + * + * @return Mage_Sales_Block_Adminhtml_Customer_Edit_Tab_Agreement + */ + protected function _prepareCollection() + { + $collection = Mage::getResourceModel('sales/billing_agreement_collection') + ->addFieldToFilter('customer_id', Mage::registry('current_customer')->getId()) + ->setOrder('created_at'); + $this->setCollection($collection); + return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection(); + } + + /** + * Remove some columns and make other not sortable + * + * @return Mage_Adminhtml_Block_Widget_Grid + */ + protected function _prepareColumns() + { + $result = parent::_prepareColumns(); + + foreach ($this->_columns as $key => $value) { + if (in_array($key, $this->_columnsToRemove)) { + unset($this->_columns[$key]); + } + } + return $result; + } +} diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile.php b/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile.php new file mode 100644 index 0000000000..4233672c82 --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile.php @@ -0,0 +1,49 @@ +_headerText = Mage::helper('sales')->__('Recurring Profiles (beta)'); + parent::__construct(); + $this->_removeButton('add'); + } +} diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/Edit/Form.php b/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/Edit/Form.php new file mode 100644 index 0000000000..0ee7aa7306 --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/Edit/Form.php @@ -0,0 +1,214 @@ +_parentElement = $element; + return $this; + } + + /** + * Setter for current product + * + * @param Mage_Catalog_Model_Product $product + */ + public function setProductEntity(Mage_Catalog_Model_Product $product) + { + $this->_product = $product; + return $this; + } + + /** + * Instantiate a recurring payment profile to use it as a helper + */ + protected function _construct() + { + $this->_profile = Mage::getSingleton('sales/recurring_profile'); + return parent::_construct(); + } + + /** + * Prepare and render the form + * + * @return string + */ + protected function _toHtml() + { + // TODO: implement $this->_isReadonly setting + $form = $this->_prepareForm(); + if ($this->_product && $this->_product->getRecurringProfile()) { + $form->setValues($this->_product->getRecurringProfile()); + } + return $form->toHtml(); + } + + /** + * Instantiate form and fields + * + * @return Varien_Data_Form + */ + protected function _prepareForm() + { + $form = new Varien_Data_Form(); + $form->setFieldsetRenderer($this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset')); + $form->setFieldsetElementRenderer($this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset_element')); + + /** + * if there is a parent element defined, it will be replaced by a hidden element with the same name + * and overriden by the form elements + * It is needed to maintain HTML consistency of the parent element's form + */ + if ($this->_parentElement) { + $form->setHtmlIdPrefix($this->_parentElement->getHtmlId()) + ->setFieldNameSuffix($this->_parentElement->getName()); + $form->addField('', 'hidden', array('name' => '')); + } + + $noYes = array(Mage::helper('adminhtml')->__('No'), Mage::helper('adminhtml')->__('Yes')); + + // schedule + $schedule = $form->addFieldset('schedule_fieldset', array( + 'legend' => Mage::helper('sales')->__('Schedule'), + 'disabled' => $this->_isReadOnly + )); + $schedule->addField('start_date_is_editable', 'select', array( + 'name' => 'start_date_is_editable', + 'label' => Mage::helper('sales')->__('Customer Can Define Start Date'), + 'comment' => Mage::helper('sales')->__('Whether buyer can define the date when billing for the profile begins.'), + 'options' => array('No', 'Yes') + )); + $this->_addField($schedule, 'schedule_description'); + $this->_addField($schedule, 'suspension_threshold'); + $this->_addField($schedule, 'bill_failed_later', array('options' => $noYes), 'select'); + + // billing + $billing = $form->addFieldset('billing_fieldset', array( + 'legend' => Mage::helper('sales')->__('Billing'), + 'disabled' => $this->_isReadOnly + )); + $this->_addField($billing, 'period_unit', array( + 'options' => $this->_getPeriodUnitOptions(Mage::helper('adminhtml')->__('-- Please Select --')), + ), 'select'); + $this->_addField($billing, 'period_frequency'); + $this->_addField($billing, 'period_max_cycles'); + + // trial + $trial = $form->addFieldset('trial_fieldset', array( + 'legend' => Mage::helper('sales')->__('Trial Period'), + 'disabled' => $this->_isReadOnly + )); + $this->_addField($trial, 'trial_period_unit', array( + 'options' => $this->_getPeriodUnitOptions(Mage::helper('adminhtml')->__('-- Not Selected --')), + ), 'select'); + $this->_addField($trial, 'trial_period_frequency'); + $this->_addField($trial, 'trial_period_max_cycles'); + $this->_addField($trial, 'trial_billing_amount'); + + // initial fees + $initial = $form->addFieldset('initial_fieldset', array( + 'legend' => Mage::helper('sales')->__('Initial Fees'), + 'disabled' => $this->_isReadOnly + )); + $this->_addField($initial, 'init_amount'); + $this->_addField($initial, 'init_may_fail', array('options' => $noYes), 'select'); + + return $form; + } + + /** + * Add a field to the form or fieldset + * Form and fieldset have same abstract + * + * @param Varien_Data_Form|Varien_Data_Form_Element_Fieldset $formOrFieldset + * @param string $elementName + * @param array $options + * @param string $type + * @return Varien_Data_Form_Element_Abstract + */ + protected function _addField($formOrFieldset, $elementName, $options = array(), $type = 'text') + { + $options = array_merge($options, array( + 'name' => $elementName, + 'label' => $this->_profile->getFieldLabel($elementName), + 'note' => $this->_profile->getFieldComment($elementName), + 'disabled' => $this->_isReadOnly, + )); + if (in_array($elementName, array('period_unit', 'period_frequency'))) { + $options['required'] = true; + } + return $formOrFieldset->addField($elementName, $type, $options); + } + + /** + * Getter for period unit options with "Please Select" label + * + * @return array + */ + protected function _getPeriodUnitOptions($emptyLabel) + { + return array_merge(array('' => $emptyLabel), + $this->_profile->getAllPeriodUnits() + ); + } +} diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/Grid.php b/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/Grid.php new file mode 100644 index 0000000000..67f0d0d786 --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/Grid.php @@ -0,0 +1,148 @@ +setId('sales_recurring_profile_grid'); + $this->setUseAjax(true); + $this->setSaveParametersInSession(true); + } + + /** + * Prepare grid collection object + * + * @return Mage_Sales_Block_Adminhtml_Recurring_Profile_Grid + */ + protected function _prepareCollection() + { + $collection = Mage::getResourceModel('sales/recurring_profile_collection'); + $this->setCollection($collection); + if (!$this->getParam($this->getVarNameSort())) { + $collection->setOrder('profile_id', 'desc'); + } + return parent::_prepareCollection(); + } + + /** + * Prepare grid columns + * + * @return Mage_Sales_Block_Adminhtml_Recurring_Profile_Grid + */ + protected function _prepareColumns() + { + $profile = Mage::getModel('sales/recurring_profile'); + + $this->addColumn('reference_id', array( + 'header' => $profile->getFieldLabel('reference_id'), + 'index' => 'reference_id', + 'html_decorators' => array('nobr'), + 'width' => 1, + )); + + if (!Mage::app()->isSingleStoreMode()) { + $this->addColumn('store_id', array( + 'header' => Mage::helper('adminhtml')->__('Store'), + 'index' => 'store_id', + 'type' => 'store', + 'store_view' => true, + 'display_deleted' => true, + )); + } + + $this->addColumn('state', array( + 'header' => $profile->getFieldLabel('state'), + 'index' => 'state', + 'type' => 'options', + 'options' => $profile->getAllStates(), + 'html_decorators' => array('nobr'), + 'width' => 1, + )); + + $this->addColumn('created_at', array( + 'header' => $profile->getFieldLabel('created_at'), + 'index' => 'created_at', + 'type' => 'datetime', + 'html_decorators' => array('nobr'), + 'width' => 1, + )); + + $this->addColumn('updated_at', array( + 'header' => $profile->getFieldLabel('updated_at'), + 'index' => 'updated_at', + 'type' => 'datetime', + 'html_decorators' => array('nobr'), + 'width' => 1, + )); + + $methods = array(); + foreach (Mage::helper('payment')->getRecurringProfileMethods() as $method) { + $methods[$method->getCode()] = $method->getTitle(); + } + $this->addColumn('method_code', array( + 'header' => $profile->getFieldLabel('method_code'), + 'index' => 'method_code', + 'type' => 'options', + 'options' => $methods, + )); + + $this->addColumn('schedule_description', array( + 'header' => $profile->getFieldLabel('schedule_description'), + 'index' => 'schedule_description', + )); + + return parent::_prepareColumns(); + } + + /** + * Return row url for js event handlers + * + * @param Varien_Object + * @return string + */ + public function getRowUrl($row) + { + return $this->getUrl('*/sales_recurring_profile/view', array('profile' => $row->getId())); + } + + /** + * Return grid url + * + * @return string + */ + public function getGridUrl() + { + return $this->getUrl('*/*/grid', array('_current'=>true)); + } +} diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View.php b/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View.php new file mode 100644 index 0000000000..fc7f2d510b --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View.php @@ -0,0 +1,103 @@ +_addButton('back', array( + 'label' => Mage::helper('adminhtml')->__('Back'), + 'onclick' => "setLocation('{$this->getUrl('*/*/')}')", + 'class' => 'back', + )); + + $profile = Mage::registry('current_recurring_profile'); + $comfirmationMessage = Mage::helper('sales')->__('Are you sure you want to do this?'); + + // cancel + if ($profile->canCancel()) { + $url = $this->getUrl('*/*/updateState', array('profile' => $profile->getId(), 'action' => 'cancel')); + $this->_addButton('cancel', array( + 'label' => Mage::helper('sales')->__('Cancel'), + 'onclick' => "confirmSetLocation('{$comfirmationMessage}', '{$url}')", + 'class' => 'delete', + )); + } + + // suspend + if ($profile->canSuspend()) { + $url = $this->getUrl('*/*/updateState', array('profile' => $profile->getId(), 'action' => 'suspend')); + $this->_addButton('suspend', array( + 'label' => Mage::helper('sales')->__('Suspend'), + 'onclick' => "confirmSetLocation('{$comfirmationMessage}', '{$url}')", + 'class' => 'delete', + )); + } + + // activate + if ($profile->canActivate()) { + $url = $this->getUrl('*/*/updateState', array('profile' => $profile->getId(), 'action' => 'activate')); + $this->_addButton('activate', array( + 'label' => Mage::helper('sales')->__('Activate'), + 'onclick' => "confirmSetLocation('{$comfirmationMessage}', '{$url}')", + 'class' => 'add', + )); + } + + // get update + if ($profile->canFetchUpdate()) { + $url = $this->getUrl('*/*/updateProfile', array('profile' => $profile->getId(),)); + $this->_addButton('update', array( + 'label' => Mage::helper('sales')->__('Get Update'), + 'onclick' => "confirmSetLocation('{$comfirmationMessage}', '{$url}')", + 'class' => 'add', + )); + } + + return parent::_prepareLayout(); + } + + /** + * Set title and a hack for tabs container + * + * @return Mage_Sales_Block_Adminhtml_Recurring_Profile_View + */ + protected function _beforeToHtml() + { + $profile = Mage::registry('current_recurring_profile'); + $this->_headerText = Mage::helper('sales')->__('Recurring Profile # %s', $profile->getReferenceId()); + $this->setViewHtml('
        '); + return parent::_beforeToHtml(); + } +} diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Getawayinfo.php b/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Getawayinfo.php new file mode 100644 index 0000000000..dbfabaf4c3 --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Getawayinfo.php @@ -0,0 +1,50 @@ + + */ +class Mage_Adminhtml_Block_Sales_Recurring_Profile_View_Getawayinfo extends Mage_Adminhtml_Block_Widget +{ + /** + * Return recurring profile getaway information for view + * + * @return array + */ + public function getRecurringProfileGetawayInformation() + { + $recurringProfile = Mage::registry('current_recurring_profile'); + $information = array(); + foreach($recurringProfile->getData() as $kay => $value) { + $information[$recurringProfile->getFieldLabel($kay)] = $value; + } + return $information; + } +} diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Info.php b/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Info.php new file mode 100644 index 0000000000..a686c91e4e --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Info.php @@ -0,0 +1,50 @@ + + */ +class Mage_Adminhtml_Block_Sales_Recurring_Profile_View_Info extends Mage_Adminhtml_Block_Widget +{ + /** + * Return recurring profile information for view + * + * @return array + */ + public function getRecurringProfileInformation() + { + $recurringProfile = Mage::registry('current_recurring_profile'); + $information = array(); + foreach($recurringProfile->getData() as $kay => $value) { + $information[$recurringProfile->getFieldLabel($kay)] = $value; + } + return $information; + } +} diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Items.php b/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Items.php new file mode 100644 index 0000000000..93405c766b --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Items.php @@ -0,0 +1,79 @@ + + */ +class Mage_Adminhtml_Block_Sales_Recurring_Profile_View_Items extends Mage_Adminhtml_Block_Sales_Items_Abstract +{ + /** + * Retrieve required options from parent + */ + protected function _beforeToHtml() + { + if (!$this->getParentBlock()) { + Mage::throwException(Mage::helper('adminhtml')->__('Invalid parent block for this block')); + } + parent::_beforeToHtml(); + } + + /** + * Return current recurring profile + * + * @return Mage_Sales_Model_Recurring_Profile + */ + public function _getRecurringProfile() + { + return Mage::registry('current_recurring_profile'); + } + + /** + * Retrieve recurring profile item + * + * @return Mage_Sales_Model_Order_Item + */ + public function getItem() + { + return $this->_getRecurringProfile()->getItem(); + } + + /** + * Retrieve formated price + * + * @param decimal $value + * @return string + */ + public function formatPrice($value) + { + $store = Mage::app()->getStore($this->_getRecurringProfile()->getStore()); + return $store->formatPrice($value); + } +} + diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Tab/Info.php b/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Tab/Info.php new file mode 100644 index 0000000000..dbc87df038 --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Tab/Info.php @@ -0,0 +1,69 @@ +__('Profile Information'); + } + + /** + * Also label getter :) + * + * @return string + */ + public function getTabTitle() + { + return $this->getLabel(); + } + + /** + * @return bool + */ + public function canShowTab() + { + return true; + } + + /** + * @return bool + */ + public function isHidden() + { + return false; + } +} diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Tab/Orders.php b/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Tab/Orders.php new file mode 100644 index 0000000000..3fb12955ca --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View/Tab/Orders.php @@ -0,0 +1,225 @@ +setId('recurring_profile_orders') + ->setUseAjax(true) + ->setSkipGenerateContent(true) + ; + } + + /** + * Prepare grid collection object + * + * @return Mage_Sales_Block_Adminhtml_Recurring_Profile_View_Tab_Orders + */ + protected function _prepareCollection() + { + $collection = Mage::getResourceModel('sales/order_collection') + ->addRecurringProfilesFilter(Mage::registry('current_recurring_profile')->getId()) + ; + $this->setCollection($collection); + return parent::_prepareCollection(); + } + + /** + * Prepare grid columns + * + * TODO: fix up this mess + * + * @return Mage_Sales_Block_Adminhtml_Recurring_Profile_View_Tab_Orders + */ + protected function _prepareColumns() + { + $this->addColumn('real_order_id', array( + 'header'=> Mage::helper('sales')->__('Order #'), + 'width' => '80px', + 'type' => 'text', + 'index' => 'increment_id', + )); + + if (!Mage::app()->isSingleStoreMode()) { + $this->addColumn('store_id', array( + 'header' => Mage::helper('sales')->__('Purchased From (Store)'), + 'index' => 'store_id', + 'type' => 'store', + 'store_view'=> true, + 'display_deleted' => true, + )); + } + + $this->addColumn('created_at', array( + 'header' => Mage::helper('sales')->__('Purchased On'), + 'index' => 'created_at', + 'type' => 'datetime', + 'width' => '100px', + )); + + $this->addColumn('billing_name', array( + 'header' => Mage::helper('sales')->__('Bill to Name'), + 'index' => 'billing_name', + )); + + $this->addColumn('shipping_name', array( + 'header' => Mage::helper('sales')->__('Ship to Name'), + 'index' => 'shipping_name', + )); + + $this->addColumn('base_grand_total', array( + 'header' => Mage::helper('sales')->__('G.T. (Base)'), + 'index' => 'base_grand_total', + 'type' => 'currency', + 'currency' => 'base_currency_code', + )); + + $this->addColumn('grand_total', array( + 'header' => Mage::helper('sales')->__('G.T. (Purchased)'), + 'index' => 'grand_total', + 'type' => 'currency', + 'currency' => 'order_currency_code', + )); + + $this->addColumn('status', array( + 'header' => Mage::helper('sales')->__('Status'), + 'index' => 'status', + 'type' => 'options', + 'width' => '70px', + 'options' => Mage::getSingleton('sales/order_config')->getStatuses(), + )); + + if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) { + $this->addColumn('action', + array( + 'header' => Mage::helper('sales')->__('Action'), + 'width' => '50px', + 'type' => 'action', + 'getter' => 'getId', + 'actions' => array( + array( + 'caption' => Mage::helper('sales')->__('View'), + 'url' => array('base'=>'*/sales_order/view'), + 'field' => 'order_id' + ) + ), + 'filter' => false, + 'sortable' => false, + 'index' => 'stores', + 'is_system' => true, + )); + } + + return parent::_prepareColumns(); + } + + /** + * Return row url for js event handlers + * + * @param Varien_Object + * @return string + */ + public function getRowUrl($row) + { + return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId())); + } + + /** + * Url for ajax grid submission + * + * @return string + */ + public function getGridUrl() + { + return $this->getTabUrl(); + } + + /** + * Url for ajax tab + * + * @return string + */ + public function getTabUrl() + { + return $this->getUrl('*/*/orders', array('profile' => Mage::registry('current_recurring_profile')->getId())); + } + + /** + * Class for ajax tab + * + * @return string + */ + public function getTabClass() + { + return 'ajax'; + } + + /** + * Label getter + * + * @return string + */ + public function getTabLabel() + { + return Mage::helper('sales')->__('Related Orders'); + } + + /** + * Same as label getter + * + * @return string + */ + public function getTabTitle() + { + return $this->getTabLabel(); + } + + /** + * @return bool + */ + public function canShowTab() + { + return true; + } + + /** + * @return bool + */ + public function isHidden() + { + return false; + } +} diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Report/Filter/Form.php b/app/code/core/Mage/Sales/Block/Adminhtml/Report/Filter/Form.php new file mode 100644 index 0000000000..c6421f695f --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Report/Filter/Form.php @@ -0,0 +1,90 @@ + + */ +class Mage_Sales_Block_Adminhtml_Report_Filter_Form extends Mage_Adminhtml_Block_Report_Filter_Form +{ + /** + * Add fields to base fieldset which are general to sales reports + * + * @return Mage_Sales_Block_Adminhtml_Report_Filter_Form + */ + protected function _prepareForm() + { + parent::_prepareForm(); + $form = $this->getForm(); + $htmlIdPrefix = $form->getHtmlIdPrefix(); + /** @var Varien_Data_Form_Element_Fieldset $fieldset */ + $fieldset = $this->getForm()->getElement('base_fieldset'); + + if (is_object($fieldset) && $fieldset instanceof Varien_Data_Form_Element_Fieldset) { + + $statuses = Mage::getModel('sales/order_config')->getStatuses(); + $values = array(); + foreach ($statuses as $code => $label) { + if (false === strpos($code, 'pending')) { + $values[] = array( + 'label' => Mage::helper('reports')->__($label), + 'value' => $code + ); + } + } + + $fieldset->addField('show_order_statuses', 'select', array( + 'name' => 'show_order_statuses', + 'label' => Mage::helper('reports')->__('Order Status'), + 'options' => array( + '0' => Mage::helper('reports')->__('Any'), + '1' => Mage::helper('reports')->__('Specified'), + ), + 'note' => Mage::helper('reports')->__('Applies to Any of the Specified Order Statuses'), + ), 'to'); + + $fieldset->addField('order_statuses', 'multiselect', array( + 'name' => 'order_statuses', + 'values' => $values, + 'display' => 'none' + ), 'show_order_statuses'); + + // define field dependencies + if ($this->getFieldVisibility('show_order_statuses') && $this->getFieldVisibility('order_statuses')) { + $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence') + ->addFieldMap("{$htmlIdPrefix}show_order_statuses", 'show_order_statuses') + ->addFieldMap("{$htmlIdPrefix}order_statuses", 'order_statuses') + ->addFieldDependence('order_statuses', 'show_order_statuses', '1') + ); + } + } + + return $this; + } +} diff --git a/app/code/core/Mage/Sales/Block/Adminhtml/Report/Filter/Form/Order.php b/app/code/core/Mage/Sales/Block/Adminhtml/Report/Filter/Form/Order.php new file mode 100644 index 0000000000..878a5359b2 --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Adminhtml/Report/Filter/Form/Order.php @@ -0,0 +1,60 @@ + + */ + +class Mage_Sales_Block_Adminhtml_Report_Filter_Form_Order extends Mage_Sales_Block_Adminhtml_Report_Filter_Form +{ + protected function _prepareForm() + { + parent::_prepareForm(); + $form = $this->getForm(); + $htmlIdPrefix = $form->getHtmlIdPrefix(); + /** @var Varien_Data_Form_Element_Fieldset $fieldset */ + $fieldset = $this->getForm()->getElement('base_fieldset'); + + if (is_object($fieldset) && $fieldset instanceof Varien_Data_Form_Element_Fieldset) { + + $fieldset->addField('show_actual_columns', 'select', array( + 'name' => 'show_actual_columns', + 'options' => array( + '1' => Mage::helper('reports')->__('Yes'), + '0' => Mage::helper('reports')->__('No') + ), + 'label' => Mage::helper('reports')->__('Show Actual Values'), + )); + + } + + return $this; + } +} diff --git a/app/code/core/Mage/Sales/Block/Billing/Agreement/View.php b/app/code/core/Mage/Sales/Block/Billing/Agreement/View.php new file mode 100644 index 0000000000..eaa3f045d8 --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Billing/Agreement/View.php @@ -0,0 +1,186 @@ + + */ +class Mage_Sales_Block_Billing_Agreement_View extends Mage_Core_Block_Template +{ + /** + * Payment methods array + * + * @var array + */ + protected $_paymentMethods = array(); + + /** + * Billing Agreement instance + * + * @var Mage_Sales_Model_Billing_Agreement + */ + protected $_billingAgreementInstance = null; + + /** + * Related orders collection + * + * @var Mage_Sales_Model_Mysql4_Order_Collection + */ + protected $_relatedOrders = null; + + /** + * Retrieve related orders collection + * + * @return Mage_Sales_Model_Mysql4_Order_Collection + */ + public function getRelatedOrders() + { + if (is_null($this->_relatedOrders)) { + $this->_relatedOrders = Mage::getResourceModel('sales/order_collection') + ->addFieldToSelect('*') + ->addFieldToFilter('customer_id', Mage::getSingleton('customer/session')->getCustomer()->getId()) + ->addFieldToFilter('state', array('in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates())) + ->addBillingAgreementsFilter($this->_billingAgreementInstance->getAgreementId()) + ->setOrder('created_at', 'desc'); + } + return $this->_relatedOrders; + } + + /** + * Retrieve order item value by key + * + * @param Mage_Sales_Model_Order $order + * @param string $key + * @return string + */ + public function getOrderItemValue(Mage_Sales_Model_Order $order, $key) + { + $escape = true; + switch ($key) { + case 'order_increment_id': + $value = $order->getIncrementId(); + break; + case 'created_at': + $value = $this->helper('core')->formatDate($order->getCreatedAt(), 'short', true); + break; + case 'shipping_address': + $value = $order->getShippingAddress() + ? $this->htmlEscape($order->getShippingAddress()->getName()) : $this->__('N/A'); + break; + case 'order_total': + $value = $order->formatPrice($order->getGrandTotal()); + $escape = false; + break; + case 'status_label': + $value = $order->getStatusLabel(); + break; + case 'view_url': + $value = $this->getUrl('*/order/view', array('order_id' => $order->getId())); + break; + default: + $value = ($order->getData($key)) ? $order->getData($key) : $this->__('N/A'); + } + return ($escape) ? $this->escapeHtml($value) : $value; + } + + /** + * Set pager + * + * @return Mage_Core_Block_Abstract + */ + protected function _prepareLayout() + { + if (is_null($this->_billingAgreementInstance)) { + $this->_billingAgreementInstance = Mage::registry('current_billing_agreement'); + } + parent::_prepareLayout(); + + $pager = $this->getLayout()->createBlock('page/html_pager') + ->setCollection($this->getRelatedOrders())->setIsOutputRequired(false); + $this->setChild('pager', $pager); + $this->getRelatedOrders()->load(); + + return $this; + } + + /** + * Load available billing agreement methods + * + * @return array + */ + protected function _loadPaymentMethods() + { + if (!$this->_paymentMethods) { + foreach ($this->helper('payment')->getBillingAgreementMethods() as $paymentMethod) { + $this->_paymentMethods[$paymentMethod->getCode()] = $paymentMethod->getTitle(); + } + } + return $this->_paymentMethods; + } + + /** + * Set data to block + * + * @return string + */ + protected function _toHtml() + { + $this->_loadPaymentMethods(); + $this->setBackUrl($this->getUrl('*/billing_agreement/')); + if ($this->_billingAgreementInstance) { + $this->setReferenceId($this->_billingAgreementInstance->getReferenceId()); + + $this->setCanCancel($this->_billingAgreementInstance->canCancel()); + $this->setCancelUrl( + $this->getUrl('*/billing_agreement/cancel', array( + '_current' => true, + 'payment_method' => $this->_billingAgreementInstance->getMethodCode())) + ); + + $methodCode = $this->_billingAgreementInstance->getMethodCode(); + if (isset($this->_paymentMethods[$methodCode])) { + $this->setPaymentMethodTitle($this->_paymentMethods[$methodCode]); + } else { + $this->setPaymentMethodTitle($methodCode); + } + + $createdAt = $this->_billingAgreementInstance->getCreatedAt(); + $updatedAt = $this->_billingAgreementInstance->getUpdatedAt(); + $this->setAgreementCreatedAt( + ($createdAt) ? $this->helper('core')->formatDate($createdAt, 'short', true) : $this->__('N/A') + ); + if ($updatedAt) { + $this->setAgreementUpdatedAt( + $this->helper('core')->formatDate($updatedAt, 'short', true) + ); + } + $this->setAgreementStatus($this->_billingAgreementInstance->getStatusLabel()); + } + + return parent::_toHtml(); + } +} diff --git a/app/code/core/Mage/Sales/Block/Billing/Agreements.php b/app/code/core/Mage/Sales/Block/Billing/Agreements.php new file mode 100644 index 0000000000..8370b220f9 --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Billing/Agreements.php @@ -0,0 +1,152 @@ + + */ +class Mage_Sales_Block_Billing_Agreements extends Mage_Core_Block_Template +{ + /** + * Payment methods array + * + * @var array + */ + protected $_paymentMethods = array(); + + /** + * Billing agreements collection + * + * @var Mage_Sales_Model_Mysql4_Billing_Agreement_Collection + */ + protected $_billingAgreements = null; + + /** + * Set Billing Agreement instance + * + * @return Mage_Core_Block_Abstract + */ + protected function _prepareLayout() + { + parent::_prepareLayout(); + $pager = $this->getLayout()->createBlock('page/html_pager') + ->setCollection($this->getBillingAgreements())->setIsOutputRequired(false); + $this->setChild('pager', $pager) + ->setBackUrl($this->getUrl('customer/account/')); + $this->getBillingAgreements()->load(); + return $this; + } + + /** + * Retrieve billing agreements collection + * + * @return Mage_Sales_Model_Mysql4_Billing_Agreement_Collection + */ + public function getBillingAgreements() + { + if (is_null($this->_billingAgreements)) { + $this->_billingAgreements = Mage::getResourceModel('sales/billing_agreement_collection') + ->addFieldToFilter('customer_id', Mage::getSingleton('customer/session')->getCustomerId()) + ->setOrder('agreement_id', 'desc'); + } + return $this->_billingAgreements; + } + + /** + * Retrieve item value by key + * + * @param Varien_Object $item + * @param string $key + * @return mixed + */ + public function getItemValue(Mage_Sales_Model_Billing_Agreement $item, $key) + { + switch ($key) { + case 'created_at': + case 'updated_at': + $value = ($item->getData($key)) + ? $this->helper('core')->formatDate($item->getData($key), 'short', true) : $this->__('N/A'); + break; + case 'edit_url': + $value = $this->getUrl('*/billing_agreement/view', array('agreement' => $item->getAgreementId())); + break; + case 'payment_method_label': + $this->_loadPaymentMethods(); + $value = isset($this->_paymentMethods[$item->getMethodCode()]) + ? $this->_paymentMethods[$item->getMethodCode()] : $this->__('N/A'); + break; + case 'status': + $value = $item->getStatusLabel(); + break; + default: + $value = ($item->getData($key)) ? $item->getData($key) : $this->__('N/A'); + } + return $this->escapeHtml($value); + } + + /** + * Load available billing agreement methods + * + * @return array + */ + protected function _loadPaymentMethods() + { + if (!$this->_paymentMethods) { + foreach ($this->helper('payment')->getBillingAgreementMethods() as $paymentMethod) { + $this->_paymentMethods[$paymentMethod->getCode()] = $paymentMethod->getTitle(); + } + } + return $this->_paymentMethods; + } + + /** + * Retrieve wizard payment options array + * + * @return array + */ + public function getWizardPaymentMethodOptions() + { + $paymentMethodOptions = array(); + foreach ($this->helper('payment')->getBillingAgreementMethods() as $paymentMethod) { + if ($paymentMethod->getConfigData('allow_billing_agreement_wizard') == 1) { + $paymentMethodOptions[$paymentMethod->getCode()] = $paymentMethod->getTitle(); + } + } + return $paymentMethodOptions; + } + + /** + * Set data to block + * + * @return string + */ + protected function _toHtml() + { + $this->setCreateUrl($this->getUrl('*/billing_agreement/startWizard')); + return parent::_toHtml(); + } +} diff --git a/app/code/core/Mage/Sales/Block/Items/Abstract.php b/app/code/core/Mage/Sales/Block/Items/Abstract.php index 94661b9e99..1e02223e0b 100644 --- a/app/code/core/Mage/Sales/Block/Items/Abstract.php +++ b/app/code/core/Mage/Sales/Block/Items/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Creditmemo.php b/app/code/core/Mage/Sales/Block/Order/Creditmemo.php index 294247bc20..ad933e9f29 100644 --- a/app/code/core/Mage/Sales/Block/Order/Creditmemo.php +++ b/app/code/core/Mage/Sales/Block/Order/Creditmemo.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Creditmemo/Items.php b/app/code/core/Mage/Sales/Block/Order/Creditmemo/Items.php index f0aea8c769..f7f21aa3e9 100644 --- a/app/code/core/Mage/Sales/Block/Order/Creditmemo/Items.php +++ b/app/code/core/Mage/Sales/Block/Order/Creditmemo/Items.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Creditmemo/Totals.php b/app/code/core/Mage/Sales/Block/Order/Creditmemo/Totals.php index 036660f93e..73d6135873 100644 --- a/app/code/core/Mage/Sales/Block/Order/Creditmemo/Totals.php +++ b/app/code/core/Mage/Sales/Block/Order/Creditmemo/Totals.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Sales_Block_Order_Creditmemo_Totals extends Mage_Sales_Block_Order_Totals diff --git a/app/code/core/Mage/Sales/Block/Order/Details.php b/app/code/core/Mage/Sales/Block/Order/Details.php index 63786905bc..669fede4da 100644 --- a/app/code/core/Mage/Sales/Block/Order/Details.php +++ b/app/code/core/Mage/Sales/Block/Order/Details.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Email/Creditmemo/Items.php b/app/code/core/Mage/Sales/Block/Order/Email/Creditmemo/Items.php index 36a37e4c62..d78f5752c2 100644 --- a/app/code/core/Mage/Sales/Block/Order/Email/Creditmemo/Items.php +++ b/app/code/core/Mage/Sales/Block/Order/Email/Creditmemo/Items.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Email/Invoice/Items.php b/app/code/core/Mage/Sales/Block/Order/Email/Invoice/Items.php index ffab5fc23c..6d697c2397 100644 --- a/app/code/core/Mage/Sales/Block/Order/Email/Invoice/Items.php +++ b/app/code/core/Mage/Sales/Block/Order/Email/Invoice/Items.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Email/Items.php b/app/code/core/Mage/Sales/Block/Order/Email/Items.php index 5f49c30e26..5357f963a7 100644 --- a/app/code/core/Mage/Sales/Block/Order/Email/Items.php +++ b/app/code/core/Mage/Sales/Block/Order/Email/Items.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Email/Items/Default.php b/app/code/core/Mage/Sales/Block/Order/Email/Items/Default.php index 5cf6f6f520..e50f22796a 100644 --- a/app/code/core/Mage/Sales/Block/Order/Email/Items/Default.php +++ b/app/code/core/Mage/Sales/Block/Order/Email/Items/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Email/Items/Order/Default.php b/app/code/core/Mage/Sales/Block/Order/Email/Items/Order/Default.php index be264707da..42a9dafeb2 100644 --- a/app/code/core/Mage/Sales/Block/Order/Email/Items/Order/Default.php +++ b/app/code/core/Mage/Sales/Block/Order/Email/Items/Order/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Email/Items/Order/Grouped.php b/app/code/core/Mage/Sales/Block/Order/Email/Items/Order/Grouped.php index b1962b9f09..8635012893 100644 --- a/app/code/core/Mage/Sales/Block/Order/Email/Items/Order/Grouped.php +++ b/app/code/core/Mage/Sales/Block/Order/Email/Items/Order/Grouped.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Email/Shipment/Items.php b/app/code/core/Mage/Sales/Block/Order/Email/Shipment/Items.php index bccddd122c..0fa2675512 100644 --- a/app/code/core/Mage/Sales/Block/Order/Email/Shipment/Items.php +++ b/app/code/core/Mage/Sales/Block/Order/Email/Shipment/Items.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/History.php b/app/code/core/Mage/Sales/Block/Order/History.php index 6a0fe0dace..e19f716076 100644 --- a/app/code/core/Mage/Sales/Block/Order/History.php +++ b/app/code/core/Mage/Sales/Block/Order/History.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -40,14 +40,11 @@ public function __construct() parent::__construct(); $this->setTemplate('sales/order/history.phtml'); - //TODO: add full name logic $orders = Mage::getResourceModel('sales/order_collection') - ->addAttributeToSelect('*') - ->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left') - ->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left') - ->addAttributeToFilter('customer_id', Mage::getSingleton('customer/session')->getCustomer()->getId()) - ->addAttributeToFilter('state', array('in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates())) - ->addAttributeToSort('created_at', 'desc') + ->addFieldToSelect('*') + ->addFieldToFilter('customer_id', Mage::getSingleton('customer/session')->getCustomer()->getId()) + ->addFieldToFilter('state', array('in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates())) + ->setOrder('created_at', 'desc') ; $this->setOrders($orders); diff --git a/app/code/core/Mage/Sales/Block/Order/Info.php b/app/code/core/Mage/Sales/Block/Order/Info.php index cce47cdd95..a93c518f2e 100644 --- a/app/code/core/Mage/Sales/Block/Order/Info.php +++ b/app/code/core/Mage/Sales/Block/Order/Info.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Invoice.php b/app/code/core/Mage/Sales/Block/Order/Invoice.php index 2a8b844361..de5e03d832 100644 --- a/app/code/core/Mage/Sales/Block/Order/Invoice.php +++ b/app/code/core/Mage/Sales/Block/Order/Invoice.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Invoice/Items.php b/app/code/core/Mage/Sales/Block/Order/Invoice/Items.php index 3e240e4b0e..52cfca274b 100644 --- a/app/code/core/Mage/Sales/Block/Order/Invoice/Items.php +++ b/app/code/core/Mage/Sales/Block/Order/Invoice/Items.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Invoice/Totals.php b/app/code/core/Mage/Sales/Block/Order/Invoice/Totals.php index 713dd7396e..bc196bdc7c 100644 --- a/app/code/core/Mage/Sales/Block/Order/Invoice/Totals.php +++ b/app/code/core/Mage/Sales/Block/Order/Invoice/Totals.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Sales_Block_Order_Invoice_Totals extends Mage_Sales_Block_Order_Totals diff --git a/app/code/core/Mage/Sales/Block/Order/Item/Renderer/Default.php b/app/code/core/Mage/Sales/Block/Order/Item/Renderer/Default.php index 20100c4729..c23d9992f0 100644 --- a/app/code/core/Mage/Sales/Block/Order/Item/Renderer/Default.php +++ b/app/code/core/Mage/Sales/Block/Order/Item/Renderer/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Item/Renderer/Grouped.php b/app/code/core/Mage/Sales/Block/Order/Item/Renderer/Grouped.php index 5fe5d6de00..a2716e91e7 100644 --- a/app/code/core/Mage/Sales/Block/Order/Item/Renderer/Grouped.php +++ b/app/code/core/Mage/Sales/Block/Order/Item/Renderer/Grouped.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Items.php b/app/code/core/Mage/Sales/Block/Order/Items.php index d363bdbb30..c4060b3f8b 100644 --- a/app/code/core/Mage/Sales/Block/Order/Items.php +++ b/app/code/core/Mage/Sales/Block/Order/Items.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Print.php b/app/code/core/Mage/Sales/Block/Order/Print.php index 99a6a769f6..1a687963ab 100644 --- a/app/code/core/Mage/Sales/Block/Order/Print.php +++ b/app/code/core/Mage/Sales/Block/Order/Print.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Print/Creditmemo.php b/app/code/core/Mage/Sales/Block/Order/Print/Creditmemo.php index 6193319327..27249cbd2c 100644 --- a/app/code/core/Mage/Sales/Block/Order/Print/Creditmemo.php +++ b/app/code/core/Mage/Sales/Block/Order/Print/Creditmemo.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Print/Invoice.php b/app/code/core/Mage/Sales/Block/Order/Print/Invoice.php index 25ed59a06a..df7209d017 100644 --- a/app/code/core/Mage/Sales/Block/Order/Print/Invoice.php +++ b/app/code/core/Mage/Sales/Block/Order/Print/Invoice.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Print/Shipment.php b/app/code/core/Mage/Sales/Block/Order/Print/Shipment.php index f9228cfc64..02dd69b2c1 100644 --- a/app/code/core/Mage/Sales/Block/Order/Print/Shipment.php +++ b/app/code/core/Mage/Sales/Block/Order/Print/Shipment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Recent.php b/app/code/core/Mage/Sales/Block/Order/Recent.php index e203e594bd..e6377bd7e2 100644 --- a/app/code/core/Mage/Sales/Block/Order/Recent.php +++ b/app/code/core/Mage/Sales/Block/Order/Recent.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Shipment.php b/app/code/core/Mage/Sales/Block/Order/Shipment.php index 348d374383..87a36347cd 100644 --- a/app/code/core/Mage/Sales/Block/Order/Shipment.php +++ b/app/code/core/Mage/Sales/Block/Order/Shipment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Shipment/Items.php b/app/code/core/Mage/Sales/Block/Order/Shipment/Items.php index aa017cff25..5a2d28e930 100644 --- a/app/code/core/Mage/Sales/Block/Order/Shipment/Items.php +++ b/app/code/core/Mage/Sales/Block/Order/Shipment/Items.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Tax.php b/app/code/core/Mage/Sales/Block/Order/Tax.php index 723b83faba..e3998c0a3b 100644 --- a/app/code/core/Mage/Sales/Block/Order/Tax.php +++ b/app/code/core/Mage/Sales/Block/Order/Tax.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Order/Totals.php b/app/code/core/Mage/Sales/Block/Order/Totals.php index ae62bc8a36..6556cefb5a 100644 --- a/app/code/core/Mage/Sales/Block/Order/Totals.php +++ b/app/code/core/Mage/Sales/Block/Order/Totals.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Sales_Block_Order_Totals extends Mage_Core_Block_Template @@ -149,7 +149,7 @@ protected function _initTotals() $this->_totals['base_grandtotal'] = new Varien_Object(array( 'code' => 'base_grandtotal', 'value' => $this->getOrder()->formatBasePrice($source->getBaseGrandTotal()), - 'label' => $this->__('Grand Total to be charged'), + 'label' => $this->__('Grand Total to be Charged'), 'is_formated' => true, )); } diff --git a/app/code/core/Mage/Sales/Block/Order/View.php b/app/code/core/Mage/Sales/Block/Order/View.php index 0521a3d053..cff4a2a7fe 100644 --- a/app/code/core/Mage/Sales/Block/Order/View.php +++ b/app/code/core/Mage/Sales/Block/Order/View.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Block/Payment/Form/Billing/Agreement.php b/app/code/core/Mage/Sales/Block/Payment/Form/Billing/Agreement.php new file mode 100644 index 0000000000..ea4081669e --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Payment/Form/Billing/Agreement.php @@ -0,0 +1,66 @@ + + */ +class Mage_Sales_Block_Payment_Form_Billing_Agreement extends Mage_Payment_Block_Form +{ + /** + * Set custom template + * + */ + public function __construct() + { + parent::__construct(); + $this->setTemplate('sales/payment/form/billing/agreement.phtml'); + $this->setTransportName(Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract::TRANSPORT_BILLING_AGREEMENT_ID); + } + + /** + * Retrieve available customer billing agreements + * + * @return array + */ + public function getBillingAgreements() + { + $data = array(); + $quote = $this->getParentBlock()->getQuote(); + if (!$quote || !$quote->getCustomer()) { + return $data; + } + $collection = Mage::getModel('sales/billing_agreement')->getAvailableCustomerBillingAgreements( + $quote->getCustomer()->getId() + ); + + foreach ($collection as $item) { + $data[$item->getId()] = $item->getReferenceId(); + } + return $data; + } +} diff --git a/app/code/core/Mage/Sales/Block/Payment/Info/Billing/Agreement.php b/app/code/core/Mage/Sales/Block/Payment/Info/Billing/Agreement.php new file mode 100644 index 0000000000..5a5332b174 --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Payment/Info/Billing/Agreement.php @@ -0,0 +1,53 @@ + + */ +class Mage_Sales_Block_Payment_Info_Billing_Agreement extends Mage_Payment_Block_Info +{ +/** + * Add reference id to payment method information + * + * @param Varien_Object|array $transport + */ + protected function _prepareSpecificInformation($transport = null) + { + if (null !== $this->_paymentSpecificInformation) { + return $this->_paymentSpecificInformation; + } + $info = $this->getInfo(); + $referenceID = $info->getAdditionalInformation( + Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract::PAYMENT_INFO_REFERENCE_ID + ); + $transport = new Varien_Object(array($this->__('Reference ID') => $referenceID,)); + $transport = parent::_prepareSpecificInformation($transport); + + return $transport; + } +} diff --git a/app/code/core/Mage/Sales/Block/Recurring/Profile/View.php b/app/code/core/Mage/Sales/Block/Recurring/Profile/View.php new file mode 100644 index 0000000000..8850eaef06 --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Recurring/Profile/View.php @@ -0,0 +1,326 @@ +addData(array( + 'reference_id' => $this->_profile->getReferenceId(), + 'can_cancel' => $this->_profile->canCancel(), + 'cancel_url' => $this->getUrl('*/*/updateState', array('profile' => $this->_profile->getId(), 'action' => 'cancel')), + 'can_suspend' => $this->_profile->canSuspend(), + 'suspend_url' => $this->getUrl('*/*/updateState', array('profile' => $this->_profile->getId(), 'action' => 'suspend')), + 'can_activate' => $this->_profile->canActivate(), + 'activate_url' => $this->getUrl('*/*/updateState', array('profile' => $this->_profile->getId(), 'action' => 'activate')), + 'can_update' => $this->_profile->canFetchUpdate(), + 'update_url' => $this->getUrl('*/*/updateProfile', array('profile' => $this->_profile->getId())), + 'back_url' => $this->getUrl('*/*/'), + 'confirmation_message' => Mage::helper('sales')->__('Are you sure you want to do this?'), + )); + } + + /** + * Getter for rendered info, if any + * + * @return array + */ + public function getRenderedInfo() + { + return $this->_info; + } + + /** + * Prepare profile main reference info + */ + public function prepareReferenceInfo() + { + $this->_shouldRenderInfo = true; + + foreach (array('method_code', 'reference_id', 'schedule_description', 'state') as $key) { + $this->_addInfo(array( + 'label' => $this->_profile->getFieldLabel($key), + 'value' => $this->_profile->renderData($key), + )); + } +// $shippingDesctiption = $this->_profile->getInfoValue('order_info', 'shipping_description'); +// if ($shippingDesctiption) { +// $this->_addInfo(array( +// 'label' => $this->__('Shipping Method'), +// 'value' => $shippingDesctiption, +// )); +// } + } + + /** + * Prepare profile order item info + */ + public function prepareItemInfo() + { + $this->_shouldRenderInfo = true; + $key = 'order_item_info'; + + foreach (array('name' => Mage::helper('catalog')->__('Product Name'), + 'sku' => Mage::helper('catalog')->__('SKU'), + 'qty' => Mage::helper('catalog')->__('Quantity'), + ) as $itemKey => $label + ) { + $value = $this->_profile->getInfoValue($key, $itemKey); + if ($value) { + $this->_addInfo(array('label' => $label, 'value' => $value,)); + } + } + } + + /** + * Prepare profile schedule info + */ + public function prepareScheduleInfo() + { + $this->_shouldRenderInfo = true; + + foreach (array('start_datetime', 'suspension_threshold') as $key) { + $this->_addInfo(array( + 'label' => $this->_profile->getFieldLabel($key), + 'value' => $this->_profile->renderData($key), + )); + } + + foreach ($this->_profile->exportScheduleInfo() as $i) { + $this->_addInfo(array( + 'label' => $i->getTitle(), + 'value' => $i->getSchedule(), + )); + } + } + + /** + * Prepare profile payments info + */ + public function prepareFeesInfo() + { + $this->_shouldRenderInfo = true; + + $this->_addInfo(array( + 'label' => $this->_profile->getFieldLabel('currency_code'), + 'value' => $this->_profile->getCurrencyCode() + )); + foreach (array('init_amount', 'trial_billing_amount', 'billing_amount', 'tax_amount', 'shipping_amount') as $key) { + $value = $this->_profile->getData($key); + if ($value) { + $this->_addInfo(array( + 'label' => $this->_profile->getFieldLabel($key), + 'value' => Mage::helper('core')->formatCurrency($value, false), + 'is_amount' => true, + )); + } + } + } + + /** + * Prepare profile address (billing or shipping) info + */ + public function prepareAddressInfo() + { + $this->_shouldRenderInfo = true; + + if ('shipping' == $this->getAddressType()) { + if ('1' == $this->_profile->getInfoValue('order_info', 'is_virtual')) { + return; + } + $key = 'shipping_address_info'; + } else { + $key = 'billing_address_info'; + } + $this->setIsAddress(true); + $address = Mage::getModel('sales/order_address', $this->_profile->getData($key)); + $this->_addInfo(array( + 'value' => preg_replace('/\\n{2,}/', "\n", $address->getFormated()), + )); + } + + /** + * Render related orders grid information + */ + public function prepareRelatedOrdersFrontendGrid() + { + $this->_prepareRelatedOrders(array( + 'increment_id', 'created_at', 'customer_firstname', 'customer_lastname', 'base_grand_total', 'status' + )); + $this->_relatedOrders->addFieldToFilter('state', array( + 'in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates() + )); + + $pager = $this->getLayout()->createBlock('page/html_pager') + ->setCollection($this->_relatedOrders)->setIsOutputRequired(false); + $this->setChild('pager', $pager); + + $this->setGridColumns(array( + new Varien_Object(array( + 'index' => 'increment_id', + 'title' => $this->__('Order #'), + 'is_nobr' => true, + 'width' => 1, + )), + new Varien_Object(array( + 'index' => 'created_at', + 'title' => $this->__('Date'), + 'is_nobr' => true, + 'width' => 1, + )), + new Varien_Object(array( + 'index' => 'customer_name', + 'title' => $this->__('Customer Name'), + )), + new Varien_Object(array( + 'index' => 'base_grand_total', + 'title' => $this->__('Order Total'), + 'is_nobr' => true, + 'width' => 1, + 'is_amount' => true, + )), + new Varien_Object(array( + 'index' => 'status', + 'title' => $this->__('Order Status'), + 'is_nobr' => true, + 'width' => 1, + )), + )); + + $orders = array(); + foreach ($this->_relatedOrders as $order) { + $orders[] = new Varien_Object(array( + 'increment_id' => $order->getIncrementId(), + 'created_at' => $this->formatDate($order->getCreatedAt()), + 'customer_name' => $order->getCustomerName(), + 'base_grand_total' => Mage::helper('core')->formatCurrency($order->getBaseGrandTotal(), false), + 'status' => $order->getStatusLabel(), + 'increment_id_link_url' => $this->getUrl('sales/order/view/', array('order_id' => $order->getId())), + )); + } + if ($orders) { + $this->setGridElements($orders); + } + } + + /** + * Prepare related orders collection + * + * @param array|string $fieldsToSelect + */ + protected function _prepareRelatedOrders($fieldsToSelect = '*') + { + if (null === $this->_relatedOrders) { + $this->_relatedOrders = Mage::getResourceModel('sales/order_collection') + ->addFieldToSelect($fieldsToSelect) + ->addFieldToFilter('customer_id', Mage::registry('current_customer')->getId()) + ->addRecurringProfilesFilter($this->_profile->getId()) + ->setOrder('entity_id', 'desc'); + } + } + + /** + * Add specified data to the $_info + * + * @param array $data + * @param string $key = null + */ + protected function _addInfo(array $data, $key = null) + { + $object = new Varien_Object($data); + if ($key) { + $this->_info[$key] = $object; + } else { + $this->_info[] = $object; + } + } + + /** + * Get current profile from registry and assign store/locale information to it + */ + protected function _prepareLayout() + { + $this->_profile = Mage::registry('current_recurring_profile') + ->setStore(Mage::app()->getStore()) + ->setLocale(Mage::app()->getLocale()) + ; + return parent::_prepareLayout(); + } + + /** + * Render self only if needed, also render info tabs group if needed + * + * @return string + */ + protected function _toHtml() + { + if (!$this->_profile || $this->_shouldRenderInfo && !$this->_info) { + return ''; + } + + if ($this->hasShouldPrepareInfoTabs()) { + foreach ($this->getChildGroup('info_tabs') as $block) { + $block->setViewUrl( + $this->getUrl("*/*/{$block->getViewAction()}", array('profile' => $this->_profile->getId())) + ); + } + } + + return parent::_toHtml(); + } +} diff --git a/app/code/core/Mage/Sales/Block/Recurring/Profiles.php b/app/code/core/Mage/Sales/Block/Recurring/Profiles.php new file mode 100644 index 0000000000..8cf67b2882 --- /dev/null +++ b/app/code/core/Mage/Sales/Block/Recurring/Profiles.php @@ -0,0 +1,129 @@ +_prepareProfiles(array('profile_id', 'reference_id', 'state', 'created_at', 'updated_at', 'method_code')); + + $pager = $this->getLayout()->createBlock('page/html_pager') + ->setCollection($this->_profiles)->setIsOutputRequired(false); + $this->setChild('pager', $pager); + + /* @var $profile Mage_Sales_Model_Recurring_Profile */ + $profile = Mage::getModel('sales/recurring_profile'); + + $this->setGridColumns(array( + new Varien_Object(array( + 'index' => 'reference_id', + 'title' => $profile->getFieldLabel('reference_id'), + 'is_nobr' => true, + 'width' => 1, + )), + new Varien_Object(array( + 'index' => 'state', + 'title' => $profile->getFieldLabel('state'), + )), + new Varien_Object(array( + 'index' => 'created_at', + 'title' => $profile->getFieldLabel('created_at'), + 'is_nobr' => true, + 'width' => 1, + 'is_amount' => true, + )), + new Varien_Object(array( + 'index' => 'updated_at', + 'title' => $profile->getFieldLabel('updated_at'), + 'is_nobr' => true, + 'width' => 1, + )), + new Varien_Object(array( + 'index' => 'method_code', + 'title' => $profile->getFieldLabel('method_code'), + 'is_nobr' => true, + 'width' => 1, + )), + )); + + $profiles = array(); + $store = Mage::app()->getStore(); + $locale = Mage::app()->getLocale(); + foreach($this->_profiles as $profile) { + $profile->setStore($store)->setLocale($locale); + $profiles[] = new Varien_Object(array( + 'reference_id' => $profile->getReferenceId(), + 'reference_id_link_url' => $this->getUrl('sales/recurring_profile/view/', array('profile' => $profile->getId())), + 'state' => $profile->renderData('state'), + 'created_at' => $this->formatDate($profile->getData('created_at'), 'medium', true), + 'updated_at' => $profile->getData('updated_at') ? $this->formatDate($profile->getData('updated_at'), 'short', true) : '', + 'method_code' => $profile->renderData('method_code'), + )); + } + if ($profiles) { + $this->setGridElements($profiles); + } + $orders = array(); + } + + /** + * Instantiate profiles collection + * + * @param array|int $fields + */ + protected function _prepareProfiles($fields = '*') + { + $this->_profiles = Mage::getModel('sales/recurring_profile')->getCollection() + ->addFieldToFilter('customer_id', Mage::registry('current_customer')->getId()) + ->addFieldToSelect($fields) + ->setOrder('profile_id', 'desc') + ; + } + + /** + * Set back Url + * + * @return Mage_Sales_Block_Recurring_Profiles + */ + protected function _beforeToHtml() + { + $this->setBackUrl($this->getUrl('customer/account/')); + return parent::_beforeToHtml(); + } +} diff --git a/app/code/core/Mage/Sales/Block/Reorder/Sidebar.php b/app/code/core/Mage/Sales/Block/Reorder/Sidebar.php index ca42d71c60..08f4f80e12 100644 --- a/app/code/core/Mage/Sales/Block/Reorder/Sidebar.php +++ b/app/code/core/Mage/Sales/Block/Reorder/Sidebar.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Exception.php b/app/code/core/Mage/Sales/Exception.php index 8f950ff1fa..7ee5505a15 100644 --- a/app/code/core/Mage/Sales/Exception.php +++ b/app/code/core/Mage/Sales/Exception.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Helper/Data.php b/app/code/core/Mage/Sales/Helper/Data.php index a0ec4af7c4..2157cd680e 100644 --- a/app/code/core/Mage/Sales/Helper/Data.php +++ b/app/code/core/Mage/Sales/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -38,7 +38,7 @@ public function checkQuoteAmount(Mage_Sales_Model_Quote $quote, $amount) if (!$quote->getHasError() && ($amount>=self::MAXIMUM_AVAILABLE_NUMBER)) { $quote->setHasError(true); $quote->addMessage( - $this->__('Some items have quantities exceeding allowed quantities. Please select a lower quantity to checkout.') + $this->__('Items maximum quantity or price do not allow checkout.') ); } return $this; diff --git a/app/code/core/Mage/Sales/Helper/Reorder.php b/app/code/core/Mage/Sales/Helper/Reorder.php index 94d238ee70..195c9c1ad3 100644 --- a/app/code/core/Mage/Sales/Helper/Reorder.php +++ b/app/code/core/Mage/Sales/Helper/Reorder.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Abstract.php b/app/code/core/Mage/Sales/Model/Abstract.php index 3dc7da327c..1d862c9f06 100644 --- a/app/code/core/Mage/Sales/Model/Abstract.php +++ b/app/code/core/Mage/Sales/Model/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -39,6 +39,20 @@ abstract class Mage_Sales_Model_Abstract extends Mage_Core_Model_Abstract */ abstract public function getStore(); + /** + * Processing object after save data + * Updates relevant grid table records. + * + * @return Mage_Core_Model_Abstract + */ + protected function _afterSave() + { + if (!$this->getForceUpdateGridRecords()) { + $this->_getResource()->updateGridRecords($this->getId()); + } + return parent::_afterSave(); + } + /** * Get object created at date affected current active store timezone * diff --git a/app/code/core/Mage/Sales/Model/Api/Resource.php b/app/code/core/Mage/Sales/Model/Api/Resource.php index d6ccdb942a..81aaa6f5a1 100644 --- a/app/code/core/Mage/Sales/Model/Api/Resource.php +++ b/app/code/core/Mage/Sales/Model/Api/Resource.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Billing/Agreement.php b/app/code/core/Mage/Sales/Model/Billing/Agreement.php new file mode 100644 index 0000000000..49bb1ee306 --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Billing/Agreement.php @@ -0,0 +1,238 @@ + + */ +class Mage_Sales_Model_Billing_Agreement extends Mage_Payment_Model_Billing_AgreementAbstract +{ + const STATUS_ACTIVE = 'active'; + const STATUS_CANCELED = 'canceled'; + + /** + * Init model + * + */ + protected function _construct() + { + $this->_init('sales/billing_agreement'); + } + + /** + * Set created_at parameter + * + * @return Mage_Core_Model_Abstract + */ + protected function _beforeSave() + { + $date = Mage::getModel('core/date')->gmtDate(); + if ($this->isObjectNew()) { + $this->setCreatedAt($date); + } else { + $this->setUpdatedAt($date); + } + return parent::_beforeSave(); + } + + /** + * Retrieve billing agreement status label + * + * @return string + */ + public function getStatusLabel() + { + switch ($this->getStatus()) { + case self::STATUS_ACTIVE: + return Mage::helper('sales')->__('Active'); + case self::STATUS_CANCELED: + return Mage::helper('sales')->__('Canceled'); + } + } + + /** + * Initialize token + * + * @return string + */ + public function initToken() + { + $this->getPaymentMethodInstance() + ->initBillingAgreementToken($this); + return $this->getRedirectUrl(); + } + + /** + * Get billing agreement details + * Data from response is inside this object + * + * @return Mage_Sales_Model_Billing_Agreement + */ + public function verifyToken() + { + $this->getPaymentMethodInstance() + ->getBillingAgreementTokenInfo($this); + return $this; + } + + /** + * Create billing agreement + * + * @return Mage_Sales_Model_Billing_Agreement + */ + public function place() + { + $this->verifyToken(); + + $this->getPaymentMethodInstance() + ->placeBillingAgreement($this); + + $this->setCustomerId($this->getCustomer()->getId()) + ->setMethodCode($this->getMethodCode()) + ->setReferenceId($this->getBillingAgreementId()) + ->setStatus(self::STATUS_ACTIVE) + ->save(); + return $this; + } + + /** + * Cancel billing agreement + * + * @return Mage_Sales_Model_Billing_Agreement + */ + public function cancel() + { + $this->setStatus(self::STATUS_CANCELED); + $this->getPaymentMethodInstance()->updateBillingAgreementStatus($this); + return $this->save(); + } + + /** + * Check whether can cancel billing agreement + * + * @return bool + */ + public function canCancel() + { + return ($this->getStatus() != self::STATUS_CANCELED); + } + + /** + * Retrieve billing agreement statuses array + * + * @return array + */ + public function getStatusesArray() + { + return array( + self::STATUS_ACTIVE => Mage::helper('sales')->__('Active'), + self::STATUS_CANCELED => Mage::helper('sales')->__('Canceled') + ); + } + + /** + * Validate data + * + * @return bool + */ + public function isValid() + { + $result = parent::isValid(); + if (!$this->getCustomerId()) { + $this->_errors[] = Mage::helper('payment')->__('Customer ID is not set.'); + } + if (!$this->getStatus()) { + $this->_errors[] = Mage::helper('payment')->__('Billing Agreement status is not set.'); + } + return $result && empty($this->_errors); + } + + /** + * Import payment data to billing agreement + * + * $payment->getBillingAgreementData() contains array with following structure : + * [billing_agreement_id] => string + * [method_code] => string + * + * @param Mage_Sales_Model_Order_Payment $payment + * @return Mage_Sales_Model_Billing_Agreement + */ + public function importOrderPayment(Mage_Sales_Model_Order_Payment $payment) + { + $baData = $payment->getBillingAgreementData(); + + $this->_paymentMethodInstance = (isset($baData['method_code'])) + ? Mage::helper('payment')->getMethodInstance($baData['method_code']) + ->setStore($payment->getMethodInstance()->getStore()) + : $payment->getMethodInstance(); + + $this->setCustomerId($payment->getOrder()->getCustomerId()) + ->setMethodCode($this->_paymentMethodInstance->getCode()) + ->setReferenceId($baData['billing_agreement_id']) + ->setStatus(self::STATUS_ACTIVE); + return $this; + } + + /** + * Retrieve available customer Billing Agreements + * + * @param int $customer + * @return Mage_Paypal_Controller_Express_Abstract + */ + public function getAvailableCustomerBillingAgreements($customerId) + { + $collection = Mage::getResourceModel('sales/billing_agreement_collection'); + $collection->addFieldToFilter('customer_id', $customerId) + ->addFieldToFilter('status', self::STATUS_ACTIVE) + ->setOrder('agreement_id'); + return $collection; + } + + /** + * Check whether need to create billing agreement for customer + * + * @param int $customerId + * @return bool + */ + public function needToCreateForCustomer($customerId) + { + return $customerId ? count($this->getAvailableCustomerBillingAgreements($customerId)) == 0 : false; + } + + /** + * Add order relation to current billing agreement + * + * @param int $orderId + * @return Mage_Sales_Model_Billing_Agreement + */ + public function addOrderRelation($orderId) + { + $this->getResource()->addOrderRelation($this->getId(), $orderId); + return $this; + } + +} diff --git a/app/code/core/Mage/Sales/Model/Config.php b/app/code/core/Mage/Sales/Model/Config.php index 93649a8b07..6cdd4ebb2e 100644 --- a/app/code/core/Mage/Sales/Model/Config.php +++ b/app/code/core/Mage/Sales/Model/Config.php @@ -20,13 +20,15 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Sales_Model_Config { + const XML_PATH_ORDER_STATES = 'global/sales/order/states'; + public function getQuoteRuleConditionInstance($type) { $config = Mage::getConfig()->getNodeClassInstance("global/sales/quote/rule/conditions/$type"); @@ -37,4 +39,25 @@ public function getQuoteRuleActionInstance($type) { return Mage::getConfig()->getNodeClassInstance("global/sales/quote/rule/actions/$type"); } + + /** + * Retrieve order statuses for state + * + * @param string $state + * @return array + */ + public function getOrderStatusesForState($state) + { + $states = Mage::getConfig()->getNode(self::XML_PATH_ORDER_STATES); + if (!isset($states->$state) || !isset($states->$state->statuses)) { + return array(); + } + + $statuses = array(); + + foreach ($states->$state->statuses->children() as $status => $node) { + $statuses[] = $status; + } + return $statuses; + } } diff --git a/app/code/core/Mage/Sales/Model/Convert/Order.php b/app/code/core/Mage/Sales/Model/Convert/Order.php index c84b1c64e8..c779b6d435 100644 --- a/app/code/core/Mage/Sales/Model/Convert/Order.php +++ b/app/code/core/Mage/Sales/Model/Convert/Order.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Convert/Quote.php b/app/code/core/Mage/Sales/Model/Convert/Quote.php index b486aded71..b5603f7e85 100644 --- a/app/code/core/Mage/Sales/Model/Convert/Quote.php +++ b/app/code/core/Mage/Sales/Model/Convert/Quote.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -130,7 +130,8 @@ public function itemToOrderItem(Mage_Sales_Model_Quote_Item_Abstract $item) ->setQuoteParentItemId($item->getParentItemId()) ->setProductId($item->getProductId()) ->setProductType($item->getProductType()) - ->setQtyBackordered($item->getBackorders()); + ->setQtyBackordered($item->getBackorders()) + ->setProduct($item->getProduct()); $options = $item->getProductOrderOptions(); if (!$options) { $options = $item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct()); diff --git a/app/code/core/Mage/Sales/Model/Email/Template.php b/app/code/core/Mage/Sales/Model/Email/Template.php index 5f8b1b833b..d6c7a2adc1 100644 --- a/app/code/core/Mage/Sales/Model/Email/Template.php +++ b/app/code/core/Mage/Sales/Model/Email/Template.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order.php b/app/code/core/Mage/Sales/Model/Entity/Order.php index 4023176d65..473801d126 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Address.php b/app/code/core/Mage/Sales/Model/Entity/Order/Address.php index 1d09b13582..3afc66eff4 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Address.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Address.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Address/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Order/Address/Collection.php index fece40c18b..51fba37664 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Address/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Address/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Attribute/Backend/Billing.php b/app/code/core/Mage/Sales/Model/Entity/Order/Attribute/Backend/Billing.php index 58a9adb51f..06e78104dc 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Attribute/Backend/Billing.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Attribute/Backend/Billing.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Attribute/Backend/Child.php b/app/code/core/Mage/Sales/Model/Entity/Order/Attribute/Backend/Child.php index 9689c6fc42..e08c11d32f 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Attribute/Backend/Child.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Attribute/Backend/Child.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Attribute/Backend/Parent.php b/app/code/core/Mage/Sales/Model/Entity/Order/Attribute/Backend/Parent.php index 36688ac023..9e1bd0cce5 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Attribute/Backend/Parent.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Attribute/Backend/Parent.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Attribute/Backend/Shipping.php b/app/code/core/Mage/Sales/Model/Entity/Order/Attribute/Backend/Shipping.php index 7575599e2a..cfb30c778e 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Attribute/Backend/Shipping.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Attribute/Backend/Shipping.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Order/Collection.php index d547768ccf..8a904d47ab 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo.php b/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo.php index f864a49278..98e8b400d2 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Attribute/Backend/Child.php b/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Attribute/Backend/Child.php index ff7ed62266..eac63093e2 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Attribute/Backend/Child.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Attribute/Backend/Child.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Attribute/Backend/Parent.php b/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Attribute/Backend/Parent.php index 4cb1184b68..c1a719bc7b 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Attribute/Backend/Parent.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Attribute/Backend/Parent.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Collection.php index b5f1bf6404..91a1923697 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Comment.php b/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Comment.php index 878b45d702..57a9b966e9 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Comment.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Comment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Comment/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Comment/Collection.php index 05fddf86a4..20e900206d 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Comment/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Comment/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Item.php b/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Item.php index 96dd1bb7b6..f3a5fea111 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Item.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Item/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Item/Collection.php index d787c305b0..997a10c529 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Item/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Creditmemo/Item/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice.php b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice.php index 0167376f7c..13b4164e83 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Attribute/Backend/Child.php b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Attribute/Backend/Child.php index 2abfe01c40..d90023eaa9 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Attribute/Backend/Child.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Attribute/Backend/Child.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Attribute/Backend/Item.php b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Attribute/Backend/Item.php index 9b2b9bff91..ccd06d650d 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Attribute/Backend/Item.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Attribute/Backend/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Attribute/Backend/Order.php b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Attribute/Backend/Order.php index 7e8ecaec30..41921539b5 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Attribute/Backend/Order.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Attribute/Backend/Order.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Attribute/Backend/Parent.php b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Attribute/Backend/Parent.php index 37ccf332f8..a14e0a70b3 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Attribute/Backend/Parent.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Attribute/Backend/Parent.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Collection.php index e80e106859..93c9088f48 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Comment.php b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Comment.php index 78338df717..97087a375e 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Comment.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Comment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Comment/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Comment/Collection.php index b49b49d2c4..bbdabb5464 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Comment/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Comment/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Item.php b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Item.php index 3aa9a5733d..a218843105 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Item.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Item/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Item/Collection.php index e0d0c7c860..cf9e9b4983 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Item/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Invoice/Item/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Item.php b/app/code/core/Mage/Sales/Model/Entity/Order/Item.php index 1d5bf0e473..6bbb24550e 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Item.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Item/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Order/Item/Collection.php index 6b0a854f1e..3d7c955725 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Item/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Item/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Payment.php b/app/code/core/Mage/Sales/Model/Entity/Order/Payment.php index 87f7697af0..f514b95c3c 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Payment.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Payment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Payment/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Order/Payment/Collection.php index 71912c7951..6d502808ad 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Payment/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Payment/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment.php b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment.php index 23681d8093..81ff1d2c06 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Attribute/Backend/Child.php b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Attribute/Backend/Child.php index 5cfc6aa50a..b9b160f023 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Attribute/Backend/Child.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Attribute/Backend/Child.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Attribute/Backend/Parent.php b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Attribute/Backend/Parent.php index 7daadb6d7e..8b2c30963d 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Attribute/Backend/Parent.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Attribute/Backend/Parent.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Collection.php index f2575b00c6..c134ad5c38 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Comment.php b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Comment.php index 9b253632ce..65822dfbc9 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Comment.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Comment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Comment/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Comment/Collection.php index 79d59f5945..ef4545c6b0 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Comment/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Comment/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Item.php b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Item.php index 0c6fde018a..b502878b99 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Item.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Item/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Item/Collection.php index 64191a759c..cb36541015 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Item/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Item/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Track.php b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Track.php index 032ea7514d..266aeb4960 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Track.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Track.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Track/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Track/Collection.php index 86ead88a81..b0fd2781df 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Track/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Shipment/Track/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Status/History.php b/app/code/core/Mage/Sales/Model/Entity/Order/Status/History.php index cc52a96153..99be971ec3 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Status/History.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Status/History.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Order/Status/History/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Order/Status/History/Collection.php index be7055ee71..31c03482c0 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Order/Status/History/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Order/Status/History/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote.php b/app/code/core/Mage/Sales/Model/Entity/Quote.php index 66317e7a5b..7e1999a4af 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Address.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Address.php index 64e9423c5e..ff7cf04bb5 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Address.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Address.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Backend.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Backend.php index b3c227e800..cb4d5c4072 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Backend.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Backend.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Backend/Child.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Backend/Child.php index d29484d4e8..bb1ff1b7c6 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Backend/Child.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Backend/Child.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Backend/Parent.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Backend/Parent.php index b5dcea32c2..0ccfb111a8 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Backend/Parent.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Backend/Parent.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Backend/Region.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Backend/Region.php index dc06c07b53..e637e41f5b 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Backend/Region.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Backend/Region.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend.php index af896bbfb8..dcaf28017e 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Custbalance.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Custbalance.php index 2ed54db047..aa3eeb410f 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Custbalance.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Custbalance.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Discount.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Discount.php index 3edcec8a52..49d2c6102f 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Discount.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Discount.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Grand.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Grand.php index 163a41990b..173f439a14 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Grand.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Grand.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Shipping.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Shipping.php index 73be6febb8..66f0f29bbe 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Shipping.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Shipping.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Subtotal.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Subtotal.php index b9d5ef0827..963cc00ad9 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Subtotal.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Subtotal.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Tax.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Tax.php index 5d06d5fb7a..c2935a5ab0 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Tax.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Tax.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Collection.php index 8619e36b05..74817259d2 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Item.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Item.php index 7d8cd4dba0..75ff998f4c 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Item.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Item/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Item/Collection.php index cf345b325a..b19ec27ae0 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Item/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Item/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Rate.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Rate.php index 4f5d10e75b..106a273fd6 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Rate.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Rate.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Rate/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Rate/Collection.php index ce1f3f87c1..4a1841fb3b 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Rate/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Address/Rate/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Collection.php index c01b9216b1..693eebe5c3 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Item.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Item.php index d8b6e1ade2..1f3709f7e8 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Item.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Item/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Item/Collection.php index 034242efa3..01c39d2a59 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Item/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Item/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Payment.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Payment.php index 8fca357ab1..7db2fb92ad 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Payment.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Payment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Quote/Payment/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Quote/Payment/Collection.php index a451a113c6..7d223d2682 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Quote/Payment/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Quote/Payment/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Sale/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Sale/Collection.php index e42ec4cd01..92bac622d1 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Sale/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Sale/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Entity/Setup.php b/app/code/core/Mage/Sales/Model/Entity/Setup.php index 651436d4b7..192168cec3 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Setup.php +++ b/app/code/core/Mage/Sales/Model/Entity/Setup.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -438,6 +438,7 @@ public function getDefaultEntities() 'original_price' => array('type'=>'decimal'), 'price' => array('type'=>'decimal'), 'cost' => array('type'=>'decimal'), + 'is_nominal' => array('type'=>'int'), 'discount_percent' => array('type'=>'decimal'), 'discount_amount' => array('type'=>'decimal'), diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Abstract.php b/app/code/core/Mage/Sales/Model/Mysql4/Abstract.php index a135db283e..5371b3baf3 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Abstract.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -41,7 +41,7 @@ abstract class Mage_Sales_Model_Mysql4_Abstract extends Mage_Core_Model_Mysql4_A */ protected function _prepareDataForSave(Mage_Core_Model_Abstract $object) { - if (!$object->getId()) { + if (!$object->getId() || $object->isObjectNew()) { $object->setCreatedAt(now()); } $object->setUpdatedAt(now()); diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Billing/Agreement.php b/app/code/core/Mage/Sales/Model/Mysql4/Billing/Agreement.php new file mode 100644 index 0000000000..dbe7703e21 --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Mysql4/Billing/Agreement.php @@ -0,0 +1,59 @@ + + */ +class Mage_Sales_Model_Mysql4_Billing_Agreement extends Mage_Core_Model_Mysql4_Abstract +{ + /** + * Resource initialization + */ + protected function _construct() + { + $this->_init('sales/billing_agreement', 'agreement_id'); + } + + /** + * Add order relation to billing agreement + * + * @param int $agreementId + * @param int $orderId + * @return Mage_Sales_Model_Mysql4_Billing_Agreement + */ + public function addOrderRelation($agreementId, $orderId) + { + $this->_getWriteAdapter()->insert( + $this->getTable('sales/billing_agreement_order'), array( + 'agreement_id' => $agreementId, + 'order_id' => $orderId + ) + ); + return $this; + } +} diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Billing/Agreement/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Billing/Agreement/Collection.php new file mode 100644 index 0000000000..66e190294e --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Mysql4/Billing/Agreement/Collection.php @@ -0,0 +1,73 @@ + + */ +class Mage_Sales_Model_Mysql4_Billing_Agreement_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract +{ + /** + * Collection initialization + * + */ + protected function _construct() + { + $this->_init('sales/billing_agreement'); + } + + /** + * Add cutomer details(email, firstname, lastname) to select + * + * @return Mage_Sales_Model_Mysql4_Billing_Agreement_Collection + */ + public function addCustomerDetails() + { + $select = $this->getSelect()->joinInner( + array('ce' => $this->getTable('customer/entity')), + 'ce.entity_id = main_table.customer_id', + array('customer_email' => 'email') + ); + + $customer = Mage::getResourceSingleton('customer/customer'); + + $attr = $customer->getAttribute('firstname'); + $select->joinLeft(array('firstname' => $attr->getBackend()->getTable()), + 'firstname.entity_id = main_table.customer_id' + . ' AND firstname.entity_type_id = ' . $customer->getTypeId() + . ' AND firstname.attribute_id = ' . $attr->getAttributeId(), + array('customer_firstname' => 'value')); + $attr = $customer->getAttribute('lastname'); + $select->joinLeft(array('lastname' => $attr->getBackend()->getTable()), + 'lastname.entity_id = main_table.customer_id' + . ' AND lastname.entity_type_id = ' . $customer->getTypeId() + . ' AND lastname.attribute_id = ' . $attr->getAttributeId(), + array('customer_lastname' => 'value')); + + return $this; + } +} diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Collection/Abstract.php b/app/code/core/Mage/Sales/Model/Mysql4/Collection/Abstract.php new file mode 100644 index 0000000000..8d160b7a15 --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Mysql4/Collection/Abstract.php @@ -0,0 +1,155 @@ +getAttributeCode(); + } + if (!$field) { + Mage::throwException(Mage::helper('sales')->__('Cannot determine the field name.')); + } + return $field; + } + + /** + * Add attribute to select result set. + * Backward compatibility with EAV collection + * + * @param string $attribute + * @return Mage_Sales_Model_Mysql4_Collection_Abstract + */ + public function addAttributeToSelect($attribute) + { + $this->addFieldToSelect($this->_attributeToField($attribute)); + return $this; + } + + /** + * Specify collection select filter by attribute value + * Backward compatibility with EAV collection + * + * @param string|Mage_Eav_Model_Entity_Attribute $attribute + * @param array|integer|string|null $condition + * @return Mage_Sales_Model_Mysql4_Collection_Abstract + */ + public function addAttributeToFilter($attribute, $condition = null) + { + $this->addFieldToFilter($this->_attributeToField($attribute), $condition); + return $this; + } + + /** + * Specify collection select filter by attribute value + * Backward compatibility with EAV collection + * + * @param string $attribute + * @param string $dir + * @return Mage_Sales_Model_Mysql4_Collection_Abstract + */ + public function addAttributeToSort($attribute, $dir='asc') + { + $this->addOrder($this->_attributeToField($attribute), $dir); + return $this; + } + + /** + * Set collection page start and records to show + * Backward compatibility with EAV collection + * + * @param integer $pageNum + * @param integer $pageSize + * @return Mage_Eav_Model_Entity_Collection_Abstract + */ + public function setPage($pageNum, $pageSize) + { + $this->setCurPage($pageNum) + ->setPageSize($pageSize); + return $this; + } + + /** + * Create all ids retrieving select with limitation + * Backward compatibility with EAV collection + * + * @return Mage_Eav_Model_Entity_Collection_Abstract + */ + protected function _getAllIdsSelect($limit=null, $offset=null) + { + $idsSelect = clone $this->getSelect(); + $idsSelect->reset(Zend_Db_Select::ORDER); + $idsSelect->reset(Zend_Db_Select::LIMIT_COUNT); + $idsSelect->reset(Zend_Db_Select::LIMIT_OFFSET); + $idsSelect->reset(Zend_Db_Select::COLUMNS); + $idsSelect->columns($this->getResource()->getIdFieldName(), 'main_table'); + $idsSelect->limit($limit, $offset); + return $idsSelect; + } + + /** + * Retrive all ids for collection + * Backward compatibility with EAV collection + * + * @param int $limit + * @param int $offset + * @return array + */ + public function getAllIds($limit=null, $offset=null) + { + return $this->getConnection()->fetchCol( + $this->_getAllIdsSelect($limit, $offset), + $this->_bindParams + ); + } + + + /** + * Backward compatibility with EAV collection + * @todo implement join functionality if necessary + */ + public function joinAttribute($alias, $attribute, $bind, $filter=null, $joinType='inner', $storeId=null) + { + return $this; + } +} diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order.php b/app/code/core/Mage/Sales/Model/Mysql4/Order.php index 57d628375e..b0db5226a7 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order.php @@ -20,28 +20,49 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Order entity resource model + * Flat sales order resource * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ - -class Mage_Sales_Model_Mysql4_Order extends Mage_Eav_Model_Entity_Abstract +class Mage_Sales_Model_Mysql4_Order extends Mage_Sales_Model_Mysql4_Order_Abstract { + protected $_eventPrefix = 'sales_order_resource'; + protected $_eventObject = 'resource'; + protected $_grid = true; + protected $_useIncrementId = true; + protected $_entityCodeForIncrementId = 'order'; - public function __construct() + protected function _construct() + { + $this->_init('sales/order', 'entity_id'); + } + + /** + * Init virtual grid records for entity + * + * @return Mage_Sales_Model_Mysql4_Order + */ + protected function _initVirtualGridColumns() { - $resource = Mage::getSingleton('core/resource'); - $this->setType('order'); - $read = $resource->getConnection('sales_read'); - $write = $resource->getConnection('sales_write'); - $this->setConnection($read, $write); + parent::_initVirtualGridColumns(); + $this->addVirtualGridColumn( + 'billing_name', + 'sales/order_address', + array('billing_address_id' => 'entity_id'), + 'CONCAT(IFNULL({{table}}.firstname, ""), " ", IFNULL({{table}}.lastname, ""))' + ) + ->addVirtualGridColumn( + 'shipping_name', + 'sales/order_address', + array('shipping_address_id' => 'entity_id'), + 'CONCAT(IFNULL({{table}}.firstname, ""), " ", IFNULL({{table}}.lastname, ""))' + ); + + return $this; } /** @@ -68,124 +89,4 @@ public function aggregateProductsByTypes($orderId, $productTypeIds = array(), $i } return $this->getReadConnection()->fetchPairs($select); } - - /** - * Aggregate Orders data - * - * @param mixed $from - * @param mixed $to - * @return Mage_Sales_Model_Mysql4_Order - */ - public function aggregate($from = null, $to = null) - { - $writeAdapter = $this->getWriteConnection(); - try { - if (!is_null($from)) { - $from = $this->formatDate($from); - } - if (!is_null($to)) { - $from = $this->formatDate($to); - } - - $tableName = $this->getTable('sales/order_aggregated_created'); - - $writeAdapter->beginTransaction(); - - if (is_null($from) && is_null($to)) { - $writeAdapter->query("TRUNCATE TABLE {$tableName}"); - } else { - $where = (!is_null($from)) ? "so.updated_at >= '{$from}'" : ''; - if (!is_null($to)) { - $where .= (!empty($where)) ? " AND so.updated_at <= '{$to}'" : "so.updated_at <= '{$to}'"; - } - - $subQuery = $writeAdapter->select(); - $subQuery->from(array('so' => $this->getTable('sales/order')), array('DISTINCT DATE(so.created_at)')) - ->where($where); - - $deleteCondition = 'DATE(period) IN (' . new Zend_Db_Expr($subQuery) . ')'; - $writeAdapter->delete($tableName, $deleteCondition); - } - - $columns = array( - 'period' => 'DATE(e.created_at)', - 'store_id' => 'e.store_id', - 'order_status' => 'e.status', - 'orders_count' => 'COUNT(e.entity_id)', - 'total_qty_ordered' => 'SUM(e.total_qty_ordered)', - 'base_profit_amount' => 'SUM(IFNULL(e.base_subtotal_invoiced, 0) * e.base_to_global_rate) + SUM(IFNULL(e.base_discount_refunded, 0) * e.base_to_global_rate) - SUM(IFNULL(e.base_subtotal_refunded, 0) * e.base_to_global_rate) - SUM(IFNULL(e.base_discount_invoiced, 0) * e.base_to_global_rate) - SUM(IFNULL(e.base_total_invoiced_cost, 0) * e.base_to_global_rate)', - 'base_subtotal_amount' => 'SUM(e.base_subtotal * e.base_to_global_rate)', - 'base_tax_amount' => 'SUM(e.base_tax_amount * e.base_to_global_rate)', - 'base_shipping_amount' => 'SUM(e.base_shipping_amount * e.base_to_global_rate)', - 'base_discount_amount' => 'SUM(e.base_discount_amount * e.base_to_global_rate)', - 'base_grand_total_amount' => 'SUM(e.base_grand_total * e.base_to_global_rate)', - 'base_invoiced_amount' => 'SUM(e.base_total_paid * e.base_to_global_rate)', - 'base_refunded_amount' => 'SUM(e.base_total_refunded * e.base_to_global_rate)', - 'base_canceled_amount' => 'SUM(IFNULL(e.subtotal_canceled, 0) * e.base_to_global_rate)' - ); - - $select = $writeAdapter->select() - ->from(array('e' => $this->getTable('sales/order')), $columns) - ->where('e.state NOT IN (?)', array( - Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, - Mage_Sales_Model_Order::STATE_NEW - )); - - if (!is_null($from) || !is_null($to)) { - $select->where("DATE(e.created_at) IN(?)", new Zend_Db_Expr($subQuery)); - } - - $select->group(new Zend_Db_Expr('1,2,3')); - - $writeAdapter->query(" - INSERT INTO `{$tableName}` (" . implode(',', array_keys($columns)) . ") {$select} - "); - - $select = $writeAdapter->select(); - $columns = array( - 'period' => 'period', - 'store_id' => new Zend_Db_Expr('0'), - 'order_status' => 'order_status', - 'orders_count' => 'SUM(orders_count)', - 'total_qty_ordered' => 'SUM(total_qty_ordered)', - 'base_profit_amount' => 'SUM(base_profit_amount)', - 'base_subtotal_amount' => 'SUM(base_subtotal_amount)', - 'base_tax_amount' => 'SUM(base_tax_amount)', - 'base_shipping_amount' => 'SUM(base_shipping_amount)', - 'base_discount_amount' => 'SUM(base_discount_amount)', - 'base_grand_total_amount' => 'SUM(base_grand_total_amount)', - 'base_invoiced_amount' => 'SUM(base_invoiced_amount)', - 'base_refunded_amount' => 'SUM(base_refunded_amount)', - 'base_canceled_amount' => 'SUM(base_canceled_amount)' - ); - $select->from($tableName, $columns) - ->where("store_id <> 0"); - - if (!is_null($from) || !is_null($to)) { - $select->where("DATE(period) IN(?)", new Zend_Db_Expr($subQuery)); - } - - $select->group(array( - 'period', - 'order_status' - )); - - $writeAdapter->query(" - INSERT INTO `{$tableName}` (" . implode(',', array_keys($columns)) . ") {$select} - "); - - $reportsFlagModel = Mage::getModel('reports/flag'); - $reportsFlagModel->setReportFlagCode(Mage_Reports_Model_Flag::REPORT_ORDER_FLAG_CODE); - $reportsFlagModel->loadSelf(); - $reportsFlagModel->save(); - - } catch (Exception $e) { - $writeAdapter->rollBack(); - throw $e; - } - - $writeAdapter->commit(); - return $this; - } } - diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Abstract.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Abstract.php new file mode 100644 index 0000000000..890e04486b --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Abstract.php @@ -0,0 +1,422 @@ +getTable($table); + + if (!in_array($alias, $this->getGridColumns())) { + Mage::throwException( + Mage::helper('sales')->__('Please specify a valid grid column alias name that exists in grid table.') + ); + } + + $this->_virtualGridColumns[$alias] = array( + $table, $joinCondition, $column + ); + + return $this; + } + + /** + * Retrieve virtual grid columns + * + * @return array + */ + public function getVirtualGridColumns() + { + if ($this->_virtualGridColumns === null) { + $this->_initVirtualGridColumns(); + } + + return $this->_virtualGridColumns; + } + + /** + * Init virtual grid records for entity + * + * @return Mage_Sales_Model_Mysql4_Abstract + */ + protected function _initVirtualGridColumns() + { + $this->_virtualGridColumns = array(); + if ($this->_eventPrefix && $this->_eventObject) { + Mage::dispatchEvent($this->_eventPrefix . '_init_virtual_grid_columns', array( + $this->_eventObject => $this + )); + } + return $this; + } + + /** + * Update records in grid table + * + * @param array|int $ids + * @return Mage_Sales_Model_Mysql4_Abstract + */ + public function updateGridRecords($ids) + { + if ($this->_grid) { + if (!is_array($ids)) { + $ids = array($ids); + } + + if ($this->_eventPrefix && $this->_eventObject) { + $proxy = new Varien_Object(); + $proxy->setIds($ids) + ->setData($this->_eventObject, $this); + + Mage::dispatchEvent($this->_eventPrefix . '_update_grid_records', array('proxy' => $proxy)); + $ids = $proxy->getIds(); + } + + if (empty($ids)) { // If nothing to update + return $this; + } + $columnsToSelect = array(); + + $select = $this->getUpdateGridRecordsSelect($ids, $columnsToSelect); + + $this->_getWriteAdapter()->query($select->insertFromSelect($this->getGridTable(), $columnsToSelect, true)); + } + + return $this; + } + + /** + * Retrieve update grid records select + * + * @param array $ids + * @param array|null $gridColumns + * @param boolean $asJoin + * @return Varien_Db_Select + */ + public function getUpdateGridRecordsSelect($ids, &$flatColumnsToSelect, $gridColumns = null) + { + $flatColumns = array_keys( + $this->_getReadAdapter()->describeTable( + $this->getMainTable() + ) + ); + + if ($gridColumns === null) { + $gridColumns = $this->getGridColumns(); + } + + $flatColumnsToSelect = array_intersect($flatColumns, $gridColumns); + + $select = $this->_getWriteAdapter()->select() + ->from(array('main_table' => $this->getMainTable()), $flatColumnsToSelect) + ->where('main_table.' . $this->getIdFieldName() . ' IN(?)', $ids); + + $this->joinVirtualGridColumnsToSelect('main_table', $select, $flatColumnsToSelect); + + return $select; + } + + /** + * Join virtual grid columns to select + * + * @param string $mainTable + * @param Zend_Db_Select $select + * @return Mage_Sales_Model_Mysql4_Abstract + */ + public function joinVirtualGridColumnsToSelect($mainTableAlias, Zend_Db_Select $select, &$columnsToSelect) + { + foreach ($this->getVirtualGridColumns() as $alias => $expression) { + list($table, $joinCondition, $column) = $expression; + $tableAlias = '_table_' . $alias; + + $joinConditionExpr = array(); + foreach ($joinCondition as $fkField=>$pkField) { + $pkField = $this->_getWriteAdapter()->quoteIdentifier( + $tableAlias . '.' . $pkField + ); + $fkField = $this->_getWriteAdapter()->quoteIdentifier( + $mainTableAlias . '.' . $fkField + ); + $joinConditionExpr[] = $fkField . '=' . $pkField; + } + + $select->joinLeft( + array($tableAlias=> $table), + implode(' AND ', $joinConditionExpr), + array($alias => str_replace('{{table}}', $tableAlias, $column)) + ); + + $columnsToSelect[] = $alias; + } + + return $this; + } + + /** + * Retrieve list of grid columns + * + * @return array + */ + public function getGridColumns() + { + if ($this->_gridColumns === null) { + if ($this->_grid) { + $this->_gridColumns = array_keys( + $this->_getReadAdapter()->describeTable($this->getGridTable()) + ); + } else { + $this->_gridColumns = array(); + } + } + + return $this->_gridColumns; + } + + /** + * Retrieve grid table + * + * @return string + */ + public function getGridTable() + { + if ($this->_grid) { + return $this->getMainTable() . '_grid'; + } + return false; + } + + /** + * Before save object attribute + * + * @param Mage_Core_Model_Abstract $object + * @param string $attribute + * @return Mage_Sales_Model_Mysql4_Abstract + */ + protected function _beforeSaveAttribute(Mage_Core_Model_Abstract $object, $attribute) + { + if ($this->_eventObject && $this->_eventPrefix) { + Mage::dispatchEvent($this->_eventPrefix . '_save_attribute_before', array( + $this->_eventObject => $this, + 'object' => $object, + 'attribute' => $attribute + )); + } + return $this; + } + + /** + * After save object attribute + * + * @param Mage_Core_Model_Abstract $object + * @param string $attribute + * @return Mage_Sales_Model_Mysql4_Abstract + */ + protected function _afterSaveAttribute(Mage_Core_Model_Abstract $object, $attribute) + { + if ($this->_eventObject && $this->_eventPrefix) { + Mage::dispatchEvent($this->_eventPrefix . '_save_attribute_after', array( + $this->_eventObject => $this, + 'object' => $object, + 'attribute' => $attribute + )); + } + return $this; + } + + /** + * Perform actions after object save + * + * @param Mage_Core_Model_Abstract $object + * @param string $attribute + * @return Mage_Sales_Model_Mysql4_Abstract + */ + public function saveAttribute(Mage_Core_Model_Abstract $object, $attribute) + { + if ($attribute instanceof Mage_Eav_Model_Entity_Attribute_Abstract) { + $attribute = $attribute->getAttributeCode(); + } + + if (is_string($attribute)) { + $attribute = array($attribute); + } + + if (is_array($attribute) && !empty($attribute)) { + $this->beginTransaction(); + try { + $this->_beforeSaveAttribute($object, $attribute); + $data = new Varien_Object(); + foreach ($attribute as $code) { + $data->setData($code, $object->getData($code)); + } + + $updateArray = $this->_prepareDataForTable($data, $this->getMainTable()); + $this->_postSaveFieldsUpdate($object, $updateArray); + if (!$object->getForceUpdateGridRecords() && + count(array_intersect($this->getGridColumns(), $attribute)) > 0) { + $this->updateGridRecords($object->getId()); + } + $this->_afterSaveAttribute($object, $attribute); + $this->commit(); + } catch (Exception $e) { + $this->rollBack(); + throw $e; + } + } + + return $this; + } + + /** + * Perform actions before object save + * + * @param Varien_Object $object + * @return Mage_Sales_Model_Mysql4_Abstract + */ + protected function _beforeSave(Mage_Core_Model_Abstract $object) + { + if ($this->_useIncrementId && !$object->getIncrementId()) { + /* @var $entityType Mage_Eav_Model_Entity_Type */ + $entityType = Mage::getModel('eav/entity_type')->loadByCode($this->_entityTypeForIncrementId); + $object->setIncrementId($entityType->fetchNewIncrementId($object->getStoreId())); + } + parent::_beforeSave($object); + return $this; + } + + /** + * Update field in table if model have been already saved + * + * @param Mage_Core_Model_Abstract $object + * @param array $data + * @return Mage_Sales_Model_Mysql4_Abstract + */ + protected function _postSaveFieldsUpdate($object, $data) + { + if ($object->getId() && !empty($data)) { + $table = $this->getMainTable(); + $this->_getWriteAdapter()->update($table, $data, $this->getIdFieldName() . '=' . (int) $object->getId()); + $object->addData($data); + } + + return $this; + } + + /** + * Set main resource table + * + * @param string $table + * @return Mage_Sales_Model_Mysql4_Abstract + */ + public function setMainTable($table) + { + $this->_mainTable = $table; + return $this; + } + + /** + * Save object data + * + * @param Mage_Core_Model_Abstract $object + * @return Mage_Core_Model_Mysql4_Abstract + */ + public function save(Mage_Core_Model_Abstract $object) + { + if (!$object->getForceObjectSave()) { + parent::save($object); + } + + return $this; + } +} diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Address.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Address.php index 878fb44e93..0ff192529c 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Address.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Address.php @@ -20,26 +20,21 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Order address entity resource model + * Flat sales order address resource * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ - -class Mage_Sales_Model_Mysql4_Order_Address extends Mage_Eav_Model_Entity_Abstract +class Mage_Sales_Model_Mysql4_Order_Address extends Mage_Sales_Model_Mysql4_Order_Abstract { - public function __construct() + protected $_eventPrefix = 'sales_order_address_resource'; + + protected function _construct() { - $resource = Mage::getSingleton('core/resource'); - $this->setType('order_address')->setConnection( - $resource->getConnection('sales_read'), - $resource->getConnection('sales_write') - ); + $this->_init('sales/order_address', 'entity_id'); } + } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Address/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Address/Collection.php index 493702118f..69874bf858 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Address/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Address/Collection.php @@ -20,30 +20,21 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Order address collection + * Flat sales order payment collection * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ - -class Mage_Sales_Model_Mysql4_Order_Address_Collection extends Mage_Eav_Model_Entity_Collection_Abstract +class Mage_Sales_Model_Mysql4_Order_Address_Collection extends Mage_Sales_Model_Mysql4_Order_Collection_Abstract { + protected $_eventPrefix = 'sales_order_address_collection'; + protected $_eventObject = 'order_address_collection'; protected function _construct() { $this->_init('sales/order_address'); } - - public function setOrderFilter($orderId) - { - $this->addAttributeToFilter('parent_id', $orderId); - return $this; - } - } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Attribute/Backend/Billing.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Attribute/Backend/Billing.php index 05cc02aae2..3addc7f8c6 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Attribute/Backend/Billing.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Attribute/Backend/Billing.php @@ -20,13 +20,14 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Order billing address backend * + * @deprecated after 1.4, no more EAV for sales * @category Mage * @package Mage_Sales * @author Magento Core Team diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Attribute/Backend/Child.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Attribute/Backend/Child.php index 56dc243415..407eca0d88 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Attribute/Backend/Child.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Attribute/Backend/Child.php @@ -20,11 +20,13 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +/** + * @deprecated after 1.4, no more EAV for sales + */ class Mage_Sales_Model_Mysql4_Order_Attribute_Backend_Child extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract { diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Attribute/Backend/Parent.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Attribute/Backend/Parent.php index 1d50fd28ec..50bbd8fcf4 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Attribute/Backend/Parent.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Attribute/Backend/Parent.php @@ -20,11 +20,13 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +/** + * @deprecated after 1.4, no more EAV for sales + */ class Mage_Sales_Model_Mysql4_Order_Attribute_Backend_Parent extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract { diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Attribute/Backend/Shipping.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Attribute/Backend/Shipping.php index 6d84b40ddf..ee619ad3be 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Attribute/Backend/Shipping.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Attribute/Backend/Shipping.php @@ -20,18 +20,17 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Order shipping address backend - * + * @deprecated after 1.4, no more EAV for sales * @category Mage * @package Mage_Sales * @author Magento Core Team */ - class Mage_Sales_Model_Mysql4_Order_Attribute_Backend_Shipping extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract { diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Collection.php index eeb906f7b4..90320d39ae 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Collection.php @@ -20,43 +20,37 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Orders collection + * Flat sales order collection * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ -class Mage_Sales_Model_Mysql4_Order_Collection extends Mage_Eav_Model_Entity_Collection_Abstract +class Mage_Sales_Model_Mysql4_Order_Collection extends Mage_Sales_Model_Mysql4_Collection_Abstract { - /** - * Initialize orders collection - * - */ + protected $_eventPrefix = 'sales_order_collection'; + protected $_eventObject = 'order_collection'; + protected function _construct() { $this->_init('sales/order'); } /** - * Add order items count expression + * Add items count expr to collection select, backward capability with eav structure * * @return Mage_Sales_Model_Mysql4_Order_Collection */ public function addItemCountExpr() { - $orderTable = $this->getEntity()->getEntityTable(); - $orderItemEntityTypeId = Mage::getResourceSingleton('sales/order_item')->getTypeId(); - $this->getSelect()->join( - array('items'=>$orderTable), - 'items.parent_id=e.entity_id and items.entity_type_id='.$orderItemEntityTypeId, - array('items_count'=>new Zend_Db_Expr('COUNT(items.entity_id)')) - ) - ->group('e.entity_id'); + if (is_null($this->_fieldsToSelect)) { // If we select all fields from table, + // we need to add column alias + $this->getSelect()->columns(array('items_count'=>'total_item_count')); + } else { + $this->addFieldToSelect('total_item_count', 'items_count'); + } return $this; } @@ -67,7 +61,9 @@ public function addItemCountExpr() */ public function getSelectCountSql() { + /* @var $countSelect Varien_Db_Select */ $countSelect = parent::getSelectCountSql(); + $countSelect->resetJoinLeft(); return $countSelect; } @@ -77,11 +73,121 @@ public function getSelectCountSql() * * @return Mage_Eav_Model_Entity_Collection_Abstract */ - protected function _getAllIdsSelect($limit=null, $offset=null) + protected function _getAllIdsSelect($limit = null, $offset = null) { - $idsSelect = parent::_getAllIdsSelect($limit, $offset); + $idsSelect = parent::getAllIds($limit, $offset); $idsSelect->resetJoinLeft(); return $idsSelect; } + + + /** + * Joins table sales_flat_order_address to select for billing and shipping orders addresses. + * Creates corillation map + * + * @return Mage_Sales_Model_Mysql4_Collection_Abstract + */ + protected function _addAddressFields() + { + $billingAliasName = 'billing_o_a'; + $shippingAliasName = 'shipping_o_a'; + $joinTable = $this->getTable('sales/order_address'); + + $this->_map = array('fields' => array( + 'billing_firstname' => $billingAliasName . '.firstname', + 'billing_lastname' => $billingAliasName . '.lastname', + 'billing_telephone' => $billingAliasName . '.telephone', + 'billing_postcode' => $billingAliasName . '.postcode', + + 'shipping_firstname' => $shippingAliasName . '.firstname', + 'shipping_lastname' => $shippingAliasName . '.lastname', + 'shipping_telephone' => $shippingAliasName . '.telephone', + 'shipping_postcode' => $shippingAliasName . '.postcode' + )); + + $this + ->getSelect() + ->joinLeft( + array($billingAliasName => $joinTable), + "(main_table.entity_id = $billingAliasName.parent_id AND $billingAliasName.address_type = 'billing')", + array( + $billingAliasName . '.firstname', + $billingAliasName . '.lastname', + $billingAliasName . '.telephone', + $billingAliasName . '.postcode' + ) + ) + ->joinLeft( + array($shippingAliasName => $joinTable), + "(main_table.entity_id = $shippingAliasName.parent_id AND $shippingAliasName.address_type = 'shipping')", + array( + $shippingAliasName . '.firstname', + $shippingAliasName . '.lastname', + $shippingAliasName . '.telephone', + $shippingAliasName . '.postcode' + ) + ); + + return $this; + } + + /** + * Specify collection select filter by attribute value + * + * @param array|string|Mage_Eav_Model_Entity_Attribute $attribute + * @param array|integer|string|null $condition + * @return Mage_Sales_Model_Mysql4_Collection_Abstract + */ + public function addAttributeToFilter($attributes, $condition = null) + { + if (is_array($attributes)){ + if (!empty($attributes)){ + $this->_addAddressFields(); + + foreach ($attributes as $attribute) { + parent::addAttributeToFilter($attribute['attribute'], $attribute); + } + } + } + else { + return parent::addAttributeToFilter($attributes, $condition); + } + + return $this; + } + + /** + * Add filter by specified billing agreements + * + * @param int|array $agreements + * @return Mage_Sales_Model_Mysql4_Order_Collection + */ + public function addBillingAgreementsFilter($agreements) + { + $agreements = (is_array($agreements)) ? $agreements : array($agreements); + $this->getSelect()->joinInner( + array('sbao' => $this->getTable('sales/billing_agreement_order')), + 'main_table.entity_id = sbao.order_id', + array() + )->where('sbao.agreement_id IN(?)', $agreements); + return $this; + } + + /** + * Add filter by specified recurring profile id(s) + * + * @param array|int $ids + * @return Mage_Sales_Model_Mysql4_Order_Collection + */ + public function addRecurringProfilesFilter($ids) + { + $ids = (is_array($ids)) ? $ids : array($ids); + $this->getSelect()->joinInner( + array('srpo' => $this->getTable('sales/recurring_profile_order')), + 'main_table.entity_id = srpo.order_id', + array() + )->where('srpo.profile_id IN(?)', $ids); + return $this; + } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Collection/Abstract.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Collection/Abstract.php new file mode 100644 index 0000000000..fd1ff79fc6 --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Collection/Abstract.php @@ -0,0 +1,99 @@ +_salesOrder = $order; + if ($this->_eventPrefix && $this->_eventObject) { + Mage::dispatchEvent($this->_eventPrefix . '_set_sales_order', array( + 'collection' => $this, + $this->_eventObject => $this, + 'order' => $order + )); + } + + return $this; + } + + /** + * Retrieve sales order as parent collection object + * + * @return Mage_Sales_Model_Order|null + */ + public function getSalesOrder() + { + return $this->_salesOrder; + } + + /** + * Add order filter + * + * @param int|Mage_Sales_Model_Order $order + * @return Mage_Sales_Model_Mysql4_Order_Collection_Abstract + */ + public function setOrderFilter($order) + { + if ($order instanceof Mage_Sales_Model_Order) { + $this->setSalesOrder($order); + $orderId = $order->getId(); + if ($orderId) { + $this->addFieldToFilter($this->_orderField, $orderId); + } else { + $this->_totalRecords = 0; + $this->_setIsLoaded(true); + } + } else { + $this->addFieldToFilter($this->_orderField, $order); + } + return $this; + } +} diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo.php index 50402a1b23..1e57bec195 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo.php @@ -20,26 +20,54 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Creditmemo entity resource model + * Flat sales order creditmemo resource * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ - -class Mage_Sales_Model_Mysql4_Order_Creditmemo extends Mage_Eav_Model_Entity_Abstract +class Mage_Sales_Model_Mysql4_Order_Creditmemo extends Mage_Sales_Model_Mysql4_Order_Abstract { - public function __construct() + protected $_eventPrefix = 'sales_order_creditmemo_resource'; + protected $_grid = true; + protected $_useIncrementId = true; + protected $_entityTypeForIncrementId = 'creditmemo'; + + protected function _construct() + { + $this->_init('sales/creditmemo', 'entity_id'); + } + + /** + * Init virtual grid records for entity + * + * @return Mage_Sales_Model_Mysql4_Order_Creditmemo + */ + protected function _initVirtualGridColumns() { - $resource = Mage::getSingleton('core/resource'); - $this->setType('creditmemo')->setConnection( - $resource->getConnection('sales_read'), - $resource->getConnection('sales_write') - ); + parent::_initVirtualGridColumns(); + $this->addVirtualGridColumn( + 'billing_name', + 'sales/order_address', + array('billing_address_id' => 'entity_id'), + 'CONCAT(IFNULL({{table}}.firstname, ""), " ", IFNULL({{table}}.lastname, ""))' + ) + ->addVirtualGridColumn( + 'order_increment_id', + 'sales/order', + array('order_id' => 'entity_id'), + 'increment_id' + ) + ->addVirtualGridColumn( + 'order_created_at', + 'sales/order', + array('order_id' => 'entity_id'), + 'created_at' + ) + ; + + return $this; } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Attribute/Backend/Child.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Attribute/Backend/Child.php index b58ee6dccf..e974ed5784 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Attribute/Backend/Child.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Attribute/Backend/Child.php @@ -20,11 +20,13 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +/** + * @deprecated after 1.4, no more EAV for sales + */ class Mage_Sales_Model_Mysql4_Order_Creditmemo_Attribute_Backend_Child extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract { diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Attribute/Backend/Parent.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Attribute/Backend/Parent.php index fdad846879..14c24fc088 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Attribute/Backend/Parent.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Attribute/Backend/Parent.php @@ -20,11 +20,13 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +/** + * @deprecated after 1.4, no more EAV for sales + */ class Mage_Sales_Model_Mysql4_Order_Creditmemo_Attribute_Backend_Parent extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract { @@ -38,7 +40,7 @@ public function afterSave($object) foreach ($object->getAllItems() as $item) { $item->save(); } - + foreach($object->getCommentsCollection() as $comment) { $comment->save(); } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Collection.php index 87bcd508c1..12f33c1e60 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Collection.php @@ -20,34 +20,38 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Creditmemos collection + * Flat sales order creditmemo collection * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ - -class Mage_Sales_Model_Mysql4_Order_Creditmemo_Collection extends Mage_Eav_Model_Entity_Collection_Abstract +class Mage_Sales_Model_Mysql4_Order_Creditmemo_Collection extends Mage_Sales_Model_Mysql4_Order_Collection_Abstract { + protected $_eventPrefix = 'sales_order_creditmemo_collection'; + protected $_eventObject = 'order_creditmemo_collection'; + + /** + * Order field for setOrderFilter + * + * @var string + */ + protected $_orderField = 'order_id'; + + protected function _construct() { $this->_init('sales/order_creditmemo'); } - public function setOrderFilter($order) + /** + * Used to emulate after load functionality for each item without loading them + * + */ + protected function _afterLoad() { - if ($order instanceof Mage_Sales_Model_Order) { - $this->addAttributeToFilter('order_id', $order->getId()); - } - else { - $this->addAttributeToFilter('order_id', $order); - } - - return $this; + $this->walk('afterLoad'); } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Comment.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Comment.php index fb48344542..1eec74f0c2 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Comment.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Comment.php @@ -20,26 +20,20 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Creditmemo comment resource model + * Flat sales order creditmemo comment resource * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ -class Mage_Sales_Model_Mysql4_Order_Creditmemo_Comment extends Mage_Eav_Model_Entity_Abstract +class Mage_Sales_Model_Mysql4_Order_Creditmemo_Comment extends Mage_Sales_Model_Mysql4_Order_Abstract { - public function __construct() + protected $_eventPrefix = 'sales_order_creditmemo_comment_resource'; + + protected function _construct() { - $resource = Mage::getSingleton('core/resource'); - $this->setType('creditmemo_comment')->setConnection( - $resource->getConnection('sales_read'), - $resource->getConnection('sales_write') - ); + $this->_init('sales/creditmemo_comment', 'entity_id'); } - } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Comment/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Comment/Collection.php index 936c63a813..bb52b27b61 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Comment/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Comment/Collection.php @@ -20,34 +20,45 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** - * Creditmemo comments collection + * Flat sales order creditmemo comments collection * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ -class Mage_Sales_Model_Mysql4_Order_Creditmemo_Comment_Collection extends Mage_Eav_Model_Entity_Collection_Abstract +class Mage_Sales_Model_Mysql4_Order_Creditmemo_Comment_Collection extends Mage_Sales_Model_Mysql4_Collection_Abstract { + protected $_eventPrefix = 'sales_order_creditmemo_comment_collection'; + protected $_eventObject = 'order_creditmemo_comment_collection'; + protected function _construct() { $this->_init('sales/order_creditmemo_comment'); } + /** + * Set creditmemo filter + * + * @param int $creditmemoId + * @return Mage_Sales_Model_Mysql4_Order_Creditmemo_Comment_Collection + */ public function setCreditmemoFilter($creditmemoId) { - $this->addAttributeToFilter('parent_id', $creditmemoId); + $this->addFieldToFilter('parent_id', $creditmemoId); return $this; } - public function setCreatedAtOrder($order='desc') + /** + * Set created_at sort order + * + * @param string $direction + * @return Mage_Sales_Model_Mysql4_Order_Creditmemo_Comment_Collection + */ + public function setCreatedAtOrder($direction='desc') { - $this->setOrder('created_at', $order); + $this->setOrder('created_at', $direction); return $this; } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Grid/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Grid/Collection.php new file mode 100644 index 0000000000..6bc6f69016 --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Grid/Collection.php @@ -0,0 +1,41 @@ +setMainTable('sales/creditmemo_grid'); + } +} diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Item.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Item.php index 4537415adc..0c62cbb694 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Item.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Item.php @@ -20,25 +20,20 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Creditmemo item resource model + * Flat sales order creditmemo item resource * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ -class Mage_Sales_Model_Mysql4_Order_Creditmemo_Item extends Mage_Eav_Model_Entity_Abstract +class Mage_Sales_Model_Mysql4_Order_Creditmemo_Item extends Mage_Sales_Model_Mysql4_Order_Abstract { - public function __construct() + protected $_eventPrefix = 'sales_order_creditmemo_item_resource'; + + protected function _construct() { - $resource = Mage::getSingleton('core/resource'); - $this->setType('creditmemo_item')->setConnection( - $resource->getConnection('sales_read'), - $resource->getConnection('sales_write') - ); + $this->_init('sales/creditmemo_item', 'entity_id'); } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Item/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Item/Collection.php index 9185ff7c98..b3996c2a04 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Item/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Creditmemo/Item/Collection.php @@ -20,29 +20,33 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** - * Quote creditmemo items collection + * Flat sales order creditmemo items collection * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ - -class Mage_Sales_Model_Mysql4_Order_Creditmemo_Item_Collection extends Mage_Eav_Model_Entity_Collection_Abstract +class Mage_Sales_Model_Mysql4_Order_Creditmemo_Item_Collection extends Mage_Sales_Model_Mysql4_Collection_Abstract { + protected $_eventPrefix = 'sales_order_creditmemo_item_collection'; + protected $_eventObject = 'order_creditmemo_item_collection'; + protected function _construct() { $this->_init('sales/order_creditmemo_item'); } + /** + * Set creditmemo filter + * + * @param int $creditmemoId + * @return Mage_Sales_Model_Mysql4_Order_Creditmemo_Item_Collection + */ public function setCreditmemoFilter($creditmemoId) { - $this->addAttributeToFilter('parent_id', $creditmemoId); + $this->addFieldToFilter('parent_id', $creditmemoId); return $this; } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Grid/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Grid/Collection.php new file mode 100644 index 0000000000..b171fb0dab --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Grid/Collection.php @@ -0,0 +1,41 @@ +setMainTable('sales/order_grid'); + } +} diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice.php index 29cf18e498..2b6c44ef8c 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice.php @@ -20,27 +20,54 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Invoice entity resource model + * Flat sales order invoice resource * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ - -class Mage_Sales_Model_Mysql4_Order_Invoice extends Mage_Eav_Model_Entity_Abstract +class Mage_Sales_Model_Mysql4_Order_Invoice extends Mage_Sales_Model_Mysql4_Order_Abstract { - public function __construct() + protected $_eventPrefix = 'sales_order_invoice_resource'; + protected $_grid = true; + protected $_useIncrementId = true; + protected $_entityTypeForIncrementId = 'invoice'; + + protected function _construct() { - $resource = Mage::getSingleton('core/resource'); - $this->setType('invoice')->setConnection( - $resource->getConnection('sales_read'), - $resource->getConnection('sales_write') - ); + $this->_init('sales/invoice', 'entity_id'); } + /** + * Init virtual grid records for entity + * + * @return Mage_Sales_Model_Mysql4_Order_Invoice + */ + protected function _initVirtualGridColumns() + { + parent::_initVirtualGridColumns(); + $this->addVirtualGridColumn( + 'billing_name', + 'sales/order_address', + array('billing_address_id' => 'entity_id'), + 'CONCAT(IFNULL({{table}}.firstname, ""), " ", IFNULL({{table}}.lastname, ""))' + ) + ->addVirtualGridColumn( + 'order_increment_id', + 'sales/order', + array('order_id' => 'entity_id'), + 'increment_id' + ) + ->addVirtualGridColumn( + 'order_created_at', + 'sales/order', + array('order_id' => 'entity_id'), + 'created_at' + ) + ; + + return $this; + } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Attribute/Backend/Child.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Attribute/Backend/Child.php index 1d9262b335..7efe927102 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Attribute/Backend/Child.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Attribute/Backend/Child.php @@ -20,11 +20,13 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +/** + * @deprecated after 1.4, no more EAV for sales + */ class Mage_Sales_Model_Mysql4_Order_Invoice_Attribute_Backend_Child extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract { diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Attribute/Backend/Item.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Attribute/Backend/Item.php index 9469a309c8..5a042eacc9 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Attribute/Backend/Item.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Attribute/Backend/Item.php @@ -20,11 +20,13 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +/** + * @deprecated after 1.4, no more EAV for sales + */ class Mage_Sales_Model_Mysql4_Order_Invoice_Attribute_Backend_Item extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract { diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Attribute/Backend/Order.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Attribute/Backend/Order.php index c270a98aa3..3600ae0d7a 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Attribute/Backend/Order.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Attribute/Backend/Order.php @@ -20,11 +20,13 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +/** + * @deprecated after 1.4, no more EAV for sales + */ class Mage_Sales_Model_Mysql4_Order_Invoice_Attribute_Backend_Order extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract { diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Attribute/Backend/Parent.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Attribute/Backend/Parent.php index c3db6beebf..055025ce03 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Attribute/Backend/Parent.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Attribute/Backend/Parent.php @@ -20,11 +20,13 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +/** + * @deprecated after 1.4, no more EAV for sales + */ class Mage_Sales_Model_Mysql4_Order_Invoice_Attribute_Backend_Parent extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract { diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Collection.php index 08543a1423..65f7d8a3b1 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Collection.php @@ -20,54 +20,36 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Invoices collection + * Flat sales order invoice collection * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ - -class Mage_Sales_Model_Mysql4_Order_Invoice_Collection extends Mage_Eav_Model_Entity_Collection_Abstract +class Mage_Sales_Model_Mysql4_Order_Invoice_Collection extends Mage_Sales_Model_Mysql4_Order_Collection_Abstract { + protected $_eventPrefix = 'sales_order_invoice_collection'; + protected $_eventObject = 'order_invoice_collection'; + /** - * Initialize orders collection + * Order field for setOrderFilter * + * @var string */ + protected $_orderField = 'order_id'; + protected function _construct() { $this->_init('sales/order_invoice'); } - /** - * Add order filter + * Used to emulate after load functionality for each item without loading them * - * @return Mage_Sales_Model_Mysql4_Order_Invoice_Collection */ - public function setOrderFilter($order) + protected function _afterLoad() { - if ($order instanceof Mage_Sales_Model_Order) { - $this->addAttributeToFilter('order_id', $order->getId()); - } else { - $this->addAttributeToFilter('order_id', $order); - } - return $this; + $this->walk('afterLoad'); } - - /** - * Reset left join - * - * @return Mage_Eav_Model_Entity_Collection_Abstract - */ - protected function _getAllIdsSelect($limit = null, $offset = null) - { - $idsSelect = parent::_getAllIdsSelect($limit, $offset); - $idsSelect->resetJoinLeft(); - return $idsSelect; - } - } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Comment.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Comment.php index 6b7c0e3dee..92737ea5ca 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Comment.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Comment.php @@ -20,26 +20,22 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Invoice comment resource model + * Flat sales order invoice comment resource * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ -class Mage_Sales_Model_Mysql4_Order_Invoice_Comment extends Mage_Eav_Model_Entity_Abstract +class Mage_Sales_Model_Mysql4_Order_Invoice_Comment extends Mage_Sales_Model_Mysql4_Order_Abstract { - public function __construct() + protected $_eventPrefix = 'sales_order_invoice_comment_resource'; + + + protected function _construct() { - $resource = Mage::getSingleton('core/resource'); - $this->setType('invoice_comment')->setConnection( - $resource->getConnection('sales_read'), - $resource->getConnection('sales_write') - ); + $this->_init('sales/invoice_comment', 'entity_id'); } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Comment/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Comment/Collection.php index b45b7d1c0f..d9d640c5d4 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Comment/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Comment/Collection.php @@ -20,34 +20,45 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** - * Invoice comments collection + * Flat sales order invoice comment collection * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ -class Mage_Sales_Model_Mysql4_Order_Invoice_Comment_Collection extends Mage_Eav_Model_Entity_Collection_Abstract +class Mage_Sales_Model_Mysql4_Order_Invoice_Comment_Collection extends Mage_Sales_Model_Mysql4_Collection_Abstract { + protected $_eventPrefix = 'sales_order_invoice_comment_collection'; + protected $_eventObject = 'order_invoice_comment_collection'; + protected function _construct() { $this->_init('sales/order_invoice_comment'); } + /** + * Set invoice filter + * + * @param int $invoiceId + * @return Mage_Sales_Model_Mysql4_Order_Invoice_Comment_Collection + */ public function setInvoiceFilter($invoiceId) { - $this->addAttributeToFilter('parent_id', $invoiceId); + $this->addFieldToFilter('parent_id', $invoiceId); return $this; } - public function setCreatedAtOrder($order='desc') + /** + * Set created_at sort order + * + * @param string $direction + * @return Mage_Sales_Model_Mysql4_Order_Invoice_Comment_Collection + */ + public function setCreatedAtOrder($direction='desc') { - $this->setOrder('created_at', $order); + $this->setOrder('created_at', $direction); return $this; } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Grid/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Grid/Collection.php new file mode 100644 index 0000000000..20004d4df7 --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Grid/Collection.php @@ -0,0 +1,41 @@ +setMainTable('sales/invoice_grid'); + } +} diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Item.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Item.php index bf22d77713..049a6aae79 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Item.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Item.php @@ -20,26 +20,21 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Invoice item resource model + * Flat sales order invoice item resource * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ -class Mage_Sales_Model_Mysql4_Order_Invoice_Item extends Mage_Eav_Model_Entity_Abstract +class Mage_Sales_Model_Mysql4_Order_Invoice_Item extends Mage_Sales_Model_Mysql4_Order_Abstract { - public function __construct() + protected $_eventPrefix = 'sales_order_invoice_item_resource'; + + protected function _construct() { - $resource = Mage::getSingleton('core/resource'); - $this->setType('invoice_item')->setConnection( - $resource->getConnection('sales_read'), - $resource->getConnection('sales_write') - ); + $this->_init('sales/invoice_item', 'entity_id'); } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Item/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Item/Collection.php index e0e497303a..aa737adf8b 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Item/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Item/Collection.php @@ -20,28 +20,33 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** - * Invoice items collection + * Flat sales order invoice item collection * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ -class Mage_Sales_Model_Mysql4_Order_Invoice_Item_Collection extends Mage_Eav_Model_Entity_Collection_Abstract +class Mage_Sales_Model_Mysql4_Order_Invoice_Item_Collection extends Mage_Sales_Model_Mysql4_Collection_Abstract { + protected $_eventPrefix = 'sales_order_invoice_item_collection'; + protected $_eventObject = 'order_invoice_item_collection'; + protected function _construct() { $this->_init('sales/order_invoice_item'); } + /** + * Set invoice filter + * + * @param int $invoiceId + * @return Mage_Sales_Model_Mysql4_Order_Invoice_Item_Collection + */ public function setInvoiceFilter($invoiceId) { - $this->addAttributeToFilter('parent_id', $invoiceId); + $this->addFieldToFilter('parent_id', $invoiceId); return $this; } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Item.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Item.php index 903ede2f91..5a6a973e0b 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Item.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Item.php @@ -20,23 +20,18 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Order item mysql4 resource model + * Flat sales order item resource * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ - -class Mage_Sales_Model_Mysql4_Order_Item extends Mage_Sales_Model_Mysql4_Abstract +class Mage_Sales_Model_Mysql4_Order_Item extends Mage_Sales_Model_Mysql4_Order_Abstract { - /** - * Initialize table and PK name - */ + protected $_eventPrefix = 'sales_order_item_resource'; + protected function _construct() { $this->_init('sales/order_item', 'item_id'); diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Item/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Item/Collection.php index 43155b5f69..44198b4bfd 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Item/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Item/Collection.php @@ -20,24 +20,36 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Order order item collection + * Flat sales order payment collection * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ -class Mage_Sales_Model_Mysql4_Order_Item_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract +class Mage_Sales_Model_Mysql4_Order_Item_Collection extends Mage_Sales_Model_Mysql4_Order_Collection_Abstract { - public function _construct() + protected $_eventPrefix = 'sales_order_item_collection'; + protected $_eventObject = 'order_item_collection'; + + /** + * Order field for setOrderFilter + * + * @var string + */ + protected $_orderField = 'order_id'; + + protected function _construct() { $this->_init('sales/order_item'); } + /** + * Assign parent items on after collection load + * + * @return Mage_Sales_Model_Mysql4_Order_Item_Collection + */ protected function _afterLoad() { parent::_afterLoad(); @@ -53,23 +65,10 @@ protected function _afterLoad() } /** - * Set filter by order id + * Set random items order * - * @param mixed $order - * @return Mage_Sales_Model_Mysql4_Order_Item_Collection + * @return Mage_Sales_Model_Mysql4_Order_Item_Collection */ - public function setOrderFilter($order) - { - if ($order instanceof Mage_Sales_Model_Order) { - $orderId = $order->getId(); - } - else { - $orderId = $order; - } - $this->addFieldToFilter('order_id', $orderId); - return $this; - } - public function setRandomOrder() { $this->setOrder('RAND()'); diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Payment.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Payment.php index 1266e526e3..f17f9f7e6a 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Payment.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Payment.php @@ -20,80 +20,29 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Order payment entity resource model + * Flat sales order payment resource * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ - -class Mage_Sales_Model_Mysql4_Order_Payment extends Mage_Eav_Model_Entity_Abstract +class Mage_Sales_Model_Mysql4_Order_Payment extends Mage_Sales_Model_Mysql4_Order_Abstract { - - public function __construct() - { - $resource = Mage::getSingleton('core/resource'); - $this->setType('order_payment')->setConnection( - $resource->getConnection('sales_read'), - $resource->getConnection('sales_write') - ); - } - /** - * Also serialize additional information + * Serializeable field: additional_information * - * @param Varien_Object $payment + * @var array */ - protected function _beforeSave(Varien_Object $payment) - { - $additionalInformation = $payment->getData('additional_information'); - if (empty($additionalInformation)) { - $payment->setData('additional_information', null); - } elseif (is_array($additionalInformation)) { - $payment->setData('additional_information', serialize($additionalInformation)); - } - parent::_beforeSave($payment); - } + protected $_serializableFields = array( + 'additional_information' => array(null, array()) + ); - /** - * Unserialize additional information after loading the object - * - * @param Varien_Object $payment - */ - protected function _afterLoad(Varien_Object $payment) - { - $this->unserializeFields($payment); - parent::_afterLoad($payment); - } - - /** - * Unserialize additional information after saving the object - * - * @param Varien_Object $payment - */ - protected function _afterSave(Varien_Object $payment) - { - $this->unserializeFields($payment); - return parent::_afterSave($payment); - } + protected $_eventPrefix = 'sales_order_payment_resource'; - /** - * Unserialize additional data if required - * @param Mage_Sales_Model_Order_Payment $payment - */ - public function unserializeFields(Mage_Sales_Model_Order_Payment $payment) + protected function _construct() { - $additionalInformation = $payment->getData('additional_information'); - if (empty($additionalInformation)) { - $payment->setData('additional_information', array()); - } elseif (!is_array($additionalInformation)) { - $payment->setData('additional_information', unserialize($additionalInformation)); - } + $this->_init('sales/order_payment', 'entity_id'); } - } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Payment/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Payment/Collection.php index e7d5301236..0b38d331bb 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Payment/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Payment/Collection.php @@ -20,32 +20,27 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Order status collection + * Flat sales order payment collection * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ -class Mage_Sales_Model_Mysql4_Order_Payment_Collection extends Mage_Eav_Model_Entity_Collection_Abstract +class Mage_Sales_Model_Mysql4_Order_Payment_Collection extends Mage_Sales_Model_Mysql4_Order_Collection_Abstract { + protected $_eventPrefix = 'sales_order_payment_collection'; + protected $_eventObject = 'order_payment_collection'; + protected function _construct() { $this->_init('sales/order_payment'); } - - public function setOrderFilter($orderId) - { - $this->addAttributeToFilter('parent_id', $orderId); - return $this; - } /** * Unserialize additional_information in each item + * * @return Mage_Sales_Model_Mysql4_Order_Payment_Collection */ protected function _afterLoad() diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Payment/Transaction.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Payment/Transaction.php index 706794ff2b..a523b90e25 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Payment/Transaction.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Payment/Transaction.php @@ -20,15 +20,24 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Sales transaction resource model */ -class Mage_Sales_Model_Mysql4_Order_Payment_Transaction extends Mage_Core_Model_Mysql4_Abstract +class Mage_Sales_Model_Mysql4_Order_Payment_Transaction extends Mage_Sales_Model_Mysql4_Order_Abstract { + /** + * Serializeable field: additional_information + * + * @var array + */ + protected $_serializableFields = array( + 'additional_information' => array(null, array()) + ); + /** * Initialize main table and the primary key field name */ @@ -81,9 +90,25 @@ public function loadObjectByTxnId(Mage_Sales_Model_Order_Payment_Transaction $tr $select = $this->_getLoadByUniqueKeySelect($orderId, $paymentId, $txnId); $data = $this->_getWriteAdapter()->fetchRow($select); $transaction->setData($data); + $this->unserializeFields($transaction); $this->_afterLoad($transaction); } + /** + * Retrieve order website id + * + * @param int $orderId + * @return string + */ + public function getOrderWebsiteId($orderId) + { + $select = $this->_getReadAdapter()->select() + ->from(array('so' => $this->getTable('sales/order')), 'cs.website_id') + ->joinInner(array('cs' => $this->getTable('core/store')), 'cs.store_id = so.store_id') + ->where('so.entity_id = ?', $orderId); + return $this->_getReadAdapter()->fetchOne($select); + } + /** * Lookup for parent_id in already saved transactions of this payment by the order_id * Also serialize additional information, if any @@ -102,7 +127,7 @@ protected function _beforeSave(Mage_Core_Model_Abstract $transaction) if ($parentTxnId) { if (!$txnId || !$orderId || !$paymentId) { - Mage::throwException(Mage::helper('sales')->__('Not enough valid data to save parent transaction ID.')); + Mage::throwException(Mage::helper('sales')->__('Not enough valid data to save the parent transaction ID.')); } $parentId = (int)$this->_lookupByTxnId($orderId, $paymentId, $parentTxnId, $idFieldName); if ($parentId) { @@ -114,58 +139,13 @@ protected function _beforeSave(Mage_Core_Model_Abstract $transaction) if ($transaction->isFailsafe()) { $autoincrementId = (int)$this->_lookupByTxnId($orderId, $paymentId, $txnId, $idFieldName); if ($autoincrementId) { - $transaction->setData($idFieldName, $autoincrementId); + $transaction->setData($idFieldName, $autoincrementId)->isObjectNew(false); } } - // serialize or set additional information to null - $additionalInformation = $transaction->getData('additional_information'); - if (empty($additionalInformation)) { - $transaction->setData('additional_information', null); - } elseif (is_array($additionalInformation)) { - $transaction->setData('additional_information', serialize($additionalInformation)); - } return parent::_beforeSave($transaction); } - /** - * Unserialize additional data after loading the object - * - * @param Mage_Core_Model_Abstract $transaction - * @return Mage_Sales_Model_Mysql4_Order_Payment_Transaction - */ - protected function _afterLoad(Mage_Core_Model_Abstract $transaction) - { - $this->unserializeFields($transaction); - return parent::_afterLoad($transaction); - } - - /** - * Unserialize additional data after saving the object (to have the data and orig_data consistent) - * - * @param Mage_Core_Model_Abstract $transaction - * @return Mage_Sales_Model_Mysql4_Order_Payment_Transaction - */ - protected function _afterSave(Mage_Core_Model_Abstract $transaction) - { - $this->unserializeFields($transaction); - return parent::_afterSave($transaction); - } - - /** - * Unserialize additional information if required - * @param Mage_Sales_Model_Order_Payment_Transaction $transaction - */ - public function unserializeFields(Mage_Sales_Model_Order_Payment_Transaction $transaction) - { - $additionalInformation = $transaction->getData('additional_information'); - if (empty($additionalInformation)) { - $transaction->setData('additional_information', array()); - } elseif (!is_array($additionalInformation)) { - $transaction->setData('additional_information', unserialize($additionalInformation)); - } - } - /** * Load cell/row by specified unique key parts * @param int $orderId diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Payment/Transaction/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Payment/Transaction/Collection.php index ecc7dc1e33..b33a9f603a 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Payment/Transaction/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Payment/Transaction/Collection.php @@ -20,15 +20,43 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Payment transactions collection */ -class Mage_Sales_Model_Mysql4_Order_Payment_Transaction_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract +class Mage_Sales_Model_Mysql4_Order_Payment_Transaction_Collection extends Mage_Sales_Model_Mysql4_Order_Collection_Abstract { + /** + * Order ID filter + * + * @var int + */ + protected $_orderId = null; + + /** + * Columns of order info that should be selected + * + * @var array + */ + protected $_addOrderInformation = array(); + + /** + * Columns of payment info that should be selected + * + * @var array + */ + protected $_addPaymentInformation = array(); + + /** + * Order Store ids + * + * @var array + */ + protected $_storeIds = array(); + /** * Payment ID filter * @var int @@ -47,6 +75,13 @@ class Mage_Sales_Model_Mysql4_Order_Payment_Transaction_Collection extends Mage_ */ protected $_txnTypes = null; + /** + * Order field for setOrderFilter + * + * @var string + */ + protected $_orderField = 'order_id'; + /** * Initialize collection items factory class */ @@ -56,6 +91,42 @@ protected function _construct() return parent::_construct(); } + /** + * Join order information + * + * @param array $keys + * @return Mage_Sales_Model_Mysql4_Order_Payment_Transaction_Collection + */ + public function addOrderInformation(array $keys) + { + $this->_addOrderInformation = array_merge($this->_addOrderInformation, $keys); + return $this; + } + + /** + * Join payment information + * + * @param array $keys + * @return Mage_Sales_Model_Mysql4_Order_Payment_Transaction_Collection + */ + public function addPaymentInformation(array $keys) + { + $this->_addPaymentInformation = array_merge($this->_addPaymentInformation, $keys); + return $this; + } + + /** + * Order ID filter setter + * + * @param int $orderId + * @return Mage_Sales_Model_Mysql4_Order_Payment_Transaction_Collection + */ + public function addOrderIdFilter($orderId) + { + $this->_orderId = (int)$orderId; + return $this; + } + /** * Payment ID filter setter * Can take either the integer id or the payment instance @@ -98,29 +169,61 @@ public function addTxnTypeFilter($txnType) } /** - * Prepare filters and load the collection - * @param bool $printQuery - * @param bool $logQuery + * Add filter by store ids + * + * @param int|array $storeIds * @return Mage_Sales_Model_Mysql4_Order_Payment_Transaction_Collection */ - public function load($printQuery = false, $logQuery = false) + public function addStoreFilter($storeIds) { + $storeIds = (is_array($storeIds)) ? $storeIds : array($storeIds); + $this->_storeIds = array_merge($this->_storeIds, $storeIds); + return $this; + } + + /** + * Prepare filters + */ + protected function _beforeLoad() + { + parent::_beforeLoad(); + if ($this->isLoaded()) { return $this; } // filters if ($this->_paymentId) { - $this->getSelect()->where('payment_id = ?', $this->_paymentId); + $this->getSelect()->where('main_table.payment_id = ?', $this->_paymentId); } if ($this->_parentId) { - $this->getSelect()->where('parent_id = ?', $this->_parentId); + $this->getSelect()->where('main_table.parent_id = ?', $this->_parentId); } if ($this->_txnTypes) { - $this->getSelect()->where('txn_type IN(?)', $this->_txnTypes); + $this->getSelect()->where('main_table.txn_type IN(?)', $this->_txnTypes); } - - return parent::load($printQuery, $logQuery); + if ($this->_orderId) { + $this->getSelect()->where('main_table.order_id = ?', $this->_orderId); + } + if ($this->_addPaymentInformation) { + $this->getSelect()->joinInner( + array('sop' => $this->getTable('sales/order_payment')), + 'main_table.payment_id = sop.entity_id', + $this->_addPaymentInformation + ); + } + if ($this->_storeIds) { + $this->getSelect()->where('so.store_id IN(?)', $this->_storeIds); + $this->addOrderInformation(array('store_id')); + } + if($this->_addOrderInformation) { + $this->getSelect()->joinInner( + array('so' => $this->getTable('sales/order')), + 'main_table.order_id = so.entity_id', + $this->_addOrderInformation + ); + } + return $this; } /** diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment.php index beea1d42db..14c9979623 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment.php @@ -20,26 +20,54 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Shipment entity resource model + * Flat sales order shipment resource * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ - -class Mage_Sales_Model_Mysql4_Order_Shipment extends Mage_Eav_Model_Entity_Abstract +class Mage_Sales_Model_Mysql4_Order_Shipment extends Mage_Sales_Model_Mysql4_Order_Abstract { - public function __construct() + protected $_eventPrefix = 'sales_order_shipment_resource'; + protected $_grid = true; + protected $_useIncrementId = true; + protected $_entityTypeForIncrementId = 'shipment'; + + protected function _construct() + { + $this->_init('sales/shipment', 'entity_id'); + } + + /** + * Init virtual grid records for entity + * + * @return Mage_Sales_Model_Mysql4_Order_Shipment + */ + protected function _initVirtualGridColumns() { - $resource = Mage::getSingleton('core/resource'); - $this->setType('shipment')->setConnection( - $resource->getConnection('sales_read'), - $resource->getConnection('sales_write') - ); + parent::_initVirtualGridColumns(); + $this->addVirtualGridColumn( + 'shipping_name', + 'sales/order_address', + array('shipping_address_id' => 'entity_id'), + 'CONCAT(IFNULL({{table}}.firstname, ""), " ", IFNULL({{table}}.lastname, ""))' + ) + ->addVirtualGridColumn( + 'order_increment_id', + 'sales/order', + array('order_id' => 'entity_id'), + 'increment_id' + ) + ->addVirtualGridColumn( + 'order_created_at', + 'sales/order', + array('order_id' => 'entity_id'), + 'created_at' + ) + ; + + return $this; } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Attribute/Backend/Child.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Attribute/Backend/Child.php index 44193ad338..1ac53ffa0b 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Attribute/Backend/Child.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Attribute/Backend/Child.php @@ -20,11 +20,13 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +/** + * @deprecated after 1.4, no more EAV for sales + */ class Mage_Sales_Model_Mysql4_Order_Shipment_Attribute_Backend_Child extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract { diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Attribute/Backend/Parent.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Attribute/Backend/Parent.php index 704934bd09..57e1abff15 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Attribute/Backend/Parent.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Attribute/Backend/Parent.php @@ -20,11 +20,13 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +/** + * @deprecated after 1.4, no more EAV for sales + */ class Mage_Sales_Model_Mysql4_Order_Shipment_Attribute_Backend_Parent extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract { diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Collection.php index e3c03dd593..f4e955a03e 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Collection.php @@ -20,34 +20,36 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Shipment collection + * Flat sales order shipment collection * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ - -class Mage_Sales_Model_Mysql4_Order_Shipment_Collection extends Mage_Eav_Model_Entity_Collection_Abstract +class Mage_Sales_Model_Mysql4_Order_Shipment_Collection extends Mage_Sales_Model_Mysql4_Order_Collection_Abstract { + protected $_eventPrefix = 'sales_order_shipment_collection'; + protected $_eventObject = 'order_shipment_collection'; + /** + * Order field for setOrderFilter + * + * @var string + */ + protected $_orderField = 'order_id'; + protected function _construct() { $this->_init('sales/order_shipment'); } - public function setOrderFilter($order) + /** + * Used to emulate after load functionality for each item without loading them + * + */ + protected function _afterLoad() { - if ($order instanceof Mage_Sales_Model_Order) { - $this->addAttributeToFilter('order_id', $order->getId()); - } - else { - $this->addAttributeToFilter('order_id', $order); - } - - return $this; + $this->walk('afterLoad'); } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Comment.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Comment.php index afe7c4b495..54160f6900 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Comment.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Comment.php @@ -20,26 +20,20 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Shipment comment resource model + * Flat sales order shipment comment resource * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ -class Mage_Sales_Model_Mysql4_Order_Shipment_Comment extends Mage_Eav_Model_Entity_Abstract +class Mage_Sales_Model_Mysql4_Order_Shipment_Comment extends Mage_Sales_Model_Mysql4_Order_Abstract { - public function __construct() + protected $_eventPrefix = 'sales_order_shipment_comment_resource'; + + protected function _construct() { - $resource = Mage::getSingleton('core/resource'); - $this->setType('shipment_comment')->setConnection( - $resource->getConnection('sales_read'), - $resource->getConnection('sales_write') - ); + $this->_init('sales/shipment_comment', 'entity_id'); } - } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Comment/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Comment/Collection.php index 59a3021e5f..c6cb9fd97a 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Comment/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Comment/Collection.php @@ -20,34 +20,45 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** - * Shipment comments collection + * Flat sales order shipment comments collection * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ -class Mage_Sales_Model_Mysql4_Order_Shipment_Comment_Collection extends Mage_Eav_Model_Entity_Collection_Abstract +class Mage_Sales_Model_Mysql4_Order_Shipment_Comment_Collection extends Mage_Sales_Model_Mysql4_Collection_Abstract { + protected $_eventPrefix = 'sales_order_shipment_comment_collection'; + protected $_eventObject = 'order_shipment_comment_collection'; + protected function _construct() { $this->_init('sales/order_shipment_comment'); } + /** + * Set shipment filter + * + * @param int $shipmentId + * @return Mage_Sales_Model_Mysql4_Order_Shipment_Comment_Collection + */ public function setShipmentFilter($shipmentId) { - $this->addAttributeToFilter('parent_id', $shipmentId); + $this->addFieldToFilter('parent_id', $shipmentId); return $this; } - public function setCreatedAtOrder($order='desc') + /** + * Set created_at sort order + * + * @param string $direction + * @return Mage_Sales_Model_Mysql4_Order_Shipment_Comment_Collection + */ + public function setCreatedAtOrder($direction='desc') { - $this->setOrder('created_at', $order); + $this->setOrder('created_at', $direction); return $this; } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Grid/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Grid/Collection.php new file mode 100644 index 0000000000..db6523482a --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Grid/Collection.php @@ -0,0 +1,43 @@ +setMainTable('sales/shipment_grid'); + } + + +} diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Item.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Item.php index 6acc739647..d0ac67f879 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Item.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Item.php @@ -20,25 +20,20 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Shipment item resource model + * Flat sales order shipment item resource * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ -class Mage_Sales_Model_Mysql4_Order_Shipment_Item extends Mage_Eav_Model_Entity_Abstract +class Mage_Sales_Model_Mysql4_Order_Shipment_Item extends Mage_Sales_Model_Mysql4_Order_Abstract { - public function __construct() + protected $_eventPrefix = 'sales_order_shipment_item_resource'; + + protected function _construct() { - $resource = Mage::getSingleton('core/resource'); - $this->setType('shipment_item')->setConnection( - $resource->getConnection('sales_read'), - $resource->getConnection('sales_write') - ); + $this->_init('sales/shipment_item', 'entity_id'); } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Item/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Item/Collection.php index b77e48c55d..67858362b5 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Item/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Item/Collection.php @@ -20,29 +20,33 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** - * Order shipment items collection + * Flat sales order shipment items collection * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ - -class Mage_Sales_Model_Mysql4_Order_Shipment_Item_Collection extends Mage_Eav_Model_Entity_Collection_Abstract +class Mage_Sales_Model_Mysql4_Order_Shipment_Item_Collection extends Mage_Sales_Model_Mysql4_Collection_Abstract { + protected $_eventPrefix = 'sales_order_shipment_item_collection'; + protected $_eventObject = 'order_shipment_item_collection'; + protected function _construct() { $this->_init('sales/order_shipment_item'); } + /** + * Set shipment filter + * + * @param int $shipmentId + * @return Mage_Sales_Model_Mysql4_Order_Shipment_Item_Collection + */ public function setShipmentFilter($shipmentId) { - $this->addAttributeToFilter('parent_id', $shipmentId); + $this->addFieldToFilter('parent_id', $shipmentId); return $this; } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Track.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Track.php index 11a8d214aa..1c93eba23f 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Track.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Track.php @@ -20,25 +20,20 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Shipment track resource model + * Flat sales order shipment comment resource * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ -class Mage_Sales_Model_Mysql4_Order_Shipment_Track extends Mage_Eav_Model_Entity_Abstract +class Mage_Sales_Model_Mysql4_Order_Shipment_Track extends Mage_Sales_Model_Mysql4_Order_Abstract { - public function __construct() + protected $_eventPrefix = 'sales_order_shipment_track_resource'; + + protected function _construct() { - $resource = Mage::getSingleton('core/resource'); - $this->setType('shipment_track')->setConnection( - $resource->getConnection('sales_read'), - $resource->getConnection('sales_write') - ); + $this->_init('sales/shipment_track', 'entity_id'); } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Track/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Track/Collection.php index f18bd446ba..81c2ab8b99 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Track/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Shipment/Track/Collection.php @@ -20,35 +20,41 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** - * Order shipment track collection + * Flat sales order shipment tracks collection * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ - -class Mage_Sales_Model_Mysql4_Order_Shipment_Track_Collection extends Mage_Eav_Model_Entity_Collection_Abstract +class Mage_Sales_Model_Mysql4_Order_Shipment_Track_Collection extends Mage_Sales_Model_Mysql4_Order_Collection_Abstract { - public function _construct() + protected $_eventPrefix = 'sales_order_shipment_track_collection'; + protected $_eventObject = 'order_shipment_track_collection'; + + /** + * Order field for setOrderFilter + * + * @var string + */ + protected $_orderField = 'order_id'; + + protected function _construct() { $this->_init('sales/order_shipment_track'); } + /** + * Set shipment filter + * + * @param int $shipmentId + * @return Mage_Sales_Model_Mysql4_Order_Shipment_Track_Collection + */ public function setShipmentFilter($shipmentId) { - $this->addAttributeToFilter('parent_id', $shipmentId); + $this->addFieldToFilter('parent_id', $shipmentId); return $this; } - public function setOrderFilter($orderId) - { - $this->addAttributeToFilter('order_id', $orderId); - return $this; - } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Status/History.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Status/History.php index cb578c5cce..4dd907a773 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Status/History.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Status/History.php @@ -20,28 +20,20 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Order status history entity resource model + * Flat sales order status history resource * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ - -class Mage_Sales_Model_Mysql4_Order_Status_History extends Mage_Eav_Model_Entity_Abstract +class Mage_Sales_Model_Mysql4_Order_Status_History extends Mage_Sales_Model_Mysql4_Order_Abstract { + protected $_eventPrefix = 'sales_order_status_history_resource'; - public function __construct() + protected function _construct() { - $resource = Mage::getSingleton('core/resource'); - $this->setType('order_status_history')->setConnection( - $resource->getConnection('sales_read'), - $resource->getConnection('sales_write') - ); + $this->_init('sales/order_status_history', 'entity_id'); } - -} +} \ No newline at end of file diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Status/History/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Status/History/Collection.php index 441cae2401..39b0a1c9e0 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Status/History/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Status/History/Collection.php @@ -20,30 +20,21 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Order status history collection + * Flat sales order status history collection * - * @category Mage - * @package Mage_Sales - * @author Magento Core Team */ - -class Mage_Sales_Model_Mysql4_Order_Status_History_Collection extends Mage_Eav_Model_Entity_Collection_Abstract +class Mage_Sales_Model_Mysql4_Order_Status_History_Collection extends Mage_Sales_Model_Mysql4_Order_Collection_Abstract { + protected $_eventPrefix = 'sales_order_status_history_collection'; + protected $_eventObject = 'order_status_history_collection'; protected function _construct() { $this->_init('sales/order_status_history'); } - - public function setOrderFilter($orderId) - { - $this->addAttributeToFilter('parent_id', $orderId); - return $this; - } - } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Tax.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Tax.php index b1e5bc3f4d..d00fa328f9 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Tax.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Tax.php @@ -20,10 +20,13 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +/** + * @deprecated after 1.4, moved to tax module + */ class Mage_Sales_Model_Mysql4_Order_Tax extends Mage_Core_Model_Mysql4_Abstract { protected function _construct() diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Order/Tax/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Order/Tax/Collection.php index 1d11b838de..bdffb1d8d1 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Order/Tax/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Order/Tax/Collection.php @@ -20,14 +20,15 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Order Tax Collection - * + * + * @deprecated after 1.4 - moved to Tax module * @author Magento Core Team */ class Mage_Sales_Model_Mysql4_Order_Tax_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote.php index 1d8e17ad93..31f2ff9e9c 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -89,6 +89,30 @@ public function loadByCustomerId($quote, $customerId) return $this; } + /** + * Load only active quote + * + * @param Mage_Sales_Model_Quote $quote + * @param int $quoteId + */ + public function loadActive($quote, $quoteId) + { + $read = $this->_getReadAdapter(); + if ($read) { + $select = $this->_getLoadSelect('entity_id', $quoteId, $quote) + ->where('is_active=1'); + + $data = $read->fetchRow($select); + + if ($data) { + $quote->setData($data); + } + } + + $this->_afterLoad($quote); + return $this; + } + public function getReservedOrderId($quote) { return Mage::getSingleton('eav/config')->getEntityType('order')->fetchNewIncrementId($quote->getStoreId()); diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address.php index ef2a9ef69e..2ab67cba25 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Backend.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Backend.php index d943b61a97..83f73e3757 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Backend.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Backend.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Backend/Child.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Backend/Child.php index 49d7cb04f0..31fa37aa8b 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Backend/Child.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Backend/Child.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Backend/Parent.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Backend/Parent.php index 14e6e00fc8..50dab671bc 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Backend/Parent.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Backend/Parent.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Backend/Region.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Backend/Region.php index 5241e5d5c6..aac91327ab 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Backend/Region.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Backend/Region.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend.php index 3698759a2c..d64eb77cd1 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Custbalance.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Custbalance.php index 01ee6bb39b..d62bf0ba58 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Custbalance.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Custbalance.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Discount.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Discount.php index f23adeb121..e5f7cb7354 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Discount.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Discount.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Grand.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Grand.php index 1c61722bf5..dd1a261be1 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Grand.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Grand.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Shipping.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Shipping.php index cdc8ba55c9..13ab8015f9 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Shipping.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Shipping.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Subtotal.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Subtotal.php index ee07e1db37..7501151d2e 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Subtotal.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Subtotal.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Tax.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Tax.php index 5b2328f910..b8acad768a 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Tax.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Attribute/Frontend/Tax.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Collection.php index b420ee987b..dca47530e5 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Item.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Item.php index 9b56749e84..08dfdcecce 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Item.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Item/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Item/Collection.php index ebd86498e1..f9788b8d8d 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Item/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Item/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -57,7 +57,13 @@ protected function _afterLoad() public function setAddressFilter($addressId) { - $this->addFieldToFilter('quote_address_id', $addressId); + if ($addressId) { + $this->addFieldToFilter('quote_address_id', $addressId); + } else { + $this->_totalRecords = 0; + $this->_setIsLoaded(true); + } + return $this; } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Rate.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Rate.php index d50a35637a..e1fa9c405d 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Rate.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Rate.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Rate/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Rate/Collection.php index 06a9aa67ad..5751e8d0e6 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Rate/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Address/Rate/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -35,14 +35,58 @@ class Mage_Sales_Model_Mysql4_Quote_Address_Rate_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract { + /** + * Whether to load fixed items only + * + * @var bool + */ + protected $_allowFixedOnly = false; + protected function _construct() { $this->_init('sales/quote_address_rate'); } + /** + * Set filter by address id + * + * @param int $addressId + * @return Mage_Sales_Model_Mysql4_Quote_Address_Rate_Collection + */ public function setAddressFilter($addressId) { - $this->addFieldToFilter('address_id', $addressId); + if ($addressId) { + $this->addFieldToFilter('address_id', $addressId); + } else { + $this->_totalRecords = 0; + $this->_setIsLoaded(true); + } + return $this; + } + + /** + * Setter for loading fixed items only + * + * @param bool $value + * @return Mage_Sales_Model_Mysql4_Quote_Address_Rate_Collection + */ + public function setFixedOnlyFilter($value) + { + $this->_allowFixedOnly = (bool)$value; return $this; } + + /** + * Don't add item to the collection if only fixed are allowed and its carrier is not fixed + * + * @param Mage_Sales_Model_Quote_Address_Rate $rate + * @return Mage_Sales_Model_Mysql4_Quote_Address_Rate_Collection; + */ + public function addItem(Varien_Object $rate) + { + if ($this->_allowFixedOnly && (!$rate->getCarrierInstance() || !$rate->getCarrierInstance()->isFixed())) { + return $this; + } + return parent::addItem($rate); + } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Collection.php index cf67b626f0..e139a03f87 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Item.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Item.php index 11e464a6f4..10d9376821 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Item.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Item/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Item/Collection.php index c52647c2ba..ebbaf24048 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Item/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Item/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -76,7 +76,13 @@ public function getStoreId() public function setQuote($quote) { $this->_quote = $quote; - $this->addFieldToFilter('quote_id', $quote->getId()); + $quoteId = $quote->getId(); + if ($quoteId) { + $this->addFieldToFilter('quote_id', $quote->getId()); + } else { + $this->_totalRecords = 0; + $this->_setIsLoaded(true); + } return $this; } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Item/Option.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Item/Option.php index f039c128e9..22ac34b7a8 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Item/Option.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Item/Option.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Item/Option/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Item/Option/Collection.php index 12aca4aaa4..a134f98b2a 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Item/Option/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Item/Option/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -47,15 +47,14 @@ protected function _construct() public function addItemFilter($item) { if (empty($item)) { - $this->addFieldToFilter('item_id', ''); - } - elseif (is_array($item)) { + $this->_totalRecords = 0; + $this->_setIsLoaded(true); + //$this->addFieldToFilter('item_id', ''); + } elseif (is_array($item)) { $this->addFieldToFilter('item_id', array('in'=>$item)); - } - elseif ($item instanceof Mage_Sales_Model_Quote_Item) { + } elseif ($item instanceof Mage_Sales_Model_Quote_Item) { $this->addFieldToFilter('item_id', $item->getId()); - } - else { + } else { $this->addFieldToFilter('item_id', $item); } return $this; diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Payment.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Payment.php index aed9ec42c6..4c78313e75 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Payment.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Payment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -33,61 +33,17 @@ */ class Mage_Sales_Model_Mysql4_Quote_Payment extends Mage_Sales_Model_Mysql4_Abstract { - protected function _construct() - { - $this->_init('sales/quote_payment', 'payment_id'); - } - /** - * Also serialize additional information + * Serializeable field: additional_information * - * @param Mage_Core_Model_Abstract $payment + * @var array */ - protected function _beforeSave(Mage_Core_Model_Abstract $payment) - { - $additionalInformation = $payment->getData('additional_information'); - if (empty($additionalInformation)) { - $payment->setData('additional_information', null); - } elseif (is_array($additionalInformation)) { - $payment->setData('additional_information', serialize($additionalInformation)); - } - return parent::_beforeSave($payment); - } + protected $_serializableFields = array( + 'additional_information' => array(null, array()) + ); - /** - * Unserialize additional information after loading the object - * - * @param Mage_Core_Model_Abstract $object $payment - */ - protected function _afterLoad(Mage_Core_Model_Abstract $payment) - { - $this->unserializeFields($payment); - return parent::_afterLoad($payment); - } - - /** - * Unserialize additional information after saving the object - * - * @param Mage_Core_Model_Abstract $payment - */ - protected function _afterSave(Mage_Core_Model_Abstract $payment) - { - $this->unserializeFields($payment); - return parent::_afterSave($payment); - } - - /** - * Unserialize additional data if required - * @param Mage_Sales_Model_Quote_Payment $payment - */ - public function unserializeFields(Mage_Sales_Model_Quote_Payment $payment) + protected function _construct() { - $additionalInformation = $payment->getData('additional_information'); - if (empty($additionalInformation)) { - $payment->setData('additional_information', array()); - } elseif (!is_array($additionalInformation)) { - $payment->setData('additional_information', unserialize($additionalInformation)); - } + $this->_init('sales/quote_payment', 'payment_id'); } - } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Payment/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Payment/Collection.php index e170215fc1..f6dd14ad5c 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Quote/Payment/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Quote/Payment/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Recurring/Profile.php b/app/code/core/Mage/Sales/Model/Mysql4/Recurring/Profile.php new file mode 100644 index 0000000000..90c37e3d39 --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Mysql4/Recurring/Profile.php @@ -0,0 +1,83 @@ +_init('sales/recurring_profile', 'profile_id'); + + $this->_serializableFields = array( + 'profile_vendor_info' => array(null, array()), + 'additional_info' => array(null, array()), + + 'order_info' => array(null, array()), + 'order_item_info' => array(null, array()), + 'billing_address_info' => array(null, array()), + 'shipping_address_info' => array(null, array()) + ); + } + + /** + * Return recurring profile child Orders Ids + * + * @param Mage_Sales_Model_Recurring_Profile + * @return array + */ + public function getChildOrderIds($object) + { + $select = $this->_getReadAdapter()->select() + ->from( + array('main_table' => $this->getTable('sales/recurring_profile_order')), + array('order_id')) + ->where('profile_id=?', $object->getId()); + return $this->_getReadAdapter()->fetchCol($select); + } + + /** + * Add order relation to recurring profile + * + * @param int $recurringProfileId + * @param int $orderId + * @return Mage_Sales_Model_Mysql4_Recurring_Profile + */ + public function addOrderRelation($recurringProfileId, $orderId) + { + $this->_getWriteAdapter()->insert( + $this->getTable('sales/recurring_profile_order'), array( + 'profile_id' => $recurringProfileId, + 'order_id' => $orderId + ) + ); + return $this; + } +} diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Recurring/Profile/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Recurring/Profile/Collection.php new file mode 100644 index 0000000000..4c55a3073e --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Mysql4/Recurring/Profile/Collection.php @@ -0,0 +1,40 @@ +_init('sales/recurring_profile'); + } +} diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Recurring/Profile/Info.php b/app/code/core/Mage/Sales/Model/Mysql4/Recurring/Profile/Info.php new file mode 100644 index 0000000000..b0b0fdcc70 --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Mysql4/Recurring/Profile/Info.php @@ -0,0 +1,33 @@ + + */ + +abstract class Mage_Sales_Model_Mysql4_Report_Abstract extends Mage_Reports_Model_Mysql4_Report_Abstract +{ + +} diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Report/Bestsellers.php b/app/code/core/Mage/Sales/Model/Mysql4/Report/Bestsellers.php new file mode 100644 index 0000000000..78e81e2ff9 --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Mysql4/Report/Bestsellers.php @@ -0,0 +1,253 @@ + + */ + +class Mage_Sales_Model_Mysql4_Report_Bestsellers extends Mage_Sales_Model_Mysql4_Report_Abstract +{ + const AGGREGATION_DAILY = 'daily'; + const AGGREGATION_MONTHLY = 'monthly'; + const AGGREGATION_YEARLY = 'yearly'; + + protected function _construct() + { + $this->_init('sales/bestsellers_aggregated_' . self::AGGREGATION_DAILY, 'id'); + } + + /** + * Aggregate Orders data by order created at + * + * @param mixed $from + * @param mixed $to + * @return Mage_Sales_Model_Mysql4_Order + */ + public function aggregate($from = null, $to = null) + { + // convert input dates to UTC to be comparable with DATETIME fields in DB + $from = $this->_dateToUtc($from); + $to = $this->_dateToUtc($to); + + $this->_checkDates($from, $to); + //$this->_getWriteAdapter()->beginTransaction(); + + try { + if ($from !== null || $to !== null) { + $subSelect = $this->_getTableDateRangeSelect( + $this->getTable('sales/order'), + 'created_at', 'updated_at', $from, $to + ); + } else { + $subSelect = null; + } + + $this->_clearTableByDateRange($this->getMainTable(), $from, $to, $subSelect); + + $columns = array( + // convert dates from UTC to current admin timezone + 'period' => "DATE(CONVERT_TZ(source_table.created_at, '+00:00', '" . $this->_getStoreTimezoneUtcOffset() . "'))", + 'store_id' => 'source_table.store_id', + 'product_id' => 'order_item.product_id', + 'product_name' => 'IFNULL(product_name.value, product_default_name.value)', + 'product_price' => 'IFNULL(product_price.value, product_default_price.value) * IFNULL(source_table.base_to_global_rate, 0)', + 'qty_ordered' => 'SUM(order_item.qty_ordered)', + ); + + $select = $this->_getWriteAdapter()->select(); + + $select->from(array('source_table' => $this->getTable('sales/order')), $columns) + ->joinInner( + array('order_item' => $this->getTable('sales/order_item')), + 'order_item.order_id = source_table.entity_id', + array() + ) + ->where('source_table.state <> ?', Mage_Sales_Model_Order::STATE_CANCELED); + + + /** @var Mage_Catalog_Model_Resource_Eav_Mysql4_Product $product */ + $product = Mage::getResourceSingleton('catalog/product'); + + $productTypes = array( + Mage_Catalog_Model_Product_Type::TYPE_GROUPED, + Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE, + Mage_Catalog_Model_Product_Type::TYPE_BUNDLE, + ); + $select->joinInner( + array('product' => $this->getTable('catalog/product')), + 'product.entity_id = order_item.product_id' + . ' AND product.entity_type_id = ' . $product->getTypeId() + . " AND product.type_id NOT IN('" . implode("', '", $productTypes) . "')", + array() + ); + + // join product attributes Name & Price + $attr = $product->getAttribute('name'); + $select->joinLeft(array('product_name' => $attr->getBackend()->getTable()), + 'product_name.entity_id = product.entity_id' + . ' AND product_name.store_id = source_table.store_id' + . ' AND product_name.entity_type_id = ' . $product->getTypeId() + . ' AND product_name.attribute_id = ' . $attr->getAttributeId(), + array()) + ->joinLeft(array('product_default_name' => $attr->getBackend()->getTable()), + 'product_default_name.entity_id = product.entity_id' + . ' AND product_default_name.store_id = 0' + . ' AND product_default_name.entity_type_id = ' . $product->getTypeId() + . ' AND product_default_name.attribute_id = ' . $attr->getAttributeId(), + array()); + + $attr = $product->getAttribute('price'); + $select->joinLeft(array('product_price' => $attr->getBackend()->getTable()), + 'product_price.entity_id = product.entity_id' + . ' AND product_price.store_id = source_table.store_id' + . ' AND product_price.entity_type_id = ' . $product->getTypeId() + . ' AND product_price.attribute_id = ' . $attr->getAttributeId(), + array()) + ->joinLeft(array('product_default_price' => $attr->getBackend()->getTable()), + 'product_default_price.entity_id = product.entity_id' + . ' AND product_default_price.store_id = 0' + . ' AND product_default_price.entity_type_id = ' . $product->getTypeId() + . ' AND product_default_price.attribute_id = ' . $attr->getAttributeId(), + array()); + + + if ($subSelect !== null) { + $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'source_table.created_at')); + } + + $select->group(new Zend_Db_Expr('1,2,3')); + + $select->useStraightJoin(); // important! + $sql = $select->insertFromSelect($this->getMainTable(), array_keys($columns)); + $this->_getWriteAdapter()->query($sql); + + $columns = array( + 'period' => 'period', + 'store_id' => new Zend_Db_Expr('0'), + 'product_id' => 'product_id', + 'product_name' => 'product_name', + 'product_price' => 'product_price', + 'qty_ordered' => 'SUM(qty_ordered)', + ); + + $select->reset(); + $select->from($this->getMainTable(), $columns) + ->where('store_id <> 0'); + + if ($subSelect !== null) { + $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'period')); + } + + $select->group(array( + 'period', + 'product_id' + )); + + $sql = $select->insertFromSelect($this->getMainTable(), array_keys($columns)); + $this->_getWriteAdapter()->query($sql); + + + // update rating + $this->_updateRatingPos(self::AGGREGATION_DAILY); + $this->_updateRatingPos(self::AGGREGATION_MONTHLY); + $this->_updateRatingPos(self::AGGREGATION_YEARLY); + + + $this->_setFlagData(Mage_Reports_Model_Flag::REPORT_BESTSELLERS_FLAG_CODE); + } catch (Exception $e) { + //$this->_getWriteAdapter()->rollBack(); + throw $e; + } + + //$this->_getWriteAdapter()->commit(); + return $this; + } + + /** + * Update rating position + * + * @param string $aggregation One of Mage_Sales_Model_Mysql4_Report_Bestsellers::AGGREGATION_XXX constants + * @return Mage_Sales_Model_Mysql4_Report_Bestsellers + */ + protected function _updateRatingPos($aggregation) + { + $aggregationTable = $this->getTable('sales/bestsellers_aggregated_' . $aggregation); + + $periodSubSelect = $this->_getWriteAdapter()->select(); + $ratingSubSelect = $this->_getWriteAdapter()->select(); + $ratingSelect = $this->_getWriteAdapter()->select(); + + $periodCol = 't.period'; + if ($aggregation == self::AGGREGATION_MONTHLY) { + $periodCol = "DATE_FORMAT(t.period, '%Y-%m-01')"; + } else if ($aggregation == self::AGGREGATION_YEARLY) { + $periodCol = "DATE_FORMAT(t.period, '%Y-01-01')"; + } + + $columns = array( + 'period' => 't.period', + 'store_id' => 't.store_id', + 'product_id' => 't.product_id', + 'product_name' => 't.product_name', + 'product_price' => 't.product_price', + ); + + if ($aggregation == self::AGGREGATION_DAILY) { + $columns['id'] = 't.id'; // to speed-up insert on duplicate key update + } + + $cols = array_keys($columns); + $cols[] = new Zend_Db_Expr('SUM(t.`qty_ordered`) AS `total_qty_ordered`'); + $periodSubSelect->from(array('t' => $this->getMainTable()), $cols) + ->group(array('t.store_id', $periodCol, 't.product_id')) + ->order(array('t.store_id', $periodCol, 'total_qty_ordered DESC')); + + $cols = $columns; + $cols['qty_ordered'] = 't.total_qty_ordered'; + $cols['rating_pos'] = new Zend_Db_Expr("(@pos := IF(t.`store_id` <> @prevStoreId OR {$periodCol} <> @prevPeriod, 1, @pos+1))"); + $cols['prevStoreId'] = new Zend_Db_Expr('(@prevStoreId := t.`store_id`)'); + $cols['prevPeriod'] = new Zend_Db_Expr("(@prevPeriod := {$periodCol})"); + $ratingSubSelect->from($periodSubSelect, $cols); + + $cols = $columns; + $cols['period'] = $periodCol; // important! + $cols['qty_ordered'] = 't.qty_ordered'; + $cols['rating_pos'] = 't.rating_pos'; + $ratingSelect->from($ratingSubSelect, $cols); + + $sql = $ratingSelect->insertFromSelect($aggregationTable, array_keys($cols)); + + $this->_getWriteAdapter()->query("SET @pos = 0, @prevStoreId = -1, @prevPeriod = '0000-00-00'"); + $this->_getWriteAdapter()->query($sql); + + return $this; + } +} + diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Report/Bestsellers/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Report/Bestsellers/Collection.php new file mode 100644 index 0000000000..3a8034998f --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Mysql4/Report/Bestsellers/Collection.php @@ -0,0 +1,259 @@ + + */ +class Mage_Sales_Model_Mysql4_Report_Bestsellers_Collection extends Mage_Sales_Model_Mysql4_Report_Collection_Abstract +{ + /** + * @var int + */ + protected $_ratingLimit = 5; + + protected $_selectedColumns = array(); + + /** + * Initialize custom resource model + */ + public function __construct() + { + parent::_construct(); + $this->setModel('adminhtml/report_item'); + $this->_resource = Mage::getResourceModel('sales/report')->init('sales/bestsellers_aggregated_daily'); + $this->setConnection($this->getResource()->getReadConnection()); + // overwrite default behaviour + $this->_applyFilters = false; + } + + protected function _getSelectedColumns() + { + if (!$this->_selectedColumns) { + if ($this->isTotals()) { + $this->_selectedColumns = $this->getAggregatedColumns(); + } else { + $this->_selectedColumns = array( + 'period' => 'period', + 'qty_ordered' => 'qty_ordered', + 'product_id' => 'product_id', + 'product_name' => 'product_name', + 'product_price' => 'product_price', + ); + if ('year' == $this->_period) { + $this->_selectedColumns['period'] = 'YEAR(period)'; + } else if ('month' == $this->_period) { + $this->_selectedColumns['period'] = "DATE_FORMAT(period, '%Y-%m')"; + } + } + } + return $this->_selectedColumns; + } + + /** + * Make select object for date boundary + * + * @param mixed $from + * @param mixed $to + * @return Zend_Db_Select + */ + protected function _makeBoundarySelect($from, $to) + { + $cols = $this->_getSelectedColumns(); + $cols['qty_ordered'] = 'SUM(qty_ordered)'; + $sel = $this->getConnection()->select() + ->from($this->getResource()->getMainTable(), $cols) + ->where('period >= ?', $from) + ->where('period <= ?', $to) + ->group('product_id') + ->order('qty_ordered DESC') + ->limit($this->_ratingLimit); + $this->_applyStoresFilterToSelect($sel); + return $sel; + } + + /** + * Add selected data + * + * @return Mage_Sales_Model_Mysql4_Report_Order_Collection + */ + protected function _initSelect() + { + // if grouping by product, not by period + if (!$this->_period) { + $cols = $this->_getSelectedColumns(); + $cols['qty_ordered'] = 'SUM(qty_ordered)'; + if ($this->_from || $this->_to) { + $this->getSelect()->from($this->getTable('sales/bestsellers_aggregated_daily'), $cols); + } else { + $this->getSelect()->from($this->getTable('sales/bestsellers_aggregated_yearly'), $cols); + } + $this->_applyStoresFilter(); + $this->_applyDateRangeFilter(); + $this->getSelect() + ->group('product_id') + ->order('qty_ordered DESC') + ->limit($this->_ratingLimit); + return $this; + } + + + if ('year' == $this->_period) { + $this->getSelect()->from($this->getTable('sales/bestsellers_aggregated_yearly'), $this->_getSelectedColumns()); + } else if ('month' == $this->_period) { + $this->getSelect()->from($this->getTable('sales/bestsellers_aggregated_monthly'), $this->_getSelectedColumns()); + } else { + $this->getSelect()->from($this->getTable('sales/bestsellers_aggregated_daily'), $this->_getSelectedColumns()); + } + if (!$this->isTotals()) { + $this->getSelect()->group(array('period', 'product_id')); + } + $this->getSelect()->where('rating_pos <= ?', $this->_ratingLimit); + + // + $selectUnions = array(); + + // apply date boundaries (before calling $this->_applyDateRangeFilter()) + $dtFormat = Varien_Date::DATE_INTERNAL_FORMAT; + $periodFrom = (!is_null($this->_from) ? new Zend_Date($this->_from, $dtFormat) : null); + $periodTo = (!is_null($this->_to) ? new Zend_Date($this->_to, $dtFormat) : null); + if ('year' == $this->_period) { + + if ($periodFrom) { + if ($periodFrom->toValue(Zend_Date::MONTH) != 1 || $periodFrom->toValue(Zend_Date::DAY) != 1) { // not the first day of the year + $dtFrom = $periodFrom->getDate(); + $dtTo = $periodFrom->getDate()->setMonth(12)->setDay(31); // last day of the year + if (!$periodTo || $dtTo->isEarlier($periodTo)) { + $selectUnions[] = $this->_makeBoundarySelect($dtFrom->toString($dtFormat), $dtTo->toString($dtFormat)); + + $this->_from = $periodFrom->getDate()->addYear(1)->setMonth(1)->setDay(1)->toString($dtFormat); // first day of the next year + } + } + } + + if ($periodTo) { + if ($periodTo->toValue(Zend_Date::MONTH) != 12 || $periodTo->toValue(Zend_Date::DAY) != 31) { // not the last day of the year + $dtFrom = $periodTo->getDate()->setMonth(1)->setDay(1); // first day of the year + $dtTo = $periodTo->getDate(); + if (!$periodFrom || $dtFrom->isLater($periodFrom)) { + $selectUnions[] = $this->_makeBoundarySelect($dtFrom->toString($dtFormat), $dtTo->toString($dtFormat)); + + $this->_to = $periodTo->getDate()->subYear(1)->setMonth(12)->setDay(31)->toString($dtFormat); // last day of the previous year + } + } + } + + if ($periodFrom && $periodTo) { + if ($periodFrom->toValue(Zend_Date::YEAR) == $periodTo->toValue(Zend_Date::YEAR)) { // the same year + $dtFrom = $periodFrom->getDate(); + $dtTo = $periodTo->getDate(); + $selectUnions[] = $this->_makeBoundarySelect($dtFrom->toString($dtFormat), $dtTo->toString($dtFormat)); + + $this->getSelect()->where('1<>1'); + } + } + + } + else if ('month' == $this->_period) { + + if ($periodFrom) { + if ($periodFrom->toValue(Zend_Date::DAY) != 1) { // not the first day of the month + $dtFrom = $periodFrom->getDate(); + $dtTo = $periodFrom->getDate()->addMonth(1)->setDay(1)->subDay(1); // last day of the month + if (!$periodTo || $dtTo->isEarlier($periodTo)) { + $selectUnions[] = $this->_makeBoundarySelect($dtFrom->toString($dtFormat), $dtTo->toString($dtFormat)); + + $this->_from = $periodFrom->getDate()->addMonth(1)->setDay(1)->toString($dtFormat); // first day of the next month + } + } + } + + if ($periodTo) { + if ($periodTo->toValue(Zend_Date::DAY) != $periodTo->toValue(Zend_Date::MONTH_DAYS)) { // not the last day of the month + $dtFrom = $periodTo->getDate()->setDay(1); // first day of the month + $dtTo = $periodTo->getDate(); + if (!$periodFrom || $dtFrom->isLater($periodFrom)) { + $selectUnions[] = $this->_makeBoundarySelect($dtFrom->toString($dtFormat), $dtTo->toString($dtFormat)); + + $this->_to = $periodTo->getDate()->setDay(1)->subDay(1)->toString($dtFormat); // last day of the previous month + } + } + } + + if ($periodFrom && $periodTo) { + if ($periodFrom->toValue(Zend_Date::YEAR) == $periodTo->toValue(Zend_Date::YEAR) + && $periodFrom->toValue(Zend_Date::MONTH) == $periodTo->toValue(Zend_Date::MONTH)) { // the same month + $dtFrom = $periodFrom->getDate(); + $dtTo = $periodTo->getDate(); + $selectUnions[] = $this->_makeBoundarySelect($dtFrom->toString($dtFormat), $dtTo->toString($dtFormat)); + + $this->getSelect()->where('1<>1'); + } + } + + } + + $this->_applyStoresFilter(); + $this->_applyDateRangeFilter(); + + // add unions to select + if ($selectUnions) { + $unionParts = array(); + $cloneSelect = clone $this->getSelect(); + $unionParts[] = '(' . $cloneSelect . ')'; + foreach ($selectUnions as $union) { + $unionParts[] = '(' . $union . ')'; + } + $this->getSelect()->reset()->union($unionParts, Zend_Db_Select::SQL_UNION_ALL); + } + + if ($this->isTotals()) { + // calculate total + $cloneSelect = clone $this->getSelect(); + $this->getSelect()->reset()->from($cloneSelect, $this->getAggregatedColumns()); + } else { + // add sorting + $this->getSelect()->order(array('period ASC', 'qty_ordered DESC')); + } + + return $this; + } + + /** + * Get SQL for get record count + * + * @return Varien_Db_Select + */ + public function getSelectCountSql() + { + $this->_renderFilters(); + return $this->getConnection()->select()->from($this->getSelect(), 'COUNT(*)'); + } + +} diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Report/Collection/Abstract.php b/app/code/core/Mage/Sales/Model/Mysql4/Report/Collection/Abstract.php index 2854bc9fee..66a1ac52c3 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Report/Collection/Abstract.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Report/Collection/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -113,11 +113,12 @@ public function addStoreFilter($storeIds) } /** - * Apply stores filter + * Apply stores filter to select object * + * @param Zend_Db_Select $select * @return Mage_Sales_Model_Mysql4_Report_Collection_Abstract */ - protected function _applyStoresFilter() + protected function _applyStoresFilterToSelect(Zend_Db_Select $select) { $nullCheck = false; $storeIds = $this->_storesIds; @@ -136,14 +137,24 @@ protected function _applyStoresFilter() $storeIds[0] = ($storeIds[0] == '') ? 0 : $storeIds[0]; if ($nullCheck) { - $this->getSelect()->where('store_id IN(?) OR store_id IS NULL', $storeIds); + $select->where('store_id IN(?) OR store_id IS NULL', $storeIds); } else { - $this->getSelect()->where('store_id IN(?)', $storeIds); + $select->where('store_id IN(?)', $storeIds); } return $this; } + /** + * Apply stores filter + * + * @return Mage_Sales_Model_Mysql4_Report_Collection_Abstract + */ + protected function _applyStoresFilter() + { + return $this->_applyStoresFilterToSelect($this->getSelect()); + } + /** * Set status filter * diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Report/Invoiced.php b/app/code/core/Mage/Sales/Model/Mysql4/Report/Invoiced.php index 44fa5f6734..04dd1c087e 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Report/Invoiced.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Report/Invoiced.php @@ -20,15 +20,15 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -class Mage_Sales_Model_Mysql4_Report_Invoiced extends Mage_Core_Model_Mysql4_Abstract +class Mage_Sales_Model_Mysql4_Report_Invoiced extends Mage_Sales_Model_Mysql4_Report_Abstract { protected function _construct() { - $this->_setResource(array('read', 'write')); + $this->_setResource('sales'); } /** @@ -40,25 +40,20 @@ protected function _construct() */ public function aggregate($from = null, $to = null) { - if (!is_null($from)) { - $from = $this->formatDate($from); - } - if (!is_null($to)) { - $from = $this->formatDate($to); - } + // convert input dates to UTC to be comparable with DATETIME fields in DB + $from = $this->_dateToUtc($from); + $to = $this->_dateToUtc($to); + + $this->_checkDates($from, $to); $this->_aggregateByOrderCreatedAt($from, $to); $this->_aggregateByInvoiceCreatedAt($from, $to); - $reportsFlagModel = Mage::getModel('reports/flag'); - $reportsFlagModel->setReportFlagCode(Mage_Reports_Model_Flag::REPORT_INVOICE_FLAG_CODE); - $reportsFlagModel->loadSelf(); - $reportsFlagModel->save(); - + $this->_setFlagData(Mage_Reports_Model_Flag::REPORT_INVOICE_FLAG_CODE); return $this; } /** - * Aggregate Invoiced data by invoice created_at + * Aggregate Invoiced data by invoice created_at as period * * @param mixed $from * @param mixed $to @@ -66,74 +61,67 @@ public function aggregate($from = null, $to = null) */ protected function _aggregateByInvoiceCreatedAt($from, $to) { - try { - $tableName = $this->getTable('sales/invoiced_aggregated'); - $writeAdapter = $this->_getWriteAdapter(); - - $writeAdapter->beginTransaction(); + $table = $this->getTable('sales/invoiced_aggregated'); + $sourceTable = $this->getTable('sales/invoice'); + $orderTable = $this->getTable('sales/order'); + $this->_getWriteAdapter()->beginTransaction(); - if (is_null($from) && is_null($to)) { - $writeAdapter->query("TRUNCATE TABLE {$tableName}"); + try { + if ($from !== null || $to !== null) { + $subSelect = $this->_getTableDateRangeRelatedSelect( + $sourceTable, $orderTable, array('order_id'=>'entity_id'), + 'created_at', 'updated_at', $from, $to + ); } else { - $where = (!is_null($from)) ? "so.updated_at >= '{$from}'" : ''; - if (!is_null($to)) { - $where .= (!empty($where)) ? " AND so.updated_at <= '{$to}'" : "so.updated_at <= '{$to}'"; - } - - $subQuery = $writeAdapter->select(); - $subQuery->from(array('so' => $this->getTable('sales/order') ), array('DISTINCT DATE(so.created_at)')) - ->where($where); - - $deleteCondition = 'DATE(period) IN (' . new Zend_Db_Expr($subQuery) . ')'; - $writeAdapter->delete($tableName, $deleteCondition); + $subSelect = null; } - $invoice = Mage::getResourceSingleton('sales/order_invoice'); - $invoiceAttr = $invoice->getAttribute('order_id'); + $this->_clearTableByDateRange($table, $from, $to, $subSelect); $columns = array( - 'period' => "DATE(soe.created_at)", - 'store_id' => 'so.store_id', - 'order_status' => 'so.status', - 'orders_count' => 'COUNT(so.entity_id)', - 'orders_invoiced' => 'COUNT(so.entity_id)', - 'invoiced' => 'SUM(so.base_total_invoiced * so.base_to_global_rate)', - 'invoiced_captured' => 'SUM(so.base_total_paid * so.base_to_global_rate)', - 'invoiced_not_captured' => 'SUM((so.base_total_invoiced - so.base_total_paid) * so.base_to_global_rate)' - ); - - $select = $writeAdapter->select() - ->from(array('soe' => $this->getTable('sales/order_entity')), $columns) - ->where('state <> ?', 'canceled'); - - $select->joinInner(array('soei' => $this->getTable($invoiceAttr->getBackend()->getTable())), - "`soei`.`entity_id` = `soe`.`entity_id` - AND `soei`.`attribute_id` = {$invoiceAttr->getAttributeId()} - AND `soei`.`entity_type_id` = `soe`.`entity_type_id`", - array() + // convert dates from UTC to current admin timezone + 'period' => "DATE(CONVERT_TZ(source_table.created_at, '+00:00', '" . $this->_getStoreTimezoneUtcOffset() . "'))", + 'store_id' => 'order_table.store_id', + 'order_status' => 'order_table.status', + 'orders_count' => 'COUNT(order_table.entity_id)', + 'orders_invoiced' => 'COUNT(order_table.entity_id)', + 'invoiced' => 'SUM(order_table.base_total_invoiced * order_table.base_to_global_rate)', + 'invoiced_captured' => 'SUM(order_table.base_total_paid * order_table.base_to_global_rate)', + 'invoiced_not_captured' => 'SUM((order_table.base_total_invoiced - order_table.base_total_paid) * order_table.base_to_global_rate)' ); - $select->joinInner(array( - 'so' => $this->getTable('sales/order')), - '`soei`.`value` = `so`.`entity_id` AND `so`.base_total_invoiced > 0', - array() - ); - - if (!is_null($from) || !is_null($to)) { - $select->where("DATE(soe.created_at) IN(?)", new Zend_Db_Expr($subQuery)); + $select = $this->_getWriteAdapter()->select(); + $select->from(array('source_table' => $sourceTable), $columns) + ->joinInner( + array('order_table' => $orderTable), + $this->_getWriteAdapter()->quoteInto( + 'source_table.order_id = order_table.entity_id AND order_table.state <> ?', + Mage_Sales_Model_Order::STATE_CANCELED), + array() + ); + + $filterSubSelect = $this->_getWriteAdapter()->select(); + $filterSubSelect->from(array('filter_source_table' => $sourceTable), 'MAX(filter_source_table.entity_id)') + ->where('filter_source_table.order_id = source_table.order_id'); + + if ($subSelect !== null) { + $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'source_table.created_at')); } + $select->where('source_table.entity_id = (?)', new Zend_Db_Expr($filterSubSelect)); + unset($filterSubSelect); + $select->group(array( - "DATE(`soe`.created_at)", + 'period', 'store_id', 'order_status' )); - $writeAdapter->query(" - INSERT INTO `{$tableName}` (" . implode(',', array_keys($columns)) . ") {$select} - "); + $select->having('orders_count > 0'); - $select = $writeAdapter->select(); + $this->_getWriteAdapter()->query($select->insertFromSelect($table, array_keys($columns))); + + $select->reset(); $columns = array( 'period' => 'period', @@ -147,32 +135,30 @@ protected function _aggregateByInvoiceCreatedAt($from, $to) ); $select - ->from($tableName, $columns) - ->where("store_id <> 0"); + ->from($table, $columns) + ->where('store_id <> 0'); - if (!is_null($from) || !is_null($to)) { - $select->where("DATE(period) IN(?)", new Zend_Db_Expr($subQuery)); - } + if ($subSelect !== null) { + $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'period')); + } - $select->group(array( - 'period', - 'order_status' - )); + $select->group(array( + 'period', + 'order_status' + )); - $writeAdapter->query(" - INSERT INTO `{$tableName}` (" . implode(',', array_keys($columns)) . ") {$select} - "); + $this->_getWriteAdapter()->query($select->insertFromSelect($table, array_keys($columns))); } catch (Exception $e) { - $writeAdapter->rollBack(); + $this->_getWriteAdapter()->rollBack(); throw $e; } - $writeAdapter->commit(); + $this->_getWriteAdapter()->commit(); return $this; } /** - * Aggregate Invoiced data by order created_at + * Aggregate Invoiced data by order created_at as period * * @param mixed $from * @param mixed $to @@ -180,30 +166,21 @@ protected function _aggregateByInvoiceCreatedAt($from, $to) */ protected function _aggregateByOrderCreatedAt($from, $to) { - try { - $tableName = $this->getTable('sales/invoiced_aggregated_order'); - $writeAdapter = $this->_getWriteAdapter(); + $table = $this->getTable('sales/invoiced_aggregated_order'); + $sourceTable = $this->getTable('sales/order'); + $this->_getWriteAdapter()->beginTransaction(); - $writeAdapter->beginTransaction(); - - if (is_null($from) && is_null($to)) { - $writeAdapter->query("TRUNCATE TABLE {$tableName}"); + try { + if ($from !== null || $to !== null) { + $subSelect = $this->_getTableDateRangeSelect($sourceTable, 'created_at', 'updated_at', $from, $to); } else { - $where = (!is_null($from)) ? "so.updated_at >= '{$from}'" : ''; - if (!is_null($to)) { - $where .= (!empty($where)) ? " AND so.updated_at <= '{$to}'" : "so.updated_at <= '{$to}'"; - } - - $subQuery = $writeAdapter->select(); - $subQuery->from(array('so' => $this->getTable('sales/order')), array('DISTINCT DATE(so.created_at)')) - ->where($where); - - $deleteCondition = 'DATE(period) IN (' . new Zend_Db_Expr($subQuery) . ')'; - $writeAdapter->delete($tableName, $deleteCondition); + $subSelect = null; } + $this->_clearTableByDateRange($table, $from, $to, $subSelect); + $columns = array( - 'period' => "DATE(created_at)", + 'period' => "DATE(CONVERT_TZ(created_at, '+00:00', '" . $this->_getStoreTimezoneUtcOffset() . "'))", 'store_id' => 'store_id', 'order_status' => 'status', 'orders_count' => 'COUNT(`base_total_invoiced`)', @@ -213,27 +190,25 @@ protected function _aggregateByOrderCreatedAt($from, $to) 'invoiced_not_captured' => 'SUM((`base_total_invoiced` - `base_total_paid`) * `base_to_global_rate`)' ); - $select = $writeAdapter->select() - ->from($this->getTable('sales/order'), $columns) + $select = $this->_getWriteAdapter()->select(); + $select->from($sourceTable, $columns) ->where('state <> ?', Mage_Sales_Model_Order::STATE_CANCELED); - if (!is_null($from) || !is_null($to)) { - $select->where("DATE(created_at) IN(?)", new Zend_Db_Expr($subQuery)); + if ($subSelect !== null) { + $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'created_at')); } $select->group(array( - "DATE(created_at)", + 'period', 'store_id', 'order_status' )); $select->having('orders_count > 0'); - $writeAdapter->query(" - INSERT INTO `{$tableName}` (" . implode(',', array_keys($columns)) . ") {$select} - "); + $this->_getWriteAdapter()->query($select->insertFromSelect($table, array_keys($columns))); - $select = $writeAdapter->select(); + $select->reset(); $columns = array( 'period' => 'period', @@ -247,27 +222,25 @@ protected function _aggregateByOrderCreatedAt($from, $to) ); $select - ->from($tableName, $columns) - ->where("store_id <> 0"); + ->from($table, $columns) + ->where('store_id <> 0'); - if (!is_null($from) || !is_null($to)) { - $select->where("DATE(period) IN(?)", new Zend_Db_Expr($subQuery)); - } + if ($subSelect !== null) { + $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'period')); + } - $select->group(array( - 'period', - 'order_status' - )); + $select->group(array( + 'period', + 'order_status' + )); - $writeAdapter->query(" - INSERT INTO `{$tableName}` (" . implode(',', array_keys($columns)) . ") {$select} - "); + $this->_getWriteAdapter()->query($select->insertFromSelect($table, array_keys($columns))); } catch (Exception $e) { - $writeAdapter->rollBack(); + $this->_getWriteAdapter()->rollBack(); throw $e; } - $writeAdapter->commit(); + $this->_getWriteAdapter()->commit(); return $this; } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Report/Invoiced/Collection/Invoiced.php b/app/code/core/Mage/Sales/Model/Mysql4/Report/Invoiced/Collection/Invoiced.php index 93a1832391..fea9c2662d 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Report/Invoiced/Collection/Invoiced.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Report/Invoiced/Collection/Invoiced.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Report/Invoiced/Collection/Order.php b/app/code/core/Mage/Sales/Model/Mysql4/Report/Invoiced/Collection/Order.php index 1b04e61e1e..654e188f32 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Report/Invoiced/Collection/Order.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Report/Invoiced/Collection/Order.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Report/Order.php b/app/code/core/Mage/Sales/Model/Mysql4/Report/Order.php new file mode 100644 index 0000000000..c2d2493c38 --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Mysql4/Report/Order.php @@ -0,0 +1,160 @@ + + */ + +class Mage_Sales_Model_Mysql4_Report_Order extends Mage_Sales_Model_Mysql4_Report_Abstract +{ + protected function _construct() + { + $this->_init('sales/order_aggregated_created', 'id'); + } + + /** + * Aggregate Orders data by order created at + * + * @param mixed $from + * @param mixed $to + * @return Mage_Sales_Model_Mysql4_Order + */ + public function aggregate($from = null, $to = null) + { + // convert input dates to UTC to be comparable with DATETIME fields in DB + $from = $this->_dateToUtc($from); + $to = $this->_dateToUtc($to); + + $this->_checkDates($from, $to); + $this->_getWriteAdapter()->beginTransaction(); + + try { + if ($from !== null || $to !== null) { + $subSelect = $this->_getTableDateRangeSelect( + $this->getTable('sales/order'), + 'created_at', 'updated_at', $from, $to + ); + } else { + $subSelect = null; + } + + $this->_clearTableByDateRange($this->getMainTable(), $from, $to, $subSelect); + + $columns = array( + // convert dates from UTC to current admin timezone + 'period' => "DATE(CONVERT_TZ(o.created_at, '+00:00', '" . $this->_getStoreTimezoneUtcOffset() . "'))", + 'store_id' => 'o.store_id', + 'order_status' => 'o.status', + 'orders_count' => 'COUNT(o.entity_id)', + 'total_qty_ordered' => 'SUM(oi.total_qty_ordered)', + 'total_qty_invoiced' => 'SUM(oi.total_qty_invoiced)', + 'total_income_amount' => 'SUM((o.base_grand_total - IFNULL(o.base_total_canceled, 0)) * o.base_to_global_rate)', + 'total_revenue_amount' => 'SUM((o.base_total_paid - IFNULL(o.base_total_refunded, 0)) * o.base_to_global_rate)', + 'total_profit_amount' => 'SUM((o.base_total_paid - IFNULL(o.base_total_refunded, 0) - IFNULL(o.base_tax_invoiced, 0) - IFNULL(o.base_shipping_invoiced, 0) - IFNULL(o.base_total_invoiced_cost, 0)) * o.base_to_global_rate)', + 'total_invoiced_amount' => 'SUM(o.base_total_invoiced * o.base_to_global_rate)', + 'total_canceled_amount' => 'SUM(o.base_total_canceled * o.base_to_global_rate)', + 'total_paid_amount' => 'SUM(o.base_total_paid * o.base_to_global_rate)', + 'total_refunded_amount' => 'SUM(o.base_total_refunded * o.base_to_global_rate)', + 'total_tax_amount' => 'SUM((o.base_tax_amount - IFNULL(o.base_tax_canceled, 0)) * o.base_to_global_rate)', + 'total_tax_amount_actual' => 'SUM((o.base_tax_invoiced - IFNULL(o.base_tax_refunded, 0)) * o.base_to_global_rate)', + 'total_shipping_amount' => 'SUM((o.base_shipping_amount - IFNULL(o.base_shipping_canceled, 0)) * o.base_to_global_rate)', + 'total_shipping_amount_actual' => 'SUM((o.base_shipping_invoiced - IFNULL(o.base_shipping_refunded, 0)) * o.base_to_global_rate)', + 'total_discount_amount' => 'SUM((ABS(o.base_discount_amount) - IFNULL(o.base_discount_canceled, 0)) * o.base_to_global_rate)', + 'total_discount_amount_actual' => 'SUM((o.base_discount_invoiced - IFNULL(o.base_discount_refunded, 0)) * o.base_to_global_rate)', + ); + + $select = $this->_getWriteAdapter()->select(); + $selectOrderItem = $this->_getWriteAdapter()->select(); + + $cols = array( + 'order_id' => 'order_id', + 'total_qty_ordered' => 'SUM(qty_ordered - IFNULL(qty_canceled, 0))', + 'total_qty_invoiced' => 'SUM(qty_invoiced)', + ); + $selectOrderItem->from($this->getTable('sales/order_item'), $cols) + ->group('order_id'); + if ($subSelect !== null) { + //$selectOrderItem->where($this->_makeConditionFromDateRangeSelect($subSelect, 'created_at')); + } + + $select->from(array('o' => $this->getTable('sales/order')), $columns) + ->join(array('oi' => $selectOrderItem), 'oi.order_id = o.entity_id', array()) + ->where('o.state NOT IN (?)', array( + Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, + Mage_Sales_Model_Order::STATE_NEW, + Mage_Sales_Model_Order::STATE_CANCELED, + )); + + if ($subSelect !== null) { + $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'o.created_at')); + } + + $select->group(array( + 'period', + 'store_id', + 'order_status', + )); + + $this->_getWriteAdapter()->query($select->insertFromSelect($this->getMainTable(), array_keys($columns))); + + // setup all columns to select SUM() except period, store_id and order_status + foreach ($columns as $k => $v) { + $columns[$k] = 'SUM(' . $k . ')'; + } + $columns['period'] = 'period'; + $columns['store_id'] = new Zend_Db_Expr('0'); + $columns['order_status'] = 'order_status'; + + $select->reset(); + $select->from($this->getMainTable(), $columns) + ->where('store_id <> 0'); + + if ($subSelect !== null) { + $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'period')); + } + + $select->group(array( + 'period', + 'order_status' + )); + + $this->_getWriteAdapter()->query($select->insertFromSelect($this->getMainTable(), array_keys($columns))); + + $this->_setFlagData(Mage_Reports_Model_Flag::REPORT_ORDER_FLAG_CODE); + } catch (Exception $e) { + $this->_getWriteAdapter()->rollBack(); + throw $e; + } + + $this->_getWriteAdapter()->commit(); + return $this; + } +} + diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Report/Order/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Report/Order/Collection.php index 3a3b792d24..f8d0716f82 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Report/Order/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Report/Order/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -59,18 +59,23 @@ protected function _getSelectedColumns() if (!$this->isTotals()) { $this->_selectedColumns = array( - 'period' => $this->_periodFormat, - 'orders_count' => 'SUM(orders_count)', - 'total_qty_ordered' => 'SUM(total_qty_ordered)', - 'base_profit_amount' => 'SUM(base_profit_amount)', - 'base_subtotal_amount' => 'SUM(base_subtotal_amount)', - 'base_tax_amount' => 'SUM(base_tax_amount)', - 'base_shipping_amount' => 'SUM(base_shipping_amount)', - 'base_discount_amount' => 'SUM(base_discount_amount)', - 'base_grand_total_amount' => 'SUM(base_grand_total_amount)', - 'base_invoiced_amount' => 'SUM(base_invoiced_amount)', - 'base_refunded_amount' => 'SUM(base_refunded_amount)', - 'base_canceled_amount' => 'SUM(base_canceled_amount)' + 'period' => $this->_periodFormat, + 'orders_count' => 'SUM(orders_count)', + 'total_qty_ordered' => 'SUM(total_qty_ordered)', + 'total_qty_invoiced' => 'SUM(total_qty_invoiced)', + 'total_income_amount' => 'SUM(total_income_amount)', + 'total_revenue_amount' => 'SUM(total_revenue_amount)', + 'total_profit_amount' => 'SUM(total_profit_amount)', + 'total_invoiced_amount' => 'SUM(total_invoiced_amount)', + 'total_canceled_amount' => 'SUM(total_canceled_amount)', + 'total_paid_amount' => 'SUM(total_paid_amount)', + 'total_refunded_amount' => 'SUM(total_refunded_amount)', + 'total_tax_amount' => 'SUM(total_tax_amount)', + 'total_tax_amount_actual' => 'SUM(total_tax_amount_actual)', + 'total_shipping_amount' => 'SUM(total_shipping_amount)', + 'total_shipping_amount_actual' => 'SUM(total_shipping_amount_actual)', + 'total_discount_amount' => 'SUM(total_discount_amount)', + 'total_discount_amount_actual' => 'SUM(total_discount_amount_actual)', ); } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Report/Order/Updatedat/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Report/Order/Updatedat/Collection.php index 2a24d61abf..6a8c604b67 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Report/Order/Updatedat/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Report/Order/Updatedat/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -37,17 +37,22 @@ class Mage_Sales_Model_Mysql4_Report_Order_Updatedat_Collection extends Mage_Sal protected $_periodFormat; protected $_inited = false; protected $_selectedColumns = array( - 'orders_count' => 'COUNT(e.entity_id)', - 'total_qty_ordered' => 'SUM(e.total_qty_ordered)', - 'base_profit_amount' => 'SUM(IFNULL(e.base_subtotal_invoiced, 0) * e.base_to_global_rate) + SUM(IFNULL(e.base_discount_refunded, 0) * e.base_to_global_rate) - SUM(IFNULL(e.base_subtotal_refunded, 0) * e.base_to_global_rate) - SUM(IFNULL(e.base_discount_invoiced, 0) * e.base_to_global_rate) - SUM(IFNULL(e.base_total_invoiced_cost, 0) * e.base_to_global_rate)', - 'base_subtotal_amount' => 'SUM(e.base_subtotal * e.base_to_global_rate)', - 'base_tax_amount' => 'SUM(e.base_tax_amount * e.base_to_global_rate)', - 'base_shipping_amount' => 'SUM(e.base_shipping_amount * e.base_to_global_rate)', - 'base_discount_amount' => 'SUM(e.base_discount_amount * e.base_to_global_rate)', - 'base_grand_total_amount' => 'SUM(e.base_grand_total * e.base_to_global_rate)', - 'base_invoiced_amount' => 'SUM(e.base_total_paid * e.base_to_global_rate)', - 'base_refunded_amount' => 'SUM(e.base_total_refunded * e.base_to_global_rate)', - 'base_canceled_amount' => 'SUM(IFNULL(e.subtotal_canceled, 0) * e.base_to_global_rate)' + 'orders_count' => 'COUNT(e.entity_id)', + 'total_qty_ordered' => 'IFNULL(SUM(oi.total_qty_ordered), 0)', + 'total_qty_invoiced' => 'IFNULL(SUM(oi.total_qty_invoiced), 0)', + 'total_income_amount' => 'IFNULL(SUM((e.base_grand_total - IFNULL(e.base_total_canceled, 0)) * e.base_to_global_rate), 0)', + 'total_revenue_amount' => 'IFNULL(SUM((e.base_total_paid - IFNULL(e.base_total_refunded, 0)) * e.base_to_global_rate), 0)', + 'total_profit_amount' => 'IFNULL(SUM((e.base_total_paid - IFNULL(e.base_total_refunded, 0) - IFNULL(e.base_tax_invoiced, 0) - IFNULL(e.base_shipping_invoiced, 0) - IFNULL(e.base_total_invoiced_cost, 0)) * e.base_to_global_rate), 0)', + 'total_invoiced_amount' => 'IFNULL(SUM(e.base_total_invoiced * e.base_to_global_rate), 0)', + 'total_canceled_amount' => 'IFNULL(SUM(e.base_total_canceled * e.base_to_global_rate), 0)', + 'total_paid_amount' => 'IFNULL(SUM(e.base_total_paid * e.base_to_global_rate), 0)', + 'total_refunded_amount' => 'IFNULL(SUM(e.base_total_refunded * e.base_to_global_rate), 0)', + 'total_tax_amount' => 'IFNULL(SUM((e.base_tax_amount - IFNULL(e.base_tax_canceled, 0)) * e.base_to_global_rate), 0)', + 'total_tax_amount_actual' => 'IFNULL(SUM((e.base_tax_invoiced - IFNULL(e.base_tax_refunded, 0)) * e.base_to_global_rate), 0)', + 'total_shipping_amount' => 'IFNULL(SUM((e.base_shipping_amount - IFNULL(e.base_shipping_canceled, 0)) * e.base_to_global_rate), 0)', + 'total_shipping_amount_actual' => 'IFNULL(SUM((e.base_shipping_invoiced - IFNULL(e.base_shipping_refunded, 0)) * e.base_to_global_rate), 0)', + 'total_discount_amount' => 'IFNULL(SUM((ABS(e.base_discount_amount) - IFNULL(e.base_discount_canceled, 0)) * e.base_to_global_rate), 0)', + 'total_discount_amount_actual' => 'IFNULL(SUM((e.base_discount_invoiced - IFNULL(e.base_discount_refunded, 0)) * e.base_to_global_rate), 0)', ); /** @@ -146,29 +151,32 @@ protected function _initSelect() $mainTable = $this->getResource()->getMainTable(); - if (!is_null($this->_from) || !is_null($this->_to)) { - $where = (!is_null($this->_from)) ? "so.updated_at >= '{$this->_from}'" : ''; - if (!is_null($this->_to)) { - $where .= (!empty($where)) ? " AND so.updated_at <= '{$this->_to}'" : "so.updated_at <= '{$this->_to}'"; - } - - $subQuery = clone $this->getSelect(); - $subQuery->from(array('so' => $mainTable), array('DISTINCT DATE(so.updated_at)')) - ->where($where); - } + $selectOrderItem = $this->getConnection()->select() + ->from($this->getTable('sales/order_item'), array( + 'order_id' => 'order_id', + 'total_qty_ordered' => 'SUM(qty_ordered - IFNULL(qty_canceled, 0))', + 'total_qty_invoiced' => 'SUM(qty_invoiced)', + )) + ->group('order_id'); $select = $this->getSelect() ->from(array('e' => $mainTable), $columns) + ->join(array('oi' => $selectOrderItem), 'oi.order_id = e.entity_id', array()) ->where('e.state NOT IN (?)', array( Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, - Mage_Sales_Model_Order::STATE_NEW + Mage_Sales_Model_Order::STATE_NEW, + Mage_Sales_Model_Order::STATE_CANCELED, )); $this->_applyStoresFilter(); $this->_applyOrderStatusFilter(); - if (!is_null($this->_from) || !is_null($this->_to)) { - $select->where("DATE(e.updated_at) IN(?)", new Zend_Db_Expr($subQuery)); + if ($this->_to !== null) { + $select->where('DATE(e.updated_at) <= DATE(?)', $this->_to); + } + + if ($this->_from !== null) { + $select->where('DATE(e.updated_at) >= DATE(?)', $this->_from); } if (!$this->isTotals()) { diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Report/Refunded.php b/app/code/core/Mage/Sales/Model/Mysql4/Report/Refunded.php index e2eb9684bf..c8cd430df6 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Report/Refunded.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Report/Refunded.php @@ -20,15 +20,15 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -class Mage_Sales_Model_Mysql4_Report_Refunded extends Mage_Core_Model_Mysql4_Abstract +class Mage_Sales_Model_Mysql4_Report_Refunded extends Mage_Sales_Model_Mysql4_Report_Abstract { protected function _construct() { - $this->_setResource(array('read', 'write')); + $this->_setResource('sales'); } /** @@ -40,50 +40,43 @@ protected function _construct() */ public function aggregate($from = null, $to = null) { - if (!is_null($from)) { - $from = $this->formatDate($from); - } - if (!is_null($to)) { - $from = $this->formatDate($to); - } + // convert input dates to UTC to be comparable with DATETIME fields in DB + $from = $this->_dateToUtc($from); + $to = $this->_dateToUtc($to); + $this->_checkDates($from, $to); $this->_aggregateByOrderCreatedAt($from, $to); $this->_aggregateByRefundCreatedAt($from, $to); - $reportsFlagModel = Mage::getModel('reports/flag'); - $reportsFlagModel->setReportFlagCode(Mage_Reports_Model_Flag::REPORT_REFUNDED_FLAG_CODE); - $reportsFlagModel->loadSelf(); - $reportsFlagModel->save(); - + $this->_setFlagData(Mage_Reports_Model_Flag::REPORT_REFUNDED_FLAG_CODE); return $this; } + /** + * Aggregate refunded data by order created at as period + * + * @param mixed $from + * @param mixed $to + * @return Mage_Sales_Model_Mysql4_Report_Refunded + */ protected function _aggregateByOrderCreatedAt($from, $to) { - try { - $tableName = $this->getTable('sales/refunded_aggregated_order'); - $writeAdapter = $this->_getWriteAdapter(); - - $writeAdapter->beginTransaction(); + $table = $this->getTable('sales/refunded_aggregated_order'); + $sourceTable = $this->getTable('sales/order'); + $this->_getWriteAdapter()->beginTransaction(); - if (is_null($from) && is_null($to)) { - $writeAdapter->query("TRUNCATE TABLE {$tableName}"); + try { + if ($from !== null || $to !== null) { + $subSelect = $this->_getTableDateRangeSelect($sourceTable, 'created_at', 'updated_at', $from, $to); } else { - $where = (!is_null($from)) ? "so.updated_at >= '{$from}'" : ''; - if (!is_null($to)) { - $where .= (!empty($where)) ? " AND so.updated_at <= '{$to}'" : "so.updated_at <= '{$to}'"; - } - - $subQuery = $writeAdapter->select(); - $subQuery->from(array('so' => $this->getTable('sales/order')), array('DISTINCT DATE(so.created_at)')) - ->where($where); - - $deleteCondition = 'DATE(period) IN (' . new Zend_Db_Expr($subQuery) . ')'; - $writeAdapter->delete($tableName, $deleteCondition); + $subSelect = null; } + $this->_clearTableByDateRange($table, $from, $to, $subSelect); + $columns = array( - 'period' => "DATE(created_at)", + // convert dates from UTC to current admin timezone + 'period' => "DATE(CONVERT_TZ(created_at, '+00:00', '" . $this->_getStoreTimezoneUtcOffset() . "'))", 'store_id' => 'store_id', 'order_status' => 'status', 'orders_count' => 'COUNT(`total_refunded`)', @@ -92,28 +85,26 @@ protected function _aggregateByOrderCreatedAt($from, $to) 'offline_refunded' => 'SUM(`base_total_offline_refunded` * `base_to_global_rate`)' ); - $select = $writeAdapter->select() - ->from($this->getTable('sales/order'), $columns) + $select = $this->_getWriteAdapter()->select(); + $select->from($sourceTable, $columns) ->where('state <> ?', Mage_Sales_Model_Order::STATE_CANCELED) ->where('base_total_refunded > 0'); - if (!is_null($from) || !is_null($to)) { - $select->where("DATE(created_at) IN(?)", new Zend_Db_Expr($subQuery)); - } + if ($subSelect !== null) { + $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'created_at')); + } - $select->group(array( - "DATE(created_at)", - 'store_id', - 'order_status' - )); + $select->group(array( + 'period', + 'store_id', + 'order_status' + )); - $select->having('orders_count > 0'); + $select->having('orders_count > 0'); - $writeAdapter->query(" - INSERT INTO `{$tableName}` (" . implode(',', array_keys($columns)) . ") {$select} - "); + $this->_getWriteAdapter()->query($select->insertFromSelect($table, array_keys($columns))); - $select = $writeAdapter->select(); + $select->reset(); $columns = array( 'period' => 'period', @@ -126,102 +117,97 @@ protected function _aggregateByOrderCreatedAt($from, $to) ); $select - ->from($tableName, $columns) - ->where("store_id <> 0"); + ->from($table, $columns) + ->where('store_id <> 0'); - if (!is_null($from) || !is_null($to)) { - $select->where("DATE(period) IN(?)", new Zend_Db_Expr($subQuery)); - } + if ($subSelect !== null) { + $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'period')); + } - $select->group(array( - 'period', - 'order_status' - )); + $select->group(array( + 'period', + 'order_status' + )); - $writeAdapter->query(" - INSERT INTO `{$tableName}` (" . implode(',', array_keys($columns)) . ") {$select} - "); + $this->_getWriteAdapter()->query($select->insertFromSelect($table, array_keys($columns))); } catch (Exception $e) { - $writeAdapter->rollBack(); + $this->_getWriteAdapter()->rollBack(); throw $e; } - $writeAdapter->commit(); + $this->_getWriteAdapter()->commit(); return $this; } + /** + * Aggregate refunded data by creaditmemo created at as period + * + * @param mixed $from + * @param mixed $to + * @return Mage_Sales_Model_Mysql4_Report_Refunded + */ protected function _aggregateByRefundCreatedAt($from, $to) { - try { - $tableName = $this->getTable('sales/refunded_aggregated'); - $writeAdapter = $this->_getWriteAdapter(); - - $writeAdapter->beginTransaction(); + $table = $this->getTable('sales/refunded_aggregated'); + $sourceTable = $this->getTable('sales/creditmemo'); + $orderTable = $this->getTable('sales/order'); + $this->_getWriteAdapter()->beginTransaction(); - if (is_null($from) && is_null($to)) { - $writeAdapter->query("TRUNCATE TABLE {$tableName}"); + try { + if ($from !== null || $to !== null) { + $subSelect = $this->_getTableDateRangeRelatedSelect( + $sourceTable, $orderTable, array('order_id'=>'entity_id'), + 'created_at', 'updated_at', $from, $to + ); } else { - $where = (!is_null($from)) ? "so.updated_at >= '{$from}'" : ''; - if (!is_null($to)) { - $where .= (!empty($where)) ? " AND so.updated_at <= '{$to}'" : "so.updated_at <= '{$to}'"; - } - - $subQuery = $writeAdapter->select(); - $subQuery->from(array('so' => $this->getTable('sales/order')), array('DISTINCT DATE(so.created_at)')) - ->where($where); - - $deleteCondition = 'DATE(period) IN (' . new Zend_Db_Expr($subQuery) . ')'; - $writeAdapter->delete($tableName, $deleteCondition); + $subSelect = null; } - $creditmemo = Mage::getResourceSingleton('sales/order_creditmemo'); - $creditmemoAttr = $creditmemo->getAttribute('order_id'); + $this->_clearTableByDateRange($table, $from, $to, $subSelect); $columns = array( - 'period' => "DATE(soe.created_at)", - 'store_id' => 'so.store_id', - 'order_status' => 'so.status', - 'orders_count' => 'COUNT(so.`total_refunded`)', - 'refunded' => 'SUM(so.`base_total_refunded` * so.`base_to_global_rate`)', - 'online_refunded' => 'SUM(so.`base_total_online_refunded` * so.`base_to_global_rate`)', - 'offline_refunded' => 'SUM(so.`base_total_offline_refunded` * so.`base_to_global_rate`)' + // convert dates from UTC to current admin timezone + 'period' => "DATE(CONVERT_TZ(source_table.created_at, '+00:00', '" . $this->_getStoreTimezoneUtcOffset() . "'))", + 'store_id' => 'order_table.store_id', + 'order_status' => 'order_table.status', + 'orders_count' => 'COUNT(order_table.`entity_id`)', + 'refunded' => 'SUM(order_table.`base_total_refunded` * order_table.`base_to_global_rate`)', + 'online_refunded' => 'SUM(order_table.`base_total_online_refunded` * order_table.`base_to_global_rate`)', + 'offline_refunded' => 'SUM(order_table.`base_total_offline_refunded` * order_table.`base_to_global_rate`)' ); - $select = $writeAdapter->select() - ->from(array('soe' => $this->getTable('sales/order_entity')), $columns) - ->where('state <> ?', 'canceled') - ->where('base_total_refunded > 0'); - - $select->joinInner(array('soei' => $this->getTable($creditmemoAttr->getBackend()->getTable())), - "`soei`.`entity_id` = `soe`.`entity_id` - AND `soei`.`attribute_id` = {$creditmemoAttr->getAttributeId()} - AND `soei`.`entity_type_id` = `soe`.`entity_type_id`", - array() - ); - - $select->joinInner(array( - 'so' => $this->getTable('sales/order')), - '`soei`.`value` = `so`.`entity_id`', - array() - ); - - if (!is_null($from) || !is_null($to)) { - $select->where("DATE(soe.created_at) IN(?)", new Zend_Db_Expr($subQuery)); + $select = $this->_getWriteAdapter()->select(); + $select->from(array('source_table' => $sourceTable), $columns) + ->joinInner( + array('order_table' => $orderTable), + $this->_getWriteAdapter()->quoteInto( + 'source_table.order_id = order_table.entity_id AND order_table.state <> ? AND order_table.base_total_refunded > 0', + Mage_Sales_Model_Order::STATE_CANCELED), + array() + ); + + $filterSubSelect = $this->_getWriteAdapter()->select(); + $filterSubSelect->from(array('filter_source_table' => $sourceTable), 'MAX(filter_source_table.entity_id)') + ->where('filter_source_table.order_id = source_table.order_id'); + + if ($subSelect !== null) { + $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'source_table.created_at')); } + $select->where('source_table.entity_id = (?)', new Zend_Db_Expr($filterSubSelect)); + unset($filterSubSelect); + $select->group(array( - "DATE(soe.created_at)", + 'period', 'store_id', 'order_status' )); $select->having('orders_count > 0'); - $writeAdapter->query(" - INSERT INTO `{$tableName}` (" . implode(',', array_keys($columns)) . ") {$select} - "); + $this->_getWriteAdapter()->query($select->insertFromSelect($table, array_keys($columns))); - $select = $writeAdapter->select(); + $select->reset(); $columns = array( 'period' => 'period', @@ -234,27 +220,24 @@ protected function _aggregateByRefundCreatedAt($from, $to) ); $select - ->from($tableName, $columns) - ->where("store_id <> 0"); - - if (!is_null($from) || !is_null($to)) { - $select->where("DATE(period) IN(?)", new Zend_Db_Expr($subQuery)); - } + ->from($table, $columns) + ->where('store_id <> 0'); - $select->group(array( - 'period', - 'order_status' - )); + if ($subSelect !== null) { + $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'period')); + } - $writeAdapter->query(" - INSERT INTO `{$tableName}` (" . implode(',', array_keys($columns)) . ") {$select} - "); + $select->group(array( + 'period', + 'order_status' + )); + $this->_getWriteAdapter()->query($select->insertFromSelect($table, array_keys($columns))); } catch (Exception $e) { - $writeAdapter->rollBack(); + $this->_getWriteAdapter()->rollBack(); throw $e; } - $writeAdapter->commit(); + $this->_getWriteAdapter()->commit(); return $this; } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Report/Refunded/Collection/Order.php b/app/code/core/Mage/Sales/Model/Mysql4/Report/Refunded/Collection/Order.php index 55defadbbc..6efcd69fed 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Report/Refunded/Collection/Order.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Report/Refunded/Collection/Order.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Report/Refunded/Collection/Refunded.php b/app/code/core/Mage/Sales/Model/Mysql4/Report/Refunded/Collection/Refunded.php index b0878ff92f..48f94bd58e 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Report/Refunded/Collection/Refunded.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Report/Refunded/Collection/Refunded.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Report/Shipping.php b/app/code/core/Mage/Sales/Model/Mysql4/Report/Shipping.php index c5bc12b0f9..91bb16a547 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Report/Shipping.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Report/Shipping.php @@ -20,15 +20,15 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -class Mage_Sales_Model_Mysql4_Report_Shipping extends Mage_Core_Model_Mysql4_Abstract +class Mage_Sales_Model_Mysql4_Report_Shipping extends Mage_Sales_Model_Mysql4_Report_Abstract { protected function _construct() { - $this->_setResource(array('read', 'write')); + $this->_setResource('sales'); } /** @@ -40,81 +40,74 @@ protected function _construct() */ public function aggregate($from = null, $to = null) { - if (!is_null($from)) { - $from = $this->formatDate($from); - } - if (!is_null($to)) { - $from = $this->formatDate($to); - } + // convert input dates to UTC to be comparable with DATETIME fields in DB + $from = $this->_dateToUtc($from); + $to = $this->_dateToUtc($to); + $this->_checkDates($from, $to); $this->_aggregateByOrderCreatedAt($from, $to); $this->_aggregateByShippingCreatedAt($from, $to); - - $reportsFlagModel = Mage::getModel('reports/flag'); - $reportsFlagModel->setReportFlagCode(Mage_Reports_Model_Flag::REPORT_SHIPPING_FLAG_CODE); - $reportsFlagModel->loadSelf(); - $reportsFlagModel->save(); - + $this->_setFlagData(Mage_Reports_Model_Flag::REPORT_SHIPPING_FLAG_CODE); return $this; } + /** + * Aggregate shipping report by order create_at as period + * + * @param mixed $from + * @param mixed $to + * @return Mage_Sales_Model_Mysql4_Report_Shipping + */ protected function _aggregateByOrderCreatedAt($from, $to) { - try { - $tableName = $this->getTable('sales/shipping_aggregated_order'); - $writeAdapter = $this->_getWriteAdapter(); + $table = $this->getTable('sales/shipping_aggregated_order'); + $sourceTable = $this->getTable('sales/order'); + $this->_getWriteAdapter()->beginTransaction(); - $writeAdapter->beginTransaction(); - - if (is_null($from) && is_null($to)) { - $writeAdapter->query("TRUNCATE TABLE {$tableName}"); + try { + if ($from !== null || $to !== null) { + $subSelect = $this->_getTableDateRangeSelect($sourceTable, 'created_at', 'updated_at', $from, $to); } else { - $where = (!is_null($from)) ? "so.updated_at >= '{$from}'" : ''; - if (!is_null($to)) { - $where .= (!empty($where)) ? " AND so.updated_at <= '{$to}'" : "so.updated_at <= '{$to}'"; - } - - $subQuery = $writeAdapter->select(); - $subQuery->from(array('so'=>$this->getTable('sales/order')), array('DISTINCT DATE(so.created_at)')) - ->where($where); - - $deleteCondition = 'DATE(period) IN (' . new Zend_Db_Expr($subQuery) . ')'; - $writeAdapter->delete($tableName, $deleteCondition); + $subSelect = null; } + $this->_clearTableByDateRange($table, $from, $to, $subSelect); + $columns = array( - 'period' => "DATE(created_at)", + // convert dates from UTC to current admin timezone + 'period' => "DATE(CONVERT_TZ(created_at, '+00:00', '" . $this->_getStoreTimezoneUtcOffset() . "'))", 'store_id' => 'store_id', 'order_status' => 'status', 'shipping_description' => 'shipping_description', 'orders_count' => 'COUNT(entity_id)', - 'total_shipping' => 'SUM(`base_shipping_amount` * `base_to_global_rate`)' + 'total_shipping' => 'SUM((`base_shipping_amount` - IFNULL(`base_shipping_canceled`, 0)) * `base_to_global_rate`)', + 'total_shipping_actual' => 'SUM((`base_shipping_invoiced` - IFNULL(`base_shipping_refunded`, 0)) * `base_to_global_rate`)', ); - $select = $writeAdapter->select() - ->from($this->getTable('sales/order'), $columns) - ->where('state NOT IN (?)', array( + $select = $this->_getWriteAdapter()->select(); + $select->from($sourceTable, $columns) + ->where('state NOT IN (?)', array( Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage_Sales_Model_Order::STATE_NEW )) ->where('is_virtual = 0'); - if (!is_null($from) || !is_null($to)) { - $select->where("DATE(created_at) IN(?)", new Zend_Db_Expr($subQuery)); - } + if ($subSelect !== null) { + $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'created_at')); + } + + $select->group(array( + 'period', + 'store_id', + 'order_status', + 'shipping_description' + )); - $select->group(array( - "DATE(created_at)", - 'store_id', - 'order_status', - 'shipping_description' - )); + $select->having('orders_count > 0'); - $writeAdapter->query(" - INSERT INTO `{$tableName}` (" . implode(',', array_keys($columns)) . ") {$select} - "); + $this->_getWriteAdapter()->query($select->insertFromSelect($table, array_keys($columns))); - $select = $writeAdapter->select(); + $select->reset(); $columns = array( 'period' => 'period', @@ -122,103 +115,103 @@ protected function _aggregateByOrderCreatedAt($from, $to) 'order_status' => 'order_status', 'shipping_description' => 'shipping_description', 'orders_count' => 'SUM(orders_count)', - 'total_shipping' => 'SUM(total_shipping)' + 'total_shipping' => 'SUM(total_shipping)', + 'total_shipping_actual' => 'SUM(total_shipping_actual)', ); $select - ->from($tableName, $columns) + ->from($table, $columns) ->where("store_id <> 0"); - if (!is_null($from) || !is_null($to)) { - $select->where("DATE(period) IN(?)", new Zend_Db_Expr($subQuery)); - } + if ($subSelect !== null) { + $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'period')); + } - $select->group(array( - 'period', - 'order_status', - 'shipping_description' - )); + $select->group(array( + 'period', + 'order_status', + 'shipping_description' + )); - $writeAdapter->query(" - INSERT INTO `{$tableName}` (" . implode(',', array_keys($columns)) . ") {$select} - "); + $this->_getWriteAdapter()->query($select->insertFromSelect($table, array_keys($columns))); } catch (Exception $e) { - $writeAdapter->rollBack(); + $this->_getWriteAdapter()->rollBack(); throw $e; } - $writeAdapter->commit(); + $this->_getWriteAdapter()->commit(); return $this; } + /** + * Aggregate shipping report by shipment create_at as period + * + * @param mixed $from + * @param mixed $to + * @return Mage_Sales_Model_Mysql4_Report_Shipping + */ protected function _aggregateByShippingCreatedAt($from, $to) { - try { - $tableName = $this->getTable('sales/shipping_aggregated'); - $writeAdapter = $this->_getWriteAdapter(); - - $writeAdapter->beginTransaction(); + $table = $this->getTable('sales/shipping_aggregated'); + $sourceTable = $this->getTable('sales/invoice'); + $orderTable = $this->getTable('sales/order'); + $this->_getWriteAdapter()->beginTransaction(); - if (is_null($from) && is_null($to)) { - $writeAdapter->query("TRUNCATE TABLE {$tableName}"); + try { + if ($from !== null || $to !== null) { + $subSelect = $this->_getTableDateRangeRelatedSelect( + $sourceTable, $orderTable, array('order_id'=>'entity_id'), + 'created_at', 'updated_at', $from, $to + ); } else { - $where = (!is_null($from)) ? "so.updated_at >= '{$from}'" : ''; - if (!is_null($to)) { - $where .= (!empty($where)) ? " AND so.updated_at <= '{$to}'" : "so.updated_at <= '{$to}'"; - } - - $subQuery = $writeAdapter->select(); - $subQuery->from(array('so'=>$this->getTable('sales/order')), array('DISTINCT DATE(so.created_at)')) - ->where($where); - - $deleteCondition = 'DATE(period) IN (' . new Zend_Db_Expr($subQuery) . ')'; - $writeAdapter->delete($tableName, $deleteCondition); + $subSelect = null; } - $columns = array( - 'period' => "DATE(soe.created_at)", - 'store_id' => 'so.store_id', - 'order_status' => 'so.status', - 'shipping_description' => 'so.shipping_description', - 'orders_count' => 'COUNT(so.entity_id)', - 'total_shipping' => 'SUM(so.`base_shipping_amount` * so.`base_to_global_rate`)' - ); + $this->_clearTableByDateRange($table, $from, $to, $subSelect); - $shipment = Mage::getResourceSingleton('sales/order_shipment'); - $shipmentAttr = $shipment->getAttribute('order_id'); - - $select = $writeAdapter->select() - ->from(array('soe' => $this->getTable('sales/order_entity')), $columns) - ->where('state <> ?', 'canceled'); - - - $select->joinInner(array('soei' => $this->getTable($shipmentAttr->getBackend()->getTable())), "`soei`.`entity_id` = `soe`.`entity_id` - AND `soei`.`attribute_id` = {$shipmentAttr->getAttributeId()} - AND `soei`.`entity_type_id` = `soe`.`entity_type_id`", - array() + $columns = array( + // convert dates from UTC to current admin timezone + 'period' => "DATE(CONVERT_TZ(source_table.created_at, '+00:00', '" . $this->_getStoreTimezoneUtcOffset() . "'))", + 'store_id' => 'order_table.store_id', + 'order_status' => 'order_table.status', + 'shipping_description' => 'order_table.shipping_description', + 'orders_count' => 'COUNT(order_table.entity_id)', + 'total_shipping' => 'SUM((order_table.`base_shipping_amount` - IFNULL(order_table.`base_shipping_canceled`, 0)) * order_table.`base_to_global_rate`)', + 'total_shipping_actual' => 'SUM((order_table.`base_shipping_invoiced` - IFNULL(order_table.`base_shipping_refunded`, 0)) * order_table.`base_to_global_rate`)', ); - $select->joinInner(array('so' => $this->getTable('sales/order')), - '`soei`.`value` = `so`.`entity_id` AND `so`.base_total_invoiced > 0', - array() - ); + $select = $this->_getWriteAdapter()->select(); + $select->from(array('source_table' => $sourceTable), $columns) + ->joinInner( + array('order_table' => $orderTable), + $this->_getWriteAdapter()->quoteInto( + 'source_table.order_id = order_table.entity_id AND order_table.state <> ?', + Mage_Sales_Model_Order::STATE_CANCELED), + array() + ) + ->useStraightJoin(); + + $filterSubSelect = $this->_getWriteAdapter()->select(); + $filterSubSelect->from(array('filter_source_table' => $sourceTable), 'MIN(filter_source_table.entity_id)') + ->where('filter_source_table.order_id = source_table.order_id'); + + if ($subSelect !== null) { + $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'source_table.created_at')); + } - if (!is_null($from) || !is_null($to)) { - $select->where("DATE(soe.created_at) IN(?)", new Zend_Db_Expr($subQuery)); - } + $select->where('source_table.entity_id = (?)', new Zend_Db_Expr($filterSubSelect)); + unset($filterSubSelect); - $select->group(array( - "DATE(soe.created_at)", - 'store_id', - 'order_status', - 'shipping_description' - )); + $select->group(array( + 'period', + 'store_id', + 'order_status', + 'shipping_description' + )); - $writeAdapter->query(" - INSERT INTO `{$tableName}` (" . implode(',', array_keys($columns)) . ") {$select} - "); + $this->_getWriteAdapter()->query($select->insertFromSelect($table, array_keys($columns))); - $select = $writeAdapter->select(); + $select->reset(); $columns = array( 'period' => 'period', @@ -226,33 +219,32 @@ protected function _aggregateByShippingCreatedAt($from, $to) 'order_status' => 'order_status', 'shipping_description' => 'shipping_description', 'orders_count' => 'SUM(orders_count)', - 'total_shipping' => 'SUM(total_shipping)' + 'total_shipping' => 'SUM(total_shipping)', + 'total_shipping_actual' => 'SUM(total_shipping_actual)', ); $select - ->from($tableName, $columns) - ->where("store_id <> 0"); - - if (!is_null($from) || !is_null($to)) { - $select->where("DATE(period) IN(?)", new Zend_Db_Expr($subQuery)); - } + ->from($table, $columns) + ->where('store_id <> 0'); - $select->group(array( - 'period', - 'order_status', - 'shipping_description' - )); + if ($subSelect !== null) { + $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'period')); + } - $writeAdapter->query(" - INSERT INTO `{$tableName}` (" . implode(',', array_keys($columns)) . ") {$select} - "); + $select->group(array( + 'period', + 'order_status', + 'shipping_description' + )); + $this->_getWriteAdapter()->query($select->insertFromSelect($table, array_keys($columns))); } catch (Exception $e) { - $writeAdapter->rollback(); + $this->_getWriteAdapter()->rollBack(); throw $e; } - $writeAdapter->commit(); + $this->_getWriteAdapter()->commit(); return $this; + } } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Report/Shipping/Collection/Order.php b/app/code/core/Mage/Sales/Model/Mysql4/Report/Shipping/Collection/Order.php index b0e5c775b1..d4d893a22f 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Report/Shipping/Collection/Order.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Report/Shipping/Collection/Order.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -64,7 +64,8 @@ protected function _getSelectedColumns() 'period' => $this->_periodFormat, 'shipping_description' => 'shipping_description', 'orders_count' => 'sum(orders_count)', - 'total_shipping' => 'sum(total_shipping)' + 'total_shipping' => 'sum(total_shipping)', + 'total_shipping_actual' => 'sum(total_shipping_actual)', ); } diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Report/Shipping/Collection/Shipment.php b/app/code/core/Mage/Sales/Model/Mysql4/Report/Shipping/Collection/Shipment.php index a629d698a7..23f3a99028 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Report/Shipping/Collection/Shipment.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Report/Shipping/Collection/Shipment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Sale/Collection.php b/app/code/core/Mage/Sales/Model/Mysql4/Sale/Collection.php index 34f97547c1..b6e67dd106 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Sale/Collection.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Sale/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -52,9 +52,9 @@ class Mage_Sales_Model_Mysql4_Sale_Collection extends Varien_Object implements I /** * Entity attribute * - * @var Mage_Eav_Model_Entity_Abstract + * @var Mage_Sales_Model_Mysql4_Order */ - protected $_entity; + protected $_resource; /** * Collection's Zend_Db_Select object @@ -90,8 +90,8 @@ class Mage_Sales_Model_Mysql4_Sale_Collection extends Varien_Object implements I */ public function __construct() { - $this->_entity = Mage::getModel('sales_entity/order'); - $this->_read = $this->_entity->getReadConnection(); + $this->_resource = Mage::getResourceSingleton('sales/order'); + $this->_read = $this->_resource->getReadConnection(); } /** @@ -140,12 +140,9 @@ public function setOrderStateFilter($state, $exclude = false) */ public function load($printQuery = false, $logQuery = false) { - $this->_select = $this->_read->select(); - $entityTable = $this->getEntity()->getEntityTable(); - $paidTable = $this->getAttribute('grand_total')->getBackend()->getTable(); - $idField = $this->getEntity()->getIdFieldName(); + $this->_select = $this->_read->select(); $this->getSelect() - ->from(array('sales' => $entityTable), + ->from(array('sales' => $this->_resource->getMainTable()), array( 'store_id', 'lifetime' => 'sum(sales.base_grand_total)', @@ -155,7 +152,6 @@ public function load($printQuery = false, $logQuery = false) 'num_orders' => 'count(sales.base_grand_total)' ) ) - ->where('sales.entity_type_id=?', $this->getEntity()->getTypeId()) ->group('sales.store_id') ; if ($this->_customer instanceof Mage_Customer_Model_Customer) { diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Setup.php b/app/code/core/Mage/Sales/Model/Mysql4/Setup.php index 00784c5cf5..c7fa987753 100644 --- a/app/code/core/Mage/Sales/Model/Mysql4/Setup.php +++ b/app/code/core/Mage/Sales/Model/Mysql4/Setup.php @@ -20,13 +20,17 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Sales_Model_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup { + /** + * List of entities converted from EAV to flat data structure + * @var $_flatEntityTables array + */ protected $_flatEntityTables = array( 'quote' => 'sales_flat_quote', 'quote_item' => 'sales_flat_quote_item', @@ -34,18 +38,57 @@ class Mage_Sales_Model_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup 'quote_address_item'=> 'sales_flat_quote_address_item', 'quote_address_rate'=> 'sales_flat_quote_shipping_rate', 'quote_payment' => 'sales_flat_quote_payment', + 'order' => 'sales_flat_order', + 'order_payment' => 'sales_flat_order_payment', 'order_item' => 'sales_flat_order_item', + 'order_address' => 'sales_flat_order_address', + 'order_status_history' => 'sales_flat_order_status_history', + 'invoice' => 'sales_flat_invoice', + 'invoice_item' => 'sales_flat_invoice_item', + 'invoice_comment' => 'sales_flat_invoice_comment', + 'creditmemo' => 'sales_flat_creditmemo', + 'creditmemo_item' => 'sales_flat_creditmemo_item', + 'creditmemo_comment'=> 'sales_flat_creditmemo_comment', + 'shipment' => 'sales_flat_shipment', + 'shipment_item' => 'sales_flat_shipment_item', + 'shipment_track' => 'sales_flat_shipment_track', + 'shipment_comment' => 'sales_flat_shipment_comment', ); + /** + * List of entities used with separate grid table + * @var $_flatEntitiesGrid array + */ + protected $_flatEntitiesGrid = array( + 'order', + 'invoice', + 'shipment', + 'creditmemo' + ); + + /** + * Check if table exist for flat entity + * + * @param string $table + * @return bool + */ protected function _flatTableExist($table) { return $this->getConnection()->fetchOne("show tables like '{$this->getTable($table)}'"); } + /** + * Add entity attribute. Overwrited for flat entities support + * + * @param int|string $entityTypeId + * @param string $code + * @param array $attr + */ public function addAttribute($entityTypeId, $code, array $attr) { if (isset($this->_flatEntityTables[$entityTypeId]) && $this->_flatTableExist($this->_flatEntityTables[$entityTypeId])) { $this->_addFlatAttribute($this->_flatEntityTables[$entityTypeId], $code, $attr); + $this->_addGridAttribute($this->_flatEntityTables[$entityTypeId], $code, $attr, $entityTypeId); } else { parent::addAttribute($entityTypeId, $code, $attr); @@ -53,15 +96,45 @@ public function addAttribute($entityTypeId, $code, array $attr) return $this; } + /** + * Add attribute as separate column in the table + * + * @param string $table + * @param string $attribute + * @param array $attr + */ protected function _addFlatAttribute($table, $attribute, $attr) { $tableInfo = $this->getConnection()->describeTable($this->getTable($table)); if (isset($tableInfo[$attribute])) { return $this; } + $columnDefinition = $this->_getAttributeColumnDefinition($attribute, $attr); + $this->getConnection()->addColumn($this->getTable($table), $attribute, $columnDefinition); + return $this; + } + + /** + * Add attribute to grid table if necessary + * @param string $table + * @param string $attribute + * @param array $attr + * @param string $entityTypeId + */ + protected function _addGridAttribute($table, $attribute, $attr, $entityTypeId) + { + if (in_array($entityTypeId, $this->_flatEntitiesGrid) && !empty($attr['grid'])) { + $columnDefinition = $this->_getAttributeColumnDefinition($attribute, $attr); + $this->getConnection()->addColumn($this->getTable($table . '_grid'), $attribute, $columnDefinition); + } + return $this; + } + + protected function _getAttributeColumnDefinition($code, $data) + { $columnDefinition = ''; - $type = isset($attr['type']) ? $attr['type'] : 'varchar'; - $req = isset($attr['required']) ? $attr['required'] : false; + $type = isset($data['type']) ? $data['type'] : 'varchar'; + $req = isset($data['required']) ? $data['required'] : false; switch ($type) { case 'int': @@ -84,13 +157,10 @@ protected function _addFlatAttribute($table, $attribute, $attr) if ($req) { $columnDefinition.= ' NOT NULL'; } - - $this->getConnection()->addColumn($this->getTable($table), $attribute, $columnDefinition); - return $this; + return $columnDefinition; } - public function getDefaultEntities() { return array( diff --git a/app/code/core/Mage/Sales/Model/Observer.php b/app/code/core/Mage/Sales/Model/Observer.php index 535c37803d..2cafb22a4c 100644 --- a/app/code/core/Mage/Sales/Model/Observer.php +++ b/app/code/core/Mage/Sales/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -130,7 +130,7 @@ public function aggregateSalesReportOrderData($schedule) Mage::app()->getLocale()->emulate(0); $currentDate = Mage::app()->getLocale()->date(); $date = $currentDate->subHour(25); - Mage::getResourceModel('sales/order')->aggregate($date); + Mage::getResourceModel('sales/report_order')->aggregate($date); Mage::app()->getLocale()->revert(); return $this; } @@ -182,5 +182,61 @@ public function aggregateSalesReportRefundedData($schedule) Mage::app()->getLocale()->revert(); return $this; } + + /** + * Refresh bestsellers report statistics for last day + * + * @param Mage_Cron_Model_Schedule $schedule + * @return Mage_Sales_Model_Observer + */ + public function aggregateSalesReportBestsellersData($schedule) + { + Mage::app()->getLocale()->emulate(0); + $currentDate = Mage::app()->getLocale()->date(); + $date = $currentDate->subHour(25); + Mage::getResourceModel('sales/report_bestsellers')->aggregate($date); + Mage::app()->getLocale()->revert(); + return $this; + } + + /** + * Add the recurring profile form when editing a product + * + * @param Varien_Event_Observer $observer + */ + public function prepareProductEditFormRecurringProfile($observer) + { + // replace the element of recurring payment profile field with a form + $profileElement = $observer->getEvent()->getProductElement(); + $block = Mage::app()->getLayout()->createBlock('sales/adminhtml_recurring_profile_edit_form') + ->setParentElement($profileElement) + ->setProductEntity($observer->getEvent()->getProduct()) + ; + $observer->getEvent()->getResult()->output = $block->toHtml(); + + // make the profile element dependent on is_recurring + $dependencies = Mage::app()->getLayout()->createBlock('adminhtml/widget_form_element_dependence') + ->addFieldMap('is_recurring', 'product[is_recurring]') + ->addFieldMap($profileElement->getHtmlId(), $profileElement->getName()) + ->addFieldDependence($profileElement->getName(), 'product[is_recurring]', '1') + ->addConfigOptions(array('levels_up' => 2)); + $observer->getEvent()->getResult()->output .= $dependencies->toHtml(); + } + + /** + * Block admin ability to use customer billing agreements + * + * @param Varien_Event_Observer $observer + */ + public function restrictAdminBillingAgreementUsage($observer) + { + $methodInstance = $observer->getEvent()->getMethodInstance(); + if (!($methodInstance instanceof Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract)) { + return; + } + if (!Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/use')) { + $observer->getEvent()->getResult()->isAvailable = false; + } + } } diff --git a/app/code/core/Mage/Sales/Model/Order.php b/app/code/core/Mage/Sales/Model/Order.php index 3c1a6cc816..9ad6778b78 100644 --- a/app/code/core/Mage/Sales/Model/Order.php +++ b/app/code/core/Mage/Sales/Model/Order.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -65,19 +65,20 @@ class Mage_Sales_Model_Order extends Mage_Sales_Model_Abstract const STATE_CLOSED = 'closed'; const STATE_CANCELED = 'canceled'; const STATE_HOLDED = 'holded'; + const STATE_PAYMENT_REVIEW = 'payment_review'; /** * Order flags */ - const ACTION_FLAG_CANCEL = 'cancel'; - const ACTION_FLAG_HOLD = 'hold'; - const ACTION_FLAG_UNHOLD = 'unhold'; - const ACTION_FLAG_EDIT = 'edit'; - const ACTION_FLAG_CREDITMEMO = 'creditmemo'; - const ACTION_FLAG_INVOICE = 'invoice'; - const ACTION_FLAG_REORDER = 'reorder'; - const ACTION_FLAG_SHIP = 'ship'; - const ACTION_FLAG_COMMENT = 'comment'; + const ACTION_FLAG_CANCEL = 'cancel'; + const ACTION_FLAG_HOLD = 'hold'; + const ACTION_FLAG_UNHOLD = 'unhold'; + const ACTION_FLAG_EDIT = 'edit'; + const ACTION_FLAG_CREDITMEMO= 'creditmemo'; + const ACTION_FLAG_INVOICE = 'invoice'; + const ACTION_FLAG_REORDER = 'reorder'; + const ACTION_FLAG_SHIP = 'ship'; + const ACTION_FLAG_COMMENT = 'comment'; /** * Report date types @@ -88,17 +89,18 @@ class Mage_Sales_Model_Order extends Mage_Sales_Model_Abstract protected $_eventPrefix = 'sales_order'; protected $_eventObject = 'order'; - protected $_addresses; - protected $_items; - protected $_payments; - protected $_statusHistory; + protected $_addresses = null; + protected $_items = null; + protected $_payments = null; + protected $_statusHistory = null; protected $_invoices; protected $_tracks; protected $_shipments; protected $_creditmemos; - protected $_relatedObjects = array(); - protected $_orderCurrency = null; - protected $_baseCurrency = null; + + protected $_relatedObjects = array(); + protected $_orderCurrency = null; + protected $_baseCurrency = null; /** * Array of action flags for canUnhold, canEdit, etc. @@ -115,6 +117,12 @@ protected function _construct() $this->_init('sales/order'); } + /** + * Clear order object data + * + * @param string $key data key + * @return Mage_Sales_Model_Order + */ public function unsetData($key=null) { parent::unsetData($key); @@ -135,7 +143,6 @@ public function getActionFlag($action) if (isset($this->_actionFlag[$action])) { return $this->_actionFlag[$action]; } - return null; } @@ -152,23 +159,27 @@ public function setActionFlag($action, $flag) return $this; } + /** + * Load order by system increment identifier + * + * @param string $incrementId + * @return Mage_Sales_Model_Order + */ public function loadByIncrementId($incrementId) { return $this->loadByAttribute('increment_id', $incrementId); } + /** + * Load order by custom attribute value. Attribute value should be unique + * + * @param string $attribute + * @param string $value + * @return Mage_Sales_Model_Order + */ public function loadByAttribute($attribute, $value) { - $collection = $this->getCollection() - ->addAttributeToSelect('*') - ->addAttributeToFilter($attribute, $value) - ->load() - ->getItems(); - if (sizeof($collection)) { - reset($collection); - $order = current($collection); - $this->setData($order->getData()); - } + $this->load($value, $attribute); return $this; } @@ -179,7 +190,8 @@ public function loadByAttribute($attribute, $value) */ public function getStore() { - if ($storeId = $this->getStoreId()) { + $storeId = $this->getStoreId(); + if ($storeId) { return Mage::app()->getStore($storeId); } return Mage::app()->getStore(); @@ -192,13 +204,23 @@ public function getStore() */ public function canCancel() { - if ($this->canUnhold()) { + if ($this->canUnhold()) { // $this->isPaymentReview() + return false; + } + + $allInvoiced = true; + foreach ($this->getAllItems() as $item) { + if ($item->getQtyToInvoice()) { + $allInvoiced = false; + break; + } + } + if ($allInvoiced) { return false; } - if ($this->isCanceled() || - $this->getState() === self::STATE_COMPLETE || - $this->getState() === self::STATE_CLOSED) { + $state = $this->getState(); + if ($this->isCanceled() || $state === self::STATE_COMPLETE || $state === self::STATE_CLOSED) { return false; } @@ -224,12 +246,11 @@ public function canCancel() */ public function canVoidPayment() { - if ($this->canUnhold()) { + if ($this->canUnhold() || $this->isPaymentReview()) { return false; } - if ($this->isCanceled() || - $this->getState() === self::STATE_COMPLETE || - $this->getState() === self::STATE_CLOSED ) { + $state = $this->getState(); + if ($this->isCanceled() || $state === self::STATE_COMPLETE || $state === self::STATE_CLOSED) { return false; } return $this->getPayment()->canVoid(new Varien_Object); @@ -242,12 +263,11 @@ public function canVoidPayment() */ public function canInvoice() { - if ($this->canUnhold()) { + if ($this->canUnhold() || $this->isPaymentReview()) { return false; } - if ($this->isCanceled() || - $this->getState() === self::STATE_COMPLETE || - $this->getState() === self::STATE_CLOSED ) { + $state = $this->getState(); + if ($this->isCanceled() || $state === self::STATE_COMPLETE || $state === self::STATE_CLOSED) { return false; } @@ -274,12 +294,11 @@ public function canCreditmemo() return $this->getForcedCanCreditmemo(); } - if ($this->canUnhold()) { + if ($this->canUnhold() || $this->isPaymentReview()) { return false; } - if ($this->isCanceled() || - $this->getState() === self::STATE_CLOSED ) { + if ($this->isCanceled() || $this->getState() === self::STATE_CLOSED) { return false; } @@ -294,8 +313,6 @@ public function canCreditmemo() if ($this->getActionFlag(self::ACTION_FLAG_EDIT) === false) { return false; } - - return true; } @@ -306,17 +323,15 @@ public function canCreditmemo() */ public function canHold() { - if ($this->isCanceled() || - $this->getState() === self::STATE_COMPLETE || - $this->getState() === self::STATE_CLOSED || - $this->getState() === self::STATE_HOLDED) { + $state = $this->getState(); + if ($this->isCanceled() || $this->isPaymentReview() + || $state === self::STATE_COMPLETE || $state === self::STATE_CLOSED || $state === self::STATE_HOLDED) { return false; } if ($this->getActionFlag(self::ACTION_FLAG_HOLD) === false) { return false; } - return true; } @@ -327,19 +342,22 @@ public function canHold() */ public function canUnhold() { - if ($this->getActionFlag(self::ACTION_FLAG_UNHOLD) === false) { + if ($this->getActionFlag(self::ACTION_FLAG_UNHOLD) === false || $this->isPaymentReview()) { return false; } - return $this->getState() === self::STATE_HOLDED; } + /** + * Check if comment can be added to order history + * + * @return bool + */ public function canComment() { if ($this->getActionFlag(self::ACTION_FLAG_COMMENT) === false) { return false; } - return true; } @@ -350,7 +368,7 @@ public function canComment() */ public function canShip() { - if ($this->canUnhold()) { + if ($this->canUnhold() || $this->isPaymentReview()) { return false; } @@ -383,9 +401,9 @@ public function canEdit() return false; } - if ($this->isCanceled() || - $this->getState() === self::STATE_COMPLETE || - $this->getState() === self::STATE_CLOSED) { + $state = $this->getState(); + if ($this->isCanceled() || $this->isPaymentReview() + || $state === self::STATE_COMPLETE || $state === self::STATE_CLOSED) { return false; } @@ -407,7 +425,7 @@ public function canEdit() */ public function canReorder() { - if ($this->canUnhold() || !$this->getCustomerId()) { + if ($this->canUnhold() || $this->isPaymentReview() || !$this->getCustomerId()) { return false; } @@ -436,6 +454,39 @@ public function canReorder() return true; } + /** + * Check whether the payment is in payment review state + * In this state order cannot be normally processed. Possible actions can be: + * - accept or deny payment + * - fetch transaction information + * + * @return bool + */ + public function isPaymentReview() + { + return $this->getState() === self::STATE_PAYMENT_REVIEW; + } + + /** + * Check whether payment can be accepted or denied + * + * @return bool + */ + public function canReviewPayment() + { + return $this->isPaymentReview() && $this->getPayment()->canReviewPayment(); + } + + /** + * Check whether there can be a transaction update fetched for payment in review state + * + * @return bool + */ + public function canFetchPaymentReviewUpdate() + { + return $this->isPaymentReview() && $this->getPayment()->canFetchTransactionInfo(); + } + /** * Retrieve order configuration model * @@ -663,7 +714,7 @@ public function place() public function hold() { if (!$this->canHold()) { - Mage::throwException(Mage::helper('sales')->__('Hold action is not available')); + Mage::throwException(Mage::helper('sales')->__('Hold action is not available.')); } $this->setHoldBeforeState($this->getState()); $this->setHoldBeforeStatus($this->getStatus()); @@ -671,8 +722,17 @@ public function hold() return $this; } + /** + * Attempt to unhold the order + * + * @return Mage_Sales_Model_Order + * @throws Mage_Core_Exception + */ public function unhold() { + if (!$this->canUnhold()) { + Mage::throwException(Mage::helper('sales')->__('Unhold action is not available.')); + } $this->setState($this->getHoldBeforeState(), $this->getHoldBeforeStatus()); $this->setHoldBeforeState(null); $this->setHoldBeforeStatus(null); @@ -705,8 +765,12 @@ public function registerCancellation($comment = '', $graceful = true) if ($this->canCancel()) { $cancelState = self::STATE_CANCELED; foreach ($this->getAllItems() as $item) { - if ($item->getQtyInvoiced()>$item->getQtyRefunded()) { - $cancelState = self::STATE_COMPLETE; + if ($cancelState != self::STATE_PROCESSING && $item->getQtyToRefund()) { + if ($item->getQtyToShip() > $item->getQtyToCancel()) { + $cancelState = self::STATE_PROCESSING; + } else { + $cancelState = self::STATE_COMPLETE; + } } $item->cancel(); } @@ -720,8 +784,11 @@ public function registerCancellation($comment = '', $graceful = true) $this->setShippingCanceled($this->getShippingAmount() - $this->getShippingInvoiced()); $this->setBaseShippingCanceled($this->getBaseShippingAmount() - $this->getBaseShippingInvoiced()); - $this->setDiscountCanceled($this->getDiscountAmount() - $this->getDiscountInvoiced()); - $this->setBaseDiscountCanceled($this->getBaseDiscountAmount() - $this->getBaseDiscountInvoiced()); + $this->setDiscountCanceled(abs($this->getDiscountAmount()) - $this->getDiscountInvoiced()); + $this->setBaseDiscountCanceled(abs($this->getBaseDiscountAmount()) - $this->getBaseDiscountInvoiced()); + + $this->setTotalCanceled($this->getSubtotalCanceled() + $this->getTaxCanceled() + $this->getShippingCanceled() - $this->getDiscountCanceled()); + $this->setBaseTotalCanceled($this->getBaseSubtotalCanceled() + $this->getBaseTaxCanceled() + $this->getBaseShippingCanceled() - $this->getBaseDiscountCanceled()); $this->_setState($cancelState, true, $comment); } elseif (!$graceful) { @@ -938,8 +1005,7 @@ public function getAddressesCollection() { if (is_null($this->_addresses)) { $this->_addresses = Mage::getResourceModel('sales/order_address_collection') - ->addAttributeToSelect('*') - ->setOrderFilter($this->getId()); + ->setOrderFilter($this); if ($this->getId()) { foreach ($this->_addresses as $address) { @@ -974,7 +1040,8 @@ public function getItemsCollection($filterByTypes = array(), $nonChildrenOnly = { if (is_null($this->_items)) { $this->_items = Mage::getResourceModel('sales/order_item_collection') - ->setOrderFilter($this->getId()); + ->setOrderFilter($this); + if ($filterByTypes) { $this->_items->filterByTypes($filterByTypes); } @@ -1023,7 +1090,7 @@ public function getParentItemsRandomCollection($limit = 1) protected function _getItemsRandomCollection($limit, $nonChildrenOnly = false) { $collection = Mage::getModel('sales/order_item')->getCollection() - ->setOrderFilter($this->getId()) + ->setOrderFilter($this) ->setRandomOrder() ->setPageSize($limit); @@ -1095,14 +1162,28 @@ public function addItem(Mage_Sales_Model_Order_Item $item) return $this; } + /** + * Whether the order has nominal items only + * + * @return bool + */ + public function isNominal() + { + foreach ($this->getAllVisibleItems() as $item) { + if ('0' == $item->getIsNominal()) { + return false; + } + } + return true; + } + /*********************** PAYMENTS ***************************/ public function getPaymentsCollection() { if (is_null($this->_payments)) { $this->_payments = Mage::getResourceModel('sales/order_payment_collection') - ->addAttributeToSelect('*') - ->setOrderFilter($this->getId()); + ->setOrderFilter($this); if ($this->getId()) { foreach ($this->_payments as $payment) { @@ -1165,8 +1246,7 @@ public function getStatusHistoryCollection($reload=false) { if (is_null($this->_statusHistory) || $reload) { $this->_statusHistory = Mage::getResourceModel('sales/order_status_history_collection') - ->addAttributeToSelect('*') - ->setOrderFilter($this->getId()) + ->setOrderFilter($this) ->setOrder('created_at', 'desc') ->setOrder('entity_id', 'desc'); @@ -1180,7 +1260,7 @@ public function getStatusHistoryCollection($reload=false) } /** - * Enter description here... + * Return collection of order status history items. * * @return array */ @@ -1196,7 +1276,7 @@ public function getAllStatusHistory() } /** - * Enter description here... + * Return collection of visible on frontend order status history items. * * @return array */ @@ -1204,7 +1284,7 @@ public function getVisibleStatusHistory() { $history = array(); foreach ($this->getStatusHistoryCollection() as $status) { - if (!$status->isDeleted() && $status->getComment() && $status->getIsCustomerNotified()) { + if (!$status->isDeleted() && $status->getComment() && $status->getIsVisibleOnFront()) { $history[] = $status; } } @@ -1379,8 +1459,7 @@ public function getInvoiceCollection() { if (is_null($this->_invoices)) { $this->_invoices = Mage::getResourceModel('sales/order_invoice_collection') - ->addAttributeToSelect('*') - ->setOrderFilter($this->getId()); + ->setOrderFilter($this); if ($this->getId()) { foreach ($this->_invoices as $invoice) { @@ -1400,17 +1479,9 @@ public function getShipmentsCollection() { if (empty($this->_shipments)) { if ($this->getId()) { - //TODO: add full name logic $this->_shipments = Mage::getResourceModel('sales/order_shipment_collection') - ->addAttributeToSelect('increment_id') - ->addAttributeToSelect('created_at') - ->addAttributeToSelect('total_qty') - ->addAttributeToSelect('email_sent') - ->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left') - ->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left') - ->setOrderFilter($this->getId()) - ->load() - ; + ->setOrderFilter($this) + ->load(); } else { return false; } @@ -1428,8 +1499,7 @@ public function getCreditmemosCollection() if (empty($this->_creditmemos)) { if ($this->getId()) { $this->_creditmemos = Mage::getResourceModel('sales/order_creditmemo_collection') - ->addAttributeToSelect('*') - ->setOrderFilter($this->getId()) + ->setOrderFilter($this) ->load(); } else { return false; @@ -1447,8 +1517,7 @@ public function getTracksCollection() { if (empty($this->_tracks)) { $this->_tracks = Mage::getResourceModel('sales/order_shipment_track_collection') - ->addAttributeToSelect('*') - ->setOrderFilter($this->getId()); + ->setOrderFilter($this); if ($this->getId()) { $this->_tracks->load(); @@ -1557,23 +1626,48 @@ protected function _beforeSave() $this->setStoreName(implode("\n", $name)); } + if (!$this->getIncrementId()) { + $incrementId = Mage::getSingleton('eav/config') + ->getEntityType('order') + ->fetchNewIncrementId($this->getStoreId()); + $this->setIncrementId($incrementId); + } + /** * Process items dependency for new order */ if (!$this->getId()) { + $itemsCount = 0; foreach ($this->getAllItems() as $item) { - if ($parent = $item->getQuoteParentItemId() && !$item->getParentItem()) { + $parent = $item->getQuoteParentItemId(); + if ($parent && !$item->getParentItem()) { $item->setParentItem($this->getItemByQuoteItemId($parent)); + } elseif (!$parent) { + $itemsCount++; } } + // Set items count + $this->setTotalItemCount($itemsCount); } if ($this->getCustomer()) { $this->setCustomerId($this->getCustomer()->getId()); } + + if ($this->hasBillingAddressId() && $this->getBillingAddressId() === null) { + $this->unsBillingAddressId(); + } + + if ($this->hasShippingAddressId() && $this->getShippingAddressId() === null) { + $this->unsShippingAddressId(); + } + $this->setData('protect_code', substr(md5(uniqid(mt_rand(), true) . ':' . microtime(true)), 5, 6)); return $this; } + /** + * Check order state before saving + */ protected function _checkState() { if (!$this->getId()) { @@ -1608,6 +1702,48 @@ protected function _checkState() return $this; } + /** + * Save order related objects + * + * @return Mage_Sales_Model_Order + */ + protected function _afterSave() + { + if (null !== $this->_addresses) { + $this->_addresses->save(); + $billingAddress = $this->getBillingAddress(); + $attributesForSave = array(); + if ($billingAddress && $this->getBillingAddressId() != $billingAddress->getId()) { + $this->setBillingAddressId($billingAddress->getId()); + $attributesForSave[] = 'billing_address_id'; + } + + $shippingAddress = $this->getShippingAddress(); + if ($shippingAddress && $this->getShippigAddressId() != $shippingAddress->getId()) { + $this->setShippingAddressId($shippingAddress->getId()); + $attributesForSave[] = 'shipping_address_id'; + } + + if (!empty($attributesForSave)) { + $this->_getResource()->saveAttribute($this, $attributesForSave); + } + + } + if (null !== $this->_items) { + $this->_items->save(); + } + if (null !== $this->_payments) { + $this->_payments->save(); + } + if (null !== $this->_statusHistory) { + $this->_statusHistory->save(); + } + foreach ($this->getRelatedObjects() as $object) { + $object->save(); + } + return parent::_afterSave(); + } + public function getStoreGroupName() { $storeId = $this->getStoreId(); @@ -1626,6 +1762,7 @@ public function getStoreGroupName() public function reset() { $this->unsetData(); + $this->_actionFlag = array(); $this->_addresses = null; $this->_items = null; $this->_payments = null; @@ -1648,7 +1785,7 @@ public function getIsNotVirtual() public function getFullTaxInfo() { - $rates = Mage::getModel('sales/order_tax')->getCollection()->loadByOrder($this)->toArray(); + $rates = Mage::getModel('tax/sales_order_tax')->getCollection()->loadByOrder($this)->toArray(); return Mage::getSingleton('tax/calculation')->reproduceProcess($rates['items']); } @@ -1659,33 +1796,7 @@ public function getFullTaxInfo() */ public function prepareInvoice($qtys = array()) { - $convertor = Mage::getModel('sales/convert_order'); - $invoice = $convertor->toInvoice($this); - foreach ($this->getAllItems() as $orderItem) { - if (!$orderItem->isDummy() && !$orderItem->getQtyToInvoice()) { - continue; - } - if ($orderItem->isDummy() && !$this->_needToAddDummy($orderItem, $qtys)) { - continue; - } - $item = $convertor->itemToInvoiceItem($orderItem); - if ($orderItem->isDummy()) { - $qty = 1; - } else { - if (isset($qtys[$orderItem->getId()])) { - $qty = $qtys[$orderItem->getId()]; - } elseif (!count($qtys)) { - $qty = $orderItem->getQtyToInvoice(); - } else { - continue; - } - } - - $item->setQty($qty); - $invoice->addItem($item); - } - $invoice->collectTotals(); - $this->getInvoiceCollection()->addItem($invoice); + $invoice = Mage::getModel('sales/service_order', $this)->prepareInvoice($qtys); return $invoice; } @@ -1696,122 +1807,8 @@ public function prepareInvoice($qtys = array()) */ public function prepareShipment($qtys = array()) { - $totalToShip = 0; - $convertor = Mage::getModel('sales/convert_order'); - $shipment = $convertor->toShipment($this); - foreach ($this->getAllItems() as $orderItem) { - if (!$orderItem->isDummy() && !$orderItem->getQtyToShip()) { - continue; - } - if ($orderItem->isDummy() && !$this->_needToAddDummyForShipment($orderItem, $qtys)) { - continue; - } - $item = $convertor->itemToShipmentItem($orderItem); - if ($orderItem->isDummy()) { - $qty = 1; - } else { - if (isset($qtys[$orderItem->getId()])) { - $qty = $qtys[$orderItem->getId()]; - } elseif (!count($qtys)) { - $qty = $orderItem->getQtyToShip(); - } else { - continue; - } - } - - $totalToShip += $qty; - $item->setQty($qty); - $shipment->addItem($item); - } - - if ($totalToShip) { - return $shipment; - } else { - return null; - } - } - - /** - * Decides if we need to create dummy invoice item or not - * for eaxample we don't need create dummy parent if all - * children are not in process - * - * @param Mage_Sales_Model_Order_Item $item - * @param array $qtys - * @return bool - */ - protected function _needToAddDummy($item, $qtys = array()) { - if ($item->getHasChildren()) { - foreach ($item->getChildrenItems() as $child) { - if (empty($qtys)) { - if ($child->getQtyToInvoice() > 0) { - return true; - } - } else { - if (isset($qtys[$child->getId()]) && $qtys[$child->getId()] > 0) { - return true; - } - } - } - return false; - } else if($item->getParentItem()) { - if (empty($qtys)) { - if ($item->getParentItem()->getQtyToInvoice() > 0) { - return true; - } - } else { - if (isset($qtys[$item->getParentItem()->getId()]) && $qtys[$item->getParentItem()->getId()] > 0) { - return true; - } - } - return false; - } - } - - /** - * Decides if we need to create dummy shipment item or not - * for eaxample we don't need create dummy parent if all - * children are not in process - * - * @param Mage_Sales_Model_Order_Item $item - * @param array $qtys - * @return bool - */ - protected function _needToAddDummyForShipment($item, $qtys = array()) { - if ($item->getHasChildren()) { - foreach ($item->getChildrenItems() as $child) { - if ($child->getIsVirtual()) { - continue; - } - if (empty($qtys)) { - if ($child->getQtyToShip() > 0) { - return true; - } - } else { - if (isset($qtys[$child->getId()]) && $qtys[$child->getId()] > 0) { - return true; - } - } - } - if ($item->isShipSeparately()) { - return true; - } - return false; - } else if($item->getParentItem()) { - if ($item->getIsVirtual()) { - return false; - } - if (empty($qtys)) { - if ($item->getParentItem()->getQtyToShip() > 0) { - return true; - } - } else { - if (isset($qtys[$item->getParentItem()->getId()]) && $qtys[$item->getParentItem()->getId()] > 0) { - return true; - } - } - return false; - } + $shipment = Mage::getModel('sales/service_order', $this)->prepareInvoice($qtys); + return $shipment; } /** @@ -1824,6 +1821,10 @@ public function isCanceled() return ($this->getState() === self::STATE_CANCELED); } + /** + * Protect order delete from not admin scope + * @return Mage_Sales_Model_Order + */ protected function _beforeDelete() { $this->_protectFromNonAdmin(); diff --git a/app/code/core/Mage/Sales/Model/Order/Address.php b/app/code/core/Mage/Sales/Model/Order/Address.php index 84b5861ee2..29744ed061 100644 --- a/app/code/core/Mage/Sales/Model/Order/Address.php +++ b/app/code/core/Mage/Sales/Model/Order/Address.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,6 +29,9 @@ class Mage_Sales_Model_Order_Address extends Mage_Customer_Model_Address_Abstrac { protected $_order; + protected $_eventPrefix = 'sales_order_address'; + protected $_eventObject = 'address'; + protected function _construct() { $this->_init('sales/order_address'); @@ -44,4 +47,20 @@ public function getOrder() { return $this->_order; } + + /** + * Before object save manipulations + * + * @return Mage_Sales_Model_Order_Address + */ + protected function _beforeSave() + { + parent::_beforeSave(); + + if (!$this->getParentId() && $this->getOrder()) { + $this->setParentId($this->getOrder()->getId()); + } + + return $this; + } } diff --git a/app/code/core/Mage/Sales/Model/Order/Api.php b/app/code/core/Mage/Sales/Model/Order/Api.php index 9b6bebb56a..0bcc36f58a 100644 --- a/app/code/core/Mage/Sales/Model/Order/Api.php +++ b/app/code/core/Mage/Sales/Model/Order/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Api/V2.php b/app/code/core/Mage/Sales/Model/Order/Api/V2.php index 5383a4acd8..e794d65dc4 100644 --- a/app/code/core/Mage/Sales/Model/Order/Api/V2.php +++ b/app/code/core/Mage/Sales/Model/Order/Api/V2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Config.php b/app/code/core/Mage/Sales/Model/Order/Config.php index 920e0bad3a..b4a7f8925e 100644 --- a/app/code/core/Mage/Sales/Model/Order/Config.php +++ b/app/code/core/Mage/Sales/Model/Order/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Creditmemo.php b/app/code/core/Mage/Sales/Model/Order/Creditmemo.php index c977dcbf23..2d670f02fa 100644 --- a/app/code/core/Mage/Sales/Model/Order/Creditmemo.php +++ b/app/code/core/Mage/Sales/Model/Order/Creditmemo.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -52,6 +52,7 @@ class Mage_Sales_Model_Order_Creditmemo extends Mage_Sales_Model_Abstract protected $_items; protected $_order; + protected $_comments; protected $_eventPrefix = 'sales_order_creditmemo'; protected $_eventObject = 'creditmemo'; @@ -135,7 +136,6 @@ public function getItemsCollection() { if (empty($this->_items)) { $this->_items = Mage::getResourceModel('sales/order_creditmemo_item_collection') - ->addAttributeToSelect('*') ->setCreditmemoFilter($this->getId()); if ($this->getId()) { @@ -250,8 +250,7 @@ public function refund() if ($baseOrderRefund > Mage::app()->getStore()->roundPrice($this->getOrder()->getBaseTotalPaid())) { - $baseAvailableRefund = $this->getOrder()->getBaseTotalPaid() - - $this->getOrder()->getBaseTotalRefunded(); + $baseAvailableRefund = $this->getOrder()->getBaseTotalPaid()- $this->getOrder()->getBaseTotalRefunded(); Mage::throwException( Mage::helper('sales')->__('Maximum amount available to refund is %s', @@ -259,58 +258,32 @@ public function refund() ) ); } + $order = $this->getOrder(); + $order->setBaseTotalRefunded($baseOrderRefund); + $order->setTotalRefunded($orderRefund); - $this->getOrder()->setBaseTotalRefunded($baseOrderRefund); - $this->getOrder()->setTotalRefunded($orderRefund); + $order->setBaseSubtotalRefunded($order->getBaseSubtotalRefunded()+$this->getBaseSubtotal()); + $order->setSubtotalRefunded($order->getSubtotalRefunded()+$this->getSubtotal()); - $this->getOrder()->setBaseSubtotalRefunded( - $this->getOrder()->getBaseSubtotalRefunded()+$this->getBaseSubtotal() - ); - $this->getOrder()->setSubtotalRefunded( - $this->getOrder()->getSubtotalRefunded()+$this->getSubtotal() - ); + $order->setBaseTaxRefunded($order->getBaseTaxRefunded()+$this->getBaseTaxAmount()); + $order->setTaxRefunded($order->getTaxRefunded()+$this->getTaxAmount()); + $order->setBaseHiddenTaxRefunded($order->getBaseHiddenTaxRefunded()+$this->getBaseHiddenTaxAmount()); + $order->setHiddenTaxRefunded($order->getHiddenTaxRefunded()+$this->getHiddenTaxAmount()); - $this->getOrder()->setBaseTaxRefunded( - $this->getOrder()->getBaseTaxRefunded()+$this->getBaseTaxAmount() - ); - $this->getOrder()->setTaxRefunded( - $this->getOrder()->getTaxRefunded()+$this->getTaxAmount() - ); + $order->setBaseShippingRefunded($order->getBaseShippingRefunded()+$this->getBaseShippingAmount()); + $order->setShippingRefunded($order->getShippingRefunded()+$this->getShippingAmount()); - $this->getOrder()->setBaseShippingRefunded( - $this->getOrder()->getBaseShippingRefunded()+$this->getBaseShippingAmount() - ); - $this->getOrder()->setShippingRefunded( - $this->getOrder()->getShippingRefunded()+$this->getShippingAmount() - ); + $order->setBaseShippingTaxRefunded($order->getBaseShippingTaxRefunded()+$this->getBaseShippingTaxAmount()); + $order->setShippingTaxRefunded($order->getShippingTaxRefunded()+$this->getShippingTaxAmount()); - $this->getOrder()->setBaseShippingTaxRefunded( - $this->getOrder()->getBaseShippingTaxRefunded()+$this->getBaseShippingTaxAmount() - ); - $this->getOrder()->setShippingTaxRefunded( - $this->getOrder()->getShippingTaxRefunded()+$this->getShippingTaxAmount() - ); - - $this->getOrder()->setAdjustmentPositive( - $this->getOrder()->getAdjustmentPositive()+$this->getAdjustmentPositive() - ); - $this->getOrder()->setBaseAdjustmentPositive( - $this->getOrder()->getBaseAdjustmentPositive()+$this->getBaseAdjustmentPositive() - ); + $order->setAdjustmentPositive($order->getAdjustmentPositive()+$this->getAdjustmentPositive()); + $order->setBaseAdjustmentPositive($order->getBaseAdjustmentPositive()+$this->getBaseAdjustmentPositive()); - $this->getOrder()->setAdjustmentNegative( - $this->getOrder()->getAdjustmentNegative()+$this->getAdjustmentNegative() - ); - $this->getOrder()->setBaseAdjustmentNegative( - $this->getOrder()->getBaseAdjustmentNegative()+$this->getBaseAdjustmentNegative() - ); + $order->setAdjustmentNegative($order->getAdjustmentNegative()+$this->getAdjustmentNegative()); + $order->setBaseAdjustmentNegative($order->getBaseAdjustmentNegative()+$this->getBaseAdjustmentNegative()); - $this->getOrder()->setDiscountRefunded( - $this->getOrder()->getDiscountRefunded()+$this->getDiscountAmount() - ); - $this->getOrder()->setBaseDiscountRefunded( - $this->getOrder()->getBaseDiscountRefunded()+$this->getBaseDiscountAmount() - ); + $order->setDiscountRefunded($order->getDiscountRefunded()+$this->getDiscountAmount()); + $order->setBaseDiscountRefunded($order->getBaseDiscountRefunded()+$this->getBaseDiscountAmount()); if ($this->getInvoice()) { $this->getInvoice()->setIsUsedForRefund(true); @@ -318,7 +291,7 @@ public function refund() } if (!$this->getPaymentRefundDisallowed()) { - $this->getOrder()->getPayment()->refund($this); + $order->getPayment()->refund($this); } Mage::dispatchEvent('sales_order_creditmemo_refund', array($this->_eventObject=>$this)); @@ -379,7 +352,7 @@ public function register() { if ($this->getId()) { Mage::throwException( - Mage::helper('sales')->__('Cannot register existing creditmemo') + Mage::helper('sales')->__('Cannot register an existing credit memo.') ); } @@ -466,12 +439,13 @@ public function getStateName($stateId = null) public function setShippingAmount($amount) { - $amount = $this->getStore()->roundPrice($amount); - $this->setData('base_shipping_amount', $amount); - - $amount = $this->getStore()->roundPrice( - $amount*$this->getOrder()->getStoreToOrderRate() - ); + // base shipping amount calculated in total model +// $amount = $this->getStore()->roundPrice($amount); +// $this->setData('base_shipping_amount', $amount); +// +// $amount = $this->getStore()->roundPrice( +// $amount*$this->getOrder()->getStoreToOrderRate() +// ); $this->setData('shipping_amount', $amount); return $this; } @@ -479,6 +453,12 @@ public function setShippingAmount($amount) public function setAdjustmentPositive($amount) { + $amount = trim($amount); + if (substr($amount, -1) == '%') { + $amount = (float) substr($amount, 0, -1); + $amount = $this->getOrder()->getGrandTotal() * $amount / 100; + } + $amount = $this->getStore()->roundPrice($amount); $this->setData('base_adjustment_positive', $amount); @@ -491,6 +471,12 @@ public function setAdjustmentPositive($amount) public function setAdjustmentNegative($amount) { + $amount = trim($amount); + if (substr($amount, -1) == '%') { + $amount = (float) substr($amount, 0, -1); + $amount = $this->getOrder()->getGrandTotal() * $amount / 100; + } + $amount = $this->getStore()->roundPrice($amount); $this->setData('base_adjustment_negative', $amount); @@ -521,9 +507,13 @@ public function getCommentsCollection($reload=false) { if (is_null($this->_comments) || $reload) { $this->_comments = Mage::getResourceModel('sales/order_creditmemo_comment_collection') - ->addAttributeToSelect('*') ->setCreditmemoFilter($this->getId()) ->setCreatedAtOrder(); + /** + * When credit memo created with adding comment, comments collection must be loaded before we added this comment. + */ + $this->_comments->load(); + if ($this->getId()) { foreach ($this->_comments as $comment) { $comment->setCreditmemo($this); @@ -719,4 +709,44 @@ protected function _beforeDelete() $this->_protectFromNonAdmin(); return parent::_beforeDelete(); } + + /** + * After save object manipulations + * + * @return Mage_Sales_Model_Order_Creditmemo + */ + protected function _afterSave() + { + if (null != $this->_items) { + foreach ($this->_items as $item) { + $item->save(); + } + } + + if (null != $this->_comments) { + foreach($this->_comments as $comment) { + $comment->save(); + } + } + + + return parent::_afterSave(); + } + + /** + * Before object save manipulations + * + * @return Mage_Sales_Model_Order_Creditmemo + */ + protected function _beforeSave() + { + parent::_beforeSave(); + + if (!$this->getOrderId() && $this->getOrder()) { + $this->setOrderId($this->getOrder()->getId()); + $this->setBillingAddressId($this->getOrder()->getBillingAddress()->getId()); + } + + return $this; + } } diff --git a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Comment.php b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Comment.php index 23102f5267..3491cd9685 100644 --- a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Comment.php +++ b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Comment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -76,4 +76,20 @@ public function getStore() } return Mage::app()->getStore(); } + + /** + * Before object save + * + * @return Mage_Sales_Model_Order_Creditmemo_Comment + */ + protected function _beforeSave() + { + parent::_beforeSave(); + + if (!$this->getParentId() && $this->getCreditmemo()) { + $this->setParentId($this->getCreditmemo()->getId()); + } + + return $this; + } } diff --git a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Config.php b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Config.php index 1daa8ec14c..972349956b 100644 --- a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Config.php +++ b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Item.php b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Item.php index d282107d34..6331ade8e8 100644 --- a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Item.php +++ b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -186,4 +186,19 @@ public function isLast() return false; } + /** + * Before object save + * + * @return Mage_Sales_Model_Order_Creditmemo_Item + */ + protected function _beforeSave() + { + parent::_beforeSave(); + + if (!$this->getParentId() && $this->getCreditmemo()) { + $this->setParentId($this->getCreditmemo()->getId()); + } + + return $this; + } } diff --git a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Abstract.php b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Abstract.php index c2272bd312..d2251d545b 100644 --- a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Abstract.php +++ b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Cost.php b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Cost.php index f0b8a2a1eb..036272794d 100644 --- a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Cost.php +++ b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Cost.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Discount.php b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Discount.php index 81153b8c56..f789495624 100644 --- a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Discount.php +++ b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Discount.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Grand.php b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Grand.php index 9039538bb3..58dbd1b0ef 100644 --- a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Grand.php +++ b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Grand.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Shipping.php b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Shipping.php index 5c172a732e..6b24ce8ea2 100644 --- a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Shipping.php +++ b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Shipping.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -36,8 +36,15 @@ class Mage_Sales_Model_Order_Creditmemo_Total_Shipping extends Mage_Sales_Model_ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo) { $order = $creditmemo->getOrder(); - $allowedAmount = $order->getShippingAmount()-$order->getShippingRefunded(); - $baseAllowedAmount = $order->getBaseShippingAmount()-$order->getBaseShippingRefunded(); + $allowedAmount = $order->getShippingAmount()-$order->getShippingRefunded(); + $baseAllowedAmount = $order->getBaseShippingAmount()-$order->getBaseShippingRefunded(); + + $shipping = $order->getShippingAmount(); + $baseShipping = $order->getBaseShippingAmount(); + $shippingInclTax = $order->getShippingInclTax(); + $baseShippingInclTax = $order->getBaseShippingInclTax(); + + $isShippingInclTax = Mage::getSingleton('tax/config')->displaySalesShippingInclTax($order->getStoreId()); /** * Check if shipping amount was specified (from invoice or another source). @@ -45,27 +52,36 @@ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo) */ if ($creditmemo->hasBaseShippingAmount()) { $baseShippingAmount = Mage::app()->getStore()->roundPrice($creditmemo->getBaseShippingAmount()); - if ($baseShippingAmount<$baseAllowedAmount) { - $shippingAmount = $allowedAmount*$baseShippingAmount/$baseAllowedAmount; - $shippingAmount = Mage::app()->getStore()->roundPrice($shippingAmount); - } elseif ($baseShippingAmount==$baseAllowedAmount) { - $shippingAmount = $allowedAmount; + if ($isShippingInclTax) { + $part = $baseShippingAmount/$baseShippingInclTax; + $shippingInclTax = Mage::app()->getStore()->roundPrice($shippingInclTax*$part); + $baseShippingInclTax= $baseShippingAmount; + $baseShippingAmount = Mage::app()->getStore()->roundPrice($baseShipping*$part);; + } + if ($baseShippingAmount<= $baseAllowedAmount) { + $shipping = $shipping*$baseShippingAmount/$baseShipping; + $shipping = Mage::app()->getStore()->roundPrice($shipping); + $baseShipping = $baseShippingAmount; } else { $baseAllowedAmount = $order->formatBasePrice($baseAllowedAmount); Mage::throwException( - Mage::helper('sales')->__('Maximum shipping amount allowed to refound is: %s', $baseAllowedAmount) + Mage::helper('sales')->__('Maximum shipping amount allowed to refund is: %s', $baseAllowedAmount) ); } } else { - $baseShippingAmount = $baseAllowedAmount; - $shippingAmount = $allowedAmount; + $shippingInclTax = Mage::app()->getStore()->roundPrice($shippingInclTax * $allowedAmount/$shipping); + $baseShippingInclTax= Mage::app()->getStore()->roundPrice($baseShippingInclTax * $baseAllowedAmount/$baseShipping); + $shipping = $allowedAmount; + $baseShipping = $baseAllowedAmount; } - $creditmemo->setShippingAmount($shippingAmount); - $creditmemo->setBaseShippingAmount($baseShippingAmount); + $creditmemo->setShippingAmount($shipping); + $creditmemo->setBaseShippingAmount($baseShipping); + $creditmemo->setShippingInclTax($shippingInclTax); + $creditmemo->setBaseShippingInclTax($baseShippingInclTax); - $creditmemo->setGrandTotal($creditmemo->getGrandTotal()+$shippingAmount); - $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal()+$baseShippingAmount); + $creditmemo->setGrandTotal($creditmemo->getGrandTotal()+$shipping); + $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal()+$baseShipping); return $this; } } diff --git a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Subtotal.php b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Subtotal.php index 7a77acf7e2..43e3f839bf 100644 --- a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Subtotal.php +++ b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Subtotal.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Tax.php b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Tax.php index 34f825054c..a25bd259a9 100644 --- a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Tax.php +++ b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Tax.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -33,80 +33,125 @@ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo) $baseShippingTaxAmount = 0; $totalTax = 0; $baseTotalTax = 0; + $totalHiddenTax = 0; + $baseTotalHiddenTax = 0; + $order = $creditmemo->getOrder(); foreach ($creditmemo->getAllItems() as $item) { if ($item->getOrderItem()->isDummy()) { continue; } + $orderItem = $item->getOrderItem(); $orderItemTax = $item->getOrderItem()->getTaxAmount(); $baseOrderItemTax = $item->getOrderItem()->getBaseTaxAmount(); - $orderItemQty = $item->getOrderItem()->getQtyOrdered(); + $orderItemQty = $item->getOrderItem()->getQtyOrdered(); if ($orderItemTax && $orderItemQty) { /** * Check item tax amount */ if ($item->isLast()) { - $tax = $orderItemTax - $item->getOrderItem()->getTaxRefunded(); - $baseTax = $baseOrderItemTax - $item->getOrderItem()->getTaxRefunded(); + $tax = $orderItemTax - $item->getOrderItem()->getTaxRefunded(); + $baseTax = $baseOrderItemTax - $item->getOrderItem()->getTaxRefunded(); + $hiddenTax = $orderItem->getHiddenTaxAmount() - $orderItem->getHiddenTaxRefunded(); + $baseHiddenTax = $orderItem->getBaseHiddenTaxAmount() - $orderItem->getBaseHiddenTaxRefunded(); + } else { - $tax = $orderItemTax*$item->getQty()/$orderItemQty; - $baseTax = $baseOrderItemTax*$item->getQty()/$orderItemQty; + $tax = $orderItemTax*$item->getQty()/$orderItemQty; + $baseTax = $baseOrderItemTax*$item->getQty()/$orderItemQty; + $hiddenTax = $orderItem->getHiddenTaxAmount()*$item->getQty()/$orderItemQty; + $baseHiddenTax = $orderItem->getBaseHiddenTaxAmount()*$item->getQty()/$orderItemQty; - $tax = $creditmemo->getStore()->roundPrice($tax); - $baseTax = $creditmemo->getStore()->roundPrice($baseTax); + $tax = $creditmemo->getStore()->roundPrice($tax); + $baseTax = $creditmemo->getStore()->roundPrice($baseTax); + $hiddenTax = $creditmemo->getStore()->roundPrice($hiddenTax); + $baseHiddenTax = $creditmemo->getStore()->roundPrice($baseHiddenTax); } $item->setTaxAmount($tax); $item->setBaseTaxAmount($baseTax); + $item->setHiddenTaxAmount($hiddenTax); + $item->setBaseHiddenTaxAmount($baseHiddenTax); $totalTax += $tax; $baseTotalTax += $baseTax; + $totalHiddenTax += $hiddenTax; + $baseTotalHiddenTax += $baseHiddenTax; } } if ($invoice = $creditmemo->getInvoice()) { - $totalTax += $invoice->getShippingTaxAmount(); - $baseTotalTax += $invoice->getBaseShippingTaxAmount(); + $totalTax += $invoice->getShippingTaxAmount(); + $baseTotalTax += $invoice->getBaseShippingTaxAmount(); + $totalHiddenTax += $invoice->getShippingHiddenTaxAmount(); + $baseTotalHiddenTax += $invoice->getBaseShippingHiddenTaxAmount(); $shippingTaxAmount = $invoice->getShippingTaxAmount(); $baseShippingTaxAmount = $invoice->getBaseShippingTaxAmount(); + $shippingHiddenTaxAmount = $invoice->getShippingHiddenTaxAmount(); + $baseShippingHiddenTaxAmount = $invoice->getBaseShippingHiddenTaxAmount(); } else { $orderShippingAmount = $order->getShippingAmount(); $baseOrderShippingAmount = $order->getBaseShippingAmount(); + $orderShippingHiddenTaxAmount = $order->getShippingHiddenTaxAmount(); + $baseOrderShippingHiddenTaxAmount = $order->getBaseShippingHiddenTaxAmount(); + $baseOrderShippingRefundedAmount = $order->getBaseShippingRefunded(); + $baseOrderShippingHiddenTaxRefunded = $order->getBaseShippingHiddenTaxRefunded(); $shippingTaxAmount = 0; $baseShippingTaxAmount = 0; + $shippingHiddenTaxAmount = 0; + $baseShippingHiddenTaxAmount = 0; if (($baseOrderShippingAmount - $baseOrderShippingRefundedAmount) > $creditmemo->getBaseShippingAmount()) { - $shippingTaxAmount = $creditmemo->getShippingAmount()*($order->getShippingTaxAmount()/$orderShippingAmount); - $baseShippingTaxAmount = $creditmemo->getBaseShippingAmount()*($order->getBaseShippingTaxAmount()/$baseOrderShippingAmount); - $shippingTaxAmount = $creditmemo->getStore()->roundPrice($shippingTaxAmount); - $baseShippingTaxAmount = $creditmemo->getStore()->roundPrice($baseShippingTaxAmount); + $part = $creditmemo->getShippingAmount()/$orderShippingAmount; + $basePart = $creditmemo->getBaseShippingAmount()/$baseOrderShippingAmount; + $shippingTaxAmount = $order->getShippingTaxAmount()*$part; + $baseShippingTaxAmount = $order->getBaseShippingTaxAmount()*$basePart; + $shippingHiddenTaxAmount = $order->getShippingHiddenTaxAmount()*$part; + $baseShippingHiddenTaxAmount= $order->getBaseShippingHiddenTaxAmount()*$basePart; + $shippingTaxAmount = $creditmemo->getStore()->roundPrice($shippingTaxAmount); + $baseShippingTaxAmount = $creditmemo->getStore()->roundPrice($baseShippingTaxAmount); + $shippingHiddenTaxAmount = $creditmemo->getStore()->roundPrice($shippingHiddenTaxAmount); + $baseShippingHiddenTaxAmount= $creditmemo->getStore()->roundPrice($baseShippingHiddenTaxAmount); } elseif (($baseOrderShippingAmount - $baseOrderShippingRefundedAmount) == $creditmemo->getBaseShippingAmount()) { - $shippingTaxAmount = $order->getShippingTaxAmount() - $order->getShippingTaxRefunded(); - $baseShippingTaxAmount = $order->getBaseShippingTaxAmount() - $order->getBaseShippingTaxRefunded(); + $shippingTaxAmount = $order->getShippingTaxAmount() - $order->getShippingTaxRefunded(); + $baseShippingTaxAmount = $order->getBaseShippingTaxAmount() - $order->getBaseShippingTaxRefunded(); + $shippingHiddenTaxAmount = $order->getShippingHiddenTaxAmount() - $order->getShippingHiddenTaxRefunded(); + $baseShippingHiddenTaxAmount= $order->getBaseShippingHiddenTaxAmount() - $order->getBaseShippingHiddenTaxRefunded(); } - $totalTax += $shippingTaxAmount; - $baseTotalTax += $baseShippingTaxAmount; + $totalTax += $shippingTaxAmount; + $baseTotalTax += $baseShippingTaxAmount; + $totalHiddenTax += $shippingHiddenTaxAmount; + $baseTotalHiddenTax += $baseShippingHiddenTaxAmount; } - - $allowedTax = $order->getTaxAmount() - $order->getTaxRefunded(); - $allowedBaseTax = $order->getBaseTaxAmount() - $order->getBaseTaxRefunded();; - $totalTax = min($allowedTax, $totalTax); - $baseTotalTax = min($allowedBaseTax, $baseTotalTax); + $allowedTax = $order->getTaxAmount() - $order->getTaxRefunded(); + $allowedBaseTax = $order->getBaseTaxAmount() - $order->getBaseTaxRefunded(); + $allowedHiddenTax = $order->getHiddenTaxAmount() + $order->getShippingHiddenTaxAmount() + - $order->getHiddenTaxRefunded() - $order->getShippingHiddenTaxRefunded(); + $allowedBaseHiddenTax = $order->getBaseHiddenTaxAmount() + $order->getBaseShippingHiddenTaxAmount() + - $order->getBaseHiddenTaxRefunded() - $order->getBaseShippingHiddenTaxRefunded(); + + + $totalTax = min($allowedTax, $totalTax); + $baseTotalTax = min($allowedBaseTax, $baseTotalTax); + $totalHiddenTax = min($allowedHiddenTax, $totalHiddenTax); + $baseTotalHiddenTax = min($allowedBaseHiddenTax, $baseTotalHiddenTax); $creditmemo->setTaxAmount($totalTax); $creditmemo->setBaseTaxAmount($baseTotalTax); + $creditmemo->setHiddenTaxAmount($totalHiddenTax); + $creditmemo->setBaseHiddenTaxAmount($baseTotalHiddenTax); + $creditmemo->setShippingTaxAmount($shippingTaxAmount); $creditmemo->setBaseShippingTaxAmount($baseShippingTaxAmount); - $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $totalTax); - $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $baseTotalTax); + $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $totalTax + $totalHiddenTax); + $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $baseTotalTax + $baseTotalHiddenTax); return $this; } } diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice.php b/app/code/core/Mage/Sales/Model/Order/Invoice.php index 13ce7d5ecb..0383256d92 100644 --- a/app/code/core/Mage/Sales/Model/Order/Invoice.php +++ b/app/code/core/Mage/Sales/Model/Order/Invoice.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -322,6 +322,12 @@ public function cancel() $order->setTaxInvoiced($order->getTaxInvoiced() - $this->getTaxAmount()); $order->setBaseTaxInvoiced($order->getBaseTaxInvoiced() - $this->getBaseTaxAmount()); + $order->setHiddenTaxInvoiced($order->getHiddenTaxInvoiced() - $this->getHiddenTaxAmount()); + $order->setBaseHiddenTaxInvoiced($order->getBaseHiddenTaxInvoiced() - $this->getBaseHiddenTaxAmount()); + + $order->setShippingTaxInvoiced($order->getShippingTaxInvoiced() - $this->getShippingTaxAmount()); + $order->setBaseShippingTaxInvoiced($order->getBaseShippingTaxInvoiced() - $this->getBaseShippingTaxAmount()); + $order->setShippingInvoiced($order->getShippingInvoiced() - $this->getShippingAmount()); $order->setBaseShippingInvoiced($order->getBaseShippingInvoiced() - $this->getBaseShippingAmount()); @@ -357,7 +363,6 @@ public function getItemsCollection() { if (empty($this->_items)) { $this->_items = Mage::getResourceModel('sales/order_invoice_item_collection') - ->addAttributeToSelect('*') ->setInvoiceFilter($this->getId()); if ($this->getId()) { @@ -475,8 +480,10 @@ public function register() } } } elseif(!$order->getPayment()->getMethodInstance()->isGateway() || $captureCase == self::CAPTURE_OFFLINE) { - $this->setCanVoidFlag(false); - $this->pay(); + if (!$order->getPayment()->getIsTransactionPending()) { + $this->setCanVoidFlag(false); + $this->pay(); + } } $order->setTotalInvoiced($order->getTotalInvoiced() + $this->getGrandTotal()); @@ -488,6 +495,13 @@ public function register() $order->setTaxInvoiced($order->getTaxInvoiced() + $this->getTaxAmount()); $order->setBaseTaxInvoiced($order->getBaseTaxInvoiced() + $this->getBaseTaxAmount()); + $order->setHiddenTaxInvoiced($order->getHiddenTaxInvoiced() + $this->getHiddenTaxAmount()); + $order->setBaseHiddenTaxInvoiced($order->getBaseHiddenTaxInvoiced() + $this->getBaseHiddenTaxAmount()); + + $order->setShippingTaxInvoiced($order->getShippingTaxInvoiced() + $this->getShippingTaxAmount()); + $order->setBaseShippingTaxInvoiced($order->getBaseShippingTaxInvoiced() + $this->getBaseShippingTaxAmount()); + + $order->setShippingInvoiced($order->getShippingInvoiced() + $this->getShippingAmount()); $order->setBaseShippingInvoiced($order->getBaseShippingInvoiced() + $this->getBaseShippingAmount()); @@ -499,6 +513,8 @@ public function register() if (is_null($state)) { $this->setState(self::STATE_OPEN); } + + Mage::dispatchEvent('sales_order_invoice_register', array($this->_eventObject=>$this, 'order' => $order)); return $this; } @@ -537,9 +553,13 @@ public function getCommentsCollection($reload=false) { if (is_null($this->_comments) || $reload) { $this->_comments = Mage::getResourceModel('sales/order_invoice_comment_collection') - ->addAttributeToSelect('*') ->setInvoiceFilter($this->getId()) ->setCreatedAtOrder(); + /** + * When invoice created with adding comment, comments collection must be loaded before we added this comment. + */ + $this->_comments->load(); + if ($this->getId()) { foreach ($this->_comments as $comment) { $comment->setInvoice($this); @@ -735,4 +755,65 @@ protected function _beforeDelete() $this->_protectFromNonAdmin(); return parent::_beforeDelete(); } + + /** + * Reset invoice object + * + * @return Mage_Sales_Model_Order_Invoice + */ + public function reset() + { + $this->unsetData(); + $this->_origData = null; + $this->_items = null; + $this->_comments = null; + $this->_order = null; + $this->_saveBeforeDestruct = false; + $this->_wasPayCalled = false; + return $this; + } + + /** + * Before object save manipulations + * + * @return Mage_Sales_Model_Order_Shipment + */ + protected function _beforeSave() + { + parent::_beforeSave(); + + if (!$this->getOrderId() && $this->getOrder()) { + $this->setOrderId($this->getOrder()->getId()); + $this->setBillingAddressId($this->getOrder()->getBillingAddress()->getId()); + } + + return $this; + } + + /** + * After object save manipulation + * + * @return Mage_Sales_Model_Order_Shipment + */ + protected function _afterSave() + { + + if (null !== $this->_items) { + /** + * Save invoice items + */ + foreach ($this->_items as $item) { + $item->setOrderItem($item->getOrderItem()); + $item->save(); + } + } + + if (null !== $this->_comments) { + foreach($this->_comments as $comment) { + $comment->save(); + } + } + + return parent::_afterSave(); + } } diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Api.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Api.php index 79fb2708e1..0063962f30 100644 --- a/app/code/core/Mage/Sales/Model/Order/Invoice/Api.php +++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -149,7 +149,7 @@ public function create($orderIncrementId, $itemsQty, $comment = null, $email = f * Check invoice create availability */ if (!$order->canInvoice()) { - $this->_fault('data_invalid', Mage::helper('sales')->__('Can not do invoice for order.')); + $this->_fault('data_invalid', Mage::helper('sales')->__('Cannot do invoice for order.')); } $invoice = $order->prepareInvoice($itemsQty); @@ -228,7 +228,7 @@ public function capture($invoiceIncrementId) } if (!$invoice->canCapture()) { - $this->_fault('status_not_changed', Mage::helper('sales')->__('Invoice can not be captured')); + $this->_fault('status_not_changed', Mage::helper('sales')->__('Invoice cannot be captured.')); } try { @@ -241,7 +241,7 @@ public function capture($invoiceIncrementId) } catch (Mage_Core_Exception $e) { $this->_fault('status_not_changed', $e->getMessage()); } catch (Exception $e) { - $this->_fault('status_not_changed', Mage::helper('sales')->__('Invoice capture problem')); + $this->_fault('status_not_changed', Mage::helper('sales')->__('Invoice capturing problem.')); } return true; @@ -264,7 +264,7 @@ public function void($invoiceIncrementId) } if (!$invoice->canVoid()) { - $this->_fault('status_not_changed', Mage::helper('sales')->__('Invoice can not be void')); + $this->_fault('status_not_changed', Mage::helper('sales')->__('Invoice cannot be voided.')); } try { @@ -300,7 +300,7 @@ public function cancel($invoiceIncrementId) } if (!$invoice->canCancel()) { - $this->_fault('status_not_changed', Mage::helper('sales')->__('Invoice can not be canceled')); + $this->_fault('status_not_changed', Mage::helper('sales')->__('Invoice cannot be canceled.')); } try { @@ -313,7 +313,7 @@ public function cancel($invoiceIncrementId) } catch (Mage_Core_Exception $e) { $this->_fault('status_not_changed', $e->getMessage()); } catch (Exception $e) { - $this->_fault('status_not_changed', Mage::helper('sales')->__('Invoice cancel problem')); + $this->_fault('status_not_changed', Mage::helper('sales')->__('Invoice canceling problem.')); } return true; diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Api/V2.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Api/V2.php index 45cfc9bb04..671fcb417f 100644 --- a/app/code/core/Mage/Sales/Model/Order/Invoice/Api/V2.php +++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Api/V2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -129,7 +129,7 @@ public function create($orderIncrementId, $itemsQty, $comment = null, $email = f * Check invoice create availability */ if (!$order->canInvoice()) { - $this->_fault('data_invalid', Mage::helper('sales')->__('Can not do invoice for order.')); + $this->_fault('data_invalid', Mage::helper('sales')->__('Cannot do invoice for order.')); } $invoice = $order->prepareInvoice($itemsQty); diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Comment.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Comment.php index 5642214221..612ed8f28e 100644 --- a/app/code/core/Mage/Sales/Model/Order/Invoice/Comment.php +++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Comment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -76,4 +76,20 @@ public function getStore() } return Mage::app()->getStore(); } + + /** + * Before object save + * + * @return Mage_Sales_Model_Order_Invoice_Comment + */ + protected function _beforeSave() + { + parent::_beforeSave(); + + if (!$this->getParentId() && $this->getInvoice()) { + $this->setParentId($this->getInvoice()->getId()); + } + + return $this; + } } diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Config.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Config.php index 3cac8113b1..bd0d06b8fe 100644 --- a/app/code/core/Mage/Sales/Model/Order/Invoice/Config.php +++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Item.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Item.php index eaa319c2a8..4ee3fc19ac 100644 --- a/app/code/core/Mage/Sales/Model/Order/Invoice/Item.php +++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -138,6 +138,8 @@ public function register() $orderItem->setTaxInvoiced($orderItem->getTaxInvoiced()+$this->getTaxAmount()); $orderItem->setBaseTaxInvoiced($orderItem->getBaseTaxInvoiced()+$this->getBaseTaxAmount()); + $orderItem->setHiddenTaxInvoiced($orderItem->getHiddenTaxInvoiced()+$this->getHiddenTaxAmount()); + $orderItem->setBaseHiddenTaxInvoiced($orderItem->getBaseHiddenTaxInvoiced()+$this->getBaseHiddenTaxAmount()); $orderItem->setDiscountInvoiced($orderItem->getDiscountInvoiced()+$this->getDiscountAmount()); $orderItem->setBaseDiscountInvoiced($orderItem->getBaseDiscountInvoiced()+$this->getBaseDiscountAmount()); @@ -159,6 +161,9 @@ public function cancel() $orderItem->setTaxInvoiced($orderItem->getTaxInvoiced()-$this->getTaxAmount()); $orderItem->setBaseTaxInvoiced($orderItem->getBaseTaxInvoiced()-$this->getBaseTaxAmount()); + $orderItem->setHiddenTaxInvoiced($orderItem->getHiddenTaxInvoiced()-$this->getHiddenTaxAmount()); + $orderItem->setBaseHiddenTaxInvoiced($orderItem->getBaseHiddenTaxInvoiced()-$this->getBaseHiddenTaxAmount()); + $orderItem->setDiscountInvoiced($orderItem->getDiscountInvoiced()-$this->getDiscountAmount()); $orderItem->setBaseDiscountInvoiced($orderItem->getBaseDiscountInvoiced()-$this->getBaseDiscountAmount()); @@ -209,4 +214,35 @@ public function isLast() } return false; } + + /** + * Before object save + * + * @return Mage_Sales_Model_Order_Invoice_Item + */ + protected function _beforeSave() + { + parent::_beforeSave(); + + if (!$this->getParentId() && $this->getInvoice()) { + $this->setParentId($this->getInvoice()->getId()); + } + + return $this; + } + + /** + * After object save + * + * @return Mage_Sales_Model_Order_Invoice_Item + */ + protected function _afterSave() + { + if (null ==! $this->_orderItem) { + $this->_orderItem->save(); + } + + parent::_afterSave(); + return $this; + } } diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Abstract.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Abstract.php index 3764391ad3..4c762e78ca 100644 --- a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Abstract.php +++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Cost.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Cost.php index 3ff4ce4f33..bf377cb2b0 100644 --- a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Cost.php +++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Cost.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Discount.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Discount.php index b4cb04fafa..ccf276e8de 100644 --- a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Discount.php +++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Discount.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Grand.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Grand.php index b7776f523e..7fc9998f13 100644 --- a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Grand.php +++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Grand.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Shipping.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Shipping.php index fafca2ee3e..c34f1bd885 100644 --- a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Shipping.php +++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Shipping.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -37,9 +37,10 @@ public function collect(Mage_Sales_Model_Order_Invoice $invoice) { $invoice->setShippingAmount(0); $invoice->setBaseShippingAmount(0); - - $orderShippingAmount = $invoice->getOrder()->getShippingAmount(); - $baseOrderShippingAmount = $invoice->getOrder()->getBaseShippingAmount(); + $orderShippingAmount = $invoice->getOrder()->getShippingAmount(); + $baseOrderShippingAmount = $invoice->getOrder()->getBaseShippingAmount(); + $shippingInclTax = $invoice->getOrder()->getShippingInclTax(); + $baseShippingInclTax = $invoice->getOrder()->getBaseShippingInclTax(); if ($orderShippingAmount) { /** * Check shipping amount in previus invoices @@ -51,6 +52,8 @@ public function collect(Mage_Sales_Model_Order_Invoice $invoice) } $invoice->setShippingAmount($orderShippingAmount); $invoice->setBaseShippingAmount($baseOrderShippingAmount); + $invoice->setShippingInclTax($shippingInclTax); + $invoice->setBaseShippingInclTax($baseShippingInclTax); $invoice->setGrandTotal($invoice->getGrandTotal()+$orderShippingAmount); $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal()+$baseOrderShippingAmount); diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Subtotal.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Subtotal.php index 3f7a1b8a3c..e05f10f535 100644 --- a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Subtotal.php +++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Subtotal.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Tax.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Tax.php index 896e5b03a7..680b342dad 100644 --- a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Tax.php +++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Tax.php @@ -20,86 +20,122 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_Sales_Model_Order_Invoice_Total_Tax extends Mage_Sales_Model_Order_Invoice_Total_Abstract { + /** + * Collect invoice tax amount + * + * @param Mage_Sales_Model_Order_Invoice $invoice + */ public function collect(Mage_Sales_Model_Order_Invoice $invoice) { - $totalTax = 0; - $baseTotalTax = 0; + $totalTax = 0; + $baseTotalTax = 0; + $totalHiddenTax = 0; + $baseTotalHiddenTax = 0; + $order = $invoice->getOrder(); foreach ($invoice->getAllItems() as $item) { $orderItem = $item->getOrderItem(); - $orderItemTax = $orderItem->getTaxAmount(); - $baseOrderItemTax = $orderItem->getBaseTaxAmount(); $orderItemQty = $orderItem->getQtyOrdered(); - if ($orderItemTax && $orderItemQty) { + if ($orderItem->getTaxAmount() && $orderItemQty) { if ($item->getOrderItem()->isDummy()) { continue; } + /** * Resolve rounding problems */ if ($item->isLast()) { - $tax = $orderItemTax - $orderItem->getTaxInvoiced(); - $baseTax = $baseOrderItemTax - $orderItem->getBaseTaxInvoiced(); - } - else { - $tax = $orderItemTax*$item->getQty()/$orderItemQty; - $baseTax = $baseOrderItemTax*$item->getQty()/$orderItemQty; + $tax = $orderItem->getTaxAmount() - $orderItem->getTaxInvoiced(); + $baseTax = $orderItem->getBaseTaxAmount() - $orderItem->getBaseTaxInvoiced(); + $hiddenTax = $orderItem->getHiddenTaxAmount() - $orderItem->getHiddenTaxInvoiced(); + $baseHiddenTax = $orderItem->getBaseHiddenTaxAmount() - $orderItem->getBaseHiddenTaxInvoiced(); + } else { + $tax = $orderItem->getTaxAmount()*$item->getQty()/$orderItemQty; + $baseTax = $orderItem->getBaseTaxAmount()*$item->getQty()/$orderItemQty; + $hiddenTax = $orderItem->getHiddenTaxAmount()*$item->getQty()/$orderItemQty; + $baseHiddenTax = $orderItem->getBaseHiddenTaxAmount()*$item->getQty()/$orderItemQty; - $tax = $invoice->getStore()->roundPrice($tax); - $baseTax = $invoice->getStore()->roundPrice($baseTax); + $tax = $invoice->getStore()->roundPrice($tax); + $baseTax = $invoice->getStore()->roundPrice($baseTax); + $hiddenTax = $invoice->getStore()->roundPrice($hiddenTax); + $baseHiddenTax = $invoice->getStore()->roundPrice($baseHiddenTax); } $item->setTaxAmount($tax); $item->setBaseTaxAmount($baseTax); + $item->setHiddenTaxAmount($hiddenTax); + $item->setBaseHiddenTaxAmount($baseHiddenTax); $totalTax += $tax; $baseTotalTax += $baseTax; + $totalHiddenTax += $hiddenTax; + $baseTotalHiddenTax += $baseHiddenTax; } } - $includeShippingTax = true; - /** - * Check shipping amount in previus invoices - */ - foreach ($order->getInvoiceCollection() as $previusInvoice) { - if ($previusInvoice->getShippingAmount() && !$previusInvoice->isCanceled()) { - $includeShippingTax = false; - } - } - - if ($includeShippingTax) { - $totalTax += $order->getShippingTaxAmount(); - $baseTotalTax += $order->getBaseShippingTaxAmount(); + if ($this->_canIncludeShipping($invoice)) { + $totalTax += $order->getShippingTaxAmount(); + $baseTotalTax += $order->getBaseShippingTaxAmount(); + $totalHiddenTax += $order->getShippingHiddenTaxAmount(); + $baseTotalHiddenTax += $order->getBaseShippingHiddenTaxAmount(); $invoice->setShippingTaxAmount($order->getShippingTaxAmount()); $invoice->setBaseShippingTaxAmount($order->getBaseShippingTaxAmount()); + $invoice->setShippingHiddenTaxAmount($order->getShippingHiddenTaxAmount()); + $invoice->setBaseShippingHiddenTaxAmount($order->getBaseShippingHiddenTaxAmount()); } - - $allowedTax = $order->getTaxAmount() - $order->getTaxInvoiced(); + $allowedTax = $order->getTaxAmount() - $order->getTaxInvoiced(); $allowedBaseTax = $order->getBaseTaxAmount() - $order->getBaseTaxInvoiced();; + $allowedHiddenTax = $order->getHiddenTaxAmount() + $order->getShippingHiddenTaxAmount() + - $order->getHiddenTaxInvoiced() - $order->getShippingHiddenTaxInvoiced(); + $allowedBaseHiddenTax = $order->getBaseHiddenTaxAmount() + $order->getBaseShippingHiddenTaxAmount() + - $order->getBaseHiddenTaxInvoiced() - $order->getBaseShippingHiddenTaxInvoiced(); if ($invoice->isLast()) { - $totalTax = $allowedTax; - $baseTotalTax = $allowedBaseTax; - } - else { - $totalTax = min($allowedTax, $totalTax); - $baseTotalTax = min($allowedBaseTax, $baseTotalTax); + $totalTax = $allowedTax; + $baseTotalTax = $allowedBaseTax; + $totalHiddenTax = $allowedHiddenTax; + $baseTotalHiddenTax = $allowedBaseHiddenTax; + } else { + $totalTax = min($allowedTax, $totalTax); + $baseTotalTax = min($allowedBaseTax, $baseTotalTax); + $totalHiddenTax = min($allowedHiddenTax, $totalHiddenTax); + $baseTotalHiddenTax = min($allowedBaseHiddenTax, $baseTotalHiddenTax); } $invoice->setTaxAmount($totalTax); $invoice->setBaseTaxAmount($baseTotalTax); + $invoice->setHiddenTaxAmount($totalHiddenTax); + $invoice->setBaseHiddenTaxAmount($baseTotalHiddenTax); - $invoice->setGrandTotal($invoice->getGrandTotal() + $totalTax); - $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseTotalTax); + $invoice->setGrandTotal($invoice->getGrandTotal() + $totalTax + $totalHiddenTax); + $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseTotalTax + $baseTotalHiddenTax); return $this; } + + /** + * Check if shipping tax calculation can be included to current invoice + * @param Mage_Sales_Model_Order_Invoice $invoice + */ + protected function _canIncludeShipping($invoice) + { + $includeShippingTax = true; + /** + * Check shipping amount in previus invoices + */ + foreach ($invoice->getOrder()->getInvoiceCollection() as $previusInvoice) { + if ($previusInvoice->getShippingAmount() && !$previusInvoice->isCanceled()) { + $includeShippingTax = false; + } + } + return $includeShippingTax; + } } diff --git a/app/code/core/Mage/Sales/Model/Order/Item.php b/app/code/core/Mage/Sales/Model/Order/Item.php index c96dc22f1c..51b405bcf3 100644 --- a/app/code/core/Mage/Sales/Model/Order/Item.php +++ b/app/code/core/Mage/Sales/Model/Order/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -75,7 +75,7 @@ protected function _construct() protected function _beforeSave() { parent::_beforeSave(); - if (!$this->getOrderId()) { + if (!$this->getOrderId() && $this->getOrder()) { $this->setOrderId($this->getOrder()->getId()); } if ($this->getParentItem()) { diff --git a/app/code/core/Mage/Sales/Model/Order/Payment.php b/app/code/core/Mage/Sales/Model/Order/Payment.php index 60bf3b3c5a..ce4cffebf3 100644 --- a/app/code/core/Mage/Sales/Model/Order/Payment.php +++ b/app/code/core/Mage/Sales/Model/Order/Payment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,6 +29,15 @@ */ class Mage_Sales_Model_Order_Payment extends Mage_Payment_Model_Info { + /** + * Actions for payment when it triggered review state + * + * @var string + */ + const REVIEW_ACTION_ACCEPT = 'accept'; + const REVIEW_ACTION_DENY = 'deny'; + const REVIEW_ACTION_UPDATE = 'update'; + /** * Order model object * @@ -36,6 +45,13 @@ class Mage_Sales_Model_Order_Payment extends Mage_Payment_Model_Info */ protected $_order; + /** + * Billing agreement instance that may be created during payment processing + * + * @var Mage_Sales_Model_Billing_Agreement + */ + protected $_billingAgreement = null; + /** * Whether can void * @var string @@ -49,6 +65,9 @@ class Mage_Sales_Model_Order_Payment extends Mage_Payment_Model_Info */ protected $_transactionsLookup = array(); + protected $_eventPrefix = 'sales_order_payment'; + protected $_eventObject = 'payment'; + /** * Transaction addditional information container * @@ -89,18 +108,19 @@ public function getOrder() /** * Check order payment capture action availability * - * @return unknown + * @return bool */ public function canCapture() { - /** - * Check Authoriztion transaction state - */ + if (!$this->getMethodInstance()->canCapture()) { + return false; + } + // Check Authoriztion transaction state $authTransaction = $this->getAuthorizationTransaction(); - if ($authTransaction) { - return !$authTransaction->getIsClosed(); + if ($authTransaction && $authTransaction->getIsClosed()) { + return false; } - return $this->getMethodInstance()->canCapture(); + return true; } public function canRefund() @@ -171,6 +191,8 @@ public function place() } } + $this->_createBillingAgreement(); + $orderIsNotified = null; if ($stateObject->getState() && $stateObject->getStatus()) { $orderState = $stateObject->getState(); @@ -185,13 +207,11 @@ public function place() $isCustomerNotified = (null !== $orderIsNotified) ? $orderIsNotified : $order->getCustomerNoteNotify(); $message = $order->getCustomerNote(); - //add message if order was holded duering authorization or capture - if ($order->getState() == Mage_Sales_Model_Order::STATE_HOLDED) { + // add message if order was put into review during authorization or capture + if ($order->getState() == Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW) { if ($message) { $order->addStatusToHistory($order->getStatus(), $message, $isCustomerNotified); } - $order->setHoldBeforeState($orderState); - $order->setHoldBeforeStatus($orderStatus); } // add message to history if order state already declared elseif ($order->getState() && ($orderStatus !== $order->getStatus() || $message)) { @@ -213,7 +233,10 @@ public function place() * Updates transactions hierarchy, if required * Updates payment totals, updates order status and adds proper comments * + * TODO: eliminate logic duplication with registerCaptureNotification() + * * @return Mage_Sales_Model_Order_Payment + * @throws Mage_Core_Exception */ public function capture($invoice) { @@ -223,51 +246,59 @@ public function capture($invoice) return $this; // @see Mage_Sales_Model_Order_Invoice::capture() } $amountToCapture = $this->_formatAmount($invoice->getBaseGrandTotal()); + $order = $this->getOrder(); + // prepare parent transaction and its amount $paidWorkaround = 0; if (!$invoice->wasPayCalled()) { $paidWorkaround = (float)$amountToCapture; } $this->_isCaptureFinal($paidWorkaround); - $baseTransaction = false; - if ($invoice->getTransactionId()) { - $baseTransaction = $this->_lookupTransaction($invoice->getTransactionId()); - } else { - $baseTransaction = $this->getAuthorizationTransaction(); - } - $this->_generateTransactionId(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, $baseTransaction); - - Mage::dispatchEvent('sales_order_payment_capture', array('payment' => $this, 'invoice' => $invoice)); + $this->_generateTransactionId(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, $this->getAuthorizationTransaction()); - $this->getMethodInstance() - ->setStore($this->getOrder()->getStoreId()) - ->capture($this, $amountToCapture); + Mage::dispatchEvent('sales_order_payment_capture', array('payment' => $this, 'invoice' => $invoice)); - // update transactions, set order state (order will close itself if required) - $transaction = $this->_addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, $invoice, true); /** - * Check if payment transaction is under pending state. - * Gateway can accept peyment transaction but mark it as pending. - * We need hold such kind of orders + * Fetch an update about existing transaction. It can determine whether the transaction can be paid + * Capture attempt will happen only when invoice is not yet paid and the transaction can be paid */ - if ($this->getIsTransactionPending()) { - $message = Mage::helper('sales')->__('Amount of %s pending approval on gateway.', $this->_formatPrice($amountToCapture)); - $message = $this->_prependMessage($message); - $message = $this->_appendTransactionToMessage($transaction, $message); - $status = $this->getTransactionPendingStatus() ? $this->getTransactionPendingStatus() : true; - $this->getOrder()->setState(Mage_Sales_Model_Order::STATE_HOLDED, $status, $message); - $invoice->setIsPaid(false); - } else { - $this->_updateTotals(array('base_amount_paid_online' => $amountToCapture)); - $message = Mage::helper('sales')->__('Captured amount of %s online.', $this->_formatPrice($amountToCapture)); - $message = $this->_prependMessage($message); - $message = $this->_appendTransactionToMessage($transaction, $message); - $this->getOrder()->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $message); - $invoice->setIsPaid(true); + if ($invoice->getTransactionId()) { + $this->getMethodInstance()->setStore($order->getStoreId())->fetchTransactionInfo($this, $invoice->getTransactionId()); } - $this->getMethodInstance()->processInvoice($invoice, $this); // should be deprecated - return $this; + $status = true; + if (!$invoice->getIsPaid() && !$this->getIsTransactionPending()) { + // attempt to capture: this can trigger "is_transaction_pending" + $this->getMethodInstance()->setStore($order->getStoreId())->capture($this, $amountToCapture); + + $transaction = $this->_addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, $invoice, true); + + if ($this->getIsTransactionPending()) { + $message = Mage::helper('sales')->__('Capturing amount of %s is pending approval on gateway.', $this->_formatPrice($amountToCapture)); + $state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW; + if ($this->getIsFraudDetected()) { + $status = 'fraud'; + } + $invoice->setIsPaid(false); + } else { // normal online capture: invoice is marked as "paid" + $message = Mage::helper('sales')->__('Captured amount of %s online.', $this->_formatPrice($amountToCapture)); + $state = Mage_Sales_Model_Order::STATE_PROCESSING; + $invoice->setIsPaid(true); + $this->_updateTotals(array('base_amount_paid_online' => $amountToCapture)); + } + if ($order->isNominal()) { + $message = $this->_prependMessage(Mage::helper('sales')->__('Nominal order registered.')); + } else { + $message = $this->_prependMessage($message); + $message = $this->_appendTransactionToMessage($transaction, $message); + } + $order->setState($state, $status, $message); + $this->getMethodInstance()->processInvoice($invoice, $this); // should be deprecated + return $this; + } + Mage::throwException( + Mage::helper('sales')->__('The transaction "%s" cannot be captured yet.', $invoice->getTransactionId()) + ); } /** @@ -277,6 +308,8 @@ public function capture($invoice) * Prevents transaction double processing * Updates payment totals, updates order status and adds proper comments * + * TODO: eliminate logic duplication with capture() + * * @param float $amount * @return Mage_Sales_Model_Order_Payment */ @@ -285,32 +318,44 @@ public function registerCaptureNotification($amount) $this->_generateTransactionId(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, $this->getAuthorizationTransaction() ); - $this->_avoidDoubleTransactionProcessing(); + $order = $this->getOrder(); - $invoice = null; $amount = (float)$amount; + $invoice = $this->_getInvoiceForTransactionId($this->getTransactionId()); + + // register new capture + if (!$invoice) { + if ($this->_isCaptureFinal($amount)) { + $invoice = $order->prepareInvoice()->register(); + $order->addRelatedObject($invoice); + $this->setCreatedInvoice($invoice); + } else { + $this->_updateTotals(array('base_amount_paid_online' => $amount)); + } + } - // prepare invoice if total paid is going to be equal to order grand total - // possible bug: we are not protected from case when order grand total != total authorized - if ($this->_isCaptureFinal($amount)) { - // ok, we may create an invoice - if (!$order->canInvoice()) { - Mage::throwException(Mage::helper('sales')->__('Order does not allow to create an invoice.')); + $status = true; + if ($this->getIsTransactionPending()) { + $message = Mage::helper('sales')->__('Capturing amount of %s is pending approval on gateway.', $this->_formatPrice($amount)); + $state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW; + if ($this->getIsFraudDetected()) { + $status = 'fraud'; } - $invoice = $order->prepareInvoice()->register()->pay(); - $order->addRelatedObject($invoice); - $this->setCreatedInvoice($invoice); } else { - $this->_updateTotals(array('base_amount_paid_online' => $amount)); - // shipping captured amount should be updated with the invoice + $message = Mage::helper('sales')->__('Registered notification about captured amount of %s.', $this->_formatPrice($amount)); + $state = Mage_Sales_Model_Order::STATE_PROCESSING; + // register capture for an existing invoice + if ($invoice && Mage_Sales_Model_Order_Invoice::STATE_OPEN == $invoice->getState()) { + $invoice->pay(); + $this->_updateTotals(array('base_amount_paid_online' => $amount)); + $order->addRelatedObject($invoice); + } } - // update transactions, set order state (order will close itself later if required) - $transaction = $this->_addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, $invoice); - $message = Mage::helper('sales')->__('Registered notification about captured amount of %s.', $this->_formatPrice($amount)); + $transaction = $this->_addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, $invoice, true); $message = $this->_prependMessage($message); $message = $this->_appendTransactionToMessage($transaction, $message); - $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $message); + $order->setState($state, $status, $message); return $this; } @@ -323,8 +368,7 @@ public function registerCaptureNotification($amount) */ public function registerAuthorizationNotification($amount) { - $this->_avoidDoubleTransactionProcessing(); - return $this->_authorize(false, $amount); + return ($this->_isTransactionExists()) ? $this : $this->_authorize(false, $amount); } /** @@ -504,6 +548,7 @@ public function refund($creditmemo) * Updates payment totals, updates order status and adds proper comments * TODO: potentially a full capture can be refunded. In this case if there was only one invoice for that transaction * then we should create a creditmemo from invoice and also refund it offline + * TODO: implement logic of chargebacks reimbursements (via negative amount) * * @param float $amount * @return Mage_Sales_Model_Order_Payment @@ -513,7 +558,9 @@ public function registerRefundNotification($amount) $this->_generateTransactionId(Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND, $this->_lookupTransaction($this->getParentTransactionId()) ); - $this->_avoidDoubleTransactionProcessing(); + if ($this->_isTransactionExists()) { + return $this; + } $order = $this->getOrder(); // create an offline creditmemo (from order), if the entire grand total of order is covered by this refund @@ -575,17 +622,150 @@ public function cancel() } if (!$this->hasMessage()) { - $this->setMessage($isOnline ? Mage::helper('sales')->__('Cancelled order online.') - : Mage::helper('sales')->__('Cancelled order offline.') + $this->setMessage($isOnline ? Mage::helper('sales')->__('Canceled order online.') + : Mage::helper('sales')->__('Canceled order offline.') ); } - $this->_void($isOnline, null, 'cancel'); + + if ($isOnline) { + $this->_void($isOnline, null, 'cancel'); + } Mage::dispatchEvent('sales_order_payment_cancel', array('payment' => $this)); return $this; } + /** + * Check order payment review availability + * + * @return bool + */ + public function canReviewPayment() + { + return (bool)$this->getMethodInstance()->canReviewPayment($this); + } + + public function canFetchTransactionInfo() + { + return (bool)$this->getMethodInstance()->canFetchTransactionInfo(); + } + + /** + * Accept online a payment that is in review state + * + * @return Mage_Sales_Model_Order_Payment + */ + public function accept() + { + $this->registerPaymentReviewAction(self::REVIEW_ACTION_ACCEPT, true); + return $this; + } + + /** + * Accept order with payment method instance + * + * @return Mage_Sales_Model_Order_Payment + */ + public function deny() + { + $this->registerPaymentReviewAction(self::REVIEW_ACTION_DENY, true); + return $this; + } + + /** + * Perform the payment review action: either initiated by merchant or by a notification + * + * Sets order to processing state and optionally approves invoice or cancels the order + * + * @param string $action + * @param bool $isOnline + * @return Mage_Sales_Model_Order_Payment + */ + public function registerPaymentReviewAction($action, $isOnline) + { + $order = $this->getOrder(); + + $transactionId = $isOnline ? $this->getLastTransId() : $this->getTransactionId(); + if (!$this->_lookupTransaction($transactionId)) { + Mage::throwException(Mage::helper('sales')->__('No valid transaction found for this payment review.')); + } + $invoice = $this->_getInvoiceForTransactionId($transactionId); + + // invoke the payment method to determine what to do with the transaction + $result = null; $message = null; + switch ($action) { + case self::REVIEW_ACTION_ACCEPT: + if ($isOnline) { + if ($this->getMethodInstance()->setStore($order->getStoreId())->acceptPayment($this)) { + $result = true; + $message = Mage::helper('sales')->__('Approved the payment online.'); + } else { + $result = -1; + $message = Mage::helper('sales')->__('There is no need to approve this payment.'); + } + } else { + $result = (bool)$this->getNotificationResult() ? true : -1; + $message = Mage::helper('sales')->__('Registered notification about approved payment.'); + } + break; + case self::REVIEW_ACTION_DENY: + if ($isOnline) { + if ($this->getMethodInstance()->setStore($order->getStoreId())->denyPayment($this)) { + $result = false; + $message = Mage::helper('sales')->__('Denied the payment online.'); + } else { + $result = -1; + $message = Mage::helper('sales')->__('There is no need to deny this payment.'); + } + } else { + $result = (bool)$this->getNotificationResult() ? false : -1; + $message = Mage::helper('sales')->__('Registered notification about denied payment.'); + } + break; + case self::REVIEW_ACTION_UPDATE: + if ($isOnline) { + $this->getMethodInstance()->setStore($order->getStoreId())->fetchTransactionInfo($this, $transactionId); + } else { + // notification mechanism is responsible to update the payment object first + } + if ($this->getIsTransactionApproved()) { + $result = true; + $message = Mage::helper('sales')->__('Registered update about approved payment.'); + } elseif ($this->getIsTransactionDenied()) { + $result = false; + $message = Mage::helper('sales')->__('Registered update about approved payment.'); + } else { + $result = -1; + $message = Mage::helper('sales')->__('There is no update for the payment.'); + } + break; + default: + throw new Exception('Not implemented.'); + } + $message = $this->_prependMessage($message); + $message = $this->_appendTransactionToMessage($transactionId, $message); + + // process payment in case of positive or negative result, or add a comment + if (-1 === $result) { // switch won't work with such $result! + $order->addStatusHistoryComment($message); + } elseif (true === $result) { + if ($invoice) { + $invoice->pay(); + $this->_updateTotals(array('base_amount_paid_online' => $invoice->getBaseGrandTotal())); + $order->addRelatedObject($invoice); + } + $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $message); + } elseif (false === $result) { + if ($invoice) { + $invoice->cancel(); + $order->addRelatedObject($invoice); + } + $order->registerCancellation($message, false); + } + return $this; + } + /** * Authorize payment either online or offline (process auth notification) * Updates transactions hierarchy, if required @@ -607,13 +787,17 @@ protected function _authorize($isOnline, $amount) $state = Mage_Sales_Model_Order::STATE_PROCESSING; $status = true; if ($isOnline) { - $this->getMethodInstance() - ->setStore($order->getStoreId()) - ->authorize($this, $amount); + + // invoke authorization on gateway + $this->getMethodInstance()->setStore($order->getStoreId())->authorize($this, $amount); + + // similar logic of "payment review" order as in capturing if ($this->getIsTransactionPending()) { - $status = $this->getTransactionPendingStatus() ? $this->getTransactionPendingStatus() : true; - $state = Mage_Sales_Model_Order::STATE_HOLDED; - $message = Mage::helper('sales')->__('Authorization amount %s pending approval on gateway.', $this->_formatPrice($amount)); + $message = Mage::helper('sales')->__('Authorizing amount of %s is pending approval on gateway.', $this->_formatPrice($amount)); + $state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW; + if ($this->getIsFraudDetected()) { + $status = 'fraud'; + } } else { $message = Mage::helper('sales')->__('Authorized amount of %s.', $this->_formatPrice($amount)); } @@ -623,13 +807,27 @@ protected function _authorize($isOnline, $amount) // update transactions, order state and add comments $transaction = $this->_addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH); - $message = $this->_prependMessage($message); - $message = $this->_appendTransactionToMessage($transaction, $message); + if ($order->isNominal()) { + $message = $this->_prependMessage(Mage::helper('sales')->__('Nominal order registered.')); + } else { + $message = $this->_prependMessage($message); + $message = $this->_appendTransactionToMessage($transaction, $message); + } $order->setState($state, $status, $message); return $this; } + /** + * Public access to _authorize method + * @param bool $isOnline + * @param float $amount + */ + public function authorize($isOnline, $amount) + { + return $this->_authorize($isOnline, $amount); + } + /** * Void payment either online or offline (process void notification) * NOTE: that in some cases authorization can be voided after a capture. In such case it makes sense to use @@ -651,8 +849,9 @@ protected function _void($isOnline, $amount = null, $gatewayCallback = 'void') // attempt to void if ($isOnline) { $this->getMethodInstance()->setStore($order->getStoreId())->$gatewayCallback($this); - } else { - $this->_avoidDoubleTransactionProcessing(); + } + if ($this->_isTransactionExists()) { + return $this; } // if the authorization was untouched, we may assume voided amount = order grand total @@ -748,7 +947,7 @@ protected function _addTransaction($type, $salesDocument = null, $failsafe = fal $transaction->setParentTxnId($parentTransactionId); if ($this->getShouldCloseParentTransaction()) { $parentTransaction = $this->_lookupTransaction($parentTransactionId); - if ($parentTransaction) { + if ($parentTransaction) { $parentTransaction->isFailsafe($failsafe)->close(false); $this->getOrder()->addRelatedObject($parentTransaction); } @@ -758,13 +957,53 @@ protected function _addTransaction($type, $salesDocument = null, $failsafe = fal } } + /** + * Public acces to _addTransaction method + * + * @param string $type + * @param Mage_Sales_Model_Abstract $salesDocument + * @param bool $failsafe + * @return null|Mage_Sales_Model_Order_Payment_Transaction + */ + public function addTransaction($type, $salesDocument = null, $failsafe = false) + { + return $this->_addTransaction($type, $salesDocument, $failsafe); + } + + /** + * Import details data of specified transaction + * + * @param Mage_Sales_Model_Order_Payment_Transaction $transactionTo + * @return Mage_Sales_Model_Order_Payment + */ + public function importTransactionInfo(Mage_Sales_Model_Order_Payment_Transaction $transactionTo) + { + $data = $this->getMethodInstance() + ->setStore($this->getOrder()->getStoreId()) + ->fetchTransactionInfo($this, $transactionTo->getTxnId()); + if ($data) { + $transactionTo->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $data); + } + return $this; + } + + /** + * Get the billing agreement, if any + * + * @return Mage_Sales_Model_Billing_Agreement|null + */ + public function getBillingAgreement() + { + return $this->_billingAgreement; + } + /** * Totals updater utility method * Updates self totals by keys in data array('key' => $delta) * * @param array $data */ - private function _updateTotals($data) + protected function _updateTotals($data) { foreach ($data as $key => $amount) { if (null !== $amount) { @@ -778,10 +1017,26 @@ private function _updateTotals($data) * Prevent double processing of the same transaction by a payment notification * Uses either specified txn_id or the transaction id that was set before * + * @deprecated after 1.4.0.1 * @param string $txnId * @throws Mage_Core_Exception */ protected function _avoidDoubleTransactionProcessing($txnId = null) + { + if ($this->_isTransactionExists($txnId)) { + Mage::throwException( + Mage::helper('sales')->__('Transaction "%s" was already processed.', $txnId) + ); + } + } + + /** + * Check transaction existence by specified transaction id + * + * @param string $txnId + * @return boolean + */ + protected function _isTransactionExists($txnId = null) { if (null === $txnId) { $txnId = $this->getTransactionId(); @@ -790,12 +1045,9 @@ protected function _avoidDoubleTransactionProcessing($txnId = null) $transaction = Mage::getModel('sales/order_payment_transaction') ->setOrderPaymentObject($this) ->loadByTxnId($txnId); - if ($transaction->getId()) { - Mage::throwException( - Mage::helper('sales')->__('Transaction "%s" was already processed.', $transaction->getTxnId()) - ); - } + return (bool)$transaction->getId(); } + return false; } /** @@ -805,10 +1057,11 @@ protected function _avoidDoubleTransactionProcessing($txnId = null) * @param string $message * @return string */ - private function _appendTransactionToMessage($transaction, $message) + protected function _appendTransactionToMessage($transaction, $message) { if ($transaction) { - $message .= ' ' . Mage::helper('sales')->__('Transaction ID: "%s".', $transaction->getTxnId()); + $txnId = is_object($transaction) ? $transaction->getTxnId() : $transaction; + $message .= ' ' . Mage::helper('sales')->__('Transaction ID: "%s".', $txnId); } return $message; } @@ -820,7 +1073,7 @@ private function _appendTransactionToMessage($transaction, $message) * @param string|Mage_Sales_Model_Order_Status_History $messagePrependTo * @return string|Mage_Sales_Model_Order_Status_History */ - private function _prependMessage($messagePrependTo) + protected function _prependMessage($messagePrependTo) { $preparedMessage = $this->getPreparedMessage(); if ($preparedMessage) { @@ -870,6 +1123,7 @@ protected function _lookupTransaction($txnId, $txnType = false) if (!$txnId) { if ($txnType && $this->getId()) { $collection = Mage::getModel('sales/order_payment_transaction')->getCollection() + ->setOrderFilter($this->getOrder()) ->addPaymentIdFilter($this->getId()) ->addTxnTypeFilter($txnType); foreach ($collection as $txn) { @@ -900,7 +1154,12 @@ protected function _lookupTransaction($txnId, $txnType = false) */ public function getAuthorizationTransaction() { - $txn = $this->_lookupTransaction($this->getParentTransactionId()); + if ($this->getParentTransactionId()) { + $txn = $this->_lookupTransaction($this->getParentTransactionId()); + } else { + $txn = false; + } + if (!$txn) { $txn = $this->_lookupTransaction(false, Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH); } @@ -908,12 +1167,13 @@ public function getAuthorizationTransaction() } /** - * Lookup an transaction by id + * Lookup the transaction by id + * @param string $transactionId * @return Mage_Sales_Model_Order_Payment_Transaction|false */ - public function getTransaction($transaction_id) + public function getTransaction($transactionId) { - return $this->_lookupTransaction($transaction_id); + return $this->_lookupTransaction($transactionId); } /** @@ -941,8 +1201,8 @@ protected function _generateTransactionId($type, $transactionBasedOn = false) */ protected function _isCaptureFinal($amountToCapture) { - if ((float)$this->getOrder()->getBaseGrandTotal() === - ((float)$this->getBaseAmountPaidOnline() + $amountToCapture)) { + $orderGrandTotal = sprintf('%.4F', $this->getOrder()->getBaseGrandTotal()); + if ($orderGrandTotal == sprintf('%.4F', ($this->getBaseAmountPaidOnline() + $amountToCapture))) { if (false !== $this->getShouldCloseParentTransaction()) { $this->setShouldCloseParentTransaction(true); } @@ -951,6 +1211,43 @@ protected function _isCaptureFinal($amountToCapture) return false; } + /** + * Before object save manipulations + * + * @return Mage_Sales_Model_Order_Payment + */ + protected function _beforeSave() + { + parent::_beforeSave(); + + if (!$this->getParentId() && $this->getOrder()) { + $this->setParentId($this->getOrder()->getId()); + } + + return $this; + } + + /** + * Generate billing agreement object if there is billing agreement data + * Adds it to order as related object + */ + protected function _createBillingAgreement() + { + if ($this->getBillingAgreementData()) { + $order = $this->getOrder(); + $agreement = Mage::getModel('sales/billing_agreement')->importOrderPayment($this); + if ($agreement->isValid()) { + $message = Mage::helper('sales')->__('Created billing agreement #%s.', $agreement->getReferenceId()); + $order->addRelatedObject($agreement); + $this->_billingAgreement = $agreement; + } else { + $message = Mage::helper('sales')->__('Failed to create billing agreement for this order.'); + } + $comment = $order->addStatusHistoryComment($message); + $order->addRelatedObject($comment); + } + } + /** * Additionnal transaction info setter * @@ -961,4 +1258,21 @@ public function setTransactionAdditionalInfo($key, $value) { $this->_transactionAdditionalInfo[$key] = $value; } + + /** + * Return invoice model for transaction + * + * @param string $transactionId + * @return Mage_Sales_Model_Order_Invoice + */ + protected function _getInvoiceForTransactionId($transactionId) + { + foreach ($this->getOrder()->getInvoiceCollection() as $invoice) { + if ($invoice->getTransactionId() == $transactionId) { + $invoice->load($invoice->getId()); // to make sure all data will properly load (maybe not required) + return $invoice; + } + } + return false; + } } diff --git a/app/code/core/Mage/Sales/Model/Order/Payment/Transaction.php b/app/code/core/Mage/Sales/Model/Order/Payment/Transaction.php index 39bc0ff6b8..f56b478266 100644 --- a/app/code/core/Mage/Sales/Model/Order/Payment/Transaction.php +++ b/app/code/core/Mage/Sales/Model/Order/Payment/Transaction.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -41,12 +41,26 @@ class Mage_Sales_Model_Order_Payment_Transaction extends Mage_Core_Model_Abstrac const TYPE_VOID = 'void'; const TYPE_REFUND = 'refund'; + /** + * Raw details key in additional info + * + */ + const RAW_DETAILS = 'raw_details_info'; + /** * Payment instance. Required for most transaction writing and search operations * @var Mage_Sales_Model_Order_Payment */ protected $_paymentObject = null; + + /** + * Order instance + * + * @var Mage_Sales_Model_Order_Payment + */ + protected $_order = null; + /** * Parent transaction instance * @var Mage_Sales_Model_Order_Payment_Transaction @@ -84,7 +98,30 @@ class Mage_Sales_Model_Order_Payment_Transaction extends Mage_Core_Model_Abstrac * Whether transaction has children * @var bool */ - private $_hasChild = null; + protected $_hasChild = null; + + /** + * Event object prefix + * + * @see Mage_Core_Model_Absctract::$_eventPrefix + * @var string + */ + protected $_eventPrefix = 'sales_order_payment_transaction'; + + /** + * Event object prefix + * + * @see Mage_Core_Model_Absctract::$_eventObject + * @var string + */ + protected $_eventObject = 'order_payment_transaction'; + + /** + * Order website id + * + * @var int + */ + protected $_orderWebsiteId = null; /** * Initialize resource model @@ -103,6 +140,7 @@ protected function _construct() public function setOrderPaymentObject(Mage_Sales_Model_Order_Payment $payment) { $this->_paymentObject = $payment; + $this->setOrder($payment->getOrder()); return $this; } @@ -169,13 +207,14 @@ public function getParentTransaction($shouldLoad = true) $class = get_class($this); $this->_parentTransaction = new $class; if ($shouldLoad) { - $this->_parentTransaction->load($parentId); + $this->_parentTransaction + ->setOrderPaymentObject($this->_paymentObject) + ->load($parentId); if (!$this->_parentTransaction->getId()) { $this->_parentTransaction = false; } else { $this->_parentTransaction - ->hasChildTransaction(true) - ->setOrderPaymentObject($this->_paymentObject); + ->hasChildTransaction(true); } } } @@ -347,6 +386,18 @@ public function hasChildTransaction($whetherHasChild = null) return $this->_hasChild; } + /** + * Check object before loading by by specified transaction ID + * @param $txnId + * @return Mage_Sales_Model_Order_Payment_Transaction + */ + protected function _beforeLoadByTxnId($txnId) + { + $this->_verifyPaymentObject(); + Mage::dispatchEvent($this->_eventPrefix . '_load_by_txn_id_before', $this->_getEventData() + array('txn_id' => $txnId)); + return $this; + } + /** * Load self by specified transaction ID. Requires the valid payment object to be set * @param string $txnId @@ -354,13 +405,26 @@ public function hasChildTransaction($whetherHasChild = null) */ public function loadByTxnId($txnId) { - $this->_verifyPaymentObject(); + $this->_beforeLoadByTxnId($txnId); $this->getResource()->loadObjectByTxnId( $this, $this->getOrderId(), $this->_paymentObject->getId(), $txnId ); + $this->_afterLoadByTxnId(); return $this; } + /** + * Check object after loading by by specified transaction ID + * @param $txnId + * @return Mage_Sales_Model_Order_Payment_Transaction + */ + protected function _afterLoadByTxnId() + { + Mage::dispatchEvent($this->_eventPrefix . '_load_by_txn_id_after', $this->_getEventData()); + return $this; + } + + /** * Additional information setter * Updates data inside the 'additional_information' array @@ -488,6 +552,46 @@ public function getOrderId() } } + /** + * Retrieve order instance + * + * @return Mage_Sales_Model_Order + */ + public function getOrder() + { + if ($this->_order === null) { + $this->setOrder(); + } + + return $this->_order; + } + + /** + * Set order instance for transaction depends on transaction behavior + * If $order equals to true, method isn't loading new order instance. + * + * @param Mage_Sales_Model_Order|null|boolean $order + * @return Mage_Sales_Model_Order_Payment_Transaction + */ + public function setOrder($order = null) + { + if (null === $order || $order === true) { + if (null !== $this->_paymentObject && $this->_paymentObject->getOrder()) { + $this->_order = $this->_paymentObject->getOrder(); + } elseif ($this->getOrderId() && $order === null) { + $this->_order = Mage::getModel('sales/order')->load($this->getOrderId()); + } else { + $this->_order = false; + } + } elseif (!$this->getId() || ($this->getOrderId() == $order->getId())) { + $this->_order = $order; + } else { + Mage::throwException(Mage::helper('sales')->__('Set order for existing transactions not allowed')); + } + + return $this; + } + /** * Setter/Getter whether transaction is supposed to prevent exceptions on saving * @@ -511,8 +615,18 @@ protected function _beforeSave() { // set parent id $this->_verifyPaymentObject(); - $this->setPaymentId($this->_paymentObject->getId()) - ->setOrderId($this->getOrderId()); + if (!$this->getId()) { + // We need to set order and payment ids only for new transactions + if (null !== $this->_paymentObject) { + $this->setPaymentId($this->_paymentObject->getId()); + } + + if (null !== $this->_order) { + $this->setOrderId($this->_order->getId()); + } + + $this->setCreatedAt(Mage::getModel('core/date')->gmtDate()); + } return parent::_beforeSave(); } @@ -534,8 +648,16 @@ protected function _loadChildren() Mage::throwException(Mage::helper('sales')->__('At least a payment ID must be set.')); } + $this->setOrder(true); + + $orderFilter = $this->getOrder(); // Try to get order instance for filter + if (!$orderFilter) { + $orderFilter = $this->getOrderId(); + } + // prepare children collection $children = $this->getResourceCollection() + ->setOrderFilter($orderFilter) ->addPaymentIdFilter($paymentId) ->addParentIdFilter($this->getId()); @@ -566,19 +688,56 @@ protected function _loadChildren() * TODO: implement that there should be only one void per authorization * @return bool */ - private function _isVoided() + protected function _isVoided() { $this->_verifyThisTransactionExists(); return self::TYPE_AUTH === $this->getTxnType() && (bool)count($this->getChildTransactions(self::TYPE_VOID)); } + /** + * Check whether this transaction is voided + * @return bool + */ + public function isVoided() + { + return $this->_isVoided(); + } + + /** + * Retrieve transaction types + * + * @return array + */ + public function getTransactionTypes() + { + return array( + Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH => Mage::helper('sales')->__('Authorization'), + Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE => Mage::helper('sales')->__('Capture'), + Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID => Mage::helper('sales')->__('Void'), + Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND => Mage::helper('sales')->__('Refund') + ); + } + + /** + * Retrieve order website id + * + * @return int + */ + public function getOrderWebsiteId() + { + if (is_null($this->_orderWebsiteId)) { + $this->_orderWebsiteId = (int)$this->getResource()->getOrderWebsiteId($this->getOrderId()); + } + return $this->_orderWebsiteId; + } + /** * Check whether specified or set transaction type is supported * @param string $txnType * @throws Mage_Core_Exception */ - private function _verifyTxnType($txnType = null) + protected function _verifyTxnType($txnType = null) { if (null === $txnType) { $txnType = $this->getTxnType(); @@ -591,7 +750,7 @@ private function _verifyTxnType($txnType = null) case self::TYPE_REFUND: break; default: - Mage::throwException(Mage::helper('sales')->__('Non-supported Transaction Type "%s".', $txnType)); + Mage::throwException(Mage::helper('sales')->__('Unsupported transaction type "%s".', $txnType)); } } @@ -602,7 +761,7 @@ private function _verifyTxnType($txnType = null) * @return Mage_Sales_Model_Order_Payment|null|false * @throws Mage_Core_Exception */ - private function _verifyPaymentObject($dryRun = false) + protected function _verifyPaymentObject($dryRun = false) { if (!$this->_paymentObject || !$this->getOrderId()) { if (!$dryRun) { @@ -617,7 +776,7 @@ private function _verifyPaymentObject($dryRun = false) * @param string $txnId * @throws Mage_Core_Exception */ - private function _verifyTxnId($txnId) + protected function _verifyTxnId($txnId) { if (null !== $txnId && 0 == strlen($txnId)) { Mage::throwException(Mage::helper('sales')->__('Transaction ID must not be empty.')); @@ -629,7 +788,7 @@ private function _verifyTxnId($txnId) * TODO for more restriction we can check for data consistency * @throws Mage_Core_Exception */ - private function _verifyThisTransactionExists() + protected function _verifyThisTransactionExists() { if (!$this->getId()) { Mage::throwException(Mage::helper('sales')->__('This operation requires an existing transaction object.')); diff --git a/app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php b/app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php index 2fd708356c..438cb70be6 100644 --- a/app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php +++ b/app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -389,7 +389,7 @@ protected function _getTotalsList($source) $totalInfo['model'] = $totalModel; } else { Mage::throwException( - Mage::helper('sales')->__('Pdf total model should extend Mage_Sales_Model_Order_Pdf_Total_Default') + Mage::helper('sales')->__('PDF total model should extend Mage_Sales_Model_Order_Pdf_Total_Default') ); } } else { @@ -601,7 +601,7 @@ protected function _setPdf(Zend_Pdf $pdf) protected function _getPdf() { if (!$this->_pdf instanceof Zend_Pdf) { - Mage::throwException(Mage::helper('sales')->__('Please define PDF object before using')); + Mage::throwException(Mage::helper('sales')->__('Please define PDF object before using.')); } return $this->_pdf; @@ -652,7 +652,7 @@ public function drawLineBlocks(Zend_Pdf_Page $page, array $draw, array $pageSett { foreach ($draw as $itemsProp) { if (!isset($itemsProp['lines']) || !is_array($itemsProp['lines'])) { - Mage::throwException(Mage::helper('sales')->__('Invalid draw line data. Please define "lines" array')); + Mage::throwException(Mage::helper('sales')->__('Invalid draw line data. Please define "lines" array.')); } $lines = $itemsProp['lines']; $height = isset($itemsProp['height']) ? $itemsProp['height'] : 10; diff --git a/app/code/core/Mage/Sales/Model/Order/Pdf/Creditmemo.php b/app/code/core/Mage/Sales/Model/Order/Pdf/Creditmemo.php index 06c86ab833..ea04efb33a 100644 --- a/app/code/core/Mage/Sales/Model/Order/Pdf/Creditmemo.php +++ b/app/code/core/Mage/Sales/Model/Order/Pdf/Creditmemo.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -115,7 +115,7 @@ protected function _drawHeader(Zend_Pdf_Page $page) $page->drawText(Mage::helper('sales')->__('SKU'), $x, $this->y, 'UTF-8'); $x += 100; - $text = Mage::helper('sales')->__('Total(ex)'); + $text = Mage::helper('sales')->__('Total (ex)'); $page->drawText($text, $this->getAlignRight($text, $x, 50, $font, $size), $this->y, 'UTF-8'); $x += 50; @@ -123,7 +123,7 @@ protected function _drawHeader(Zend_Pdf_Page $page) $page->drawText($text, $this->getAlignRight($text, $x, 50, $font, $size), $this->y, 'UTF-8'); $x += 50; - $text = Mage::helper('sales')->__('QTY'); + $text = Mage::helper('sales')->__('Qty'); $page->drawText($text, $this->getAlignCenter($text, $x, 30, $font, $size), $this->y, 'UTF-8'); $x += 30; @@ -131,7 +131,7 @@ protected function _drawHeader(Zend_Pdf_Page $page) $page->drawText($text, $this->getAlignRight($text, $x, 45, $font, $size, 10), $this->y, 'UTF-8'); $x += 45; - $text = Mage::helper('sales')->__('Total(inc)'); + $text = Mage::helper('sales')->__('Total (inc)'); $page->drawText($text, $this->getAlignRight($text, $x, 570 - $x, $font, $size), $this->y, 'UTF-8'); } diff --git a/app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php b/app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php index 904cc4bb92..f4f0d5a01b 100644 --- a/app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php +++ b/app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -80,7 +80,7 @@ public function getPdf($invoices = array()) $page->drawText(Mage::helper('sales')->__('Products'), 35, $this->y, 'UTF-8'); $page->drawText(Mage::helper('sales')->__('SKU'), 255, $this->y, 'UTF-8'); $page->drawText(Mage::helper('sales')->__('Price'), 380, $this->y, 'UTF-8'); - $page->drawText(Mage::helper('sales')->__('QTY'), 430, $this->y, 'UTF-8'); + $page->drawText(Mage::helper('sales')->__('Qty'), 430, $this->y, 'UTF-8'); $page->drawText(Mage::helper('sales')->__('Tax'), 480, $this->y, 'UTF-8'); $page->drawText(Mage::helper('sales')->__('Subtotal'), 535, $this->y, 'UTF-8'); @@ -140,7 +140,7 @@ public function newPage(array $settings = array()) $page->drawText(Mage::helper('sales')->__('Product'), 35, $this->y, 'UTF-8'); $page->drawText(Mage::helper('sales')->__('SKU'), 255, $this->y, 'UTF-8'); $page->drawText(Mage::helper('sales')->__('Price'), 380, $this->y, 'UTF-8'); - $page->drawText(Mage::helper('sales')->__('QTY'), 430, $this->y, 'UTF-8'); + $page->drawText(Mage::helper('sales')->__('Qty'), 430, $this->y, 'UTF-8'); $page->drawText(Mage::helper('sales')->__('Tax'), 480, $this->y, 'UTF-8'); $page->drawText(Mage::helper('sales')->__('Subtotal'), 535, $this->y, 'UTF-8'); diff --git a/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Abstract.php b/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Abstract.php index e9e5c18d94..75efae8832 100644 --- a/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Abstract.php +++ b/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Creditmemo/Default.php b/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Creditmemo/Default.php index 48ad454541..8f71c258a2 100644 --- a/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Creditmemo/Default.php +++ b/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Creditmemo/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Creditmemo/Grouped.php b/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Creditmemo/Grouped.php index 575353abc7..b268d71197 100644 --- a/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Creditmemo/Grouped.php +++ b/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Creditmemo/Grouped.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php b/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php index fef3de3f59..6a12a84862 100644 --- a/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php +++ b/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Grouped.php b/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Grouped.php index 6d33dcfe46..408bf74571 100644 --- a/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Grouped.php +++ b/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Grouped.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Shipment/Default.php b/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Shipment/Default.php index e887c548ef..12483199df 100644 --- a/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Shipment/Default.php +++ b/app/code/core/Mage/Sales/Model/Order/Pdf/Items/Shipment/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Pdf/Shipment.php b/app/code/core/Mage/Sales/Model/Order/Pdf/Shipment.php index b0feceb36a..62395b6b41 100644 --- a/app/code/core/Mage/Sales/Model/Order/Pdf/Shipment.php +++ b/app/code/core/Mage/Sales/Model/Order/Pdf/Shipment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -75,7 +75,7 @@ public function getPdf($shipments = array()) $page->drawRectangle(25, $this->y, 570, $this->y-15); $this->y -=10; $page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4)); - $page->drawText(Mage::helper('sales')->__('QTY'), 35, $this->y, 'UTF-8'); + $page->drawText(Mage::helper('sales')->__('Qty'), 35, $this->y, 'UTF-8'); $page->drawText(Mage::helper('sales')->__('Products'), 60, $this->y, 'UTF-8'); $page->drawText(Mage::helper('sales')->__('SKU'), 470, $this->y, 'UTF-8'); @@ -128,7 +128,7 @@ public function newPage(array $settings = array()) $this->y -=10; $page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4)); - $page->drawText(Mage::helper('sales')->__('QTY'), 35, $this->y, 'UTF-8'); + $page->drawText(Mage::helper('sales')->__('Qty'), 35, $this->y, 'UTF-8'); $page->drawText(Mage::helper('sales')->__('Products'), 60, $this->y, 'UTF-8'); $page->drawText(Mage::helper('sales')->__('SKU'), 470, $this->y, 'UTF-8'); diff --git a/app/code/core/Mage/Sales/Model/Order/Pdf/Total/Default.php b/app/code/core/Mage/Sales/Model/Order/Pdf/Total/Default.php index d8782715a4..abe2abc34f 100644 --- a/app/code/core/Mage/Sales/Model/Order/Pdf/Total/Default.php +++ b/app/code/core/Mage/Sales/Model/Order/Pdf/Total/Default.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Shipment.php b/app/code/core/Mage/Sales/Model/Order/Shipment.php index 644390d9fd..bed41c036c 100644 --- a/app/code/core/Mage/Sales/Model/Order/Shipment.php +++ b/app/code/core/Mage/Sales/Model/Order/Shipment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -49,6 +49,7 @@ class Mage_Sales_Model_Order_Shipment extends Mage_Sales_Model_Abstract protected $_items; protected $_tracks; protected $_order; + protected $_comments; protected $_eventPrefix = 'sales_order_shipment'; protected $_eventObject = 'shipment'; @@ -150,7 +151,7 @@ public function register() { if ($this->getId()) { Mage::throwException( - Mage::helper('sales')->__('Can not register existing shipment') + Mage::helper('sales')->__('Cannot register existing shipment') ); } @@ -175,7 +176,6 @@ public function getItemsCollection() { if (empty($this->_items)) { $this->_items = Mage::getResourceModel('sales/order_shipment_item_collection') - ->addAttributeToSelect('*') ->setShipmentFilter($this->getId()); if ($this->getId()) { @@ -224,7 +224,6 @@ public function getTracksCollection() { if (empty($this->_tracks)) { $this->_tracks = Mage::getResourceModel('sales/order_shipment_track_collection') - ->addAttributeToSelect('*') ->setShipmentFilter($this->getId()); if ($this->getId()) { @@ -289,9 +288,14 @@ public function getCommentsCollection($reload=false) { if (is_null($this->_comments) || $reload) { $this->_comments = Mage::getResourceModel('sales/order_shipment_comment_collection') - ->addAttributeToSelect('*') ->setShipmentFilter($this->getId()) ->setCreatedAtOrder(); + + /** + * When shipment created with adding comment, comments collection must be loaded before we added this comment. + */ + $this->_comments->load(); + if ($this->getId()) { foreach ($this->_comments as $comment) { $comment->setShipment($this); @@ -330,6 +334,8 @@ public function sendEmail($notifyCustomer=true, $comment='') } $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment()) ->setIsSecureMode(true); + $paymentBlock->getMethod()->setStore($order->getStore()->getId()); + $mailTemplate = Mage::getModel('core/email_template'); if ($order->getCustomerIsGuest()) { @@ -478,13 +484,24 @@ protected function _getEmails($configPath) return false; } + /** + * Before object save + * + * @return Mage_Sales_Model_Order_Shipment + */ protected function _beforeSave() { - if (!count($this->getAllItems())) { + if ((!$this->getId() || null !== $this->_items) && !count($this->getAllItems())) { Mage::throwException( Mage::helper('sales')->__('Cannot create an empty shipment.') ); } + + if (!$this->getOrderId() && $this->getOrder()) { + $this->setOrderId($this->getOrder()->getId()); + $this->setShippingAddressId($this->getOrder()->getShippingAddress()->getId()); + } + return parent::_beforeSave(); } @@ -494,6 +511,34 @@ protected function _beforeDelete() return parent::_beforeDelete(); } + /** + * After object save manipulations + * + * @return Mage_Sales_Model_Order_Shipment + */ + protected function _afterSave() + { + if (null !== $this->_items) { + foreach ($this->_items as $item) { + $item->save(); + } + } + + if (null !== $this->_tracks) { + foreach($this->_tracks as $track) { + $track->save(); + } + } + + if (null !== $this->_comments) { + foreach($this->_comments as $comment) { + $comment->save(); + } + } + + return parent::_afterSave(); + } + /** * Retrieve store model instance * diff --git a/app/code/core/Mage/Sales/Model/Order/Shipment/Api.php b/app/code/core/Mage/Sales/Model/Order/Shipment/Api.php index 13098eedb4..0473f1ee1c 100644 --- a/app/code/core/Mage/Sales/Model/Order/Shipment/Api.php +++ b/app/code/core/Mage/Sales/Model/Order/Shipment/Api.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -146,7 +146,7 @@ public function create($orderIncrementId, $itemsQty = array(), $comment = null, * Check shipment create availability */ if (!$order->canShip()) { - $this->_fault('data_invalid', Mage::helper('sales')->__('Can not do shipment for order.')); + $this->_fault('data_invalid', Mage::helper('sales')->__('Cannot do shipment for order.')); } /* @var $shipment Mage_Sales_Model_Order_Shipment */ diff --git a/app/code/core/Mage/Sales/Model/Order/Shipment/Api/V2.php b/app/code/core/Mage/Sales/Model/Order/Shipment/Api/V2.php index 8d7b582b2a..0e47e8a4d5 100644 --- a/app/code/core/Mage/Sales/Model/Order/Shipment/Api/V2.php +++ b/app/code/core/Mage/Sales/Model/Order/Shipment/Api/V2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -125,7 +125,7 @@ public function create($orderIncrementId, $itemsQty = array(), $comment = null, * Check shipment create availability */ if (!$order->canShip()) { - $this->_fault('data_invalid', Mage::helper('sales')->__('Can not do shipment for order.')); + $this->_fault('data_invalid', Mage::helper('sales')->__('Cannot do shipment for order.')); } /* @var $shipment Mage_Sales_Model_Order_Shipment */ diff --git a/app/code/core/Mage/Sales/Model/Order/Shipment/Comment.php b/app/code/core/Mage/Sales/Model/Order/Shipment/Comment.php index 1692153d94..9e3a732a3f 100644 --- a/app/code/core/Mage/Sales/Model/Order/Shipment/Comment.php +++ b/app/code/core/Mage/Sales/Model/Order/Shipment/Comment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -76,4 +76,20 @@ public function getStore() } return Mage::app()->getStore(); } + + /** + * Before object save + * + * @return Mage_Sales_Model_Order_Shipment_Comment + */ + protected function _beforeSave() + { + parent::_beforeSave(); + + if (!$this->getParentId() && $this->getShipment()) { + $this->setParentId($this->getShipment()->getId()); + } + + return $this; + } } diff --git a/app/code/core/Mage/Sales/Model/Order/Shipment/Item.php b/app/code/core/Mage/Sales/Model/Order/Shipment/Item.php index 7d92ffbe34..2af3ab2234 100644 --- a/app/code/core/Mage/Sales/Model/Order/Shipment/Item.php +++ b/app/code/core/Mage/Sales/Model/Order/Shipment/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -136,4 +136,20 @@ public function register() return $this; } + /** + * Before object save + * + * @return Mage_Sales_Model_Order_Shipment_Item + */ + protected function _beforeSave() + { + parent::_beforeSave(); + + if (!$this->getParentId() && $this->getShipment()) { + $this->setParentId($this->getShipment()->getId()); + } + + return $this; + } + } diff --git a/app/code/core/Mage/Sales/Model/Order/Shipment/Track.php b/app/code/core/Mage/Sales/Model/Order/Shipment/Track.php index 3d7b9c3a70..e5ddc08f7c 100644 --- a/app/code/core/Mage/Sales/Model/Order/Shipment/Track.php +++ b/app/code/core/Mage/Sales/Model/Order/Shipment/Track.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -116,4 +116,20 @@ public function getStore() } return Mage::app()->getStore(); } + + /** + * Before object save + * + * @return Mage_Sales_Model_Order_Shipment_Track + */ + protected function _beforeSave() + { + parent::_beforeSave(); + + if (!$this->getParentId() && $this->getShipment()) { + $this->setParentId($this->getShipment()->getId()); + } + + return $this; + } } diff --git a/app/code/core/Mage/Sales/Model/Order/Status.php b/app/code/core/Mage/Sales/Model/Order/Status.php index f64917661a..640abd1b98 100644 --- a/app/code/core/Mage/Sales/Model/Order/Status.php +++ b/app/code/core/Mage/Sales/Model/Order/Status.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Order/Status/History.php b/app/code/core/Mage/Sales/Model/Order/Status/History.php index ed58805c0d..286bd9bbc3 100644 --- a/app/code/core/Mage/Sales/Model/Order/Status/History.php +++ b/app/code/core/Mage/Sales/Model/Order/Status/History.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -40,10 +40,14 @@ class Mage_Sales_Model_Order_Status_History extends Mage_Sales_Model_Abstract /** * Whether setting order again is required (for example when setting non-saved yet order) + * @deprecated after 1.4, wrong logic of setting order id * @var bool */ private $_shouldSetOrderBeforeSave = false; + protected $_eventPrefix = 'sales_order_status_history'; + protected $_eventObject = 'status_history'; + /** * Initialize resource model */ @@ -61,11 +65,8 @@ protected function _construct() public function setOrder(Mage_Sales_Model_Order $order) { $this->_order = $order; - $id = $order->getId(); - if (!$id) { - $this->_shouldSetOrderBeforeSave = true; - } - return $this->setParentId($id)->setStoreId($order->getStoreId()); + $this->setStoreId($order->getStoreId()); + return $this; } /** @@ -130,13 +131,17 @@ public function getStore() /** * Set order again if required + * * @return Mage_Sales_Model_Order_Status_History */ protected function _beforeSave() { - if ($this->_shouldSetOrderBeforeSave) { - $this->setOrder($this->_order); + parent::_beforeSave(); + + if (!$this->getParentId() && $this->getOrder()) { + $this->setParentId($this->getOrder()->getId()); } - return parent::_beforeSave(); + + return $this; } } diff --git a/app/code/core/Mage/Sales/Model/Order/Tax.php b/app/code/core/Mage/Sales/Model/Order/Tax.php index a5400d31a0..3e0b6aeb1b 100644 --- a/app/code/core/Mage/Sales/Model/Order/Tax.php +++ b/app/code/core/Mage/Sales/Model/Order/Tax.php @@ -20,10 +20,13 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +/** + * @deprecated after 1.4, moved to tax module + */ class Mage_Sales_Model_Order_Tax extends Mage_Core_Model_Abstract { protected function _construct() diff --git a/app/code/core/Mage/Sales/Model/Order/Total.php b/app/code/core/Mage/Sales/Model/Order/Total.php index fad91dd9d2..1a7e8f5321 100644 --- a/app/code/core/Mage/Sales/Model/Order/Total.php +++ b/app/code/core/Mage/Sales/Model/Order/Total.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Payment/Method/Billing/AgreementAbstract.php b/app/code/core/Mage/Sales/Model/Payment/Method/Billing/AgreementAbstract.php new file mode 100644 index 0000000000..b1109e5a87 --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Payment/Method/Billing/AgreementAbstract.php @@ -0,0 +1,106 @@ + + */ +abstract class Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract extends Mage_Payment_Model_Method_Abstract +{ + /** + * Transport billing agreement id + * + */ + const TRANSPORT_BILLING_AGREEMENT_ID = 'ba_agreement_id'; + const PAYMENT_INFO_REFERENCE_ID = 'ba_reference_id'; + + protected $_infoBlockType = 'sales/payment_info_billing_agreement'; + protected $_formBlockType = 'sales/payment_form_billing_agreement'; + + /** + * Is method instance available + * + * @var null|bool + */ + protected $_isAvailable = null; + + /** + * Check whether method is available + * + * @param Mage_Sales_Model_Quote $quote + * @return bool + */ + public function isAvailable($quote = null) + { + if (is_null($this->_isAvailable)) { + if (is_object($quote) && $quote->getCustomer()) { + $availableBA = Mage::getModel('sales/billing_agreement')->getAvailableCustomerBillingAgreements( + $quote->getCustomer()->getId() + ); + $this->_canUseCheckout = count($availableBA) > 0; + } + $this->_isAvailable = parent::isAvailable($quote) && $this->_isAvailable($quote); + $this->_canUseCheckout = ($this->_isAvailable && $this->_canUseCheckout); + } + return $this->_isAvailable; + } + + /** + * Assign data to info model instance + * + * @param mixed $data + * @return Mage_Payment_Model_Info + */ + public function assignData($data) + { + $result = parent::assignData($data); + + $key = self::TRANSPORT_BILLING_AGREEMENT_ID; + $id = false; + if (is_array($data) && isset($data[$key])) { + $id = $data[$key]; + } elseif ($data instanceof Varien_Object && $data->getData($key)) { + $id = $data->getData($key); + } + if ($id) { + $info = $this->getInfoInstance(); + $ba = Mage::getModel('sales/billing_agreement')->load($id); + if ($ba->getId() && $ba->getCustomerId() == $info->getQuote()->getCustomer()->getId()) { + $info->setAdditionalInformation($key, $id) + ->setAdditionalInformation(self::PAYMENT_INFO_REFERENCE_ID, $ba->getReferenceId()); + } + } + return $result; + } + + /** + * + * + * @param unknown_type $quote + */ + abstract protected function _isAvailable($quote); +} diff --git a/app/code/core/Mage/Sales/Model/Quote.php b/app/code/core/Mage/Sales/Model/Quote.php index 80d8f8c231..bd1c22369d 100644 --- a/app/code/core/Mage/Sales/Model/Quote.php +++ b/app/code/core/Mage/Sales/Model/Quote.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -229,6 +229,19 @@ public function loadByCustomer($customer) return $this; } + /** + * Loading only active quote + * + * @param int $quoteId + * @return Mage_Sales_Model_Quote + */ + public function loadActive($quoteId) + { + $this->_getResource()->loadActive($this, $quoteId); + $this->_afterLoad(); + return $this; + } + /** * Assign customer model object data to quote * @@ -616,6 +629,18 @@ public function removeItem($itemId) */ public function addItem(Mage_Sales_Model_Quote_Item $item) { + /** + * Temporary workaround for purchase process: it is too dangerous to purchase more than one nominal item + * or a mixture of nominal and non-nominal items, although technically possible. + * + * The problem is that currently it is implemented as sequential submission of nominal items and order, by one click. + * It makes logically impossible to make the process of the purchase failsafe. + * Proper solution is to submit items one by one with customer confirmation each time. + */ + if ($item->isNominal() && $this->hasItems() || $this->hasNominalItems()) { + Mage::throwException(Mage::helper('sales')->__('Nominal item can be purchased standalone only. To proceed please remove other items from the quote.')); + } + $item->setQuote($this); if (!$item->getId()) { $this->getItemsCollection()->addItem($item); @@ -642,7 +667,7 @@ public function addProduct(Mage_Catalog_Model_Product $product, $request=null) $request = new Varien_Object(array('qty'=>$request)); } if (!($request instanceof Varien_Object)) { - Mage::throwException(Mage::helper('sales')->__('Invalid request for adding product to quote')); + Mage::throwException(Mage::helper('sales')->__('Invalid request for adding product to quote.')); } $cartCandidates = $product->getTypeInstance(true) @@ -732,6 +757,7 @@ protected function _addCatalogProduct(Mage_Catalog_Model_Product $product, $qty $item->setOptions($product->getCustomOptions()) ->setProduct($product); + $this->addItem($item); return $item; @@ -1194,6 +1220,81 @@ public function merge(Mage_Sales_Model_Quote $quote) return $this; } + /** + * Whether there are recurring items + * + * @return bool + */ + public function hasRecurringItems() + { + foreach ($this->getAllVisibleItems() as $item) { + if ($item->getProduct() && $item->getProduct()->isRecurring()) { + return true; + } + } + return false; + } + + /** + * Getter whether quote has nominal items + * Can bypass treating virtual items as nominal + * + * @param bool $countVirtual + * @return bool + */ + public function hasNominalItems($countVirtual = true) + { + foreach ($this->getAllVisibleItems() as $item) { + if ($item->isNominal()) { + if ((!$countVirtual) && $item->getProduct()->isVirtual()) { + continue; + } + return true; + } + } + return false; + } + + /** + * Whether quote has nominal items only + * + * @return bool + */ + public function isNominal() + { + foreach ($this->getAllVisibleItems() as $item) { + if (!$item->isNominal()) { + return false; + } + } + return true; + } + + /** + * Create recurring payment profiles basing on the current items + * + * @return array + */ + public function prepareRecurringPaymentProfiles() + { + if (!$this->getTotalsCollectedFlag()) { + // Whoops! Make sure nominal totals must be calculated here. + throw new Exception('Quote totals must be collected before this operation.'); + } + + $result = array(); + foreach ($this->getAllVisibleItems() as $item) { + $product = $item->getProduct(); + if (is_object($product) && ($product->isRecurring()) + && $profile = Mage::getModel('sales/recurring_profile')->importProduct($product)) { + $profile->importQuote($this); + $profile->importQuoteItem($item); + $result[] = $profile; + } + } + return $result; + } + protected function _validateCouponCode() { $code = $this->_getData('coupon_code'); diff --git a/app/code/core/Mage/Sales/Model/Quote/Address.php b/app/code/core/Mage/Sales/Model/Quote/Address.php index 47fccedca5..876a634c16 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Address.php +++ b/app/code/core/Mage/Sales/Model/Quote/Address.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -80,6 +80,13 @@ class Mage_Sales_Model_Quote_Address extends Mage_Customer_Model_Address_Abstrac protected $_totalAmounts = array(); protected $_baseTotalAmounts = array(); + /** + * Whether to segregate by nominal items only + * + * @var bool + */ + protected $_nominalOnly = null; + /** * Initialize resource */ @@ -256,7 +263,7 @@ public function getAllItems() $items = array(); if ($this->getQuote()->getIsMultiShipping() && $addressItems->count() > 0) { foreach ($addressItems as $aItem) { - if ($aItem->isDeleted()) { + if ($aItem->isDeleted() || !$this->_filterNominal($aItem)) { continue; } @@ -272,7 +279,7 @@ public function getAllItems() } else { $isQuoteVirtual = $this->getQuote()->isVirtual(); foreach ($quoteItems as $qItem) { - if ($qItem->isDeleted()) { + if ($qItem->isDeleted() || !$this->_filterNominal($qItem)) { continue; } @@ -294,6 +301,50 @@ public function getAllItems() return $items; } + /** + * Getter for all non-nominal items + * + * @return array + */ + public function getAllNonNominalItems() + { + $this->_nominalOnly = false; + $result = $this->getAllItems(); + $this->_nominalOnly = null; + return $result; + } + + /** + * Getter for all nominal items + * + * @return array + */ + public function getAllNominalItems() + { + $this->_nominalOnly = true; + $result = $this->getAllItems(); + $this->_nominalOnly = null; + return $result; + } + + /** + * Segregate by nominal criteria + * + * true: get nominals only + * false: get non-nominals only + * null: get all + * + * @param Mage_Sales_Model_Quote_Item_Abstract + * @return Mage_Sales_Model_Quote_Item_Abstract|false + */ + protected function _filterNominal($item) + { + return (null === $this->_nominalOnly) + || ((false === $this->_nominalOnly) && !$item->isNominal()) + || ((true === $this->_nominalOnly) && $item->isNominal()) + ? $item : false; + } + /** * Retrieve all visible items * @@ -461,6 +512,9 @@ public function getShippingRatesCollection() if (is_null($this->_rates)) { $this->_rates = Mage::getModel('sales/quote_address_rate')->getCollection() ->setAddressFilter($this->getId()); + if ($this->getQuote()->hasNominalItems(false)) { + $this->_rates->setFixedOnlyFilter(true); + } if ($this->getId()) { foreach ($this->_rates as $rate) { $rate->setAddress($this); @@ -605,8 +659,28 @@ public function collectShippingRates() return $this; } + $found = $this->requestShippingRates(); + if (!$found) { + $this->setShippingAmount(0) + ->setBaseShippingAmount(0) + ->setShippingMethod('') + ->setShippingDescription(''); + } + + return $this; + } + + /** + * Request shipping rates for entire address or specified address item + * Returns true if current selected shipping method code corresponds to one of the found rates + * + * @param Mage_Sales_Model_Quote_Item_Abstract $item + * @return bool + */ + public function requestShippingRates(Mage_Sales_Model_Quote_Item_Abstract $item = null) + { $request = Mage::getModel('shipping/rate_request'); - $request->setAllItems($this->getAllItems()); + $request->setAllItems($item ? array($item) : $this->getAllItems()); $request->setDestCountryId($this->getCountryId()); $request->setDestRegionId($this->getRegionId()); $request->setDestRegionCode($this->getRegionCode()); @@ -617,12 +691,17 @@ public function collectShippingRates() $request->setDestStreet($this->getStreet(-1)); $request->setDestCity($this->getCity()); $request->setDestPostcode($this->getPostcode()); - $request->setPackageValue($this->getBaseSubtotal()); - $request->setPackageValueWithDiscount($this->getBaseSubtotalWithDiscount()); - $request->setPackageWeight($this->getWeight()); - $request->setPackageQty($this->getItemQty()); + $request->setPackageValue($item ? $item->getBaseRowTotal() : $this->getBaseSubtotal()); + $request->setPackageValueWithDiscount($item ? $item->getBaseRowTotal() - $item->getBaseDiscountAmount() : $this->getBaseSubtotalWithDiscount()); + $request->setPackageWeight($item ? $item->getRowWeight() : $this->getWeight()); + $request->setPackageQty($item ? $item->getQty() : $this->getItemQty()); + + /** + * Need for shipping methods that use insurance based on price of physical products + */ + $request->setPackagePhysicalValue($item ? $item->getBaseRowTotal() : $this->getBaseSubtotal() - $this->getBaseVirtualAmount()); - $request->setFreeMethodWeight($this->getFreeMethodWeight()); + $request->setFreeMethodWeight($item ? 0 : $this->getFreeMethodWeight()); /** * Store and website identifiers need specify from quote @@ -640,9 +719,7 @@ public function collectShippingRates() $request->setPackageCurrency($this->getQuote()->getStore()->getCurrentCurrency()); $request->setLimitCarrier($this->getLimitCarrier()); - $result = Mage::getModel('shipping/shipping') - ->collectRates($request) - ->getResult(); + $result = Mage::getModel('shipping/shipping')->collectRates($request)->getResult(); $found = false; if ($result) { @@ -651,23 +728,28 @@ public function collectShippingRates() foreach ($shippingRates as $shippingRate) { $rate = Mage::getModel('sales/quote_address_rate') ->importShippingRate($shippingRate); - $this->addShippingRate($rate); + if (!$item) { + $this->addShippingRate($rate); + } + + if ($this->getShippingMethod() == $rate->getCode()) { + if ($item) { + $item->setBaseShippingAmount($rate->getPrice()); + } else { + /** + * possible bug: this should be setBaseShippingAmount(), + * see Mage_Sales_Model_Quote_Address_Total_Shipping::collect() + * where this value is set again from the current specified rate price + * (looks like a workaround for this bug) + */ + $this->setShippingAmount($rate->getPrice()); + } - if ($this->getShippingMethod()==$rate->getCode()) { - $this->setShippingAmount($rate->getPrice()); $found = true; } } } - - if (!$found) { - $this->setShippingAmount(0) - ->setBaseShippingAmount(0) - ->setShippingMethod('') - ->setShippingDescription(''); - } - - return $this; + return $found; } /** @@ -809,15 +891,6 @@ public function setAppliedTaxes($data) public function setShippingAmount($value, $alreadyExclTax = false) { return $this->setData('shipping_amount', $value); -// -// if (Mage::helper('tax')->shippingPriceIncludesTax()) { -// $includingTax = Mage::helper('tax')->getShippingPrice($value, true, $this, $this->getQuote()->getCustomerTaxClassId()); -// if (!$alreadyExclTax) { -// $value = Mage::helper('tax')->getShippingPrice($value, false, $this, $this->getQuote()->getCustomerTaxClassId()); -// } -// $this->setShippingTaxAmount($includingTax - $value); -// } -// return $this->setData('shipping_amount', $value); } /** @@ -830,15 +903,6 @@ public function setShippingAmount($value, $alreadyExclTax = false) public function setBaseShippingAmount($value, $alreadyExclTax = false) { return $this->setData('base_shipping_amount', $value); -// -// if (Mage::helper('tax')->shippingPriceIncludesTax()) { -// $includingTax = Mage::helper('tax')->getShippingPrice($value, true, $this, $this->getQuote()->getCustomerTaxClassId()); -// if (!$alreadyExclTax) { -// $value = Mage::helper('tax')->getShippingPrice($value, false, $this, $this->getQuote()->getCustomerTaxClassId()); -// } -// $this->setBaseShippingTaxAmount($includingTax - $value); -// } -// return $this->setData('base_shipping_amount', $value); } /** diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Item.php b/app/code/core/Mage/Sales/Model/Quote/Address/Item.php index 7a2f703319..2f0a770248 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Address/Item.php +++ b/app/code/core/Mage/Sales/Model/Quote/Address/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Rate.php b/app/code/core/Mage/Sales/Model/Quote/Address/Rate.php index d40e4b2aa5..a2f1b38fbe 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Address/Rate.php +++ b/app/code/core/Mage/Sales/Model/Quote/Address/Rate.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total.php index 11d22f9071..a813fbc23c 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Address/Total.php +++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Abstract.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Abstract.php index 7810f172cd..162196700a 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Abstract.php +++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -42,6 +42,20 @@ abstract class Mage_Sales_Model_Quote_Address_Total_Abstract protected $_code; protected $_address = null; + /** + * Various abstract abilities + * @var bool + */ + protected $_canAddAmountToAddress = true; + protected $_canSetAddressAmount = true; + + /** + * Key for item row total getting + * + * @var string + */ + protected $_itemRowTotalKey = null; + /** * Set total code code name * @@ -64,6 +78,16 @@ public function getCode() return $this->_code; } + /** + * Label getter + * + * @return string + */ + public function getLabel() + { + return ''; + } + /** * Collect totals process. * @@ -115,7 +139,7 @@ protected function _getAddress() { if ($this->_address === null) { Mage::throwException( - Mage::helper('sales')->__('Address model is not defined') + Mage::helper('sales')->__('Address model is not defined.') ); } return $this->_address; @@ -129,7 +153,9 @@ protected function _getAddress() */ protected function _setAmount($amount) { - $this->_getAddress()->setTotalAmount($this->getCode(), $amount); + if ($this->_canSetAddressAmount) { + $this->_getAddress()->setTotalAmount($this->getCode(), $amount); + } return $this; } @@ -141,7 +167,9 @@ protected function _setAmount($amount) */ protected function _setBaseAmount($baseAmount) { - $this->_getAddress()->setBaseTotalAmount($this->getCode(), $baseAmount); + if ($this->_canSetAddressAmount) { + $this->_getAddress()->setBaseTotalAmount($this->getCode(), $baseAmount); + } return $this; } @@ -153,7 +181,9 @@ protected function _setBaseAmount($baseAmount) */ protected function _addAmount($amount) { - $this->_getAddress()->addTotalAmount($this->getCode(),$amount); + if ($this->_canAddAmountToAddress) { + $this->_getAddress()->addTotalAmount($this->getCode(),$amount); + } return $this; } @@ -165,10 +195,65 @@ protected function _addAmount($amount) */ protected function _addBaseAmount($baseAmount) { - $this->_getAddress()->addBaseTotalAmount($this->getCode(), $baseAmount); + if ($this->_canAddAmountToAddress) { + $this->_getAddress()->addBaseTotalAmount($this->getCode(), $baseAmount); + } return $this; } + /** + * Get all items except nominals + * + * @param Mage_Sales_Model_Quote_Address $address + * @return array + */ + protected function _getAddressItems(Mage_Sales_Model_Quote_Address $address) + { + return $address->getAllNonNominalItems(); + } + + /** + * Getter for row default total + * + * @param Mage_Sales_Model_Quote_Item_Abstract $item + * @return float + */ + public function getItemRowTotal(Mage_Sales_Model_Quote_Item_Abstract $item) + { + if (!$this->_itemRowTotalKey) { + return 0; + } + return $item->getDataUsingMethod($this->_itemRowTotalKey); + } + + /** + * Getter for row default base total + * + * @param Mage_Sales_Model_Quote_Item_Abstract $item + * @return float + */ + public function getItemBaseRowTotal(Mage_Sales_Model_Quote_Item_Abstract $item) + { + if (!$this->_itemRowTotalKey) { + return 0; + } + return $item->getDataUsingMethod('base_' . $this->_itemRowTotalKey); + } + + /** + * Whether the item row total may be compouded with others + * + * @param Mage_Sales_Model_Quote_Item_Abstract $item + * @return bool + */ + public function getIsItemRowTotalCompoundable(Mage_Sales_Model_Quote_Item_Abstract $item) + { + if ($item->getData("skip_compound_{$this->_itemRowTotalKey}")) { + return false; + } + return true; + } + /** * Process model configuration array. * This method can be used for changing models apply sort order diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Collector.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Collector.php index 84cf073a23..6d93b867bb 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Collector.php +++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Collector.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -32,6 +32,20 @@ class Mage_Sales_Model_Quote_Address_Total_Collector protected $_retrievers = array(); protected $_store; + /** + * Configuration path where to collect registered totals + * + * @var string + */ + protected $_totalsConfigNode = 'global/sales/quote/totals'; + + /** + * Cache key for collectors + * + * @var string + */ + protected $_collectorsCacheKey = 'sorted_quote_collectors'; + public function __construct($options) { @@ -72,7 +86,7 @@ public function getRetrievers() */ protected function _initModels() { - $totalsConfig = Mage::getConfig()->getNode('global/sales/quote/totals'); + $totalsConfig = Mage::getConfig()->getNode($this->_totalsConfigNode); foreach ($totalsConfig->children() as $totalCode=>$totalConfig) { $class = $totalConfig->getClassName(); @@ -88,7 +102,7 @@ protected function _initModels() $this->_models[$totalCode] = $model; } else { Mage::throwException( - Mage::helper('sales')->__('Address total model should be extended from Mage_Sales_Model_Quote_Address_Total_Abstract') + Mage::helper('sales')->__('The address total model should be extended from Mage_Sales_Model_Quote_Address_Total_Abstract.') ); } } @@ -128,42 +142,48 @@ protected function _prepareConfigArray($code, $totalConfig) protected function _getSortedCollectorCodes() { if (Mage::app()->useCache('config')) { - $cachedData = Mage::app()->loadCache('sorted_quote_collectors'); + $cachedData = Mage::app()->loadCache($this->_collectorsCacheKey); if ($cachedData) { return unserialize($cachedData); } } $configArray = $this->_modelsConfig; - foreach ($configArray as $code => $data) { - foreach ($data['before'] as $beforeCode) { - if (!isset($configArray[$beforeCode])) { - continue; + // invoke simple sorting if the first element contains the "sort_order" key + reset($configArray); $element = current($configArray); + if (isset($element['sort_order'])) { + uasort($configArray, array($this, '_compareSortOrder')); + } else { + foreach ($configArray as $code => $data) { + foreach ($data['before'] as $beforeCode) { + if (!isset($configArray[$beforeCode])) { + continue; + } + $configArray[$code]['before'] = array_merge( + $configArray[$code]['before'], $configArray[$beforeCode]['before'] + ); + $configArray[$beforeCode]['after'] = array_merge( + $configArray[$beforeCode]['after'], array($code), $data['after'] + ); + $configArray[$beforeCode]['after'] = array_unique($configArray[$beforeCode]['after']); } - $configArray[$code]['before'] = array_merge( - $configArray[$code]['before'], $configArray[$beforeCode]['before'] - ); - $configArray[$beforeCode]['after'] = array_merge( - $configArray[$beforeCode]['after'], array($code), $data['after'] - ); - $configArray[$beforeCode]['after'] = array_unique($configArray[$beforeCode]['after']); - } - foreach ($data['after'] as $afterCode) { - if (!isset($configArray[$afterCode])) { - continue; + foreach ($data['after'] as $afterCode) { + if (!isset($configArray[$afterCode])) { + continue; + } + $configArray[$code]['after'] = array_merge( + $configArray[$code]['after'], $configArray[$afterCode]['after'] + ); + $configArray[$afterCode]['before'] = array_merge( + $configArray[$afterCode]['before'], array($code), $data['before'] + ); + $configArray[$afterCode]['before'] = array_unique($configArray[$afterCode]['before']); } - $configArray[$code]['after'] = array_merge( - $configArray[$code]['after'], $configArray[$afterCode]['after'] - ); - $configArray[$afterCode]['before'] = array_merge( - $configArray[$afterCode]['before'], array($code), $data['before'] - ); - $configArray[$afterCode]['before'] = array_unique($configArray[$afterCode]['before']); } + uasort($configArray, array($this, '_compareTotals')); } - uasort($configArray, array($this, '_compareTotals')); $sortedCollectors = array_keys($configArray); if (Mage::app()->useCache('config')) { - Mage::app()->saveCache(serialize($sortedCollectors), 'sorted_quote_collectors', array( + Mage::app()->saveCache(serialize($sortedCollectors), $this->_collectorsCacheKey, array( Mage_Core_Model_Config::CACHE_TAG )); } @@ -182,7 +202,7 @@ protected function _initCollectors() foreach ($sortedCodes as $code) { $this->_collectors[$code] = $this->_models[$code]; } - + return $this; } @@ -207,6 +227,28 @@ protected function _compareTotals($a, $b) return $res; } + /** + * uasort() callback that uses sort_order for comparison + * + * @param array $a + * @param array $b + * @return int + */ + protected function _compareSortOrder($a, $b) + { + if (!isset($a['sort_order']) || !isset($b['sort_order'])) { + return 0; + } + if ($a['sort_order'] > $b['sort_order']) { + $res = 1; + } elseif ($a['sort_order'] < $b['sort_order']) { + $res = -1; + } else { + $res = 0; + } + return $res; + } + /** * Initialize retrievers array * diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Custbalance.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Custbalance.php index 2e256541e0..3eb9debba2 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Custbalance.php +++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Custbalance.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Discount.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Discount.php index 0a40b12883..5447287803 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Discount.php +++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Discount.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Grand.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Grand.php index 32e11e4af1..d9cea8aec1 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Grand.php +++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Grand.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal.php new file mode 100644 index 0000000000..464a84bde9 --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal.php @@ -0,0 +1,99 @@ + $address->getQuote()->getStore()) + ); + + // invoke nominal totals + foreach ($collector->getCollectors() as $model) { + $model->collect($address); + } + + // aggregate collected amounts into one to have sort of grand total per item + foreach ($address->getAllNominalItems() as $item) { + $rowTotal = 0; $baseRowTotal = 0; + $totalDetails = array(); + foreach ($collector->getCollectors() as $model) { + $itemRowTotal = $model->getItemRowTotal($item); + if ($model->getIsItemRowTotalCompoundable($item)) { + $rowTotal += $itemRowTotal; + $baseRowTotal += $model->getItemBaseRowTotal($item); + $isCompounded = true; + } else { + $isCompounded = false; + } + if ((float)$itemRowTotal > 0 && $label = $model->getLabel()) { + $totalDetails[] = new Varien_Object(array( + 'label' => $label, + 'amount' => $itemRowTotal, + 'is_compounded' => $isCompounded, + )); + } + } + $item->setNominalRowTotal($rowTotal); + $item->setBaseNominalRowTotal($baseRowTotal); + $item->setNominalTotalDetails($totalDetails); + } + + return $this; + } + + /** + * Fetch collected nominal items + * + * @param Mage_Sales_Model_Quote_Address $address + * @return Mage_Sales_Model_Quote_Address_Total_Nominal + */ + public function fetch(Mage_Sales_Model_Quote_Address $address) + { + $items = $address->getAllNominalItems(); + if ($items) { + $address->addTotal(array( + 'code' => $this->getCode(), + 'title' => Mage::helper('sales')->__('Nominal Items'), + 'items' => $items, + 'area' => 'footer', + )); + } + return $this; + } +} diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/Collector.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/Collector.php new file mode 100644 index 0000000000..c23aaae430 --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/Collector.php @@ -0,0 +1,45 @@ +__('Initial Fee'); + } +} diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/Recurring/Trial.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/Recurring/Trial.php new file mode 100644 index 0000000000..1f8184a314 --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/Recurring/Trial.php @@ -0,0 +1,62 @@ +__('Trial Payment'); + } + + /** + * Prevent compounding nominal subtotal in case if the trial payment exists + * + * @see Mage_Sales_Model_Quote_Address_Total_Nominal_Subtotal + * @param Mage_Sales_Model_Quote_Address $address + * @param Mage_Sales_Model_Quote_Item_Abstract $item + */ + protected function _afterCollectSuccess($address, $item) + { + $item->setData('skip_compound_row_total', true); + } +} diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/RecurringAbstract.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/RecurringAbstract.php new file mode 100644 index 0000000000..77bb5e2a76 --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/RecurringAbstract.php @@ -0,0 +1,107 @@ +_getAddressItems($address); + foreach ($items as $item) { + if ($item->getProduct()->isRecurring()) { + $profileData = $item->getProduct()->getRecurringProfile(); + if (!empty($profileData[$this->_profileDataKey])) { + $item->setData($this->_itemRowTotalKey, $profileData[$this->_profileDataKey]); + $this->_afterCollectSuccess($address, $item); + } + } + } + return $this; + } + + /** + * Don't fetch anything + * + * @param Mage_Sales_Model_Quote_Address $address + * @return array + */ + public function fetch(Mage_Sales_Model_Quote_Address $address) + { + return Mage_Sales_Model_Quote_Address_Total_Abstract::fetch($address); + } + + /** + * Get nominal items only + * + * @param Mage_Sales_Model_Quote_Address $address + * @return array + */ + protected function _getAddressItems(Mage_Sales_Model_Quote_Address $address) + { + return $address->getAllNominalItems(); + } + + /** + * Hook for successful collecting of a recurring amount + * + * @param Mage_Sales_Model_Quote_Address $address + * @param Mage_Sales_Model_Quote_Item_Abstract $item + */ + protected function _afterCollectSuccess($address, $item) + { + } +} diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/Shipping.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/Shipping.php new file mode 100644 index 0000000000..e4a82a6039 --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/Shipping.php @@ -0,0 +1,111 @@ +getAllNominalItems(); + if (!count($items)) { + return $this; + } + + // estimate quote with all address items to get their row weights + $this->_shouldGetAllItems = true; + parent::collect($address); + $address->setCollectShippingRates(true); + $this->_shouldGetAllItems = false; + // now $items contains row weight information + + // collect shipping rates for each item individually + foreach ($items as $item) { + if (!$item->getProduct()->isVirtual()) { + $address->requestShippingRates($item); + $baseAmount = $item->getBaseShippingAmount(); + if ($baseAmount) { + $item->setShippingAmount($address->getQuote()->getStore()->convertPrice($baseAmount, false)); + } + } + } + + return $this; + } + + /** + * Don't fetch anything + * + * @param Mage_Sales_Model_Quote_Address $address + * @return array + */ + public function fetch(Mage_Sales_Model_Quote_Address $address) + { + return Mage_Sales_Model_Quote_Address_Total_Abstract::fetch($address); + } + + /** + * Get nominal items only or indeed get all items, depending on current logic requirements + * + * @param Mage_Sales_Model_Quote_Address $address + * @return array + */ + protected function _getAddressItems(Mage_Sales_Model_Quote_Address $address) + { + if ($this->_shouldGetAllItems) { + return $address->getAllItems(); + } + return $address->getAllNominalItems(); + } +} diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/Subtotal.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/Subtotal.php new file mode 100644 index 0000000000..ec229e03b1 --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal/Subtotal.php @@ -0,0 +1,77 @@ +__('Regular Payment'); + } + + /** + * Get nominal items only + * + * @param Mage_Sales_Model_Quote_Address $address + * @return array + */ + protected function _getAddressItems(Mage_Sales_Model_Quote_Address $address) + { + return $address->getAllNominalItems(); + } +} diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Shipping.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Shipping.php index de45376250..b4b257269d 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Shipping.php +++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Shipping.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -48,7 +48,7 @@ public function collect(Mage_Sales_Model_Quote_Address $address) $this->_setAmount(0) ->_setBaseAmount(0); - $items = $address->getAllItems(); + $items = $this->_getAddressItems($address); if (!count($items)) { return $this; } @@ -192,4 +192,14 @@ public function fetch(Mage_Sales_Model_Quote_Address $address) } return $this; } + + /** + * Get Shipping label + * + * @return string + */ + public function getLabel() + { + return Mage::helper('sales')->__('Shipping'); + } } diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Subtotal.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Subtotal.php index bf3c6bc938..934d03fd74 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Subtotal.php +++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Subtotal.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -38,17 +38,30 @@ public function collect(Mage_Sales_Model_Quote_Address $address) parent::collect($address); $address->setTotalQty(0); + $baseVirtualAmount = $virtualAmount = 0; + /** * Process address items */ - $items = $address->getAllItems(); - + $items = $this->_getAddressItems($address); foreach ($items as $item) { - if (!$this->_initItem($address, $item) || $item->getQty()<=0) { + if ($this->_initItem($address, $item) && $item->getQty() > 0) { + /** + * Separatly calculate subtotal only for virtual products + */ + if ($item->getProduct()->isVirtual()) { + $virtualAmount += $item->getRowTotal(); + $baseVirtualAmount += $item->getBaseRowTotal(); + } + } + else { $this->_removeItem($address, $item); } } + $address->setBaseVirtualAmount($baseVirtualAmount); + $address->setVirtualAmount($virtualAmount); + /** * Initialize grand totals */ @@ -72,7 +85,9 @@ protected function _initItem($address, $item) $quoteItem = $item; } $product = $quoteItem->getProduct(); - $product->setCustomerGroupId($quoteItem->getQuote()->getCustomerGroupId()); + if (!$product->hasCustomerGroupId()) { + $product->setCustomerGroupId($quoteItem->getQuote()->getCustomerGroupId()); + } /** * Quote super mode flag meen whot we work with quote without restriction @@ -149,4 +164,14 @@ public function fetch(Mage_Sales_Model_Quote_Address $address) )); return $this; } + + /** + * Get Subtotal label + * + * @return string + */ + public function getLabel() + { + return Mage::helper('sales')->__('Subtotal'); + } } diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Tax.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Tax.php index f9f45c6972..ed40aaa7e3 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Tax.php +++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Tax.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Quote/Config.php b/app/code/core/Mage/Sales/Model/Quote/Config.php index fbfd71df4e..7a7dd3b420 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Config.php +++ b/app/code/core/Mage/Sales/Model/Quote/Config.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Quote/Item.php b/app/code/core/Mage/Sales/Model/Quote/Item.php index 21b208d915..c8d0d4ec95 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Item.php +++ b/app/code/core/Mage/Sales/Model/Quote/Item.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -225,7 +225,7 @@ public function checkData() $parent = parent::checkData(); if ($this->getProduct()->getHasError()) { $this->setHasError(true); - $this->setMessage(Mage::helper('sales')->__('Item options declare error')); + $this->setMessage(Mage::helper('sales')->__('Item options declaration error.')); $this->getQuote()->setHasError(true); $this->getQuote()->addMessage($this->getProduct()->getMessage(), 'options'); } @@ -242,6 +242,7 @@ public function setProduct($product) { if ($this->getQuote()) { $product->setStoreId($this->getQuote()->getStoreId()); + $product->setCustomerGroupId($this->getQuote()->getCustomer()->getGroupId()); } $this->setData('product', $product) ->setProductId($product->getId()) @@ -250,10 +251,12 @@ public function setProduct($product) ->setName($product->getName()) ->setWeight($this->getProduct()->getWeight()) ->setTaxClassId($product->getTaxClassId()) - ->setBaseCost($product->getCost()); - if ($product->getStockItem()) { - $this->setIsQtyDecimal($product->getStockItem()->getIsQtyDecimal()); - } + ->setBaseCost($product->getCost()) + ->setIsRecurring($product->getIsRecurring()) + ; + if ($product->getStockItem()) { + $this->setIsQtyDecimal($product->getStockItem()->getIsQtyDecimal()); + } Mage::dispatchEvent('sales_quote_item_set_product', array( 'product' => $product, @@ -354,6 +357,9 @@ public function compare($item) return false; } foreach ($this->getOptions() as $option) { + if (in_array($option->getCode(), $this->_notRepresentOptions)) { + continue; + } if ($itemOption = $item->getOptionByCode($option->getCode())) { $itemOptionValue = $itemOption->getValue(); $optionValue = $option->getValue(); @@ -478,7 +484,7 @@ public function addOption($option) $option->setItem($this); } else { - Mage::throwException(Mage::helper('sales')->__('Invalid item option format')); + Mage::throwException(Mage::helper('sales')->__('Invalid item option format.')); } if ($exOption = $this->getOptionByCode($option->getCode())) { @@ -543,7 +549,7 @@ protected function _addOptionCode($option) $this->_optionsByCode[$option->getCode()] = $option; } else { - Mage::throwException(Mage::helper('sales')->__('Item option with code %s already exist', $option->getCode())); + Mage::throwException(Mage::helper('sales')->__('An item option with code %s already exists.', $option->getCode())); } return $this; } diff --git a/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php b/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php index 620f668630..d0822120d3 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php +++ b/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -178,7 +178,7 @@ public function checkData() $this->setMessage($e->getMessage()); } catch (Exception $e){ $this->setHasError(true); - $this->setMessage(Mage::helper('sales')->__('Item qty declare error')); + $this->setMessage(Mage::helper('sales')->__('Item qty declaration error.')); } try { @@ -188,13 +188,13 @@ public function checkData() $this->setMessage($e->getMessage()); $this->getQuote()->setHasError(true); $this->getQuote()->addMessage( - Mage::helper('sales')->__('Some of the products below don\'t have all the required options. Please remove them and add again with all the required options.') + Mage::helper('sales')->__('Some of the products below do not have all the required options. Please remove them and add again with all the required options.') ); } catch (Exception $e) { $this->setHasError(true); - $this->setMessage(Mage::helper('sales')->__('Item options declare error')); + $this->setMessage(Mage::helper('sales')->__('Item options declaration error.')); $this->getQuote()->setHasError(true); - $this->getQuote()->addMessage(Mage::helper('sales')->__('Items options declare error.')); + $this->getQuote()->addMessage(Mage::helper('sales')->__('Items options declaration error.')); } return $this; @@ -249,10 +249,9 @@ public function getCalculationPrice() { $price = $this->_getData('calculation_price'); if (is_null($price)) { - if ($this->hasCustomPrice()) { - $price = $this->getCustomPrice(); - } - else { + if ($this->hasOriginalCustomPrice()) { + $price = $this->getOriginalCustomPrice(); + } else { $price = $this->getOriginalPrice(); } $this->setData('calculation_price', $price); @@ -282,6 +281,31 @@ public function getBaseCalculationPrice() return $this->_getData('base_calculation_price'); } + /** + * Get whether the item is nominal + * TODO: fix for multishipping checkout + * + * @return bool + */ + public function isNominal() + { + if (!$this->hasData('is_nominal')) { + $this->setData('is_nominal', $this->getProduct() ? '1' == $this->getProduct()->getIsRecurring() : false); + } + return $this->_getData('is_nominal'); + } + + /** + * Data getter for 'is_nominal' + * Used for converting item to order item + * + * @return int + */ + public function getIsNominal() + { + return (int)$this->isNominal(); + } + /** * Get original price (retrieved from product) for item. * Original price value is in current selected currency @@ -338,7 +362,7 @@ public function getPrice() */ public function setCustomPrice($value) { - $this->setCalculationPrice(null); + $this->setCalculationPrice($value); $this->setBaseCalculationPrice(null); return $this->setData('custom_price', $value); } @@ -496,18 +520,6 @@ public function calcTaxAmount() public function getTaxAmount() { return $this->_getData('tax_amount'); - - $priceType = $this->getProduct()->getPriceType(); - if ($this->getHasChildren() && (null !== $priceType) && (int)$priceType === Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) { - $amount = 0; - foreach ($this->getChildren() as $child) { - $amount+= $child->getTaxAmount(); - } - return $amount; - } - else { - return $this->_getData('tax_amount'); - } } @@ -520,18 +532,6 @@ public function getTaxAmount() public function getBaseTaxAmount() { return $this->_getData('base_tax_amount'); - - $priceType = $this->getProduct()->getPriceType(); - if ($this->getHasChildren() && (null !== $priceType) && (int)$priceType === Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) { - $baseAmount = 0; - foreach ($this->getChildren() as $child) { - $baseAmount+= $child->getBaseTaxAmount(); - } - return $baseAmount; - } - else { - return $this->_getData('base_tax_amount'); - } } /** diff --git a/app/code/core/Mage/Sales/Model/Quote/Item/Option.php b/app/code/core/Mage/Sales/Model/Quote/Item/Option.php index c233955ab8..dd37fa42d6 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Item/Option.php +++ b/app/code/core/Mage/Sales/Model/Quote/Item/Option.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/Model/Quote/Payment.php b/app/code/core/Mage/Sales/Model/Quote/Payment.php index 07ac0f4468..a37479a1b3 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Payment.php +++ b/app/code/core/Mage/Sales/Model/Quote/Payment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -87,7 +87,6 @@ public function importData(array $data) $this->setMethod($data->getMethod()); $method = $this->getMethodInstance(); - $method->setStore($this->getQuote()->getStore()); /** * Payment avalability related with quote totals. @@ -96,7 +95,7 @@ public function importData(array $data) $this->getQuote()->collectTotals(); if (!$method->isAvailable($this->getQuote())) { - Mage::throwException(Mage::helper('sales')->__('Requested Payment Method is not available')); + Mage::throwException(Mage::helper('sales')->__('The requested Payment Method is not available.')); } $method->assignData($data); @@ -153,4 +152,15 @@ public function getOrderPlaceRedirectUrl() } return ''; } + + /** + * Retrieve payment method model object + * + * @return Mage_Payment_Model_Method_Abstract + */ + public function getMethodInstance() + { + $method = parent::getMethodInstance(); + return $method->setStore($this->getQuote()->getStore()); + } } diff --git a/app/code/core/Mage/Sales/Model/Recurring/Profile.php b/app/code/core/Mage/Sales/Model/Recurring/Profile.php new file mode 100644 index 0000000000..95ce16828d --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Recurring/Profile.php @@ -0,0 +1,736 @@ +load($internalReferenceId, 'internal_reference_id'); + } + + /** + * Submit a recurring profile right after an order is placed + * + */ + public function submit() + { + $this->_getResource()->beginTransaction(); + try { + $this->setInternalReferenceId(Mage::helper('core')->uniqHash('temporary-')); + $this->save(); + $this->setInternalReferenceId(Mage::helper('core')->uniqHash($this->getId() . '-')); + $this->getMethodInstance()->submitRecurringProfile($this, $this->getQuote()->getPayment()); + $this->save(); + $this->_getResource()->commit(); + } catch (Exception $e) { + $this->_getResource()->rollBack(); + throw $e; + } + } + + /** + * Activate the suspended profile + */ + public function activate() + { + $this->_checkWorkflow(self::STATE_ACTIVE, false); + $this->setNewState(self::STATE_ACTIVE); + $this->getMethodInstance()->updateRecurringProfileStatus($this); + $this->setState(self::STATE_ACTIVE) + ->save(); + } + + /** + * Check whether the workflow allows to activate the profile + * + * @return bool + */ + public function canActivate() + { + return $this->_checkWorkflow(self::STATE_ACTIVE); + } + + /** + * Suspend active profile + */ + public function suspend() + { + $this->_checkWorkflow(self::STATE_SUSPENDED, false); + $this->setNewState(self::STATE_SUSPENDED); + $this->getMethodInstance()->updateRecurringProfileStatus($this); + $this->setState(self::STATE_SUSPENDED) + ->save(); + } + + /** + * Check whether the workflow allows to suspend the profile + * + * @return bool + */ + public function canSuspend() + { + return $this->_checkWorkflow(self::STATE_SUSPENDED); + } + + /** + * Cancel active or suspended profile + */ + public function cancel() + { + $this->_checkWorkflow(self::STATE_CANCELED, false); + $this->setNewState(self::STATE_CANCELED); + $this->getMethodInstance()->updateRecurringProfileStatus($this); + $this->setState(self::STATE_CANCELED) + ->save(); + } + + /** + * Check whether the workflow allows to cancel the profile + * + * @return bool + */ + public function canCancel() + { + return $this->_checkWorkflow(self::STATE_CANCELED); + } + + public function fetchUpdate() + { + $result = new Varien_Object(); + $this->getMethodInstance()->getRecurringProfileDetails($this->getReferenceId(), $result); + + if ($result->getIsProfileActive()) { + $this->setState(self::STATE_ACTIVE); + } elseif ($result->getIsProfilePending()) { + $this->setState(self::STATE_PENDING); + } elseif ($result->getIsProfileCanceled()) { + $this->setState(self::STATE_CANCELED); + } elseif ($result->getIsProfileSuspended()) { + $this->setState(self::STATE_SUSPENDED); + } elseif ($result->getIsProfileExpired()) { + $this->setState(self::STATE_EXPIRED); + } + } + + public function canFetchUpdate() + { + return $this->getMethodInstance()->canGetRecurringProfileDetails(); + } +// +//// public function billOutstandingAmount($baseAmount, Varien_Object $info = null) +//// { +//// +//// } +//// +//// public function canBillOutstandingAmount() +//// { +//// // check method instance? +//// } +// +// public function processSubmissionNotification(Varien_Object $info) +// { +// // confirmation that this profile was created on the gateway +// } +// +// public function processPaymentNotification(Varien_Object $info) +// { +// // create new order basing on original order item and addresses +// } +// +// public function processStateNotification(Varien_Object $info) +// { +// // update self state +// } +// +//// public function loadByInternalReferenceId($internalReferenceId) +//// { +//// +//// } + + /** + * Initialize new order based on profile data + * + * Takes arbitrary number of Varien_Object instances to be treated as items for new order + * + * @return Mage_Sales_Model_Order + */ + public function createOrder() + { + $items = array(); + $itemInfoObjects = func_get_args(); + + $billingAmount = 0; + $shippingAmount = 0; + $taxAmount = 0; + $isVirtual = 1; + $weight = 0; + foreach ($itemInfoObjects as $itemInfo) { + $item = $this->_getItem($itemInfo); + $billingAmount += $item->getPrice(); + $shippingAmount += $item->getShippingAmount(); + $taxAmount += $item->getTaxAmount(); + $weight += $item->getWeight(); + if (!$item->getIsVirtual()) { + $isVirtual = 0; + } + $items[] = $item; + } + $grandTotal = $billingAmount + $shippingAmount + $taxAmount; + + $order = Mage::getModel('sales/order'); + + $billingAddress = Mage::getModel('sales/order_address') + ->setData($this->getBillingAddressInfo()) + ->setId(null); + + $shippingInfo = $this->getShippingAddressInfo(); + $shippingAddress = Mage::getModel('sales/order_address') + ->setData($shippingInfo) + ->setId(null); + + $payment = Mage::getModel('sales/order_payment') + ->setMethod($this->getMethodCode()); + + $transferDataKays = array( + 'store_id', 'store_name', 'customer_id', 'customer_email', + 'customer_firstname', 'customer_lastname', 'customer_middlename', 'customer_prefix', + 'customer_suffix', 'customer_taxvat', 'customer_gender', 'customer_is_guest', + 'customer_note_notify', 'customer_group_id', 'customer_note', 'shipping_method', + 'shipping_description', 'base_currency_code', 'global_currency_code', 'order_currency_code', + 'store_currency_code', 'base_to_global_rate', 'base_to_order_rate', 'store_to_base_rate', + 'store_to_order_rate' + ); + + $orderInfo = $this->getOrderInfo(); + foreach ($transferDataKays as $key) { + if (isset($orderInfo[$key])) { + $order->setData($key, $orderInfo[$key]); + } elseif ($shippingInfo[$key]) { + $order->setData($key, $shippingInfo[$key]); + } + } + + $order->setStoreId($this->getStoreId()) + ->setState(Mage_Sales_Model_Order::STATE_NEW) + ->setBaseToOrderRate($this->getInfoValue('order_info', 'base_to_quote_rate')) + ->setStoreToOrderRate($this->getInfoValue('order_info', 'store_to_quote_rate')) + ->setOrderCurrencyCode($this->getInfoValue('order_info', 'quote_currency_code')) + ->setBaseSubtotal($billingAmount) + ->setSubtotal($billingAmount) + ->setBaseShippingAmount($shippingAmount) + ->setShippingAmount($shippingAmount) + ->setBaseTaxAmount($taxAmount) + ->setTaxAmount($taxAmount) + ->setBaseGrandTotal($grandTotal) + ->setGrandTotal($grandTotal) + ->setIsVirtual($isVirtual) + ->setWeight($weight) + ->setTotalQtyOrdered($this->getInfoValue('order_info', 'items_qty')) + ->setBillingAddress($billingAddress) + ->setShippingAddress($shippingAddress) + ->setPayment($payment); + + foreach ($items as $item) { + $order->addItem($item); + } + + return $order; + } + + /** + * Validate states + * + * @return bool + */ + public function isValid() + { + parent::isValid(); + + // state + if (!in_array($this->getState(), $this->getAllStates(false), true)) { + $this->_errors['state'][] = Mage::helper('sales')->__('Wrong state: "%s".', $this->getState()); + } + + return empty($this->_errors); + } + + /** + * Import quote information to the profile + * + * @param Mage_Sales_Model_Quote_ $quote + * @return Mage_Sales_Model_Recurring_Profile + */ + public function importQuote(Mage_Sales_Model_Quote $quote) + { + $this->setQuote($quote); + + if ($quote->getPayment() && $quote->getPayment()->getMethod()) { + $this->setMethodInstance($quote->getPayment()->getMethodInstance()); + } + + $orderInfo = $quote->getData(); + $this->_cleanupArray($orderInfo); + $this->setOrderInfo($orderInfo); + + $addressInfo = $quote->getBillingAddress()->getData(); + $this->_cleanupArray($addressInfo); + $this->setBillingAddressInfo($addressInfo); + if (!$quote->isVirtual()) { + $addressInfo = $quote->getShippingAddress()->getData(); + $this->_cleanupArray($addressInfo); + $this->setShippingAddressInfo($addressInfo); + } + + $this->setCurrencyCode($quote->getBaseCurrencyCode()); + $this->setCustomerId($quote->getCustomerId()); + $this->setStoreId($quote->getStoreId()); + + return $this; + } + + /** + * Import quote item information to the profile + * + * @param Mage_Sales_Model_Quote_Item_Abstract $item + * @return Mage_Sales_Model_Recurring_Profile + */ + public function importQuoteItem(Mage_Sales_Model_Quote_Item_Abstract $item) + { + $this->setQuoteItemInfo($item); + + // TODO: make it abstract from amounts + $this->setBillingAmount($item->getBaseRowTotal()) + ->setTaxAmount($item->getBaseTaxAmount()) + ->setShippingAmount($item->getBaseShippingAmount()) + ; + if (!$this->getScheduleDescription()) { + $this->setScheduleDescription($item->getName()); + } + + $orderItemInfo = $item->getData(); + $this->_cleanupArray($orderItemInfo); + $this->setOrderItemInfo($orderItemInfo); + + return $this->_filterValues(); + } + + /** + * Getter for sales-related field labels + * + * @param string $field + * @return string|null + */ + public function getFieldLabel($field) + { + switch ($field) { + case 'order_item_id': + return Mage::helper('sales')->__('Purchased Item'); + case 'state': + return Mage::helper('sales')->__('Profile State'); + case 'created_at': + return Mage::helper('adminhtml')->__('Created At'); + case 'updated_at': + return Mage::helper('adminhtml')->__('Updated At'); + default: + return parent::getFieldLabel($field); + } + } + + /** + * Getter for sales-related field comments + * + * @param string $field + * @return string|null + */ + public function getFieldComment($field) + { + switch ($field) { + case 'order_item_id': + return Mage::helper('sales')->__('Original order item that recurring payment profile correspondss to.'); + default: + return parent::getFieldComment($field); + } + } + + /** + * Getter for all available states + * + * @param bool $withLabels + * @return array + */ + public function getAllStates($withLabels = true) + { + $states = array(self::STATE_UNKNOWN, self::STATE_PENDING, self::STATE_ACTIVE, + self::STATE_SUSPENDED, self::STATE_CANCELED, self::STATE_EXPIRED, + ); + if ($withLabels) { + $result = array(); + foreach ($states as $state) { + $result[$state] = $this->getStateLabel($state); + } + return $result; + } + return $states; + } + + /** + * Get state label based on the code + * + * @param string $state + * @return string + */ + public function getStateLabel($state) + { + switch ($state) { + case self::STATE_UNKNOWN: return Mage::helper('sales')->__('Not Initialized'); + case self::STATE_PENDING: return Mage::helper('sales')->__('Pending'); + case self::STATE_ACTIVE: return Mage::helper('sales')->__('Active'); + case self::STATE_SUSPENDED: return Mage::helper('sales')->__('Suspended'); + case self::STATE_CANCELED: return Mage::helper('sales')->__('Canceled'); + case self::STATE_EXPIRED: return Mage::helper('sales')->__('Expired'); + default: return $state; + } + } + + /** + * Render state as label + * + * @param string $key + * @return mixed + */ + public function renderData($key) + { + $value = $this->_getData($key); + switch ($key) { + case 'state': + return $this->getStateLabel($value); + } + return parent::renderData($key); + } + + /** + * Getter for additional information value + * It is assumed that the specified additional info is an object or associative array + * + * @param string $infoKey + * @param string $infoValueKey + * @return mixed|null + */ + public function getInfoValue($infoKey, $infoValueKey) + { + $info = $this->getData($infoKey); + if (!$info) { + return; + } + if (!is_object($info)) { + if (is_array($info) && isset($info[$infoValueKey])) { + return $info[$infoValueKey]; + } + } else { + if ($info instanceof Varien_Object) { + return $info->getDataUsingMethod($infoValueKey); + } elseif (isset($info->$infoValueKey)) { + return $info->$infoValueKey; + } + } + } + + /** + * Initialize resource model + */ + protected function _construct() + { + $this->_init('sales/recurring_profile'); + } + + /** + * Automatically set "unknown" state if not defined + * + * @return Mage_Payment_Model_Recurring_Profile + */ + protected function _filterValues() + { + $result = parent::_filterValues(); + + if (!$this->getState()) { + $this->setState(self::STATE_UNKNOWN); + } + + return $result; + } + + /** + * Initialize the workflow reference + */ + protected function _initWorkflow() + { + if (null === $this->_workflow) { + $this->_workflow = array( + 'unknown' => array('pending', 'active', 'suspended', 'canceled'), + 'pending' => array('active', 'canceled'), + 'active' => array('suspended', 'canceled'), + 'suspended' => array('active', 'canceled'), + 'canceled' => array(), + 'expired' => array(), + ); + } + } + + /** + * Check whether profile can be changed to specified state + * + * @param string $againstState + * @param bool $soft + * @return bool + * @throws Mage_Core_Exception + */ + protected function _checkWorkflow($againstState, $soft = true) + { + $this->_initWorkflow(); + $state = $this->getState(); + $result = (!empty($this->_workflow[$state])) && in_array($againstState, $this->_workflow[$state]); + if (!$soft && !$result) { + Mage::throwException( + Mage::helper('sales')->__('This profile state cannot be changed to "%s".', $againstState) + ); + } + return $result; + } + + /** + * Return recurring profile child orders Ids + * + * @return array + */ + public function getChildOrderIds() + { + $ids = $this->_getResource()->getChildOrderIds($this); + if (empty($ids)){ + $ids[] = '-1'; + } + return $ids; + } + + /** + * Add order relation to recurring profile + * + * @param int $recurringProfileId + * @return Mage_Sales_Model_Recurring_Profile + */ + public function addOrderRelation($orderId) + { + $this->getResource()->addOrderRelation($this->getId(), $orderId); + return $this; + } + + /** + * Create and return new order item based on profile item data and $itemInfo + * + * @param Varien_Object $itemInfo + * @return Mage_Sales_Model_Order_Item + */ + protected function _getItem($itemInfo) + { + $paymentType = $itemInfo->getPaymentType(); + if (!$paymentType) { + throw new Exception("Recurring profile payment type is not specified."); + } + + switch ($paymentType) { + case self::PAYMENT_TYPE_REGULAR: return $this->_getRegularItem($itemInfo); + case self::PAYMENT_TYPE_TRIAL: return $this->_getTrialItem($itemInfo); + case self::PAYMENT_TYPE_INITIAL: return $this->_getInitialItem($itemInfo); + default: new Exception("Invalid recurring profile payment type '{$paymentType}'."); + } + } + + /** + * Create and return new order item based on profile item data and $itemInfo + * for regular payment + * + * @param Varien_Object $itemInfo + * @return Mage_Sales_Model_Order_Item + */ + protected function _getRegularItem($itemInfo) + { + $price = $itemInfo->getPrice() ? $itemInfo->getPrice() : $this->getBillingAmount(); + $shippingAmount = $itemInfo->getShippingAmount() ? $itemInfo->getShippingAmount() : $this->getShippingAmount(); + $taxAmount = $itemInfo->getTaxAmount() ? $itemInfo->getTaxAmount() : $this->getTaxAmount(); + + $item = Mage::getModel('sales/order_item') + ->setData($this->getOrderItemInfo()) + ->setQtyOrdered($this->getInfoValue('order_item_info', 'qty')) + ->setBaseOriginalPrice($this->getInfoValue('order_item_info', 'price')) + ->setPrice($price) + ->setBasePrice($price) + ->setRowTotal($price) + ->setBaseRowTotal($price) + ->setTaxAmount($taxAmount) + ->setShippingAmount($shippingAmount) + ->setId(null); + return $item; + } + + /** + * Create and return new order item based on profile item data and $itemInfo + * for trial payment + * + * @param Varien_Object $itemInfo + * @return Mage_Sales_Model_Order_Item + */ + protected function _getTrialItem($itemInfo) + { + $item = $this->_getRegularItem($itemInfo); + + $item->setName( + Mage::helper('sales')->__('Trial ') . $item->getName() + ); + + $option = array( + 'label' => Mage::helper('sales')->__('Payment type'), + 'value' => Mage::helper('sales')->__('Trial period payment') + ); + + $this->_addAdditionalOptionToItem($item, $option); + + return $item; + } + + /** + * Create and return new order item based on profile item data and $itemInfo + * for initial payment + * + * @param Varien_Object $itemInfo + * @return Mage_Sales_Model_Order_Item + */ + protected function _getInitialItem($itemInfo) + { + $price = $itemInfo->getPrice() ? $itemInfo->getPrice() : $this->getInitAmount(); + $shippingAmount = $itemInfo->getShippingAmount() ? $itemInfo->getShippingAmount() : 0; + $taxAmount = $itemInfo->getTaxAmount() ? $itemInfo->getTaxAmount() : 0; + $item = Mage::getModel('sales/order_item') + ->setStoreId($this->getStoreId()) + ->setProductType(Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL) + ->setIsVirtual(1) + ->setSku('initial_fee') + ->setName(Mage::helper('sales')->__('Recurring Profile Initial Fee')) + ->setDescription('') + ->setWeight(0) + ->setQtyOrdered(1) + ->setPrice($price) + ->setOriginalPrice($price) + ->setBasePrice($price) + ->setBaseOriginalPrice($price) + ->setRowTotal($price) + ->setBaseRowTotal($price) + ->setTaxAmount($taxAmount) + ->setShippingAmount($shippingAmount); + + $option = array( + 'label' => Mage::helper('sales')->__('Payment type'), + 'value' => Mage::helper('sales')->__('Initial period payment') + ); + + $this->_addAdditionalOptionToItem($item, $option); + return $item; + } + + /** + * Add additional options suboption into itev + * + * @param Mage_Sales_Model_Order_Item $itemInfo + * @param array $option + */ + protected function _addAdditionalOptionToItem($item, $option) + { + $options = $item->getProductOptions(); + $additionalOptions = $item->getProductOptionByCode('additional_options'); + if (is_array($additionalOptions)) { + $additionalOptions[] = $option; + } else { + $additionalOptions = array($option); + } + $options['additional_options'] = $additionalOptions; + $item->setProductOptions($options); + } + + /** + * Recursively cleanup array from objects + * + * @param array &$array + */ + private function _cleanupArray(&$array) + { + if (!$array) { + return; + } + foreach ($array as $key => $value) { + if (is_object($value)) { + unset($array[$key]); + } elseif (is_array($value)) { + $this->_cleanupArray($array[$key]); + } + } + } +} diff --git a/app/code/core/Mage/Sales/Model/Service/Order.php b/app/code/core/Mage/Sales/Model/Service/Order.php new file mode 100644 index 0000000000..264157e43b --- /dev/null +++ b/app/code/core/Mage/Sales/Model/Service/Order.php @@ -0,0 +1,382 @@ +_order = $order; + $this->_convertor = Mage::getModel('sales/convert_order'); + } + + /** + * Quote convertor declaration + * + * @param Mage_Sales_Model_Convert_Order $convertor + * @return Mage_Sales_Model_Service_Order + */ + public function setConvertor(Mage_Sales_Model_Convert_Order $convertor) + { + $this->_convertor = $convertor; + return $this; + } + + /** + * Get assigned order object + * + * @return Mage_Sales_Model_Order + */ + public function getOrder() + { + return $this->_order; + } + + /** + * Prepare order invoice based on order data and requested items qtys + * + * @param array $data + * @return Mage_Sales_Model_Order_Invoice + */ + public function prepareInvoice($qtys = array()) + { + $invoice = $this->_convertor->toInvoice($this->_order); + $totalQty = 0; + foreach ($this->_order->getAllItems() as $orderItem) { + if (!$this->_canInvoiceItem($orderItem, $qtys)) { + continue; + } + $item = $this->_convertor->itemToInvoiceItem($orderItem); + if ($orderItem->isDummy()) { + $qty = 1; + } else { + if (isset($qtys[$orderItem->getId()])) { + $qty = (float) $qtys[$orderItem->getId()]; + } elseif (!count($qtys)) { + $qty = $orderItem->getQtyToInvoice(); + } else { + continue; + } + } + $totalQty += $qty; + $item->setQty($qty); + $invoice->addItem($item); + } + $invoice->setTotalQty($totalQty); + $invoice->collectTotals(); + $this->_order->getInvoiceCollection()->addItem($invoice); + return $invoice; + } + + /** + * Prepare order shipment based on order items and requested items qty + * + * @param array $data + * @return Mage_Sales_Model_Order_Shipment + */ + public function prepareShipment($qtys = array()) + { + $totalQty = 0; + $shipment = $this->_convertor->toShipment($this->_order); + foreach ($this->_order->getAllItems() as $orderItem) { + if (!$this->_canShipItem($orderItem, $qtys)) { + continue; + } + + $item = $this->_convertor->itemToShipmentItem($orderItem); + if ($orderItem->isDummy()) { + $qty = 1; + } else { + if (isset($qtys[$orderItem->getId()])) { + $qty = min($qtys[$orderItem->getId()], $orderItem->getQtyToShip()); + } elseif (!count($qtys)) { + $qty = $orderItem->getQtyToShip(); + } else { + continue; + } + } + + $totalQty += $qty; + $item->setQty($qty); + $shipment->addItem($item); + } + $shipment->setTotalQty($totalQty); + return $shipment; + } + + /** + * Prepare order creditmemo based on order items and requested params + * + * @param array $data + * @return Mage_Sales_Model_Order_Creditmemo + */ + public function prepareCreditmemo($data = array()) + { + $totalQty = 0; + $creditmemo = $this->_convertor->toCreditmemo($this->_order); + $qtys = isset($data['qtys']) ? $data['qtys'] : array(); + + foreach ($this->_order->getAllItems() as $orderItem) { + if (!$this->_canRefundItem($orderItem, $qtys)) { + continue; + } + + $item = $this->_convertor->itemToCreditmemoItem($orderItem); + if ($orderItem->isDummy()) { + $qty = 1; + } else { + if (isset($qtys[$orderItem->getId()])) { + $qty = (float) $qtys[$orderItem->getId()]; + } elseif (!count($qtys)) { + $qty = $orderItem->getQtyToRefund(); + } else { + continue; + } + } + $totalQty += $qty; + $item->setQty($qty); + $creditmemo->addItem($item); + } + $creditmemo->setTotalQty($totalQty); + + $this->_initCreditmemoData($creditmemo, $data); + + $creditmemo->collectTotals(); + return $creditmemo; + } + + /** + * Prepare order creditmemo based on invoice items and requested requested params + * + * @param array $data + * @return Mage_Sales_Model_Order_Creditmemo + */ + public function prepareInvoiceCreditmemo($invoice, $data = array()) + { + $totalQty = 0; + $qtys = isset($data['qtys']) ? $data['qtys'] : array(); + $creditmemo = $this->_convertor->toCreditmemo($this->_order); + $creditmemo->setInvoice($invoice); + foreach ($invoice->getAllItems() as $invoiceItem) { + $orderItem = $invoiceItem->getOrderItem(); + if (!$this->_canRefundItem($orderItem, $qtys)) { + continue; + } + + $item = $this->_convertor->itemToCreditmemoItem($orderItem); + if ($orderItem->isDummy()) { + $qty = 1; + } else { + if (isset($qtys[$orderItem->getId()])) { + $qty = (float) $qtys[$orderItem->getId()]; + } elseif (!count($qtys)) { + $qty = $orderItem->getQtyToRefund(); + } else { + continue; + } + } + $qty = min($qty, $invoiceItem->getQty()); + $totalQty += $qty; + $item->setQty($qty); + $creditmemo->addItem($item); + } + $creditmemo->setTotalQty($totalQty); + + $this->_initCreditmemoData($creditmemo, $data); + if (!isset($data['shipping_amount'])) { + $order = $invoice->getOrder(); + $baseAllowedAmount = $order->getBaseShippingAmount()-$order->getBaseShippingRefunded(); + $creditmemo->setBaseShippingAmount(min($baseAllowedAmount, $invoice->getBaseShippingAmount())); + } + + $creditmemo->collectTotals(); + return $creditmemo; + } + + /** + * Initialize creditmemo state based on requested parameters + * + * @param Mage_Sales_Model_Order_Creditmemo $creditmemo + * @param array $data + */ + protected function _initCreditmemoData($creditmemo, $data) + { + if (isset($data['shipping_amount'])) { + $creditmemo->setBaseShippingAmount((float)$data['shipping_amount']); + } + + if (isset($data['adjustment_positive'])) { + $creditmemo->setAdjustmentPositive($data['adjustment_positive']); + } + + if (isset($data['adjustment_negative'])) { + $creditmemo->setAdjustmentNegative($data['adjustment_negative']); + } + } + + /** + * Check if order item can be invoiced. Dummy item can be invoiced or with his childrens or + * with parent item which is included to invoice + * + * @param Mage_Sales_Model_Order_Item $item + * @param array $qtys + * @return bool + */ + protected function _canInvoiceItem($item, $qtys=array()) + { + if ($item->getLockedDoInvoice()) { + return false; + } + if ($item->isDummy()) { + if ($item->getHasChildren()) { + foreach ($item->getChildrenItems() as $child) { + if (empty($qtys)) { + if ($child->getQtyToInvoice() > 0) { + return true; + } + } else { + if (isset($qtys[$child->getId()]) && $qtys[$child->getId()] > 0) { + return true; + } + } + } + return false; + } else if($item->getParentItem()) { + $parent = $item->getParentItem(); + if (empty($qtys)) { + return $parent->getQtyToInvoice() > 0; + } else { + return isset($qtys[$parent->getId()]) && $qtys[$parent->getId()] > 0; + } + } + } else { + return $item->getQtyToInvoice() > 0; + } + } + + /** + * Check if order item can be shiped. Dummy item can be shiped or with his childrens or + * with parent item which is included to shipment + * + * @param Mage_Sales_Model_Order_Item $item + * @param array $qtys + * @return bool + */ + protected function _canShipItem($item, $qtys=array()) + { + if ($item->getIsVirtual() || $item->getLockedDoShip()) { + return false; + } + if ($item->isDummy(true)) { + if ($item->getHasChildren()) { + if ($item->isShipSeparately()) { + return true; + } + foreach ($item->getChildrenItems() as $child) { + if ($child->getIsVirtual()) { + continue; + } + if (empty($qtys)) { + if ($child->getQtyToShip() > 0) { + return true; + } + } else { + if (isset($qtys[$child->getId()]) && $qtys[$child->getId()] > 0) { + return true; + } + } + } + return false; + } else if($item->getParentItem()) { + $parent = $item->getParentItem(); + if (empty($qtys)) { + return $parent->getQtyToShip() > 0; + } else { + return isset($qtys[$parent->getId()]) && $qtys[$parent->getId()] > 0; + } + } + } else { + return $item->getQtyToShip()>0; + } + } + + /** + * Check if order item can be refunded + * + * @param Mage_Sales_Model_Order_Item $item + * @param array $qtys + * @return bool + */ + protected function _canRefundItem($item, $qtys=array()) + { + if ($item->isDummy()) { + if ($item->getHasChildren()) { + foreach ($item->getChildrenItems() as $child) { + if (empty($qtys)) { + if ($child->getQtyToRefund()>0) { + return true; + } + } else { + if (isset($qtys[$child->getId()]) && $qtys[$child->getId()] > 0) { + return true; + } + } + } + return false; + } else if($item->getParentItem()) { + $parent = $item->getParentItem(); + if (empty($qtys)) { + return $parent->getQtyToRefund()>0; + } else { + return isset($qtys[$parent->getId()]) && $qtys[$parent->getId()] > 0; + } + } + } else { + return $item->getQtyToRefund()>0; + } + } +} diff --git a/app/code/core/Mage/Sales/Model/Service/Quote.php b/app/code/core/Mage/Sales/Model/Service/Quote.php index 08b1ce1f5b..6ef71713b2 100644 --- a/app/code/core/Mage/Sales/Model/Service/Quote.php +++ b/app/code/core/Mage/Sales/Model/Service/Quote.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -44,12 +44,26 @@ class Mage_Sales_Model_Service_Quote protected $_convertor; /** - * List of additional order attributes which will beadded to order befire save + * List of additional order attributes which will be added to order before save * * @var array */ protected $_orderData = array(); + /** + * List of recurring payment profiles that may have been generated before placing the order + * + * @var array + */ + protected $_recurringPaymentProfiles = array(); + + /** + * Order that may be created during submission + * + * @var Mage_Sales_Model_Order + */ + protected $_order = null; + /** * Class constructor * @@ -95,13 +109,24 @@ public function setOrderData(array $data) return $this; } + /** + * @deprecated after 1.4.0.1 + * @see submitOrder() + * @see submitAll() + */ + public function submit() + { + return $this->submitOrder(); + } + /** * Submit the quote. Quote submit process will create the order based on quote data * * @return Mage_Sales_Model_Order */ - public function submit() + public function submitOrder() { + $this->_deleteNominalItems(); $this->_validate(); $quote = $this->_quote; $isVirtual = $quote->isVirtual(); @@ -146,11 +171,64 @@ public function submit() */ Mage::dispatchEvent('checkout_type_onepage_save_order', array('order'=>$order, 'quote'=>$quote)); Mage::dispatchEvent('sales_model_service_quote_submit_before', array('order'=>$order, 'quote'=>$quote)); - $transaction->save(); + try { + $transaction->save(); + Mage::dispatchEvent('sales_model_service_quote_submit_success', array('order'=>$order, 'quote'=>$quote)); + } catch (Exception $e) { + Mage::dispatchEvent('sales_model_service_quote_submit_failure', array('order'=>$order, 'quote'=>$quote)); + throw $e; + } Mage::dispatchEvent('sales_model_service_quote_submit_after', array('order'=>$order, 'quote'=>$quote)); + $this->_order = $order; return $order; } + /** + * Submit nominal items + * + * @return array + */ + public function submitNominalItems() + { + $this->_validate(); + $this->_submitRecurringPaymentProfiles(); + $this->_deleteNominalItems(); + } + + /** + * Submit all available items + * All created items will be set to the object + */ + public function submitAll() + { + $this->submitNominalItems(); + // no need to submit the order if there are no normal items remained + if (!$this->_quote->getAllVisibleItems()) { + return; + } + $this->submitOrder(); + } + + /** + * Return recurring payment profiles + * + * @return array + */ + public function getRecurringPaymentProfiles() + { + return $this->_recurringPaymentProfiles; + } + + /** + * Get an order that may had been created during submission + * + * @return Mage_Sales_Model_Order + */ + public function getOrder() + { + return $this->_order; + } + /** * Validate quote data before converting to order * @@ -170,7 +248,7 @@ protected function _validate() $method= $address->getShippingMethod(); $rate = $address->getShippingRateByCode($method); if (!$this->getQuote()->isVirtual() && (!$method || !$rate)) { - Mage::throwException($helper->__('Please specify shipping method.')); + Mage::throwException($helper->__('Please specify a shipping method.')); } } @@ -182,8 +260,36 @@ protected function _validate() } if (!($this->getQuote()->getPayment()->getMethod())) { - Mage::throwException($helper->__('Please select valid payment method.')); + Mage::throwException($helper->__('Please select a valid payment method.')); } + return $this; } + + /** + * Submit recurring payment profiles + */ + protected function _submitRecurringPaymentProfiles() + { + $profiles = $this->_quote->prepareRecurringPaymentProfiles(); + foreach ($profiles as $profile) { + if (!$profile->isValid()) { + Mage::throwException($profile->getValidationErrors(true, true)); + } + $profile->submit(); + } + $this->_recurringPaymentProfiles = $profiles; + } + + /** + * Get rid of all nominal items + */ + protected function _deleteNominalItems() + { + foreach ($this->_quote->getAllVisibleItems() as $item) { + if ($item->isNominal()) { + $item->isDeleted(true); + } + } + } } diff --git a/app/code/core/Mage/Sales/controllers/Billing/AgreementController.php b/app/code/core/Mage/Sales/controllers/Billing/AgreementController.php new file mode 100644 index 0000000000..7e086e72ae --- /dev/null +++ b/app/code/core/Mage/Sales/controllers/Billing/AgreementController.php @@ -0,0 +1,200 @@ + + */ +class Mage_Sales_Billing_AgreementController extends Mage_Core_Controller_Front_Action +{ + /** + * View billing agreements + * + */ + public function indexAction() + { + $this->_title($this->__('Billing Agreements')); + $this->loadLayout(); + $this->_initLayoutMessages('customer/session'); + $this->renderLayout(); + } + + /** + * Action predispatch + * + * Check customer authentication + */ + public function preDispatch() + { + parent::preDispatch(); + if (!$this->getRequest()->isDispatched()) { + return; + } + if (!$this->_getSession()->authenticate($this)) { + $this->setFlag('', 'no-dispatch', true); + } + } + + /** + * View billing agreement + * + */ + public function viewAction() + { + if (!$agreement = $this->_initAgreement()) { + return; + } + $this->_title($this->__('Billing Agreements')) + ->_title($this->__('Billing Agreement # %s', $agreement->getReferenceId())); + $this->loadLayout(); + $this->_initLayoutMessages('customer/session'); + $navigationBlock = $this->getLayout()->getBlock('customer_account_navigation'); + if ($navigationBlock) { + $navigationBlock->setActive('sales/billing_agreement/'); + } + $this->renderLayout(); + } + + /** + * Wizard start action + * + */ + public function startWizardAction() + { + $agreement = Mage::getModel('sales/billing_agreement'); + $paymentCode = $this->getRequest()->getParam('payment_method'); + if ($paymentCode) { + try { + $agreement->setStoreId(Mage::app()->getStore()->getId()) + ->setMethodCode($paymentCode) + ->setReturnUrl(Mage::getUrl('*/*/returnWizard', array('payment_method' => $paymentCode))) + ->setCancelUrl(Mage::getUrl('*/*/cancelWizard', array('payment_method' => $paymentCode))); + + $this->_redirectUrl($agreement->initToken()); + return $this; + } catch (Mage_Core_Exception $e) { + $this->_getSession()->addError($e->getMessage()); + } catch (Exception $e) { + Mage::logException($e); + $this->_getSession()->addError($this->__('Failed to start billing agreement wizard.')); + } + } + $this->_redirect('*/*/'); + } + + /** + * Wizard return action + * + */ + public function returnWizardAction() + { + $agreement = Mage::getModel('sales/billing_agreement'); + $paymentCode = $this->getRequest()->getParam('payment_method'); + $token = $this->getRequest()->getParam('token'); + if ($token && $paymentCode) { + try { + $agreement->setStoreId(Mage::app()->getStore()->getId()) + ->setToken($token) + ->setMethodCode($paymentCode) + ->setCustomer(Mage::getSingleton('customer/session')->getCustomer()) + ->place(); + $this->_getSession()->addSuccess( + $this->__('The billing agreement "%s" has been created.', $agreement->getReferenceId()) + ); + $this->_redirect('*/*/view', array('agreement' => $agreement->getId())); + return; + } catch (Mage_Core_Exception $e) { + $this->_getSession()->addError($e->getMessage()); + } catch (Exception $e) { + Mage::logException($e); + $this->_getSession()->addError($this->__('Failed to finish billing agreement wizard.')); + } + $this->_redirect('*/*/index'); + } + } + + /** + * Wizard cancel action + * + */ + public function cancelWizardAction() + { + $this->_redirect('*/*/index'); + } + + /** + * Cancel action + * Set billing agreement status to 'Canceled' + * + */ + public function cancelAction() + { + $agreement = $this->_initAgreement(); + if ($agreement && $agreement->canCancel()) { + try { + $agreement->cancel(); + $this->_getSession()->addNotice($this->__('The billing agreement "%s" has been canceled.', $agreement->getReferenceId())); + } catch (Mage_Core_Exception $e) { + $this->_getSession()->addError($e->getMessage()); + } catch (Exception $e) { + Mage::logException($e); + $this->_getSession()->addError($this->__('Failed to cancel the billing agreement.')); + } + } + $this->_redirect('*/*/view', array('_current' => true)); + } + + /** + * Init billing agreement model from request + * + * @return Mage_Sales_Model_Billing_Agreement + */ + protected function _initAgreement() + { + $agreementId = $this->getRequest()->getParam('agreement'); + if ($agreementId) { + $billingAgreement = Mage::getModel('sales/billing_agreement')->load($agreementId); + if (!$billingAgreement->getAgreementId()) { + $this->_getSession()->addError($this->__('Wrong billing agreement ID specified.')); + $this->_redirect('*/*/'); + return false; + } + } + Mage::register('current_billing_agreement', $billingAgreement); + return $billingAgreement; + } + + /** + * Retrieve customer session model + * + * @return Mage_Customer_Model_Session + */ + protected function _getSession() + { + return Mage::getSingleton('customer/session'); + } +} diff --git a/app/code/core/Mage/Sales/controllers/DownloadController.php b/app/code/core/Mage/Sales/controllers/DownloadController.php index c5d7f02b6b..836893766e 100644 --- a/app/code/core/Mage/Sales/controllers/DownloadController.php +++ b/app/code/core/Mage/Sales/controllers/DownloadController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/controllers/OrderController.php b/app/code/core/Mage/Sales/controllers/OrderController.php index 336615e991..84179c2c82 100644 --- a/app/code/core/Mage/Sales/controllers/OrderController.php +++ b/app/code/core/Mage/Sales/controllers/OrderController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -219,7 +219,7 @@ public function reorderAction() $this->_redirect('*/*/history'); } catch (Exception $e) { Mage::getSingleton('checkout/session')->addException($e, - Mage::helper('checkout')->__('Can not add item to shopping cart') + Mage::helper('checkout')->__('Cannot add the item to shopping cart.') ); $this->_redirect('checkout/cart'); } diff --git a/app/code/core/Mage/Sales/controllers/Recurring/ProfileController.php b/app/code/core/Mage/Sales/controllers/Recurring/ProfileController.php new file mode 100644 index 0000000000..beb820de13 --- /dev/null +++ b/app/code/core/Mage/Sales/controllers/Recurring/ProfileController.php @@ -0,0 +1,200 @@ +getRequest()->isDispatched()) { + return; + } + $this->_session = Mage::getSingleton('customer/session'); + if (!$this->_session->authenticate($this)) { + $this->setFlag('', 'no-dispatch', true); + } + Mage::register('current_customer', $this->_session->getCustomer()); + } + + /** + * Profiles listing + */ + public function indexAction() + { + $this->_title($this->__('Recurring Profiles')); + $this->loadLayout(); + $this->_initLayoutMessages('customer/session'); + $this->renderLayout(); + } + + /** + * Profile main view + */ + public function viewAction() + { + $this->_viewAction(); + } + + /** + * Profile history view + */ +// TODO: implement +// public function historyAction() +// { +// $this->_viewAction(); +// } + + /** + * Profile related orders view + */ + public function ordersAction() + { + $this->_viewAction(); + } + + /** + * Profile payment gateway info view + */ +// TODO: implement +// public function vendorAction() +// { +// $this->_viewAction(); +// } + + /** + * Attempt to set profile state + */ + public function updateStateAction() + { + $profile = null; + try { + $profile = $this->_initProfile(); + + switch ($this->getRequest()->getParam('action')) { + case 'cancel': + $profile->cancel(); + break; + case 'suspend': + $profile->suspend(); + break; + case 'activate': + $profile->activate(); + break; + } + $this->_session->addSuccess($this->__('The profile state has been updated.')); + } catch (Mage_Core_Exception $e) { + $this->_session->addError($e->getMessage()); + } catch (Exception $e) { + $this->_session->addError($this->__('Failed to update the profile.')); + Mage::logException($e); + } + if ($profile) { + $this->_redirect('*/*/view', array('profile' => $profile->getId())); + } else { + $this->_redirect('*/*/'); + } + } + + /** + * Fetch an update with profile + */ + public function updateProfileAction() + { + $profile = null; + try { + $profile = $this->_initProfile(); + $profile->fetchUpdate(); + if ($profile->hasDataChanges()) { + $profile->save(); + $this->_session->addSuccess($this->__('The profile has been updated.')); + } else { + $this->_session->addNotice($this->__('The profile has no changes.')); + } + } catch (Mage_Core_Exception $e) { + $this->_session->addError($e->getMessage()); + } catch (Exception $e) { + $this->_session->addError($this->__('Failed to update the profile.')); + Mage::logException($e); + } + if ($profile) { + $this->_redirect('*/*/view', array('profile' => $profile->getId())); + } else { + $this->_redirect('*/*/'); + } + } + + /** + * Generic profile view action + */ + protected function _viewAction() + { + try { + $profile = $this->_initProfile(); + $this->_title($this->__('Recurring Profiles'))->_title($this->__('Profile #%s', $profile->getReferenceId())); + $this->loadLayout(); + $this->_initLayoutMessages('customer/session'); + $navigationBlock = $this->getLayout()->getBlock('customer_account_navigation'); + if ($navigationBlock) { + $navigationBlock->setActive('sales/recurring_profile/'); + } + $this->renderLayout(); + return; + } catch (Mage_Core_Exception $e) { + $this->_session->addError($e->getMessage()); + } catch (Exception $e) { + Mage::logException($e); + } + $this->_redirect('*/*/'); + } + + /** + * Instantiate current profile and put it into registry + * + * @return Mage_Sales_Model_Recurring_Profile + * @throws Mage_Core_Exception + */ + protected function _initProfile() + { + $profile = Mage::getModel('sales/recurring_profile')->load($this->getRequest()->getParam('profile')); + if (!$profile->getId()) { + Mage::throwException($this->__('Specified profile does not exist.')); + } + Mage::register('current_recurring_profile', $profile); + return $profile; + } +} diff --git a/app/code/core/Mage/Sales/doc/test.php b/app/code/core/Mage/Sales/doc/test.php index 088da4d5bd..f630d757d4 100644 --- a/app/code/core/Mage/Sales/doc/test.php +++ b/app/code/core/Mage/Sales/doc/test.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ include "lib/Varien/Object.php"; diff --git a/app/code/core/Mage/Sales/etc/adminhtml.xml b/app/code/core/Mage/Sales/etc/adminhtml.xml index d56f26d556..a2127ef37e 100644 --- a/app/code/core/Mage/Sales/etc/adminhtml.xml +++ b/app/code/core/Mage/Sales/etc/adminhtml.xml @@ -1,4 +1,4 @@ - + @@ -52,6 +52,21 @@ adminhtml/sales_creditmemo 40 + + Transactions + adminhtml/sales_transactions + 50 + + + Recurring Profiles (beta) + adminhtml/sales_recurring_profile + 60 + + + Billing Agreements + adminhtml/sales_billing_agreement + 70 + @@ -73,6 +88,7 @@ Reorder Edit Cancel + Accept or Deny Payment Capture Invoice Creditmemo @@ -99,6 +115,40 @@ Credit Memos 40 + + Transactions + + Fetch + + 50 + + + Recurring Profiles + 60 + + + Billing Agreements + + + Actions + + + View + 5 + + + Manage + 10 + + + Place Order Using Billing Agreements + 15 + + + + + 70 + diff --git a/app/code/core/Mage/Sales/etc/api.xml b/app/code/core/Mage/Sales/etc/api.xml index 349819932e..e7b35e89f9 100644 --- a/app/code/core/Mage/Sales/etc/api.xml +++ b/app/code/core/Mage/Sales/etc/api.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Sales/etc/config.xml b/app/code/core/Mage/Sales/etc/config.xml index 20ea873cd3..ba78a0fb17 100644 --- a/app/code/core/Mage/Sales/etc/config.xml +++ b/app/code/core/Mage/Sales/etc/config.xml @@ -1,4 +1,4 @@ - + - 0.9.56 + 1.4.0.15 @@ -121,6 +121,7 @@ * * * + * * * * @@ -129,10 +130,16 @@ * * * + * * * * + * + * + * + * + ** ** ** @@ -198,6 +205,11 @@ * * * + * + * + * + * + * @@ -236,12 +248,14 @@ * * * + * * * * * * + * * * @@ -358,12 +372,52 @@ sales_flat_quote_payment
        sales_flat_quote_shipping_rate
        - sales_order
        - sales_order_tax
        + sales_flat_order
        + sales_flat_order_grid
        sales_flat_order_item
        + sales_flat_order_address
        + sales_flat_order_payment
        + sales_flat_order_status_history
        + + sales_flat_invoice
        + sales_flat_invoice_grid
        + sales_flat_invoice_item
        + sales_flat_invoice_comment
        + + sales_flat_shipment
        + sales_flat_shipment_grid
        + sales_flat_shipment_item
        + sales_flat_shipment_comment
        + sales_flat_shipment_track
        + + sales_flat_creditmemo
        + sales_flat_creditmemo_grid
        + sales_flat_creditmemo_item
        + sales_flat_creditmemo_comment
        + + sales_recurring_profile
        + sales_recurring_profile_order
        + + + sales_order_tax
        + + sales_flat_order_item_option
        + + + sales_order_entity
        + sales_order_aggregated_created
        sales_order_aggregated_updated
        @@ -377,6 +431,14 @@ sales_refunded_aggregated_order
        sales_payment_transaction
        + + sales_bestsellers_aggregated_daily
        + sales_bestsellers_aggregated_monthly
        + sales_bestsellers_aggregated_yearly
        + + sales_billing_agreement
        + sales_billing_agreement_order
        + + @@ -551,6 +638,7 @@ + @@ -598,10 +686,17 @@ - + + + + + + + + @@ -736,6 +831,12 @@ sales.xml + + sales/billing_agreement.xml + + + sales/recurring_profile.xml + @@ -797,6 +898,22 @@ + + + + sales/observer + prepareProductEditFormRecurringProfile + + + + + + + sales/observer + restrictAdminBillingAgreementUsage + + + @@ -890,6 +1007,9 @@ 1 + + 0 + @@ -915,6 +1035,10 @@ 0 0 * * * sales/observer::aggregateSalesReportRefundedData + + 0 0 * * * + sales/observer::aggregateSalesReportBestsellersData +
        diff --git a/app/code/core/Mage/Sales/etc/system.xml b/app/code/core/Mage/Sales/etc/system.xml index 2245731228..b36a1619db 100644 --- a/app/code/core/Mage/Sales/etc/system.xml +++ b/app/code/core/Mage/Sales/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -44,7 +44,7 @@ 1 - + text 10 1 @@ -120,7 +120,7 @@ 1 - + image adminhtml/system_config_backend_image_pdf sales/store/logo @@ -132,7 +132,7 @@ Default logo, will be used in PDF and HTML documents.<br />(jpeg, tiff, png) - + image adminhtml/system_config_backend_image sales/store/logo_html @@ -155,7 +155,7 @@ - + 50 1 1 @@ -171,24 +171,24 @@ 0 - + 10 1 1 0 - Subtotal after discount + Subtotal after discount. - + 20 textarea 1 1 1 - This message will be shown in shopping cart when subtotal after discount less than minimum amount + This message will be shown in shopping cart when subtotal after discount less than minimum amount. - + 30 textarea 1 @@ -196,7 +196,7 @@ 1 - + 40 select adminhtml/system_config_source_yesno @@ -205,25 +205,44 @@ 0 - + 50 textarea 1 1 1 - If empty, the default description above will be used + If empty, the default description above will be used. - + 60 textarea 1 1 1 - If empty, the default error above will be used + If empty, the default error above will be used. + + + 60 + 1 + 0 + 0 + + + + 10 + select + adminhtml/system_config_source_yesno + 1 + 0 + 0 + Improves dashboard performance but provides non-realtime data. + + + @@ -286,7 +305,7 @@ 1 1 1 - separate by "," + Comma-separated. @@ -351,7 +370,7 @@ 1 1 1 - separate by "," + Comma-separated. @@ -416,7 +435,7 @@ 1 1 1 - separate by "," + Comma-separated. @@ -480,7 +499,7 @@ 1 1 1 - separate by "," + Comma-separated. @@ -545,7 +564,7 @@ 1 1 1 - separate by "," + Comma-separated. @@ -609,7 +628,7 @@ 1 1 1 - separate by "," + Comma-separated. @@ -674,7 +693,7 @@ 1 1 1 - separate by "," + Comma-separated. @@ -738,7 +757,7 @@ 1 1 1 - separate by "," + Comma-separated. diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.7.0.php index 39b98244ec..986ea3ddf0 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.8.11.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.8.11.php index 96d6e7bdee..cfb5389ae7 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.8.11.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.8.11.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.9.0.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.9.0.php index 2f1b52d30f..569f7c12af 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.9.0.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.9.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-1.4.0.0.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-1.4.0.0.php new file mode 100644 index 0000000000..04bc81fb11 --- /dev/null +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-1.4.0.0.php @@ -0,0 +1,1309 @@ +startSetup(); +$installer->run(" +/* Orders */ +CREATE TABLE `{$installer->getTable('sales_flat_order')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `state` varchar(32) default NULL, + `status` varchar(32) default NULL, + `coupon_code` varchar(255) default NULL, + `protect_code` varchar(255) default NULL, + `shipping_description` varchar(255) default NULL, + `is_virtual` tinyint(1) unsigned default NULL, + `store_id` smallint(5) unsigned default NULL, + `customer_id` int(10) unsigned default NULL, + `base_discount_amount` decimal(12,4) default NULL, + `base_discount_canceled` decimal(12,4) default NULL, + `base_discount_invoiced` decimal(12,4) default NULL, + `base_discount_refunded` decimal(12,4) default NULL, + `base_grand_total` decimal(12,4) default NULL, + `base_shipping_amount` decimal(12,4) default NULL, + `base_shipping_canceled` decimal(12,4) default NULL, + `base_shipping_invoiced` decimal(12,4) default NULL, + `base_shipping_refunded` decimal(12,4) default NULL, + `base_shipping_tax_amount` decimal(12,4) default NULL, + `base_shipping_tax_refunded` decimal(12,4) default NULL, + `base_subtotal` decimal(12,4) default NULL, + `base_subtotal_canceled` decimal(12,4) default NULL, + `base_subtotal_invoiced` decimal(12,4) default NULL, + `base_subtotal_refunded` decimal(12,4) default NULL, + `base_tax_amount` decimal(12,4) default NULL, + `base_tax_canceled` decimal(12,4) default NULL, + `base_tax_invoiced` decimal(12,4) default NULL, + `base_tax_refunded` decimal(12,4) default NULL, + `base_to_global_rate` decimal(12,4) default NULL, + `base_to_order_rate` decimal(12,4) default NULL, + `base_total_canceled` decimal(12,4) default NULL, + `base_total_invoiced` decimal(12,4) default NULL, + `base_total_invoiced_cost` decimal(12,4) default NULL, + `base_total_offline_refunded` decimal(12,4) default NULL, + `base_total_online_refunded` decimal(12,4) default NULL, + `base_total_paid` decimal(12,4) default NULL, + `base_total_qty_ordered` decimal(12,4) default NULL, + `base_total_refunded` decimal(12,4) default NULL, + `discount_amount` decimal(12,4) default NULL, + `discount_canceled` decimal(12,4) default NULL, + `discount_invoiced` decimal(12,4) default NULL, + `discount_refunded` decimal(12,4) default NULL, + `grand_total` decimal(12,4) default NULL, + `shipping_amount` decimal(12,4) default NULL, + `shipping_canceled` decimal(12,4) default NULL, + `shipping_invoiced` decimal(12,4) default NULL, + `shipping_refunded` decimal(12,4) default NULL, + `shipping_tax_amount` decimal(12,4) default NULL, + `shipping_tax_refunded` decimal(12,4) default NULL, + `store_to_base_rate` decimal(12,4) default NULL, + `store_to_order_rate` decimal(12,4) default NULL, + `subtotal` decimal(12,4) default NULL, + `subtotal_canceled` decimal(12,4) default NULL, + `subtotal_invoiced` decimal(12,4) default NULL, + `subtotal_refunded` decimal(12,4) default NULL, + `tax_amount` decimal(12,4) default NULL, + `tax_canceled` decimal(12,4) default NULL, + `tax_invoiced` decimal(12,4) default NULL, + `tax_refunded` decimal(12,4) default NULL, + `total_canceled` decimal(12,4) default NULL, + `total_invoiced` decimal(12,4) default NULL, + `total_offline_refunded` decimal(12,4) default NULL, + `total_online_refunded` decimal(12,4) default NULL, + `total_paid` decimal(12,4) default NULL, + `total_qty_ordered` decimal(12,4) default NULL, + `total_refunded` decimal(12,4) default NULL, + `can_ship_partially` tinyint(1) unsigned default NULL, + `can_ship_partially_item` tinyint(1) unsigned default NULL, + `customer_is_guest` tinyint(1) unsigned default NULL, + `customer_note_notify` tinyint(1) unsigned default NULL, + `billing_address_id` int(10) default NULL, + `customer_group_id` smallint(5) default NULL, + `edit_increment` int(10) default NULL, + `email_sent` tinyint(1) unsigned default NULL, + `forced_do_shipment_with_invoice` tinyint(1) unsigned default NULL, + `gift_message_id` int(10) default NULL, + `payment_authorization_expiration` int(10) default NULL, + `paypal_ipn_customer_notified` int(10) default NULL, + `quote_address_id` int(10) default NULL, + `quote_id` int(10) default NULL, + `shipping_address_id` int(10) default NULL, + `adjustment_negative` decimal(12,4) default NULL, + `adjustment_positive` decimal(12,4) default NULL, + `base_adjustment_negative` decimal(12,4) default NULL, + `base_adjustment_positive` decimal(12,4) default NULL, + `base_shipping_discount_amount` decimal(12,4) default NULL, + `base_subtotal_incl_tax` decimal(12,4) default NULL, + `base_total_due` decimal(12,4) default NULL, + `payment_authorization_amount` decimal(12,4) default NULL, + `shipping_discount_amount` decimal(12,4) default NULL, + `subtotal_incl_tax` decimal(12,4) default NULL, + `total_due` decimal(12,4) default NULL, + `weight` decimal(12,4) default NULL, + `customer_dob` datetime default NULL, + `increment_id` varchar(50) default NULL, + `applied_rule_ids` varchar(255) default NULL, + `base_currency_code` char(3) default NULL, + `customer_email` varchar(255) default NULL, + `customer_firstname` varchar(255) default NULL, + `customer_lastname` varchar(255) default NULL, + `customer_middlename` varchar(255) default NULL, + `customer_prefix` varchar(255) default NULL, + `customer_suffix` varchar(255) default NULL, + `customer_taxvat` varchar(255) default NULL, + `discount_description` varchar(255) default NULL, + `ext_customer_id` varchar(255) default NULL, + `ext_order_id` varchar(255) default NULL, + `global_currency_code` char(3) default NULL, + `hold_before_state` varchar(255) default NULL, + `hold_before_status` varchar(255) default NULL, + `order_currency_code` varchar(255) default NULL, + `original_increment_id` varchar(50) default NULL, + `relation_child_id` varchar(32) default NULL, + `relation_child_real_id` varchar(32) default NULL, + `relation_parent_id` varchar(32) default NULL, + `relation_parent_real_id` varchar(32) default NULL, + `remote_ip` varchar(255) default NULL, + `shipping_method` varchar(255) default NULL, + `store_currency_code` char(3) default NULL, + `store_name` varchar(255) default NULL, + `x_forwarded_for` varchar(255) default NULL, + `customer_note` text, + `created_at` datetime default NULL, + `updated_at` datetime default NULL, + `total_item_count` smallint(5) unsigned DEFAULT '0', + `customer_gender` int(11) DEFAULT NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_STATUS` (`status`), + KEY `IDX_STATE` (`state`), + KEY `IDX_STORE_ID` (`store_id`), + KEY `IDX_INCREMENT_ID` (`increment_id`), + KEY `IDX_CREATED_AT` (`created_at`), + KEY `IDX_CUSTOMER_ID` (`customer_id`), + KEY `IDX_EXT_ORDER_ID` (`ext_order_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Orders Grid */ +CREATE TABLE `{$installer->getTable('sales_flat_order_grid')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `status` varchar(32) default NULL, + `store_id` smallint(5) unsigned default NULL, + `customer_id` int(10) unsigned default NULL, + `base_grand_total` decimal(12,4) default NULL, + `base_total_paid` decimal(12,4) default NULL, + `grand_total` decimal(12,4) default NULL, + `total_paid` decimal(12,4) default NULL, + `increment_id` varchar(50) default NULL, + `base_currency_code` char(3) default NULL, + `order_currency_code` varchar(255) default NULL, + `shipping_name` varchar(255) default NULL, + `billing_name` varchar(255) default NULL, + `created_at` datetime default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_STATUS` (`status`), + KEY `IDX_STORE_ID` (`store_id`), + KEY `IDX_BASE_GRAND_TOTAL` (`base_grand_total`), + KEY `IDX_BASE_TOTAL_PAID` (`base_total_paid`), + KEY `IDX_GRAND_TOTAL` (`grand_total`), + KEY `IDX_TOTAL_PAID` (`total_paid`), + KEY `IDX_INCREMENT_ID` (`increment_id`), + KEY `IDX_SHIPPING_NAME` (`shipping_name`), + KEY `IDX_BILLING_NAME` (`billing_name`), + KEY `IDX_CREATED_AT` (`created_at`), + KEY `IDX_CUSTOMER_ID` (`customer_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Order Address */ +CREATE TABLE `{$installer->getTable('sales_flat_order_address')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned default NULL, + `customer_address_id` int(10) default NULL, + `quote_address_id` int(10) default NULL, + `region_id` int(10) default NULL, + `customer_id` int(10) default NULL, + `fax` varchar(255) default NULL, + `region` varchar(255) default NULL, + `postcode` varchar(255) default NULL, + `lastname` varchar(255) default NULL, + `street` varchar(255) default NULL, + `city` varchar(255) default NULL, + `email` varchar(255) default NULL, + `telephone` varchar(255) default NULL, + `country_id` char(2) default NULL, + `firstname` varchar(255) default NULL, + `address_type` varchar(255) default NULL, + `prefix` varchar(255) default NULL, + `middlename` varchar(255) default NULL, + `suffix` varchar(255) default NULL, + `company` varchar(255) default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_PARENT_ID` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Order Comments */ +CREATE TABLE `{$installer->getTable('sales_flat_order_status_history')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned NOT NULL, + `is_customer_notified` int(10) default NULL, + `comment` text, + `status` varchar(32) default NULL, + `created_at` datetime default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_PARENT_ID` (`parent_id`), + KEY `IDX_CREATED_AT` (`created_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Order Items */ + +CREATE TABLE `{$installer->getTable('sales_flat_order_item')}` ( + `item_id` int(10) unsigned NOT NULL auto_increment, + `order_id` int(10) unsigned NOT NULL default '0', + `parent_item_id` int(10) unsigned default NULL, + `quote_item_id` int(10) unsigned default NULL, + `store_id` smallint(5) unsigned default NULL, + `created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `product_id` int(10) unsigned default NULL, + `product_type` varchar(255) default NULL, + `product_options` text, + `weight` decimal(12,4) default '0.0000', + `is_virtual` tinyint(1) unsigned default NULL, + `sku` varchar(255) NOT NULL default '', + `name` varchar(255) default NULL, + `description` text, + `applied_rule_ids` text, + `additional_data` text, + `free_shipping` tinyint(1) unsigned NOT NULL default '0', + `is_qty_decimal` tinyint(1) unsigned default NULL, + `no_discount` tinyint(1) unsigned default '0', + `qty_backordered` decimal(12,4) default '0.0000', + `qty_canceled` decimal(12,4) default '0.0000', + `qty_invoiced` decimal(12,4) default '0.0000', + `qty_ordered` decimal(12,4) default '0.0000', + `qty_refunded` decimal(12,4) default '0.0000', + `qty_shipped` decimal(12,4) default '0.0000', + `base_cost` decimal(12,4) default '0.0000', + `price` decimal(12,4) NOT NULL default '0.0000', + `base_price` decimal(12,4) NOT NULL default '0.0000', + `original_price` decimal(12,4) default NULL, + `base_original_price` decimal(12,4) default NULL, + `tax_percent` decimal(12,4) default '0.0000', + `tax_amount` decimal(12,4) default '0.0000', + `base_tax_amount` decimal(12,4) default '0.0000', + `tax_invoiced` decimal(12,4) default '0.0000', + `base_tax_invoiced` decimal(12,4) default '0.0000', + `discount_percent` decimal(12,4) default '0.0000', + `discount_amount` decimal(12,4) default '0.0000', + `base_discount_amount` decimal(12,4) default '0.0000', + `discount_invoiced` decimal(12,4) default '0.0000', + `base_discount_invoiced` decimal(12,4) default '0.0000', + `amount_refunded` decimal(12,4) default '0.0000', + `base_amount_refunded` decimal(12,4) default '0.0000', + `row_total` decimal(12,4) NOT NULL default '0.0000', + `base_row_total` decimal(12,4) NOT NULL default '0.0000', + `row_invoiced` decimal(12,4) NOT NULL default '0.0000', + `base_row_invoiced` decimal(12,4) NOT NULL default '0.0000', + `row_weight` decimal(12,4) default '0.0000', + `gift_message_id` int(10) default NULL, + `gift_message_available` int(10) default NULL, + `base_tax_before_discount` decimal(12,4) default NULL, + `tax_before_discount` decimal(12,4) default NULL, + `ext_order_item_id` varchar(255) default NULL, + `weee_tax_applied` text, + `weee_tax_applied_amount` decimal(12,4) default NULL, + `weee_tax_applied_row_amount` decimal(12,4) default NULL, + `base_weee_tax_applied_amount` decimal(12,4) default NULL, + `base_weee_tax_applied_row_amount` decimal(12,4) default NULL, + `weee_tax_disposition` decimal(12,4) default NULL, + `weee_tax_row_disposition` decimal(12,4) default NULL, + `base_weee_tax_disposition` decimal(12,4) default NULL, + `base_weee_tax_row_disposition` decimal(12,4) default NULL, + `locked_do_invoice` tinyint(1) unsigned default NULL, + `locked_do_ship` tinyint(1) unsigned default NULL, + `price_incl_tax` decimal(12,4) default NULL, + `base_price_incl_tax` decimal(12,4) default NULL, + `row_total_incl_tax` decimal(12,4) default NULL, + `base_row_total_incl_tax` decimal(12,4) default NULL, + PRIMARY KEY (`item_id`), + KEY `IDX_ORDER` (`order_id`), + KEY `IDX_STORE_ID` (`store_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Order Payment */ + +CREATE TABLE `{$installer->getTable('sales_flat_order_payment')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned NOT NULL, + `base_shipping_captured` decimal(12,4) default NULL, + `shipping_captured` decimal(12,4) default NULL, + `amount_refunded` decimal(12,4) default NULL, + `base_amount_paid` decimal(12,4) default NULL, + `amount_canceled` decimal(12,4) default NULL, + `base_amount_authorized` decimal(12,4) default NULL, + `base_amount_paid_online` decimal(12,4) default NULL, + `base_amount_refunded_online` decimal(12,4) default NULL, + `base_shipping_amount` decimal(12,4) default NULL, + `shipping_amount` decimal(12,4) default NULL, + `amount_paid` decimal(12,4) default NULL, + `amount_authorized` decimal(12,4) default NULL, + `base_amount_ordered` decimal(12,4) default NULL, + `base_shipping_refunded` decimal(12,4) default NULL, + `shipping_refunded` decimal(12,4) default NULL, + `base_amount_refunded` decimal(12,4) default NULL, + `amount_ordered` decimal(12,4) default NULL, + `base_amount_canceled` decimal(12,4) default NULL, + `ideal_transaction_checked` tinyint(1) unsigned default NULL, + `quote_payment_id` int(10) default NULL, + `additional_data` text, + `cc_exp_month` varchar(255) default NULL, + `cc_ss_start_year` varchar(255) default NULL, + `echeck_bank_name` varchar(255) default NULL, + `method` varchar(255) default NULL, + `cc_debug_request_body` varchar(255) default NULL, + `cc_secure_verify` varchar(255) default NULL, + `cybersource_token` varchar(255) default NULL, + `ideal_issuer_title` varchar(255) default NULL, + `protection_eligibility` varchar(255) default NULL, + `cc_approval` varchar(255) default NULL, + `cc_last4` varchar(255) default NULL, + `cc_status_description` varchar(255) default NULL, + `echeck_type` varchar(255) default NULL, + `paybox_question_number` varchar(255) default NULL, + `cc_debug_response_serialized` varchar(255) default NULL, + `cc_ss_start_month` varchar(255) default NULL, + `echeck_account_type` varchar(255) default NULL, + `last_trans_id` varchar(255) default NULL, + `cc_cid_status` varchar(255) default NULL, + `cc_owner` varchar(255) default NULL, + `cc_type` varchar(255) default NULL, + `ideal_issuer_id` varchar(255) default NULL, + `po_number` varchar(255) default NULL, + `cc_exp_year` varchar(255) default NULL, + `cc_status` varchar(255) default NULL, + `echeck_routing_number` varchar(255) default NULL, + `account_status` varchar(255) default NULL, + `anet_trans_method` varchar(255) default NULL, + `cc_debug_response_body` varchar(255) default NULL, + `cc_ss_issue` varchar(255) default NULL, + `echeck_account_name` varchar(255) default NULL, + `cc_avs_status` varchar(255) default NULL, + `cc_number_enc` varchar(255) default NULL, + `cc_trans_id` varchar(255) default NULL, + `flo2cash_account_id` varchar(255) default NULL, + `paybox_request_number` varchar(255) default NULL, + `address_status` varchar(255) default NULL, + `additional_information` text, + PRIMARY KEY (`entity_id`), + KEY `IDX_PARENT_ID` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Shipments */ + +CREATE TABLE `{$installer->getTable('sales_flat_shipment')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `store_id` smallint(5) unsigned default NULL, + `total_weight` decimal(12,4) default NULL, + `total_qty` decimal(12,4) default NULL, + `email_sent` tinyint(1) unsigned default NULL, + `order_id` int(10) unsigned NOT NULL, + `customer_id` int(10) default NULL, + `shipping_address_id` int(10) default NULL, + `billing_address_id` int(10) default NULL, + `shipment_status` int(10) default NULL, + `increment_id` varchar(50) default NULL, + `created_at` datetime default NULL, + `updated_at` datetime default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_STORE_ID` (`store_id`), + KEY `IDX_TOTAL_QTY` (`total_qty`), + KEY `IDX_INCREMENT_ID` (`increment_id`), + KEY `IDX_ORDER_ID` (`order_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Shipments Grid */ + +CREATE TABLE `{$installer->getTable('sales_flat_shipment_grid')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `store_id` smallint(5) unsigned default NULL, + `total_qty` decimal(12,4) default NULL, + `order_id` int(10) unsigned NOT NULL, + `shipment_status` int(10) default NULL, + `increment_id` varchar(50) default NULL, + `order_increment_id` varchar(50) default NULL, + `created_at` datetime default NULL, + `order_created_at` datetime default NULL, + `shipping_name` varchar(255) default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_STORE_ID` (`store_id`), + KEY `IDX_TOTAL_QTY` (`total_qty`), + KEY `IDX_ORDER_ID` (`order_id`), + KEY `IDX_SHIPMENT_STATUS` (`shipment_status`), + KEY `IDX_INCREMENT_ID` (`increment_id`), + KEY `IDX_ORDER_INCREMENT_ID` (`order_increment_id`), + KEY `IDX_CREATED_AT` (`created_at`), + KEY `IDX_ORDER_CREATED_AT` (`order_created_at`), + KEY `IDX_SHIPPING_NAME` (`shipping_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Shipment Items */ + +CREATE TABLE `{$installer->getTable('sales_flat_shipment_item')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned NOT NULL, + `row_total` decimal(12,4) default NULL, + `price` decimal(12,4) default NULL, + `weight` decimal(12,4) default NULL, + `qty` decimal(12,4) default NULL, + `product_id` int(10) default NULL, + `order_item_id` int(10) default NULL, + `additional_data` text, + `description` text, + `name` varchar(255) default NULL, + `sku` varchar(255) default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_PARENT_ID` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Shipping tracking */ + +CREATE TABLE `{$installer->getTable('sales_flat_shipment_track')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned NOT NULL, + `weight` decimal(12,4) default NULL, + `qty` decimal(12,4) default NULL, + `order_id` int(10) unsigned NOT NULL, + `number` text, + `description` text, + `title` varchar(255) default NULL, + `carrier_code` varchar(32) default NULL, + `created_at` datetime default NULL, + `updated_at` datetime default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_PARENT_ID` (`parent_id`), + KEY `IDX_ORDER_ID` (`order_id`), + KEY `IDX_CREATED_AT` (`created_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Shipment Comment */ +CREATE TABLE `{$installer->getTable('sales_flat_shipment_comment')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned NOT NULL, + `is_customer_notified` int(10) default NULL, + `comment` text, + `created_at` datetime default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_CREATED_AT` (`created_at`), + KEY `IDX_PARENT_ID` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Invoice Main Table */ +CREATE TABLE `{$installer->getTable('sales_flat_invoice')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `store_id` smallint(5) unsigned default NULL, + `base_grand_total` decimal(12,4) default NULL, + `shipping_tax_amount` decimal(12,4) default NULL, + `tax_amount` decimal(12,4) default NULL, + `base_tax_amount` decimal(12,4) default NULL, + `store_to_order_rate` decimal(12,4) default NULL, + `base_shipping_tax_amount` decimal(12,4) default NULL, + `base_discount_amount` decimal(12,4) default NULL, + `base_to_order_rate` decimal(12,4) default NULL, + `grand_total` decimal(12,4) default NULL, + `shipping_amount` decimal(12,4) default NULL, + `subtotal_incl_tax` decimal(12,4) default NULL, + `base_subtotal_incl_tax` decimal(12,4) default NULL, + `store_to_base_rate` decimal(12,4) default NULL, + `base_shipping_amount` decimal(12,4) default NULL, + `total_qty` decimal(12,4) default NULL, + `base_to_global_rate` decimal(12,4) default NULL, + `subtotal` decimal(12,4) default NULL, + `base_subtotal` decimal(12,4) default NULL, + `discount_amount` decimal(12,4) default NULL, + `billing_address_id` int(10) default NULL, + `is_used_for_refund` tinyint(1) unsigned default NULL, + `order_id` int(10) unsigned NOT NULL, + `email_sent` tinyint(1) unsigned default NULL, + `can_void_flag` tinyint(1) unsigned default NULL, + `state` int(10) default NULL, + `shipping_address_id` int(10) default NULL, + `cybersource_token` varchar(255) default NULL, + `store_currency_code` char(3) default NULL, + `transaction_id` varchar(255) default NULL, + `order_currency_code` char(3) default NULL, + `base_currency_code` char(3) default NULL, + `global_currency_code` char(3) default NULL, + `increment_id` varchar(50) default NULL, + `created_at` datetime default NULL, + `updated_at` datetime default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_STORE_ID` (`store_id`), + KEY `IDX_GRAND_TOTAL` (`grand_total`), + KEY `IDX_ORDER_ID` (`order_id`), + KEY `IDX_STATE` (`state`), + KEY `IDX_INCREMENT_ID` (`increment_id`), + KEY `IDX_CREATED_AT` (`created_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Invoices Grid */ +CREATE TABLE `{$installer->getTable('sales_flat_invoice_grid')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `store_id` smallint(5) unsigned default NULL, + `base_grand_total` decimal(12,4) default NULL, + `grand_total` decimal(12,4) default NULL, + `order_id` int(10) unsigned NOT NULL, + `state` int(10) default NULL, + `store_currency_code` char(3) default NULL, + `order_currency_code` char(3) default NULL, + `base_currency_code` char(3) default NULL, + `global_currency_code` char(3) default NULL, + `increment_id` varchar(50) default NULL, + `order_increment_id` varchar(50) default NULL, + `created_at` datetime default NULL, + `order_created_at` datetime default NULL, + `billing_name` varchar(255) default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_STORE_ID` (`store_id`), + KEY `IDX_GRAND_TOTAL` (`grand_total`), + KEY `IDX_ORDER_ID` (`order_id`), + KEY `IDX_STATE` (`state`), + KEY `IDX_INCREMENT_ID` (`increment_id`), + KEY `IDX_ORDER_INCREMENT_ID` (`order_increment_id`), + KEY `IDX_CREATED_AT` (`created_at`), + KEY `IDX_ORDER_CREATED_AT` (`order_created_at`), + KEY `IDX_BILLING_NAME` (`billing_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Invoice Items */ + +CREATE TABLE `{$installer->getTable('sales_flat_invoice_item')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned NOT NULL, + `base_price` decimal(12,4) default NULL, + `base_weee_tax_row_disposition` decimal(12,4) default NULL, + `weee_tax_applied_row_amount` decimal(12,4) default NULL, + `base_weee_tax_applied_amount` decimal(12,4) default NULL, + `tax_amount` decimal(12,4) default NULL, + `base_row_total` decimal(12,4) default NULL, + `discount_amount` decimal(12,4) default NULL, + `row_total` decimal(12,4) default NULL, + `weee_tax_row_disposition` decimal(12,4) default NULL, + `base_discount_amount` decimal(12,4) default NULL, + `base_weee_tax_disposition` decimal(12,4) default NULL, + `price_incl_tax` decimal(12,4) default NULL, + `weee_tax_applied_amount` decimal(12,4) default NULL, + `base_tax_amount` decimal(12,4) default NULL, + `base_price_incl_tax` decimal(12,4) default NULL, + `qty` decimal(12,4) default NULL, + `weee_tax_disposition` decimal(12,4) default NULL, + `base_cost` decimal(12,4) default NULL, + `base_weee_tax_applied_row_amount` decimal(12,4) default NULL, + `price` decimal(12,4) default NULL, + `base_row_total_incl_tax` decimal(12,4) default NULL, + `row_total_incl_tax` decimal(12,4) default NULL, + `product_id` int(10) default NULL, + `order_item_id` int(10) default NULL, + `additional_data` text, + `description` text, + `weee_tax_applied` text, + `sku` varchar(255) default NULL, + `name` varchar(255) default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_PARENT_ID` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Invoice Comments */ +CREATE TABLE `{$installer->getTable('sales_flat_invoice_comment')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned NOT NULL, + `is_customer_notified` tinyint(1) unsigned default NULL, + `comment` text, + `created_at` datetime default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_CREATED_AT` (`created_at`), + KEY `IDX_PARENT_ID` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* CreditMemo Main table */ +CREATE TABLE `{$installer->getTable('sales_flat_creditmemo')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `store_id` smallint(5) unsigned default NULL, + `adjustment_positive` decimal(12,4) default NULL, + `base_shipping_tax_amount` decimal(12,4) default NULL, + `store_to_order_rate` decimal(12,4) default NULL, + `base_discount_amount` decimal(12,4) default NULL, + `base_to_order_rate` decimal(12,4) default NULL, + `grand_total` decimal(12,4) default NULL, + `base_adjustment_negative` decimal(12,4) default NULL, + `base_subtotal_incl_tax` decimal(12,4) default NULL, + `shipping_amount` decimal(12,4) default NULL, + `subtotal_incl_tax` decimal(12,4) default NULL, + `adjustment_negative` decimal(12,4) default NULL, + `base_shipping_amount` decimal(12,4) default NULL, + `store_to_base_rate` decimal(12,4) default NULL, + `base_to_global_rate` decimal(12,4) default NULL, + `base_adjustment` decimal(12,4) default NULL, + `base_subtotal` decimal(12,4) default NULL, + `discount_amount` decimal(12,4) default NULL, + `subtotal` decimal(12,4) default NULL, + `adjustment` decimal(12,4) default NULL, + `base_grand_total` decimal(12,4) default NULL, + `base_adjustment_positive` decimal(12,4) default NULL, + `base_tax_amount` decimal(12,4) default NULL, + `shipping_tax_amount` decimal(12,4) default NULL, + `tax_amount` decimal(12,4) default NULL, + `order_id` int(10) unsigned NOT NULL, + `email_sent` tinyint(1) unsigned default NULL, + `creditmemo_status` int(10) default NULL, + `state` int(10) default NULL, + `shipping_address_id` int(10) default NULL, + `billing_address_id` int(10) default NULL, + `invoice_id` int(10) default NULL, + `cybersource_token` varchar(255) default NULL, + `store_currency_code` char(3) default NULL, + `order_currency_code` char(3) default NULL, + `base_currency_code` char(3) default NULL, + `global_currency_code` char(3) default NULL, + `transaction_id` varchar(255) default NULL, + `increment_id` varchar(50) default NULL, + `created_at` datetime default NULL, + `updated_at` datetime default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_STORE_ID` (`store_id`), + KEY `IDX_ORDER_ID` (`order_id`), + KEY `IDX_CREDITMEMO_STATUS` (`creditmemo_status`), + KEY `IDX_INCREMENT_ID` (`increment_id`), + KEY `IDX_STATE` (`state`), + KEY `IDX_CREATED_AT` (`created_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* CreditMemo Grid */ +CREATE TABLE `{$installer->getTable('sales_flat_creditmemo_grid')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `store_id` smallint(5) unsigned default NULL, + `store_to_order_rate` decimal(12,4) default NULL, + `base_to_order_rate` decimal(12,4) default NULL, + `grand_total` decimal(12,4) default NULL, + `store_to_base_rate` decimal(12,4) default NULL, + `base_to_global_rate` decimal(12,4) default NULL, + `base_grand_total` decimal(12,4) default NULL, + `order_id` int(10) unsigned NOT NULL, + `creditmemo_status` int(10) default NULL, + `state` int(10) default NULL, + `invoice_id` int(10) default NULL, + `store_currency_code` char(3) default NULL, + `order_currency_code` char(3) default NULL, + `base_currency_code` char(3) default NULL, + `global_currency_code` char(3) default NULL, + `increment_id` varchar(50) default NULL, + `order_increment_id` varchar(50) default NULL, + `created_at` datetime default NULL, + `order_created_at` datetime default NULL, + `billing_name` varchar(255) default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_STORE_ID` (`store_id`), + KEY `IDX_GRAND_TOTAL` (`grand_total`), + KEY `IDX_BASE_GRAND_TOTAL` (`base_grand_total`), + KEY `IDX_ORDER_ID` (`order_id`), + KEY `IDX_CREDITMEMO_STATUS` (`creditmemo_status`), + KEY `IDX_STATE` (`state`), + KEY `IDX_INCREMENT_ID` (`increment_id`), + KEY `IDX_ORDER_INCREMENT_ID` (`order_increment_id`), + KEY `IDX_CREATED_AT` (`created_at`), + KEY `IDX_ORDER_CREATED_AT` (`order_created_at`), + KEY `IDX_BILLING_NAME` (`billing_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* CreditMemo Item */ + +CREATE TABLE `{$installer->getTable('sales_flat_creditmemo_item')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned NOT NULL, + `weee_tax_applied_row_amount` decimal(12,4) default NULL, + `base_price` decimal(12,4) default NULL, + `base_weee_tax_row_disposition` decimal(12,4) default NULL, + `tax_amount` decimal(12,4) default NULL, + `base_weee_tax_applied_amount` decimal(12,4) default NULL, + `weee_tax_row_disposition` decimal(12,4) default NULL, + `base_row_total` decimal(12,4) default NULL, + `discount_amount` decimal(12,4) default NULL, + `row_total` decimal(12,4) default NULL, + `weee_tax_applied_amount` decimal(12,4) default NULL, + `base_discount_amount` decimal(12,4) default NULL, + `base_weee_tax_disposition` decimal(12,4) default NULL, + `price_incl_tax` decimal(12,4) default NULL, + `base_tax_amount` decimal(12,4) default NULL, + `weee_tax_disposition` decimal(12,4) default NULL, + `base_price_incl_tax` decimal(12,4) default NULL, + `qty` decimal(12,4) default NULL, + `base_cost` decimal(12,4) default NULL, + `base_weee_tax_applied_row_amount` decimal(12,4) default NULL, + `price` decimal(12,4) default NULL, + `base_row_total_incl_tax` decimal(12,4) default NULL, + `row_total_incl_tax` decimal(12,4) default NULL, + `product_id` int(10) default NULL, + `order_item_id` int(10) default NULL, + `additional_data` text, + `description` text, + `weee_tax_applied` text, + `sku` varchar(255) default NULL, + `name` varchar(255) default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_PARENT_ID` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* CreditMemo Comment */ + +CREATE TABLE `{$installer->getTable('sales_flat_creditmemo_comment')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned NOT NULL, + `is_customer_notified` int(10) default NULL, + `comment` text, + `created_at` datetime default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_CREATED_AT` (`created_at`), + KEY `IDX_PARENT_ID` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('sales_flat_quote')}` ( + `entity_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `store_id` smallint(5) unsigned NOT NULL DEFAULT '0', + `created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `converted_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `is_active` tinyint(1) unsigned DEFAULT '1', + `is_virtual` tinyint(1) unsigned DEFAULT '0', + `is_multi_shipping` tinyint(1) unsigned DEFAULT '0', + `items_count` int(10) unsigned DEFAULT '0', + `items_qty` decimal(12,4) DEFAULT '0.0000', + `orig_order_id` int(10) unsigned DEFAULT '0', + `store_to_base_rate` decimal(12,4) DEFAULT '0.0000', + `store_to_quote_rate` decimal(12,4) DEFAULT '0.0000', + `base_currency_code` varchar(255) DEFAULT NULL, + `store_currency_code` varchar(255) DEFAULT NULL, + `quote_currency_code` varchar(255) DEFAULT NULL, + `grand_total` decimal(12,4) DEFAULT '0.0000', + `base_grand_total` decimal(12,4) DEFAULT '0.0000', + `checkout_method` varchar(255) DEFAULT NULL, + `customer_id` int(10) unsigned DEFAULT '0', + `customer_tax_class_id` int(10) unsigned DEFAULT '0', + `customer_group_id` int(10) unsigned DEFAULT '0', + `customer_email` varchar(255) DEFAULT NULL, + `customer_prefix` varchar(40) DEFAULT NULL, + `customer_firstname` varchar(255) DEFAULT NULL, + `customer_middlename` varchar(40) DEFAULT NULL, + `customer_lastname` varchar(255) DEFAULT NULL, + `customer_suffix` varchar(40) DEFAULT NULL, + `customer_dob` datetime DEFAULT NULL, + `customer_note` varchar(255) DEFAULT NULL, + `customer_note_notify` tinyint(1) unsigned DEFAULT '1', + `customer_is_guest` tinyint(1) unsigned DEFAULT '0', + `remote_ip` varchar(32) DEFAULT NULL, + `applied_rule_ids` varchar(255) DEFAULT NULL, + `reserved_order_id` varchar(64) DEFAULT '', + `password_hash` varchar(255) DEFAULT NULL, + `coupon_code` varchar(255) DEFAULT NULL, + `global_currency_code` varchar(255) DEFAULT NULL, + `base_to_global_rate` decimal(12,4) DEFAULT NULL, + `base_to_quote_rate` decimal(12,4) DEFAULT NULL, + `customer_taxvat` varchar(255) DEFAULT NULL, + `customer_gender` varchar(255) DEFAULT NULL, + `subtotal` decimal(12,4) DEFAULT NULL, + `base_subtotal` decimal(12,4) DEFAULT NULL, + `subtotal_with_discount` decimal(12,4) DEFAULT NULL, + `base_subtotal_with_discount` decimal(12,4) DEFAULT NULL, + `is_changed` int(10) unsigned DEFAULT NULL, + `trigger_recollect` tinyint(1) NOT NULL DEFAULT '0', + `ext_shipping_info` text, + `gift_message_id` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_CUSTOMER` (`customer_id`,`store_id`,`is_active`), + CONSTRAINT `FK_SALES_QUOTE_STORE` FOREIGN KEY (`store_id`) + REFERENCES `{$installer->getTable('core_store')}` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('sales_flat_quote_address')}` ( + `address_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `quote_id` int(10) unsigned NOT NULL DEFAULT '0', + `created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `customer_id` int(10) unsigned DEFAULT NULL, + `save_in_address_book` tinyint(1) DEFAULT '0', + `customer_address_id` int(10) unsigned DEFAULT NULL, + `address_type` varchar(255) DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, + `prefix` varchar(40) DEFAULT NULL, + `firstname` varchar(255) DEFAULT NULL, + `middlename` varchar(40) DEFAULT NULL, + `lastname` varchar(255) DEFAULT NULL, + `suffix` varchar(40) DEFAULT NULL, + `company` varchar(255) DEFAULT NULL, + `street` varchar(255) DEFAULT NULL, + `city` varchar(255) DEFAULT NULL, + `region` varchar(255) DEFAULT NULL, + `region_id` int(10) unsigned DEFAULT NULL, + `postcode` varchar(255) DEFAULT NULL, + `country_id` varchar(255) DEFAULT NULL, + `telephone` varchar(255) DEFAULT NULL, + `fax` varchar(255) DEFAULT NULL, + `same_as_billing` tinyint(1) unsigned NOT NULL DEFAULT '0', + `free_shipping` tinyint(1) unsigned NOT NULL DEFAULT '0', + `collect_shipping_rates` tinyint(1) unsigned NOT NULL DEFAULT '0', + `shipping_method` varchar(255) NOT NULL DEFAULT '', + `shipping_description` varchar(255) NOT NULL DEFAULT '', + `weight` decimal(12,4) NOT NULL DEFAULT '0.0000', + `subtotal` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_subtotal` decimal(12,4) NOT NULL DEFAULT '0.0000', + `subtotal_with_discount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_subtotal_with_discount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `tax_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_tax_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `shipping_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_shipping_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `shipping_tax_amount` decimal(12,4) DEFAULT NULL, + `base_shipping_tax_amount` decimal(12,4) DEFAULT NULL, + `discount_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_discount_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `grand_total` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_grand_total` decimal(12,4) NOT NULL DEFAULT '0.0000', + `customer_notes` text, + `applied_taxes` text, + `discount_description` varchar(255) DEFAULT NULL, + `shipping_discount_amount` decimal(12,4) DEFAULT NULL, + `base_shipping_discount_amount` decimal(12,4) DEFAULT NULL, + `subtotal_incl_tax` decimal(12,4) DEFAULT NULL, + `base_subtotal_total_incl_tax` decimal(12,4) DEFAULT NULL, + `gift_message_id` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`address_id`), + CONSTRAINT `FK_SALES_QUOTE_ADDRESS_SALES_QUOTE` FOREIGN KEY (`quote_id`) + REFERENCES `{$installer->getTable('sales_flat_quote')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('sales_flat_quote_address_item')}` ( + `address_item_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `parent_item_id` int(10) unsigned DEFAULT NULL, + `quote_address_id` int(10) unsigned NOT NULL DEFAULT '0', + `quote_item_id` int(10) unsigned NOT NULL DEFAULT '0', + `created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `applied_rule_ids` text, + `additional_data` text, + `weight` decimal(12,4) DEFAULT '0.0000', + `qty` decimal(12,4) NOT NULL DEFAULT '0.0000', + `discount_amount` decimal(12,4) DEFAULT '0.0000', + `tax_amount` decimal(12,4) DEFAULT '0.0000', + `row_total` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_row_total` decimal(12,4) NOT NULL DEFAULT '0.0000', + `row_total_with_discount` decimal(12,4) DEFAULT '0.0000', + `base_discount_amount` decimal(12,4) DEFAULT '0.0000', + `base_tax_amount` decimal(12,4) DEFAULT '0.0000', + `row_weight` decimal(12,4) DEFAULT '0.0000', + `product_id` int(10) unsigned DEFAULT NULL, + `super_product_id` int(10) unsigned DEFAULT NULL, + `parent_product_id` int(10) unsigned DEFAULT NULL, + `sku` varchar(255) DEFAULT NULL, + `image` varchar(255) DEFAULT NULL, + `name` varchar(255) DEFAULT NULL, + `description` text, + `free_shipping` int(10) unsigned DEFAULT NULL, + `is_qty_decimal` int(10) unsigned DEFAULT NULL, + `price` decimal(12,4) DEFAULT NULL, + `discount_percent` decimal(12,4) DEFAULT NULL, + `no_discount` int(10) unsigned DEFAULT NULL, + `tax_percent` decimal(12,4) DEFAULT NULL, + `base_price` decimal(12,4) DEFAULT NULL, + `base_cost` decimal(12,4) DEFAULT NULL, + `price_incl_tax` decimal(12,4) DEFAULT NULL, + `base_price_incl_tax` decimal(12,4) DEFAULT NULL, + `row_total_incl_tax` decimal(12,4) DEFAULT NULL, + `base_row_total_incl_tax` decimal(12,4) DEFAULT NULL, + `gift_message_id` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`address_item_id`), + CONSTRAINT `FK_QUOTE_ADDRESS_ITEM_QUOTE_ADDRESS` FOREIGN KEY (`quote_address_id`) + REFERENCES `{$installer->getTable('sales_flat_quote_address')}` (`address_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `FK_SALES_FLAT_QUOTE_ADDRESS_ITEM_PARENT` FOREIGN KEY (`parent_item_id`) + REFERENCES `{$installer->getTable('sales_flat_quote_address_item')}` (`address_item_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `FK_SALES_QUOTE_ADDRESS_ITEM_QUOTE_ITEM` FOREIGN KEY (`quote_item_id`) + REFERENCES `{$installer->getTable('sales_flat_quote_item')}` (`item_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('sales_flat_quote_item')}` ( + `item_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `quote_id` int(10) unsigned NOT NULL DEFAULT '0', + `created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `product_id` int(10) unsigned DEFAULT NULL, + `store_id` smallint(5) unsigned DEFAULT NULL, + `parent_item_id` int(10) unsigned DEFAULT NULL, + `is_virtual` tinyint(1) unsigned DEFAULT NULL, + `sku` varchar(255) NOT NULL DEFAULT '', + `name` varchar(255) DEFAULT NULL, + `description` text, + `applied_rule_ids` text, + `additional_data` text, + `free_shipping` tinyint(1) unsigned NOT NULL DEFAULT '0', + `is_qty_decimal` tinyint(1) unsigned DEFAULT NULL, + `no_discount` tinyint(1) unsigned DEFAULT '0', + `weight` decimal(12,4) DEFAULT '0.0000', + `qty` decimal(12,4) NOT NULL DEFAULT '0.0000', + `price` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_price` decimal(12,4) NOT NULL DEFAULT '0.0000', + `custom_price` decimal(12,4) DEFAULT NULL, + `discount_percent` decimal(12,4) DEFAULT '0.0000', + `discount_amount` decimal(12,4) DEFAULT '0.0000', + `base_discount_amount` decimal(12,4) DEFAULT '0.0000', + `tax_percent` decimal(12,4) DEFAULT '0.0000', + `tax_amount` decimal(12,4) DEFAULT '0.0000', + `base_tax_amount` decimal(12,4) DEFAULT '0.0000', + `row_total` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_row_total` decimal(12,4) NOT NULL DEFAULT '0.0000', + `row_total_with_discount` decimal(12,4) DEFAULT '0.0000', + `row_weight` decimal(12,4) DEFAULT '0.0000', + `product_type` varchar(255) DEFAULT NULL, + `base_tax_before_discount` decimal(12,4) DEFAULT NULL, + `tax_before_discount` decimal(12,4) DEFAULT NULL, + `original_custom_price` decimal(12,4) DEFAULT NULL, + `redirect_url` varchar(255) DEFAULT NULL, + `base_cost` decimal(12,4) DEFAULT NULL, + `price_incl_tax` decimal(12,4) DEFAULT NULL, + `base_price_incl_tax` decimal(12,4) DEFAULT NULL, + `row_total_incl_tax` decimal(12,4) DEFAULT NULL, + `base_row_total_incl_tax` decimal(12,4) DEFAULT NULL, + `gift_message_id` int(10) unsigned DEFAULT NULL, + `weee_tax_applied` text, + `weee_tax_applied_amount` decimal(12,4) DEFAULT NULL, + `weee_tax_applied_row_amount` decimal(12,4) DEFAULT NULL, + `base_weee_tax_applied_amount` decimal(12,4) DEFAULT NULL, + `base_weee_tax_applied_row_amount` decimal(12,4) DEFAULT NULL, + `weee_tax_disposition` decimal(12,4) DEFAULT NULL, + `weee_tax_row_disposition` decimal(12,4) DEFAULT NULL, + `base_weee_tax_disposition` decimal(12,4) DEFAULT NULL, + `base_weee_tax_row_disposition` decimal(12,4) DEFAULT NULL, + PRIMARY KEY (`item_id`), + CONSTRAINT `FK_SALES_FLAT_QUOTE_ITEM_PARENT_ITEM` FOREIGN KEY (`parent_item_id`) + REFERENCES `{$installer->getTable('sales_flat_quote_item')}` (`item_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `FK_SALES_QUOTE_ITEM_CATALOG_PRODUCT_ENTITY` FOREIGN KEY (`product_id`) + REFERENCES `{$installer->getTable('catalog_product_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `FK_SALES_QUOTE_ITEM_SALES_QUOTE` FOREIGN KEY (`quote_id`) + REFERENCES `{$installer->getTable('sales_flat_quote')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `FK_SALES_QUOTE_ITEM_STORE` FOREIGN KEY (`store_id`) + REFERENCES `{$installer->getTable('core_store')}` (`store_id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('sales_flat_quote_item_option')}` ( + `option_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `item_id` int(10) unsigned NOT NULL, + `product_id` int(10) unsigned NOT NULL, + `code` varchar(255) NOT NULL, + `value` text NOT NULL, + PRIMARY KEY (`option_id`), + CONSTRAINT `FK_SALES_QUOTE_ITEM_OPTION_ITEM_ID` FOREIGN KEY (`item_id`) + REFERENCES `{$installer->getTable('sales_flat_quote_item')}` (`item_id`) ON DELETE CASCADE ON UPDATE CASCADE + +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Additional options for quote item'; + +CREATE TABLE `{$installer->getTable('sales_flat_quote_payment')}` ( + `payment_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `quote_id` int(10) unsigned NOT NULL DEFAULT '0', + `created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `method` varchar(255) DEFAULT '', + `cc_type` varchar(255) DEFAULT '', + `cc_number_enc` varchar(255) DEFAULT '', + `cc_last4` varchar(255) DEFAULT '', + `cc_cid_enc` varchar(255) DEFAULT '', + `cc_owner` varchar(255) DEFAULT '', + `cc_exp_month` tinyint(2) unsigned DEFAULT '0', + `cc_exp_year` smallint(4) unsigned DEFAULT '0', + `cc_ss_owner` varchar(255) DEFAULT '', + `cc_ss_start_month` tinyint(2) unsigned DEFAULT '0', + `cc_ss_start_year` smallint(4) unsigned DEFAULT '0', + `cybersource_token` varchar(255) DEFAULT '', + `paypal_correlation_id` varchar(255) DEFAULT '', + `paypal_payer_id` varchar(255) DEFAULT '', + `paypal_payer_status` varchar(255) DEFAULT '', + `po_number` varchar(255) DEFAULT '', + `additional_data` text, + `cc_ss_issue` varchar(255) DEFAULT NULL, + `additional_information` text, + `ideal_issuer_id` varchar(255) DEFAULT NULL, + `ideal_issuer_list` text, + PRIMARY KEY (`payment_id`), + CONSTRAINT `FK_SALES_QUOTE_PAYMENT_SALES_QUOTE` FOREIGN KEY (`quote_id`) + REFERENCES `{$installer->getTable('sales_flat_quote')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('sales_flat_quote_shipping_rate')}` ( + `rate_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `address_id` int(10) unsigned NOT NULL DEFAULT '0', + `created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `carrier` varchar(255) DEFAULT NULL, + `carrier_title` varchar(255) DEFAULT NULL, + `code` varchar(255) DEFAULT NULL, + `method` varchar(255) DEFAULT NULL, + `method_description` text, + `price` decimal(12,4) NOT NULL DEFAULT '0.0000', + `error_message` text, + `method_title` text, + PRIMARY KEY (`rate_id`), + CONSTRAINT `FK_SALES_QUOTE_SHIPPING_RATE_ADDRESS` FOREIGN KEY (`address_id`) + REFERENCES `{$installer->getTable('sales_flat_quote_address')}` (`address_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('sales_invoiced_aggregated')}` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `period` date NOT NULL DEFAULT '0000-00-00', + `store_id` smallint(5) unsigned DEFAULT NULL, + `order_status` varchar(50) NOT NULL DEFAULT '', + `orders_count` int(11) NOT NULL DEFAULT '0', + `orders_invoiced` decimal(12,4) NOT NULL DEFAULT '0.0000', + `invoiced` decimal(12,4) NOT NULL DEFAULT '0.0000', + `invoiced_captured` decimal(12,4) NOT NULL DEFAULT '0.0000', + `invoiced_not_captured` decimal(12,4) NOT NULL DEFAULT '0.0000', + PRIMARY KEY (`id`), + UNIQUE KEY `UNQ_PERIOD_STORE_ORDER_STATUS` (`period`,`store_id`,`order_status`), + KEY `IDX_STORE_ID` (`store_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('sales_invoiced_aggregated_order')}` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `period` date NOT NULL DEFAULT '0000-00-00', + `store_id` smallint(5) unsigned DEFAULT NULL, + `order_status` varchar(50) NOT NULL DEFAULT '', + `orders_count` int(11) NOT NULL DEFAULT '0', + `orders_invoiced` decimal(12,4) NOT NULL DEFAULT '0.0000', + `invoiced` decimal(12,4) NOT NULL DEFAULT '0.0000', + `invoiced_captured` decimal(12,4) NOT NULL DEFAULT '0.0000', + `invoiced_not_captured` decimal(12,4) NOT NULL DEFAULT '0.0000', + PRIMARY KEY (`id`), + UNIQUE KEY `UNQ_PERIOD_STORE_ORDER_STATUS` (`period`,`store_id`,`order_status`), + KEY `IDX_STORE_ID` (`store_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('sales_order_aggregated_created')}` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `period` date NOT NULL DEFAULT '0000-00-00', + `store_id` smallint(5) unsigned DEFAULT NULL, + `order_status` varchar(50) NOT NULL DEFAULT '', + `orders_count` int(11) NOT NULL DEFAULT '0', + `total_qty_ordered` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_profit_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_subtotal_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_tax_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_shipping_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_discount_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_grand_total_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_invoiced_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_refunded_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_canceled_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_tax_invoiced_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_tax_canceled_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_tax_refunded_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_subtotal_invoiced_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_subtotal_refunded_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_subtotal_canceled_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_discount_invoiced_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_discount_canceled_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_discount_refunded_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_shipping_invoiced_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_shipping_canceled_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_shipping_refunded_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_shipping_discount_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_shipping_tax_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `base_shipping_tax_refunded_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + PRIMARY KEY (`id`), + UNIQUE KEY `UNQ_PERIOD_STORE_ORDER_STATUS` (`period`,`store_id`,`order_status`), + KEY `IDX_STORE_ID` (`store_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('sales_payment_transaction')}` ( + `transaction_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `parent_id` int(10) unsigned DEFAULT NULL, + `order_id` int(10) unsigned NOT NULL DEFAULT '0', + `payment_id` int(10) unsigned NOT NULL DEFAULT '0', + `txn_id` varchar(100) NOT NULL DEFAULT '', + `parent_txn_id` varchar(100) DEFAULT NULL, + `txn_type` varchar(15) NOT NULL DEFAULT '', + `is_closed` tinyint(1) unsigned NOT NULL DEFAULT '1', + `additional_information` blob, + PRIMARY KEY (`transaction_id`), + UNIQUE KEY `UNQ_ORDER_PAYMENT_TXN` (`order_id`, `payment_id`,`txn_id`), + KEY `IDX_ORDER_ID` (`order_id`), + KEY `IDX_PARENT_ID` (`parent_id`), + KEY `IDX_PAYMENT_ID` (`payment_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('sales_refunded_aggregated')}` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `period` date NOT NULL DEFAULT '0000-00-00', + `store_id` smallint(5) unsigned DEFAULT NULL, + `order_status` varchar(50) NOT NULL DEFAULT '', + `orders_count` int(11) NOT NULL DEFAULT '0', + `refunded` decimal(12,4) NOT NULL DEFAULT '0.0000', + `online_refunded` decimal(12,4) NOT NULL DEFAULT '0.0000', + `offline_refunded` decimal(12,4) NOT NULL DEFAULT '0.0000', + PRIMARY KEY (`id`), + UNIQUE KEY `UNQ_PERIOD_STORE_ORDER_STATUS` (`period`,`store_id`,`order_status`), + KEY `IDX_STORE_ID` (`store_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('sales_refunded_aggregated_order')}` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `period` date NOT NULL DEFAULT '0000-00-00', + `store_id` smallint(5) unsigned DEFAULT NULL, + `order_status` varchar(50) NOT NULL DEFAULT '', + `orders_count` int(11) NOT NULL DEFAULT '0', + `refunded` decimal(12,4) NOT NULL DEFAULT '0.0000', + `online_refunded` decimal(12,4) NOT NULL DEFAULT '0.0000', + `offline_refunded` decimal(12,4) NOT NULL DEFAULT '0.0000', + PRIMARY KEY (`id`), + UNIQUE KEY `UNQ_PERIOD_STORE_ORDER_STATUS` (`period`,`store_id`,`order_status`), + KEY `IDX_STORE_ID` (`store_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('sales_shipping_aggregated')}` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `period` date NOT NULL DEFAULT '0000-00-00', + `store_id` smallint(5) unsigned DEFAULT NULL, + `order_status` varchar(50) NOT NULL DEFAULT '', + `shipping_description` varchar(255) NOT NULL DEFAULT '', + `orders_count` int(11) NOT NULL DEFAULT '0', + `total_shipping` decimal(12,4) NOT NULL DEFAULT '0.0000', + PRIMARY KEY (`id`), + UNIQUE KEY `UNQ_PERIOD_STORE_ORDER_STATUS` (`period`,`store_id`,`order_status`,`shipping_description`), + KEY `IDX_STORE_ID` (`store_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('sales_shipping_aggregated_order')}` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `period` date NOT NULL DEFAULT '0000-00-00', + `store_id` smallint(5) unsigned DEFAULT NULL, + `order_status` varchar(50) NOT NULL DEFAULT '', + `shipping_description` varchar(255) NOT NULL DEFAULT '', + `orders_count` int(11) NOT NULL DEFAULT '0', + `total_shipping` decimal(12,4) NOT NULL DEFAULT '0.0000', + PRIMARY KEY (`id`), + UNIQUE KEY `UNQ_PERIOD_STORE_ORDER_STATUS` (`period`,`store_id`,`order_status`,`shipping_description`), + KEY `IDX_STORE_ID` (`store_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$constraints = array( + 'sales_flat_order' => array( + 'customer' => array('customer_id', 'customer_entity', 'entity_id', 'set null'), + 'store' => array('store_id', 'core_store', 'store_id', 'set null'), + ), + 'sales_flat_order_grid' => array( + 'parent' => array('entity_id', 'sales_flat_order', 'entity_id'), + 'customer' => array('customer_id', 'customer_entity', 'entity_id', 'set null'), + 'store' => array('store_id', 'core_store', 'store_id', 'set null'), + ), + 'sales_flat_order_item' => array( + 'parent' => array('order_id', 'sales_flat_order', 'entity_id'), + 'store' => array('store_id', 'core_store', 'store_id', 'set null'), + ), + 'sales_flat_order_address' => array( + 'parent' => array('parent_id', 'sales_flat_order', 'entity_id'), + ), + 'sales_flat_order_payment' => array( + 'parent' => array('parent_id', 'sales_flat_order', 'entity_id'), + ), + 'sales_flat_order_status_history' => array( + 'parent' => array('parent_id', 'sales_flat_order', 'entity_id'), + ), + 'sales_flat_shipment' => array( + 'parent' => array('order_id', 'sales_flat_order', 'entity_id'), + 'store' => array('store_id', 'core_store', 'store_id', 'set null') + ), + 'sales_flat_shipment_grid' => array( + 'parent' => array('entity_id', 'sales_flat_shipment', 'entity_id'), + 'store' => array('store_id', 'core_store', 'store_id', 'set null') + ), + 'sales_flat_shipment_track' => array( + 'parent' => array('parent_id', 'sales_flat_shipment', 'entity_id'), + ), + 'sales_flat_shipment_item' => array( + 'parent' => array('parent_id', 'sales_flat_shipment', 'entity_id'), + ), + 'sales_flat_shipment_comment' => array( + 'parent' => array('parent_id', 'sales_flat_shipment', 'entity_id'), + ), + 'sales_flat_invoice' => array( + 'parent' => array('order_id', 'sales_flat_order', 'entity_id'), + 'store' => array('store_id', 'core_store', 'store_id', 'set null') + ), + 'sales_flat_invoice_grid' => array( + 'parent' => array('entity_id', 'sales_flat_invoice', 'entity_id'), + 'store' => array('store_id', 'core_store', 'store_id', 'set null') + ), + 'sales_flat_invoice_item' => array( + 'parent' => array('parent_id', 'sales_flat_invoice', 'entity_id'), + ), + 'sales_flat_invoice_comment' => array( + 'parent' => array('parent_id', 'sales_flat_invoice', 'entity_id'), + ), + 'sales_flat_creditmemo' => array( + 'parent' => array('order_id', 'sales_flat_order', 'entity_id'), + 'store' => array('store_id', 'core_store', 'store_id', 'set null') + ), + 'sales_flat_creditmemo_grid' => array( + 'parent' => array('entity_id', 'sales_flat_creditmemo', 'entity_id'), + 'store' => array('store_id', 'core_store', 'store_id', 'set null') + ), + 'sales_flat_creditmemo_item' => array( + 'parent' => array('parent_id', 'sales_flat_creditmemo', 'entity_id'), + ), + 'sales_flat_creditmemo_comment' => array( + 'parent' => array('parent_id', 'sales_flat_creditmemo', 'entity_id'), + ), + 'sales_payment_transaction' => array( + 'parent' => array('parent_id', 'sales_payment_transaction', 'transaction_id'), + 'order' => array('order_id', 'sales_flat_order', 'entity_id'), + 'payment' => array('payment_id', 'sales_flat_order_payment', 'entity_id'), + ), + 'sales_invoiced_aggregated' => array( + 'store' => array('store_id', 'core_store', 'store_id', 'set null'), + ), + 'sales_invoiced_aggregated_order' => array( + 'store' => array('store_id', 'core_store', 'store_id', 'set null'), + ), + 'sales_order_aggregated_created' => array( + 'store' => array('store_id', 'core_store', 'store_id', 'set null'), + ), + 'sales_refunded_aggregated' => array( + 'store' => array('store_id', 'core_store', 'store_id', 'set null'), + ), + 'sales_refunded_aggregated_order' => array( + 'store' => array('store_id', 'core_store', 'store_id', 'set null'), + ), + 'sales_shipping_aggregated' => array( + 'store' => array('store_id', 'core_store', 'store_id', 'set null'), + ), + 'sales_shipping_aggregated_order' => array( + 'store' => array('store_id', 'core_store', 'store_id', 'set null'), + ) +); + +foreach ($constraints as $table => $list) { + foreach ($list as $code => $constraint) { + $constraint[1] = $installer->getTable($constraint[1]); + array_unshift($constraint, $installer->getTable($table)); + array_unshift($constraint, strtoupper($table . '_' . $code)); + + call_user_func_array(array($installer->getConnection(), 'addConstraint'), $constraint); + } +} + +// Add eav entity types +$installer->addEntityType('order', array( + 'entity_model' => 'sales/order', + 'table' =>'sales/order', + 'increment_model' =>'eav/entity_increment_numeric', + 'increment_per_store' =>true +)); + +$installer->addEntityType('invoice', array( + 'entity_model' => 'sales/order_invoice', + 'table' =>'sales/invoice', + 'increment_model' =>'eav/entity_increment_numeric', + 'increment_per_store' =>true +)); + +$installer->addEntityType('creditmemo', array( + 'entity_model' => 'sales/order_creditmemo', + 'table' =>'sales/creditmemo', + 'increment_model' =>'eav/entity_increment_numeric', + 'increment_per_store' =>true +)); + +$installer->addEntityType('shipment', array( + 'entity_model' => 'sales/order_shipment', + 'table' =>'sales/shipment', + 'increment_model' =>'eav/entity_increment_numeric', + 'increment_per_store' =>true +)); + +$installer->endSetup(); diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.6.2-0.7.0.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.6.2-0.7.0.php index 7af0a06148..2f1aa92d2b 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.6.2-0.7.0.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.6.2-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.7.0-0.7.1.php index 9d5bb72e75..3e1126c776 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.7.1-0.7.2.php index 517d04cf7e..699a1d058a 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.7.2-0.7.3.php index bfd16d116c..9973543e18 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.7.2-0.7.3.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.7.2-0.7.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.7.9-0.7.10.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.7.9-0.7.10.php index 24e6a992c5..7fcfa9e0c2 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.7.9-0.7.10.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.7.9-0.7.10.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.0-0.8.1.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.0-0.8.1.php index a265361c59..dfa93c9c62 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.0-0.8.1.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.0-0.8.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.1-0.8.2.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.1-0.8.2.php index 5b252d1ac5..e29aa89214 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.1-0.8.2.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.1-0.8.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.11-0.8.12.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.11-0.8.12.php index 5b3440fe95..c50c3c88dd 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.11-0.8.12.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.11-0.8.12.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.12-0.8.13.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.12-0.8.13.php index 05f422e369..b31db00efe 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.12-0.8.13.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.12-0.8.13.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.13-0.8.14.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.13-0.8.14.php index e42c478c1c..5a04deccf7 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.13-0.8.14.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.13-0.8.14.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.14-0.8.15.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.14-0.8.15.php index c1ab4ed596..451bb9ad36 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.14-0.8.15.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.14-0.8.15.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.15-0.8.16.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.15-0.8.16.php index f389a679b7..a806eb57bb 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.15-0.8.16.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.15-0.8.16.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.16-0.8.17.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.16-0.8.17.php index b7e9ab4ece..12efd4ed14 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.16-0.8.17.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.16-0.8.17.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.17-0.8.18.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.17-0.8.18.php index d05f3d34aa..7b659f9e53 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.17-0.8.18.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.17-0.8.18.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.18-0.8.19.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.18-0.8.19.php index 8ba5a2667a..dac2192c1d 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.18-0.8.19.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.18-0.8.19.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.19-0.8.20.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.19-0.8.20.php index 6abbda5e12..17ad9ce8f1 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.19-0.8.20.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.19-0.8.20.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.2-0.8.3.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.2-0.8.3.php index bc56571847..02e75ca90c 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.2-0.8.3.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.2-0.8.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.20-0.8.21.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.20-0.8.21.php index 15a24cf77c..145eb27c5d 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.20-0.8.21.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.20-0.8.21.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.21-0.8.22.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.21-0.8.22.php index 46beee4d93..b4626d4466 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.21-0.8.22.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.21-0.8.22.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.22-0.8.23.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.22-0.8.23.php index 1fb5ddeb9c..bf1b8e1280 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.22-0.8.23.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.22-0.8.23.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.23-0.8.24.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.23-0.8.24.php index 61626ae4a2..726ec69ec6 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.23-0.8.24.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.23-0.8.24.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.24-0.8.25.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.24-0.8.25.php index 2b07a12b66..21443e9a14 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.24-0.8.25.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.24-0.8.25.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.25-0.8.26.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.25-0.8.26.php index b2f9ebe6e2..6b61b6926c 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.25-0.8.26.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.25-0.8.26.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.26-0.8.27.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.26-0.8.27.php index ab302bf321..7355ba48f3 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.26-0.8.27.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.26-0.8.27.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.27-0.8.28.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.27-0.8.28.php index e14ef90f67..1558911fc7 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.27-0.8.28.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.27-0.8.28.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.28-0.8.29.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.28-0.8.29.php index 9785597237..8faf83b0f6 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.28-0.8.29.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.28-0.8.29.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.29-0.9.0.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.29-0.9.0.php index 9869f1564b..8733eb2257 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.29-0.9.0.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.29-0.9.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.3-0.8.4.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.3-0.8.4.php index d87af27aa8..0de9508f60 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.3-0.8.4.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.3-0.8.4.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.6-0.8.7.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.6-0.8.7.php index bc56571847..02e75ca90c 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.6-0.8.7.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.6-0.8.7.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.7-0.8.8.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.7-0.8.8.php index 5a474d30db..0ced576b6b 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.7-0.8.8.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.7-0.8.8.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.8-0.8.9.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.8-0.8.9.php index 0054b4bc6b..65527563aa 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.8-0.8.9.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.8-0.8.9.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.0-0.9.1.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.0-0.9.1.php index b5c4615835..c7e2eb7224 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.0-0.9.1.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.0-0.9.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.1-0.9.2.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.1-0.9.2.php index b51b1e0ac7..94f5221598 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.1-0.9.2.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.1-0.9.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.10-0.9.11.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.10-0.9.11.php index 1fdcdbaf70..df66092f13 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.10-0.9.11.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.10-0.9.11.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.11-0.9.12.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.11-0.9.12.php index 3be08d9624..396f730c65 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.11-0.9.12.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.11-0.9.12.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.12-0.9.13.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.12-0.9.13.php index 4872c24118..56f32ae5f1 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.12-0.9.13.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.12-0.9.13.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.13-0.9.14.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.13-0.9.14.php index c87acdd5f3..7feb5f0d41 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.13-0.9.14.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.13-0.9.14.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.14-0.9.15.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.14-0.9.15.php index 6dc839d440..7483baf227 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.14-0.9.15.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.14-0.9.15.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.15-0.9.16.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.15-0.9.16.php index 288190ece9..f33018f6a5 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.15-0.9.16.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.15-0.9.16.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.16-0.9.17.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.16-0.9.17.php index b2834847a0..ac37d1c8a6 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.16-0.9.17.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.16-0.9.17.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.17-0.9.18.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.17-0.9.18.php index fa36b1837b..507e8e536a 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.17-0.9.18.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.17-0.9.18.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.18-0.9.19.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.18-0.9.19.php index e619fcd122..c99152973b 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.18-0.9.19.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.18-0.9.19.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.19-0.9.20.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.19-0.9.20.php index e40bdccbd5..e87fce6c08 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.19-0.9.20.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.19-0.9.20.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.2-0.9.3.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.2-0.9.3.php index 4ed917e798..956bdade3c 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.2-0.9.3.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.2-0.9.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.20-0.9.21.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.20-0.9.21.php index 131bc1e5c9..8db3dc817f 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.20-0.9.21.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.20-0.9.21.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.21-0.9.22.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.21-0.9.22.php index 88cdc0e998..f2cac246a0 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.21-0.9.22.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.21-0.9.22.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.22-0.9.23.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.22-0.9.23.php index 8ee6b3afea..889c2642a5 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.22-0.9.23.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.22-0.9.23.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.23-0.9.24.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.23-0.9.24.php index a5cc22f329..dac1670619 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.23-0.9.24.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.23-0.9.24.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.24-0.9.25.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.24-0.9.25.php index 45e778ccb2..427d63ece1 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.24-0.9.25.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.24-0.9.25.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.25-0.9.26.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.25-0.9.26.php index fbe468839a..3e7b878b15 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.25-0.9.26.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.25-0.9.26.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.26-0.9.27.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.26-0.9.27.php index 08406573a7..af175892a5 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.26-0.9.27.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.26-0.9.27.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -56,8 +56,11 @@ */ $orderEntityType = $installer->getEntityType('order'); +$orderEntityType['entity_table'] = 'sales_order'; $invoiceEntityType = $installer->getEntityType('invoice'); +$invoiceEntityType['entity_table'] = 'sales_order_entity'; $creditmemoEntityType = $installer->getEntityType('creditmemo'); +$creditmemoEntityType['entity_table'] = 'sales_order_entity'; $entityTypes = array($orderEntityType['entity_type_id'] => $orderEntityType, $invoiceEntityType['entity_type_id'] => $invoiceEntityType, diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.27-0.9.28.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.27-0.9.28.php index 367df8fd04..4b4186e28f 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.27-0.9.28.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.27-0.9.28.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.28-0.9.29.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.28-0.9.29.php index 3035fae26d..2ccdb28165 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.28-0.9.29.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.28-0.9.29.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -66,7 +66,9 @@ $baseDiscountAttributeId = $installer->getAttributeId($entityTypeId, 'base_discount_amount'); $baseDiscountAttributeTable = $installer->getAttributeTable($entityTypeId, 'base_discount_amount'); -$preparedSql = sprintf($sql, +$temporaryTableName = $installer->getConnection()->quoteIdentifier('sales_sql_update' . crc32(uniqid('sales'))); + +$preparedSql = 'CREATE TEMPORARY TABLE ' . $temporaryTableName . ' ' . sprintf($sql, $orderAttributeTable, $discountAttributeTable, $discountAttributeId, @@ -76,18 +78,23 @@ $orderAttributeId ); -$stmt = $installer->getConnection()->query($preparedSql); -while($row = $stmt->fetch()) { - $data = array( - 'discount_refunded' => $row['order_discount'], - 'base_discount_refunded' => $row['order_base_discount'] - ); - $installer->getConnection()->update( - $ordersTable, - $data, - $installer->getConnection()->quoteInto('entity_id=?', $row['order_id']) - ); -} +$installer->getConnection()->query($preparedSql); +$select = $installer->getConnection()->select(); +$select->join(array('to_update' => $temporaryTableName), + 'to_update.order_id = main_table.entity_id', + array( + 'discount_refunded' => 'order_discount', + 'base_discount_refunded' => 'order_base_discount' + ) +); + +$installer->getConnection()->query( + $select->crossUpdateFromSelect(array('main_table'=>$ordersTable)) +); + +$installer->getConnection()->query( + 'DROP TEMPORARY TABLE ' . $temporaryTableName +); // Update discount_invoiced (base_discount_invoiced) $entityTypeId = $installer->getEntityTypeId('invoice'); @@ -98,7 +105,7 @@ $baseDiscountAttributeId = $installer->getAttributeId($entityTypeId, 'base_discount_amount'); $baseDiscountAttributeTable = $installer->getAttributeTable($entityTypeId, 'base_discount_amount'); -$preparedSql = sprintf($sql, +$preparedSql = 'CREATE TEMPORARY TABLE ' . $temporaryTableName . ' ' . sprintf($sql, $orderAttributeTable, $discountAttributeTable, $discountAttributeId, @@ -108,38 +115,38 @@ $orderAttributeId ); -$stmt = $installer->getConnection()->query($preparedSql); -while($row = $stmt->fetch()) { - $data = array( - 'discount_invoiced' => $row['order_discount'], - 'base_discount_invoiced' => $row['order_base_discount'] - ); - $installer->getConnection()->update( - $ordersTable, - $data, - $installer->getConnection()->quoteInto('entity_id=?', $row['order_id']) - ); -} +$installer->getConnection()->query($preparedSql); +$select = $installer->getConnection()->select(); +$select->join(array('to_update' => $temporaryTableName), + 'to_update.order_id = main_table.entity_id', + array( + 'discount_invoiced' => 'order_discount', + 'base_discount_invoiced' => 'order_base_discount' + ) +); + +$installer->getConnection()->query( + $select->crossUpdateFromSelect(array('main_table'=>$ordersTable)) +); + +$installer->getConnection()->query( + 'DROP TEMPORARY TABLE ' . $temporaryTableName +); // Update discount_canceled (base_discount_canceled) $statusAttributeId = $installer->getAttributeId($ordersEntity['entity_type_id'], 'status'); $statusAttributeTable = $installer->getAttributeTable($ordersEntity['entity_type_id'], 'status'); -$select = $installer->getConnection()->select() - ->from( +$select = $installer->getConnection()->select(); +$select->from( array('s' => $statusAttributeTable), array('order_id' => 's.entity_id') ) ->where('s.attribute_id=?', $statusAttributeId) - ->where('s.entity_type_id=?', $ordersEntity['entity_type_id']) ->where('s.value=?', Mage_Sales_Model_Order::STATE_CANCELED); -$stmt = $installer->getConnection()->query($select); -while($row = $stmt->fetch()) { - $entityId = $row['order_id']; - $installer->run(" - UPDATE `{$ordersTable}` SET - `discount_canceled`=`discount_amount`-`discount_invoiced`, - `base_discount_canceled`=`base_discount_amount`-`base_discount_invoiced` - WHERE `entity_id`='{$entityId}' - "); -} +$installer->run(" + UPDATE `{$ordersTable}` SET + `discount_canceled`=`discount_amount`-`discount_invoiced`, + `base_discount_canceled`=`base_discount_amount`-`base_discount_invoiced` + WHERE `entity_id`=IN({$select->assemble()}); +"); diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.29-0.9.30.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.29-0.9.30.php index a55837e808..8ed4bc4378 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.29-0.9.30.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.29-0.9.30.php @@ -20,15 +20,15 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; /* @var $installer Mage_Sales_Model_Mysql4_Setup */ -$tableOrder = $this->getTable('sales/order'); -$tableOrderEntity = $this->getTable('sales/order_entity'); +$tableOrder = $this->getTable('sales_order'); +$tableOrderEntity = $this->getTable('sales_order_entity'); $cleanTables = array( $tableOrder . '_datetime', diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.3-0.9.4.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.3-0.9.4.php index 9232ab42c8..42f0c6f41f 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.3-0.9.4.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.3-0.9.4.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.30-0.9.31.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.30-0.9.31.php index a36e1f47ce..271ec30dde 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.30-0.9.31.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.30-0.9.31.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.31-0.9.32.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.31-0.9.32.php index 4d5cb52d9d..ddb93dbf0d 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.31-0.9.32.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.31-0.9.32.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.32-0.9.33.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.32-0.9.33.php index 0b8edd2bff..d0ae0e9ebe 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.32-0.9.33.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.32-0.9.33.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.33-0.9.34.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.33-0.9.34.php index 12efeba8ac..5a4d4e592b 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.33-0.9.34.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.33-0.9.34.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.34-0.9.35.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.34-0.9.35.php index 5a6a8dfabe..1d2d3cfb51 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.34-0.9.35.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.34-0.9.35.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.35-0.9.36.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.35-0.9.36.php index 7c982c5b89..f90d5ab293 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.35-0.9.36.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.35-0.9.36.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.36-0.9.37.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.36-0.9.37.php index 2ff75e30f1..35eebbf75a 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.36-0.9.37.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.36-0.9.37.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.37-0.9.38.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.37-0.9.38.php index 1cee3dccb7..bc586ad7db 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.37-0.9.38.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.37-0.9.38.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -30,16 +30,16 @@ $installer->startSetup(); $installer->run(" -UPDATE `{$installer->getTable('sales/order')}` AS `s` - LEFT JOIN `{$installer->getTable('customer/entity')}` AS `c` +UPDATE `{$installer->getTable('sales_order')}` AS `s` + LEFT JOIN `{$installer->getTable('customer_entity')}` AS `c` ON `s`.`customer_id`=`c`.`entity_id` SET `s`.`customer_id`=NULL WHERE `c`.`entity_id` IS NULL; "); -$installer->getConnection()->modifyColumn($installer->getTable('sales/order'), 'customer_id', 'INT UNSIGNED NULL DEFAULT NULL'); +$installer->getConnection()->modifyColumn($installer->getTable('sales_order'), 'customer_id', 'INT UNSIGNED NULL DEFAULT NULL'); $installer->getConnection()->addConstraint('FK_SALES_ORDER_CUSTOMER', - $installer->getTable('sales/order'), 'customer_id', - $installer->getTable('customer/entity'), 'entity_id', + $installer->getTable('sales_order'), 'customer_id', + $installer->getTable('customer_entity'), 'entity_id', 'set null', 'cascade' ); diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.38-0.9.39.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.38-0.9.39.php index 0effc26ec0..d6122353f7 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.38-0.9.39.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.38-0.9.39.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,17 +29,17 @@ $installer = $this; $installer->startSetup(); -$installer->getConnection()->addColumn($installer->getTable('sales/quote_item'), +$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_item'), 'store_id', 'smallint(5) unsigned default null AFTER `product_id`'); $installer->getConnection()->addConstraint('FK_SALES_QUOTE_ITEM_STORE', - $installer->getTable('sales/quote_item'), 'store_id', + $installer->getTable('sales_flat_quote_item'), 'store_id', $installer->getTable('core/store'), 'store_id', 'set null', 'cascade' ); -$installer->getConnection()->addColumn($installer->getTable('sales/order_item'), +$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_item'), 'store_id', 'smallint(5) unsigned default null AFTER `quote_item_id`'); $installer->getConnection()->addConstraint('FK_SALES_ORDER_ITEM_STORE', - $installer->getTable('sales/order_item'), 'store_id', + $installer->getTable('sales_flat_order_item'), 'store_id', $installer->getTable('core/store'), 'store_id', 'set null', 'cascade' ); diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.39-0.9.40.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.39-0.9.40.php index db94080735..ec254a25ef 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.39-0.9.40.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.39-0.9.40.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.4-0.9.5.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.4-0.9.5.php index 2a68479129..9cfff382fe 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.4-0.9.5.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.4-0.9.5.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.40-0.9.41.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.40-0.9.41.php index d21d98f0da..abc8601bd4 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.40-0.9.41.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.40-0.9.41.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -43,9 +43,9 @@ 'required' => false, )); -$installer->getConnection()->changeColumn($installer->getTable('sales/order_item'), 'cost', 'base_cost', 'DECIMAL( 12, 4 ) NULL DEFAULT \'0.0000\''); +$installer->getConnection()->changeColumn($installer->getTable('sales_flat_order_item'), 'cost', 'base_cost', 'DECIMAL( 12, 4 ) NULL DEFAULT \'0.0000\''); -$installer->getConnection()->addColumn($installer->getTable('sales/order'), 'base_total_invoiced_cost', 'DECIMAL( 12, 4 ) NULL DEFAULT NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales_order'), 'base_total_invoiced_cost', 'DECIMAL( 12, 4 ) NULL DEFAULT NULL'); $installer->addAttribute('order', 'base_total_invoiced_cost', array( 'type' => 'static' diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.41-0.9.42.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.41-0.9.42.php index e7d8b68013..5272c9fce1 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.41-0.9.42.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.41-0.9.42.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.42-0.9.43.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.42-0.9.43.php index 69e98f730e..cc97543451 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.42-0.9.43.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.42-0.9.43.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.43-0.9.44.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.43-0.9.44.php index ae000c0102..3543c4b5f4 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.43-0.9.44.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.43-0.9.44.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.44-0.9.45.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.44-0.9.45.php index e79efda5b0..15094e7548 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.44-0.9.45.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.44-0.9.45.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -39,7 +39,7 @@ ); foreach ($attributes as $attribute) { - $installer->getConnection()->addColumn($this->getTable('sales/order'), $attribute['attribute_code'], 'decimal(12,4) NULL'); + $installer->getConnection()->addColumn($this->getTable('sales_order'), $attribute['attribute_code'], 'decimal(12,4) NULL'); } try { @@ -47,7 +47,7 @@ foreach ($attributes as $attribute) { $installer->run(" - UPDATE {$this->getTable('sales/order')} AS o, {$this->getTable('sales/order')}_{$attribute['backend_type']} AS od + UPDATE {$this->getTable('sales_order')} AS o, {$this->getTable('sales_order')}_{$attribute['backend_type']} AS od SET o.{$attribute['attribute_code']} = od.value WHERE od.entity_id = o.entity_id AND od.attribute_id = {$attribute['attribute_id']} @@ -55,7 +55,7 @@ "); $installer->run(" - DELETE FROM {$this->getTable('sales/order')}_{$attribute['backend_type']} + DELETE FROM {$this->getTable('sales_order')}_{$attribute['backend_type']} WHERE attribute_id = {$attribute['attribute_id']} AND entity_type_id = {$orderEntityTypeId} "); @@ -70,7 +70,7 @@ } catch (Exception $e) { $installer->getConnection()->rollback(); foreach ($attributes as $attribute) { - $installer->getConnection()->dropColumn($this->getTable('sales/order'), $attribute['attribute_code']); + $installer->getConnection()->dropColumn($this->getTable('sales_order'), $attribute['attribute_code']); } throw $e; } diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.45-0.9.46.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.45-0.9.46.php index c2d8846dd0..a5903cb911 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.45-0.9.46.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.45-0.9.46.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -47,17 +47,17 @@ // modify existing attributes in sales/order table foreach ($attributesToModify as $attribute) { - $installer->getConnection()->modifyColumn($this->getTable('sales/order'), $attribute['attribute_code'], "decimal(12,4) NOT NULL DEFAULT '0'"); + $installer->getConnection()->modifyColumn($this->getTable('sales_order'), $attribute['attribute_code'], "decimal(12,4) NOT NULL DEFAULT '0'"); } foreach ($attributesToMove as $attribute) { - $installer->getConnection()->addColumn($this->getTable('sales/order'), $attribute['attribute_code'], 'varchar(50) NULL'); + $installer->getConnection()->addColumn($this->getTable('sales_order'), $attribute['attribute_code'], 'varchar(50) NULL'); } foreach ($attributesToMove as $attribute) { $installer->run(" - UPDATE {$this->getTable('sales/order')} AS o, {$this->getTable('sales/order')}_{$attribute['backend_type']} AS od + UPDATE {$this->getTable('sales_order')} AS o, {$this->getTable('sales_order')}_{$attribute['backend_type']} AS od SET o.{$attribute['attribute_code']} = od.value WHERE od.entity_id = o.entity_id AND od.attribute_id = {$attribute['attribute_id']} @@ -65,7 +65,7 @@ "); $installer->run(" - DELETE FROM {$this->getTable('sales/order')}_{$attribute['backend_type']} + DELETE FROM {$this->getTable('sales_order')}_{$attribute['backend_type']} WHERE attribute_id = {$attribute['attribute_id']} AND entity_type_id = {$orderEntityTypeId} "); diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.46-0.9.47.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.46-0.9.47.php index 713c4ebc83..f395b07857 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.46-0.9.47.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.46-0.9.47.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -38,8 +38,8 @@ $installer->getAttribute($orderEntityTypeId, 'shipping_description') ); -$installer->getConnection()->addColumn($this->getTable('sales/order'), $attributes[0]['attribute_code'], "tinyint(1) UNSIGNED NOT NULL DEFAULT 0"); -$installer->getConnection()->addColumn($this->getTable('sales/order'), $attributes[1]['attribute_code'], "varchar(255) NOT NULL DEFAULT ''"); +$installer->getConnection()->addColumn($this->getTable('sales_order'), $attributes[0]['attribute_code'], "tinyint(1) UNSIGNED NOT NULL DEFAULT 0"); +$installer->getConnection()->addColumn($this->getTable('sales_order'), $attributes[1]['attribute_code'], "varchar(255) NOT NULL DEFAULT ''"); try { @@ -47,7 +47,7 @@ foreach ($attributes as $attribute) { $installer->run(" - UPDATE {$this->getTable('sales/order')} AS o, {$this->getTable('sales/order')}_{$attribute['backend_type']} AS od + UPDATE {$this->getTable('sales_order')} AS o, {$this->getTable('sales_order')}_{$attribute['backend_type']} AS od SET o.{$attribute['attribute_code']} = od.value WHERE od.entity_id = o.entity_id AND od.attribute_id = {$attribute['attribute_id']} @@ -55,7 +55,7 @@ "); $installer->run(" - DELETE FROM {$this->getTable('sales/order')}_{$attribute['backend_type']} + DELETE FROM {$this->getTable('sales_order')}_{$attribute['backend_type']} WHERE attribute_id = {$attribute['attribute_id']} AND entity_type_id = {$orderEntityTypeId} "); @@ -70,7 +70,7 @@ } catch (Exception $e) { $installer->getConnection()->rollback(); foreach ($attributes as $attribute) { - $installer->getConnection()->dropColumn($this->getTable('sales/order'), $attribute['attribute_code']); + $installer->getConnection()->dropColumn($this->getTable('sales_order'), $attribute['attribute_code']); } throw $e; } diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.47-0.9.48.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.47-0.9.48.php index ed8b65619d..951a17ee25 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.47-0.9.48.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.47-0.9.48.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.48-0.9.49.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.48-0.9.49.php index bc7458c629..2452fc16bb 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.48-0.9.49.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.48-0.9.49.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.49-0.9.50.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.49-0.9.50.php index d9c1b8f555..68b5d9ee77 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.49-0.9.50.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.49-0.9.50.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,8 +29,8 @@ $installer = $this; $tablePaymentTransaction = $this->getTable('sales/payment_transaction'); -$tableOrders = $this->getTable('sales/order'); -$tableOrderPayment = $this->getTable('sales/order_entity'); +$tableOrders = $this->getTable('sales_order'); +$tableOrderPayment = $this->getTable('sales_order_entity'); $installer->run(" CREATE TABLE `{$tablePaymentTransaction}` ( diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.5-0.9.6.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.5-0.9.6.php index 9c52eb1f78..5758840334 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.5-0.9.6.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.5-0.9.6.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.50-0.9.51.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.50-0.9.51.php index d12dc83b69..bf8bd0e579 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.50-0.9.51.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.50-0.9.51.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -30,4 +30,112 @@ $installer->startSetup(); $installer->addAttribute('order_payment', 'additional_information', array('type' => 'text')); $installer->addAttribute('quote_payment', 'additional_information', array('type' => 'text')); + + +$processingItemsCountForOneIteration = 1000; + +$connection = $installer->getConnection(); + +$paymentMethods = array( + 'paypal_standard', + 'paypal_express', + 'paypal_direct', + 'paypaluk_direct', + 'paypaluk_express' +); +$entityTypeCode = 'order_payment'; +$attributesIds = array( + 'method' => false, + 'additional_data' => false, + 'additional_information' => false +); + +/* get order_payment entity type code*/ +$entityTypeId = $connection->fetchOne(" + SELECT entity_type_id + FROM {$this->getTable('eav_entity_type')} + WHERE entity_type_code = '{$entityTypeCode}'; +"); + +/* get order_payment attribute codes*/ +foreach ($attributesIds as $attributeCode => $attributeId) { + $attributesIds[$attributeCode] = $connection->fetchOne(" + SELECT attribute_id + FROM {$this->getTable('eav_attribute')} + WHERE attribute_code = '{$attributeCode}' and entity_type_id = {$entityTypeId}; + "); +} + +/* get count of paypal order payments*/ +$methodIds = "'" . implode("','", $paymentMethods) . "'"; +$paymentsCount = $connection->fetchOne(" + SELECT count(entity_id) as count + FROM {$this->getTable('sales_order_entity_varchar')} + WHERE attribute_id = {$attributesIds['method']} and value in ({$methodIds}); +"); + +$connection->beginTransaction(); +try { + + /* process payment attributes*/ + for ($i=0; $i<=$paymentsCount; $i+=$processingItemsCountForOneIteration) { + + /* get payment ids for current iteration*/ + $currentPaymentIds = $installer->getConnection()->fetchCol(" + SELECT entity_id + FROM {$this->getTable('sales_order_entity_varchar')} + WHERE attribute_id = {$attributesIds['method']} and value in ({$methodIds}) + LIMIT {$i}, {$processingItemsCountForOneIteration}; + "); + + if (!count($currentPaymentIds)) { + continue; + } + + $currentPaymentIdsCondition = implode(',', $currentPaymentIds); + + /* get data for current payment ids*/ + $data = $installer->getConnection()->fetchAll(" + SELECT + e.entity_id, + ev_additional_data.value as additional_data + FROM {$this->getTable('sales_order_entity')} as e + LEFT JOIN {$this->getTable('sales_order_entity_text')} as ev_additional_data on (ev_additional_data.entity_id = e.entity_id and ev_additional_data.attribute_id = {$attributesIds['additional_data']}) + WHERE e.entity_id in ({$currentPaymentIdsCondition}) + "); + + /* prepare query data items */ + $insertQueryItems = array(); + foreach ($data as $item) { + if ($item['additional_data'] != '') { + $additionalInformationFields = array(); + $additionalInformationFields['paypal_payer_email'] = $item['additional_data']; + $additionalInformation = serialize($additionalInformationFields); + + $insertQueryItems[] = array( + $entityTypeId, + $attributesIds['additional_information'], + $item['entity_id'], + $additionalInformation + ); + } + } + + if (!count($insertQueryItems)) { + continue; + } + + $connection->insertArray( + $this->getTable('sales_order_entity_text'), + array('entity_type_id', 'attribute_id', 'entity_id', 'value'), + $insertQueryItems + ); + } + +} catch (Exception $e) { + $connection->rollBack(); + throw $e; +} +$connection->commit(); + $installer->endSetup(); diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.51-0.9.52.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.51-0.9.52.php index 643cfbe63a..897a7c50e8 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.51-0.9.52.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.51-0.9.52.php @@ -20,15 +20,15 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; /* @var $installer Mage_Sales_Model_Mysql4_Setup */ -$tableOrder = $this->getTable('sales/order'); -$tableOrderItem = $this->getTable('sales/order_item'); +$tableOrder = $this->getTable('sales_order'); +$tableOrderItem = $this->getTable('sales_flat_order_item'); $select = $installer->getConnection()->select() ->from($tableOrderItem, array( diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.52-0.9.53.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.52-0.9.53.php index a189680c73..b993da82b7 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.52-0.9.53.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.52-0.9.53.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.53-0.9.54.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.53-0.9.54.php index d0f407401c..ab901e37e6 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.53-0.9.54.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.53-0.9.54.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.54-0.9.55.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.54-0.9.55.php index e63b492a99..feb1cd0456 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.54-0.9.55.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.54-0.9.55.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.55-0.9.56.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.55-0.9.56.php index 012fad1af2..82a763d2d2 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.55-0.9.56.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.55-0.9.56.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.6-0.9.7.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.6-0.9.7.php index beebef61fd..009aef7ef7 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.6-0.9.7.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.6-0.9.7.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.7-0.9.8.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.7-0.9.8.php index 3b1c932447..7230cf02d2 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.7-0.9.8.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.7-0.9.8.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.8-0.9.9.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.8-0.9.9.php index 473cae27c8..0065da865e 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.8-0.9.9.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.8-0.9.9.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.9-0.9.10.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.9-0.9.10.php index 7c2449ae38..98e257625c 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.9-0.9.10.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.9-0.9.10.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sales - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.3.99-1.4.0.0.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.3.99-1.4.0.0.php new file mode 100644 index 0000000000..dc7e55cc82 --- /dev/null +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.3.99-1.4.0.0.php @@ -0,0 +1,1170 @@ +startSetup(); + +/* Include code from mysql4-upgrade-0.9.38-0.9.39.php */ +$installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_item'), + 'store_id', 'smallint(5) unsigned default null AFTER `product_id`'); +$installer->getConnection()->addConstraint('FK_SALES_QUOTE_ITEM_STORE', + $installer->getTable('sales_flat_quote_item'), 'store_id', + $installer->getTable('core/store'), 'store_id', + 'set null', 'cascade' +); +$installer->getConnection()->addColumn($installer->getTable('sales_flat_order_item'), + 'store_id', 'smallint(5) unsigned default null AFTER `quote_item_id`'); +$installer->getConnection()->addConstraint('FK_SALES_ORDER_ITEM_STORE', + $installer->getTable('sales_flat_order_item'), 'store_id', + $installer->getTable('core/store'), 'store_id', + 'set null', 'cascade' +); +$installer->addAttribute('quote_item', 'redirect_url', array( + 'type' => 'varchar', +)); +/* including end */ + +$installer->run(" +/* Orders */ +CREATE TABLE `{$installer->getTable('sales_flat_order')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `state` varchar(32) default NULL, + `status` varchar(32) default NULL, + `coupon_code` varchar(255) default NULL, + `protect_code` varchar(255) default NULL, + `shipping_description` varchar(255) default NULL, + `is_virtual` tinyint(1) unsigned default NULL, + `store_id` smallint(5) unsigned default NULL, + `customer_id` int(10) unsigned default NULL, + `base_discount_amount` decimal(12,4) default NULL, + `base_discount_canceled` decimal(12,4) default NULL, + `base_discount_invoiced` decimal(12,4) default NULL, + `base_discount_refunded` decimal(12,4) default NULL, + `base_grand_total` decimal(12,4) default NULL, + `base_shipping_amount` decimal(12,4) default NULL, + `base_shipping_canceled` decimal(12,4) default NULL, + `base_shipping_invoiced` decimal(12,4) default NULL, + `base_shipping_refunded` decimal(12,4) default NULL, + `base_shipping_tax_amount` decimal(12,4) default NULL, + `base_shipping_tax_refunded` decimal(12,4) default NULL, + `base_subtotal` decimal(12,4) default NULL, + `base_subtotal_canceled` decimal(12,4) default NULL, + `base_subtotal_invoiced` decimal(12,4) default NULL, + `base_subtotal_refunded` decimal(12,4) default NULL, + `base_tax_amount` decimal(12,4) default NULL, + `base_tax_canceled` decimal(12,4) default NULL, + `base_tax_invoiced` decimal(12,4) default NULL, + `base_tax_refunded` decimal(12,4) default NULL, + `base_to_global_rate` decimal(12,4) default NULL, + `base_to_order_rate` decimal(12,4) default NULL, + `base_total_canceled` decimal(12,4) default NULL, + `base_total_invoiced` decimal(12,4) default NULL, + `base_total_invoiced_cost` decimal(12,4) default NULL, + `base_total_offline_refunded` decimal(12,4) default NULL, + `base_total_online_refunded` decimal(12,4) default NULL, + `base_total_paid` decimal(12,4) default NULL, + `base_total_qty_ordered` decimal(12,4) default NULL, + `base_total_refunded` decimal(12,4) default NULL, + `discount_amount` decimal(12,4) default NULL, + `discount_canceled` decimal(12,4) default NULL, + `discount_invoiced` decimal(12,4) default NULL, + `discount_refunded` decimal(12,4) default NULL, + `grand_total` decimal(12,4) default NULL, + `shipping_amount` decimal(12,4) default NULL, + `shipping_canceled` decimal(12,4) default NULL, + `shipping_invoiced` decimal(12,4) default NULL, + `shipping_refunded` decimal(12,4) default NULL, + `shipping_tax_amount` decimal(12,4) default NULL, + `shipping_tax_refunded` decimal(12,4) default NULL, + `store_to_base_rate` decimal(12,4) default NULL, + `store_to_order_rate` decimal(12,4) default NULL, + `subtotal` decimal(12,4) default NULL, + `subtotal_canceled` decimal(12,4) default NULL, + `subtotal_invoiced` decimal(12,4) default NULL, + `subtotal_refunded` decimal(12,4) default NULL, + `tax_amount` decimal(12,4) default NULL, + `tax_canceled` decimal(12,4) default NULL, + `tax_invoiced` decimal(12,4) default NULL, + `tax_refunded` decimal(12,4) default NULL, + `total_canceled` decimal(12,4) default NULL, + `total_invoiced` decimal(12,4) default NULL, + `total_offline_refunded` decimal(12,4) default NULL, + `total_online_refunded` decimal(12,4) default NULL, + `total_paid` decimal(12,4) default NULL, + `total_qty_ordered` decimal(12,4) default NULL, + `total_refunded` decimal(12,4) default NULL, + `can_ship_partially` tinyint(1) unsigned default NULL, + `can_ship_partially_item` tinyint(1) unsigned default NULL, + `customer_is_guest` tinyint(1) unsigned default NULL, + `customer_note_notify` tinyint(1) unsigned default NULL, + `billing_address_id` int(10) default NULL, + `customer_group_id` smallint(5) default NULL, + `edit_increment` int(10) default NULL, + `email_sent` tinyint(1) unsigned default NULL, + `forced_do_shipment_with_invoice` tinyint(1) unsigned default NULL, + `gift_message_id` int(10) default NULL, + `payment_authorization_expiration` int(10) default NULL, + `paypal_ipn_customer_notified` int(10) default NULL, + `quote_address_id` int(10) default NULL, + `quote_id` int(10) default NULL, + `shipping_address_id` int(10) default NULL, + `adjustment_negative` decimal(12,4) default NULL, + `adjustment_positive` decimal(12,4) default NULL, + `base_adjustment_negative` decimal(12,4) default NULL, + `base_adjustment_positive` decimal(12,4) default NULL, + `base_shipping_discount_amount` decimal(12,4) default NULL, + `base_subtotal_incl_tax` decimal(12,4) default NULL, + `base_total_due` decimal(12,4) default NULL, + `payment_authorization_amount` decimal(12,4) default NULL, + `shipping_discount_amount` decimal(12,4) default NULL, + `subtotal_incl_tax` decimal(12,4) default NULL, + `total_due` decimal(12,4) default NULL, + `weight` decimal(12,4) default NULL, + `customer_dob` datetime default NULL, + `increment_id` varchar(50) default NULL, + `applied_rule_ids` varchar(255) default NULL, + `base_currency_code` char(3) default NULL, + `customer_email` varchar(255) default NULL, + `customer_firstname` varchar(255) default NULL, + `customer_lastname` varchar(255) default NULL, + `customer_middlename` varchar(255) default NULL, + `customer_prefix` varchar(255) default NULL, + `customer_suffix` varchar(255) default NULL, + `customer_taxvat` varchar(255) default NULL, + `discount_description` varchar(255) default NULL, + `ext_customer_id` varchar(255) default NULL, + `ext_order_id` varchar(255) default NULL, + `global_currency_code` char(3) default NULL, + `hold_before_state` varchar(255) default NULL, + `hold_before_status` varchar(255) default NULL, + `order_currency_code` varchar(255) default NULL, + `original_increment_id` varchar(50) default NULL, + `relation_child_id` varchar(32) default NULL, + `relation_child_real_id` varchar(32) default NULL, + `relation_parent_id` varchar(32) default NULL, + `relation_parent_real_id` varchar(32) default NULL, + `remote_ip` varchar(255) default NULL, + `shipping_method` varchar(255) default NULL, + `store_currency_code` char(3) default NULL, + `store_name` varchar(255) default NULL, + `x_forwarded_for` varchar(255) default NULL, + `customer_note` text, + `created_at` datetime default NULL, + `updated_at` datetime default NULL, + `total_item_count` smallint(5) unsigned DEFAULT '0', + `customer_gender` int(11) DEFAULT NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_STATUS` (`status`), + KEY `IDX_STATE` (`state`), + KEY `IDX_STORE_ID` (`store_id`), + KEY `IDX_INCREMENT_ID` (`increment_id`), + KEY `IDX_CREATED_AT` (`created_at`), + KEY `IDX_CUSTOMER_ID` (`customer_id`), + KEY `IDX_EXT_ORDER_ID` (`ext_order_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Orders Grid */ +CREATE TABLE `{$installer->getTable('sales_flat_order_grid')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `status` varchar(32) default NULL, + `store_id` smallint(5) unsigned default NULL, + `customer_id` int(10) unsigned default NULL, + `base_grand_total` decimal(12,4) default NULL, + `base_total_paid` decimal(12,4) default NULL, + `grand_total` decimal(12,4) default NULL, + `total_paid` decimal(12,4) default NULL, + `increment_id` varchar(50) default NULL, + `base_currency_code` char(3) default NULL, + `order_currency_code` varchar(255) default NULL, + `shipping_name` varchar(255) default NULL, + `billing_name` varchar(255) default NULL, + `created_at` datetime default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_STATUS` (`status`), + KEY `IDX_STORE_ID` (`store_id`), + KEY `IDX_BASE_GRAND_TOTAL` (`base_grand_total`), + KEY `IDX_BASE_TOTAL_PAID` (`base_total_paid`), + KEY `IDX_GRAND_TOTAL` (`grand_total`), + KEY `IDX_TOTAL_PAID` (`total_paid`), + KEY `IDX_INCREMENT_ID` (`increment_id`), + KEY `IDX_SHIPPING_NAME` (`shipping_name`), + KEY `IDX_BILLING_NAME` (`billing_name`), + KEY `IDX_CREATED_AT` (`created_at`), + KEY `IDX_CUSTOMER_ID` (`customer_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Order Address */ +CREATE TABLE `{$installer->getTable('sales_flat_order_address')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned default NULL, + `customer_address_id` int(10) default NULL, + `quote_address_id` int(10) default NULL, + `region_id` int(10) default NULL, + `customer_id` int(10) default NULL, + `fax` varchar(255) default NULL, + `region` varchar(255) default NULL, + `postcode` varchar(255) default NULL, + `lastname` varchar(255) default NULL, + `street` varchar(255) default NULL, + `city` varchar(255) default NULL, + `email` varchar(255) default NULL, + `telephone` varchar(255) default NULL, + `country_id` char(2) default NULL, + `firstname` varchar(255) default NULL, + `address_type` varchar(255) default NULL, + `prefix` varchar(255) default NULL, + `middlename` varchar(255) default NULL, + `suffix` varchar(255) default NULL, + `company` varchar(255) default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_PARENT_ID` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Order Comments */ +CREATE TABLE `{$installer->getTable('sales_flat_order_status_history')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned NOT NULL, + `is_customer_notified` int(10) default NULL, + `comment` text, + `status` varchar(32) default NULL, + `created_at` datetime default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_PARENT_ID` (`parent_id`), + KEY `IDX_CREATED_AT` (`created_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Order Payment */ + +CREATE TABLE `{$installer->getTable('sales_flat_order_payment')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned NOT NULL, + `base_shipping_captured` decimal(12,4) default NULL, + `shipping_captured` decimal(12,4) default NULL, + `amount_refunded` decimal(12,4) default NULL, + `base_amount_paid` decimal(12,4) default NULL, + `amount_canceled` decimal(12,4) default NULL, + `base_amount_authorized` decimal(12,4) default NULL, + `base_amount_paid_online` decimal(12,4) default NULL, + `base_amount_refunded_online` decimal(12,4) default NULL, + `base_shipping_amount` decimal(12,4) default NULL, + `shipping_amount` decimal(12,4) default NULL, + `amount_paid` decimal(12,4) default NULL, + `amount_authorized` decimal(12,4) default NULL, + `base_amount_ordered` decimal(12,4) default NULL, + `base_shipping_refunded` decimal(12,4) default NULL, + `shipping_refunded` decimal(12,4) default NULL, + `base_amount_refunded` decimal(12,4) default NULL, + `amount_ordered` decimal(12,4) default NULL, + `base_amount_canceled` decimal(12,4) default NULL, + `ideal_transaction_checked` tinyint(1) unsigned default NULL, + `quote_payment_id` int(10) default NULL, + `additional_data` text, + `cc_exp_month` varchar(255) default NULL, + `cc_ss_start_year` varchar(255) default NULL, + `echeck_bank_name` varchar(255) default NULL, + `method` varchar(255) default NULL, + `cc_debug_request_body` varchar(255) default NULL, + `cc_secure_verify` varchar(255) default NULL, + `cybersource_token` varchar(255) default NULL, + `ideal_issuer_title` varchar(255) default NULL, + `protection_eligibility` varchar(255) default NULL, + `cc_approval` varchar(255) default NULL, + `cc_last4` varchar(255) default NULL, + `cc_status_description` varchar(255) default NULL, + `echeck_type` varchar(255) default NULL, + `paybox_question_number` varchar(255) default NULL, + `cc_debug_response_serialized` varchar(255) default NULL, + `cc_ss_start_month` varchar(255) default NULL, + `echeck_account_type` varchar(255) default NULL, + `last_trans_id` varchar(255) default NULL, + `cc_cid_status` varchar(255) default NULL, + `cc_owner` varchar(255) default NULL, + `cc_type` varchar(255) default NULL, + `ideal_issuer_id` varchar(255) default NULL, + `po_number` varchar(255) default NULL, + `cc_exp_year` varchar(255) default NULL, + `cc_status` varchar(255) default NULL, + `echeck_routing_number` varchar(255) default NULL, + `account_status` varchar(255) default NULL, + `anet_trans_method` varchar(255) default NULL, + `cc_debug_response_body` varchar(255) default NULL, + `cc_ss_issue` varchar(255) default NULL, + `echeck_account_name` varchar(255) default NULL, + `cc_avs_status` varchar(255) default NULL, + `cc_number_enc` varchar(255) default NULL, + `cc_trans_id` varchar(255) default NULL, + `flo2cash_account_id` varchar(255) default NULL, + `paybox_request_number` varchar(255) default NULL, + `address_status` varchar(255) default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_PARENT_ID` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Shipments */ + +CREATE TABLE `{$installer->getTable('sales_flat_shipment')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `store_id` smallint(5) unsigned default NULL, + `total_weight` decimal(12,4) default NULL, + `total_qty` decimal(12,4) default NULL, + `email_sent` tinyint(1) unsigned default NULL, + `order_id` int(10) unsigned NOT NULL, + `customer_id` int(10) default NULL, + `shipping_address_id` int(10) default NULL, + `billing_address_id` int(10) default NULL, + `shipment_status` int(10) default NULL, + `increment_id` varchar(50) default NULL, + `created_at` datetime default NULL, + `updated_at` datetime default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_STORE_ID` (`store_id`), + KEY `IDX_TOTAL_QTY` (`total_qty`), + KEY `IDX_INCREMENT_ID` (`increment_id`), + KEY `IDX_ORDER_ID` (`order_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Shipments Grid */ + +CREATE TABLE `{$installer->getTable('sales_flat_shipment_grid')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `store_id` smallint(5) unsigned default NULL, + `total_qty` decimal(12,4) default NULL, + `order_id` int(10) unsigned NOT NULL, + `shipment_status` int(10) default NULL, + `increment_id` varchar(50) default NULL, + `order_increment_id` varchar(50) default NULL, + `created_at` datetime default NULL, + `order_created_at` datetime default NULL, + `shipping_name` varchar(255) default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_STORE_ID` (`store_id`), + KEY `IDX_TOTAL_QTY` (`total_qty`), + KEY `IDX_ORDER_ID` (`order_id`), + KEY `IDX_SHIPMENT_STATUS` (`shipment_status`), + KEY `IDX_INCREMENT_ID` (`increment_id`), + KEY `IDX_ORDER_INCREMENT_ID` (`order_increment_id`), + KEY `IDX_CREATED_AT` (`created_at`), + KEY `IDX_ORDER_CREATED_AT` (`order_created_at`), + KEY `IDX_SHIPPING_NAME` (`shipping_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Shipment Items */ + +CREATE TABLE `{$installer->getTable('sales_flat_shipment_item')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned NOT NULL, + `row_total` decimal(12,4) default NULL, + `price` decimal(12,4) default NULL, + `weight` decimal(12,4) default NULL, + `qty` decimal(12,4) default NULL, + `product_id` int(10) default NULL, + `order_item_id` int(10) default NULL, + `additional_data` text, + `description` text, + `name` varchar(255) default NULL, + `sku` varchar(255) default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_PARENT_ID` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Shipping tracking */ + +CREATE TABLE `{$installer->getTable('sales_flat_shipment_track')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned NOT NULL, + `weight` decimal(12,4) default NULL, + `qty` decimal(12,4) default NULL, + `order_id` int(10) unsigned NOT NULL, + `number` text, + `description` text, + `title` varchar(255) default NULL, + `carrier_code` varchar(32) default NULL, + `created_at` datetime default NULL, + `updated_at` datetime default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_PARENT_ID` (`parent_id`), + KEY `IDX_ORDER_ID` (`order_id`), + KEY `IDX_CREATED_AT` (`created_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Shipment Comment */ +CREATE TABLE `{$installer->getTable('sales_flat_shipment_comment')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned NOT NULL, + `is_customer_notified` int(10) default NULL, + `comment` text, + `created_at` datetime default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_CREATED_AT` (`created_at`), + KEY `IDX_PARENT_ID` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Invoice Main Table */ +CREATE TABLE `{$installer->getTable('sales_flat_invoice')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `store_id` smallint(5) unsigned default NULL, + `base_grand_total` decimal(12,4) default NULL, + `shipping_tax_amount` decimal(12,4) default NULL, + `tax_amount` decimal(12,4) default NULL, + `base_tax_amount` decimal(12,4) default NULL, + `store_to_order_rate` decimal(12,4) default NULL, + `base_shipping_tax_amount` decimal(12,4) default NULL, + `base_discount_amount` decimal(12,4) default NULL, + `base_to_order_rate` decimal(12,4) default NULL, + `grand_total` decimal(12,4) default NULL, + `shipping_amount` decimal(12,4) default NULL, + `subtotal_incl_tax` decimal(12,4) default NULL, + `base_subtotal_incl_tax` decimal(12,4) default NULL, + `store_to_base_rate` decimal(12,4) default NULL, + `base_shipping_amount` decimal(12,4) default NULL, + `total_qty` decimal(12,4) default NULL, + `base_to_global_rate` decimal(12,4) default NULL, + `subtotal` decimal(12,4) default NULL, + `base_subtotal` decimal(12,4) default NULL, + `discount_amount` decimal(12,4) default NULL, + `billing_address_id` int(10) default NULL, + `is_used_for_refund` tinyint(1) unsigned default NULL, + `order_id` int(10) unsigned NOT NULL, + `email_sent` tinyint(1) unsigned default NULL, + `can_void_flag` tinyint(1) unsigned default NULL, + `state` int(10) default NULL, + `shipping_address_id` int(10) default NULL, + `cybersource_token` varchar(255) default NULL, + `store_currency_code` char(3) default NULL, + `transaction_id` varchar(255) default NULL, + `order_currency_code` char(3) default NULL, + `base_currency_code` char(3) default NULL, + `global_currency_code` char(3) default NULL, + `increment_id` varchar(50) default NULL, + `created_at` datetime default NULL, + `updated_at` datetime default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_STORE_ID` (`store_id`), + KEY `IDX_GRAND_TOTAL` (`grand_total`), + KEY `IDX_ORDER_ID` (`order_id`), + KEY `IDX_STATE` (`state`), + KEY `IDX_INCREMENT_ID` (`increment_id`), + KEY `IDX_CREATED_AT` (`created_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Invoices Grid */ +CREATE TABLE `{$installer->getTable('sales_flat_invoice_grid')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `store_id` smallint(5) unsigned default NULL, + `base_grand_total` decimal(12,4) default NULL, + `grand_total` decimal(12,4) default NULL, + `order_id` int(10) unsigned NOT NULL, + `state` int(10) default NULL, + `store_currency_code` char(3) default NULL, + `order_currency_code` char(3) default NULL, + `base_currency_code` char(3) default NULL, + `global_currency_code` char(3) default NULL, + `increment_id` varchar(50) default NULL, + `order_increment_id` varchar(50) default NULL, + `created_at` datetime default NULL, + `order_created_at` datetime default NULL, + `billing_name` varchar(255) default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_STORE_ID` (`store_id`), + KEY `IDX_GRAND_TOTAL` (`grand_total`), + KEY `IDX_ORDER_ID` (`order_id`), + KEY `IDX_STATE` (`state`), + KEY `IDX_INCREMENT_ID` (`increment_id`), + KEY `IDX_ORDER_INCREMENT_ID` (`order_increment_id`), + KEY `IDX_CREATED_AT` (`created_at`), + KEY `IDX_ORDER_CREATED_AT` (`order_created_at`), + KEY `IDX_BILLING_NAME` (`billing_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Invoice Items */ + +CREATE TABLE `{$installer->getTable('sales_flat_invoice_item')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned NOT NULL, + `base_price` decimal(12,4) default NULL, + `base_weee_tax_row_disposition` decimal(12,4) default NULL, + `weee_tax_applied_row_amount` decimal(12,4) default NULL, + `base_weee_tax_applied_amount` decimal(12,4) default NULL, + `tax_amount` decimal(12,4) default NULL, + `base_row_total` decimal(12,4) default NULL, + `discount_amount` decimal(12,4) default NULL, + `row_total` decimal(12,4) default NULL, + `weee_tax_row_disposition` decimal(12,4) default NULL, + `base_discount_amount` decimal(12,4) default NULL, + `base_weee_tax_disposition` decimal(12,4) default NULL, + `price_incl_tax` decimal(12,4) default NULL, + `weee_tax_applied_amount` decimal(12,4) default NULL, + `base_tax_amount` decimal(12,4) default NULL, + `base_price_incl_tax` decimal(12,4) default NULL, + `qty` decimal(12,4) default NULL, + `weee_tax_disposition` decimal(12,4) default NULL, + `base_cost` decimal(12,4) default NULL, + `base_weee_tax_applied_row_amount` decimal(12,4) default NULL, + `price` decimal(12,4) default NULL, + `base_row_total_incl_tax` decimal(12,4) default NULL, + `row_total_incl_tax` decimal(12,4) default NULL, + `product_id` int(10) default NULL, + `order_item_id` int(10) default NULL, + `additional_data` text, + `description` text, + `weee_tax_applied` text, + `sku` varchar(255) default NULL, + `name` varchar(255) default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_PARENT_ID` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Invoice Comments */ +CREATE TABLE `{$installer->getTable('sales_flat_invoice_comment')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned NOT NULL, + `is_customer_notified` tinyint(1) unsigned default NULL, + `comment` text, + `created_at` datetime default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_CREATED_AT` (`created_at`), + KEY `IDX_PARENT_ID` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* CreditMemo Main table */ +CREATE TABLE `{$installer->getTable('sales_flat_creditmemo')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `store_id` smallint(5) unsigned default NULL, + `adjustment_positive` decimal(12,4) default NULL, + `base_shipping_tax_amount` decimal(12,4) default NULL, + `store_to_order_rate` decimal(12,4) default NULL, + `base_discount_amount` decimal(12,4) default NULL, + `base_to_order_rate` decimal(12,4) default NULL, + `grand_total` decimal(12,4) default NULL, + `base_adjustment_negative` decimal(12,4) default NULL, + `base_subtotal_incl_tax` decimal(12,4) default NULL, + `shipping_amount` decimal(12,4) default NULL, + `subtotal_incl_tax` decimal(12,4) default NULL, + `adjustment_negative` decimal(12,4) default NULL, + `base_shipping_amount` decimal(12,4) default NULL, + `store_to_base_rate` decimal(12,4) default NULL, + `base_to_global_rate` decimal(12,4) default NULL, + `base_adjustment` decimal(12,4) default NULL, + `base_subtotal` decimal(12,4) default NULL, + `discount_amount` decimal(12,4) default NULL, + `subtotal` decimal(12,4) default NULL, + `adjustment` decimal(12,4) default NULL, + `base_grand_total` decimal(12,4) default NULL, + `base_adjustment_positive` decimal(12,4) default NULL, + `base_tax_amount` decimal(12,4) default NULL, + `shipping_tax_amount` decimal(12,4) default NULL, + `tax_amount` decimal(12,4) default NULL, + `order_id` int(10) unsigned NOT NULL, + `email_sent` tinyint(1) unsigned default NULL, + `creditmemo_status` int(10) default NULL, + `state` int(10) default NULL, + `shipping_address_id` int(10) default NULL, + `billing_address_id` int(10) default NULL, + `invoice_id` int(10) default NULL, + `cybersource_token` varchar(255) default NULL, + `store_currency_code` char(3) default NULL, + `order_currency_code` char(3) default NULL, + `base_currency_code` char(3) default NULL, + `global_currency_code` char(3) default NULL, + `transaction_id` varchar(255) default NULL, + `increment_id` varchar(50) default NULL, + `created_at` datetime default NULL, + `updated_at` datetime default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_STORE_ID` (`store_id`), + KEY `IDX_ORDER_ID` (`order_id`), + KEY `IDX_CREDITMEMO_STATUS` (`creditmemo_status`), + KEY `IDX_INCREMENT_ID` (`increment_id`), + KEY `IDX_STATE` (`state`), + KEY `IDX_CREATED_AT` (`created_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* CreditMemo Grid */ +CREATE TABLE `{$installer->getTable('sales_flat_creditmemo_grid')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `store_id` smallint(5) unsigned default NULL, + `store_to_order_rate` decimal(12,4) default NULL, + `base_to_order_rate` decimal(12,4) default NULL, + `grand_total` decimal(12,4) default NULL, + `store_to_base_rate` decimal(12,4) default NULL, + `base_to_global_rate` decimal(12,4) default NULL, + `base_grand_total` decimal(12,4) default NULL, + `order_id` int(10) unsigned NOT NULL, + `creditmemo_status` int(10) default NULL, + `state` int(10) default NULL, + `invoice_id` int(10) default NULL, + `store_currency_code` char(3) default NULL, + `order_currency_code` char(3) default NULL, + `base_currency_code` char(3) default NULL, + `global_currency_code` char(3) default NULL, + `increment_id` varchar(50) default NULL, + `order_increment_id` varchar(50) default NULL, + `created_at` datetime default NULL, + `order_created_at` datetime default NULL, + `billing_name` varchar(255) default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_STORE_ID` (`store_id`), + KEY `IDX_GRAND_TOTAL` (`grand_total`), + KEY `IDX_BASE_GRAND_TOTAL` (`base_grand_total`), + KEY `IDX_ORDER_ID` (`order_id`), + KEY `IDX_CREDITMEMO_STATUS` (`creditmemo_status`), + KEY `IDX_STATE` (`state`), + KEY `IDX_INCREMENT_ID` (`increment_id`), + KEY `IDX_ORDER_INCREMENT_ID` (`order_increment_id`), + KEY `IDX_CREATED_AT` (`created_at`), + KEY `IDX_ORDER_CREATED_AT` (`order_created_at`), + KEY `IDX_BILLING_NAME` (`billing_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* CreditMemo Item */ + +CREATE TABLE `{$installer->getTable('sales_flat_creditmemo_item')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned NOT NULL, + `weee_tax_applied_row_amount` decimal(12,4) default NULL, + `base_price` decimal(12,4) default NULL, + `base_weee_tax_row_disposition` decimal(12,4) default NULL, + `tax_amount` decimal(12,4) default NULL, + `base_weee_tax_applied_amount` decimal(12,4) default NULL, + `weee_tax_row_disposition` decimal(12,4) default NULL, + `base_row_total` decimal(12,4) default NULL, + `discount_amount` decimal(12,4) default NULL, + `row_total` decimal(12,4) default NULL, + `weee_tax_applied_amount` decimal(12,4) default NULL, + `base_discount_amount` decimal(12,4) default NULL, + `base_weee_tax_disposition` decimal(12,4) default NULL, + `price_incl_tax` decimal(12,4) default NULL, + `base_tax_amount` decimal(12,4) default NULL, + `weee_tax_disposition` decimal(12,4) default NULL, + `base_price_incl_tax` decimal(12,4) default NULL, + `qty` decimal(12,4) default NULL, + `base_cost` decimal(12,4) default NULL, + `base_weee_tax_applied_row_amount` decimal(12,4) default NULL, + `price` decimal(12,4) default NULL, + `base_row_total_incl_tax` decimal(12,4) default NULL, + `row_total_incl_tax` decimal(12,4) default NULL, + `product_id` int(10) default NULL, + `order_item_id` int(10) default NULL, + `additional_data` text, + `description` text, + `weee_tax_applied` text, + `sku` varchar(255) default NULL, + `name` varchar(255) default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_PARENT_ID` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* CreditMemo Comment */ + +CREATE TABLE `{$installer->getTable('sales_flat_creditmemo_comment')}` ( + `entity_id` int(10) unsigned NOT NULL auto_increment, + `parent_id` int(10) unsigned NOT NULL, + `is_customer_notified` int(10) default NULL, + `comment` text, + `created_at` datetime default NULL, + PRIMARY KEY (`entity_id`), + KEY `IDX_CREATED_AT` (`created_at`), + KEY `IDX_PARENT_ID` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$installer->getConnection()->dropForeignKey( + $installer->getTable('sales_flat_order_item'), + 'FK_SALES_ORDER_ITEM_STORE' +); + +$installer->getConnection()->dropForeignKey( + $installer->getTable('sales_payment_transaction'), + 'FK_SALES_PAYMENT_TXN_PARENT' +); + +$installer->getConnection()->dropForeignKey( + $installer->getTable('sales_payment_transaction'), + 'FK_SALES_TXN_ORDER' +); + +$installer->getConnection()->dropForeignKey( + $installer->getTable('sales_payment_transaction'), + 'FK_SALES_TXN_PAYMENT' +); + +$installer->getConnection()->dropKey( + $installer->getTable('sales_flat_order_item'), + 'FK_SALES_ORDER_ITEM_STORE' +); + +$installer->getConnection()->addKey( + $installer->getTable('sales_flat_order_item'), + 'IDX_STORE_ID', + 'store_id' +); + +$installer->getConnection()->dropColumn($installer->getTable('sales_flat_order_item'), 'is_active'); + +$excludeAttributes = array( + 'all' => array('entity_type_id', 'attribute_set_id', 'is_active'), + 'order_payment' => array('increment_id','created_at', 'updated_at', 'store_id'), + 'order_status_history' => array('updated_at', 'store_id', 'increment_id'), + 'invoice_comment' => array('updated_at', 'store_id', 'increment_id'), + 'shipment_comment' => array('updated_at', 'store_id', 'increment_id'), + 'creditmemo_comment' => array('updated_at', 'store_id', 'increment_id'), + 'invoice_item' => array('increment_id','created_at', 'updated_at', 'store_id'), + 'shipment_item' => array('increment_id','created_at', 'updated_at', 'store_id'), + 'creditmemo_item' => array('increment_id','created_at', 'updated_at', 'store_id'), + 'order_address' => array('increment_id','created_at', 'updated_at', 'store_id'), + 'order' => array('payment_authorization_amount', 'parent_id'), + 'creditmemo' => array('parent_id'), + 'invoice' => array('parent_id'), + 'shipment' => array('parent_id'), + 'shipment_track' => array('increment_id', 'store_id'), +); + +$entityToFlat = array( + 'order' => array('grid'=>true), + 'order_item' => array('flat'=> true), + 'order_address' => array(), + 'order_payment' => array(), + 'order_status_history' => array(), + 'invoice' => array('grid' => true), + 'invoice_item' => array(), + 'invoice_comment' => array(), + 'creditmemo' => array('grid' => true), + 'creditmemo_item' => array(), + 'creditmemo_comment' => array(), + 'shipment' => array('grid' => true), + 'shipment_item' => array(), + 'shipment_comment' => array(), + 'shipment_track' => array() +); + +/* @var $select Varien_Db_Select */ +$select = $installer->getConnection()->select(); + +$select + ->from(array('attribute' => $installer->getTable('eav/attribute')), array( + 'id' => 'attribute_id', + 'code' => 'attribute_code', + 'type' => 'backend_type', + 'table' => 'backend_table')) + ->join(array('entity' => $installer->getTable('eav/entity_type')), 'attribute.entity_type_id = entity.entity_type_id', array( + 'entity' => 'entity_type_code', + 'type_id' => 'entity_type_id' + )) + ->where('entity.entity_type_code IN (?)', array_keys($entityToFlat)) + ->where('attribute.attribute_code NOT IN(?)', $excludeAttributes['all']); +; + + +$attributes = array(); + +foreach ($installer->getConnection()->fetchAll($select) as $attribute) { + $attributes[$attribute['entity']][$attribute['code']] = $attribute; +} + + +$definitions = array( + 'datetime' => 'datetime default null', + 'int' => 'int(11) default null', + 'varchar' => 'varchar(255) default null', + 'text' => 'text default null', + 'decimal' => 'decimal(12,4) default null' +); + +foreach ($entityToFlat as $entityCode => $flags) { + $flatTablePrefix = 'sales_flat_' . $entityCode; + $flatFields = $installer->getConnection()->fetchPairs( + 'DESCRIBE ' . $installer->getTable($flatTablePrefix) + ); + + if (!empty($flags['flat'])) { + $entityTable = $installer->getTable('sales_flat_' . $entityCode); + } else { + $entityTable = $this->getTable($entityCode == 'order' ? 'sales_order' : 'sales_order_entity'); + $firstAttribute = current($attributes[$entityCode]); + $entityTypeId = $firstAttribute['type_id']; + } + + $entityFields = $installer->getConnection()->fetchPairs( + 'DESCRIBE ' . $entityTable + ); + + $entityIndex = $installer->getConnection()->getIndexList($entityTable); + $entityFieldInIndex = array(); + + // Create list of entity fields in index to not loose them. + foreach ($entityIndex as $name => $info) { + $entityFieldInIndex += array_combine($info['fields'], array_fill(0, count($info['fields']), $name)); + } + + // Copy all fields from entity tables + $addIndex = array(); + + foreach ($entityFields as $code => $definition) { + if (!isset($flatFields[$code]) && + !in_array($code, $excludeAttributes['all']) && + (!isset($excludeAttributes[$entityCode]) || + !in_array($code, $excludeAttributes[$entityCode]))) { + + $installer->getConnection()->addColumn( + $installer->getTable($flatTablePrefix), + $code, $definition + ); + + if (isset($entityFieldInIndex[$code])) { // Add entity table indexes with custom fields + $addIndex[] = $entityFieldInIndex[$code]; + } + + $flatFields[$code] = $definition; + } + } + + foreach ($addIndex as $indexName) { // Adding indexes to not loose them in customizations + $fields = array_intersect($entityIndex[$indexName]['fields'], array_keys($flatFields)); + $installer->getConnection()->addKey( + $installer->getTable($flatTablePrefix), + $indexName, + $fields, + $entityIndex[$indexName]['type'] + ); + } + + $attributesByTable = array(); + + if (empty($flags['flat']) && isset($attributes[$entityCode])) { + // If our table is not flat we need to add field from attributes too + foreach ($attributes[$entityCode] as $attributeCode => $attribute) { + if ($attribute['type'] == 'static') { + continue; + } + + if (!isset($flatFields[$attributeCode]) && + isset($definitions[$attribute['type']]) && + !in_array($attributeCode, $excludeAttributes['all']) && + (!isset($excludeAttributes[$entityCode]) || + !in_array($attributeCode, $excludeAttributes[$entityCode]))) { + + $installer->getConnection()->addColumn( + $installer->getTable($flatTablePrefix), + $attributeCode, $definitions[$attribute['type']] + ); + + + $flatFields[$attributeCode] = $definitions[$attribute['type']]; + } + + // Collect data for fast access on update + $attributesByTable[$entityTable . '_' . $attribute['type']][] = $attribute; + } + } + + // Create list of keys inserted from base entity table + $keys = array_keys(array_intersect_key($entityFields, $flatFields)); + + $fields = array_combine($keys, $keys); + + if ($entityTable !== $installer->getTable($flatTablePrefix)) { + $select->reset() + ->from(array('e' => $entityTable), $fields); + + $select->where('e.entity_type_id = ?', $entityTypeId); + + + $sql = $select->insertFromSelect($installer->getTable($flatTablePrefix), array_keys($fields), false) . "; \n"; + + // Update base record with eav attributes values + foreach ($attributesByTable as $table => $updateAttributes) { + $select->reset(); + $joinCount = 0; + foreach ($updateAttributes as $attribute) { + if (isset($entityFields[$attribute['code']]) || !isset($flatFields[$attribute['code']])) { + continue; + } + + $alias = '_table_' . $attribute['code']; + $select->joinLeft( + array($alias=>$table), + $alias . '.entity_id = e.entity_id AND ' . $alias . '.attribute_id = ' . $attribute['id'], + array($attribute['code'] => 'value') + ); + $joinCount ++; + + if ($joinCount > 60) { // If we have too much joins for mysql + $joinCount = 0; + $sql .= $select->crossUpdateFromSelect(array('e'=>$installer->getTable($flatTablePrefix))) . "; \n"; + $select->reset(); + } + } + + if ($joinCount > 0) { + $sql .= $select->crossUpdateFromSelect(array('e'=>$installer->getTable($flatTablePrefix))) . "; \n"; + } + } + + } else { + $sql = ''; + } + + if (!empty($flags['grid'])) { // Filling grid table with default base record + $gridFields = array_keys( + array_intersect_key( + $installer->getConnection()->describeTable( + $installer->getTable($flatTablePrefix . '_grid') + ), + $flatFields + ) + ); + + $select->reset(); + $select->from($installer->getTable($flatTablePrefix), $gridFields); + $sql .= $select->insertFromSelect($installer->getTable($flatTablePrefix . '_grid'), $gridFields, false); + } + + $installer->run($sql); +} + +// Insert virtual grid fields (shipping_name, billing_name, etc) + +// Order Grid +$select->reset(); +$select->join( + array('order' => $installer->getTable('sales_flat_order')), + 'order.entity_id = e.entity_id', + array() +); + +$select->joinLeft( + array('shipping_address' => $installer->getTable('sales_flat_order_address')), + 'order.shipping_address_id = shipping_address.entity_id', + array('shipping_name' => 'IF(shipping_address.entity_id IS NOT NULL, CONCAT(shipping_address.firstname, \' \', shipping_address.lastname), NULL)') +); + +$select->joinLeft( + array('billing_address' => $installer->getTable('sales_flat_order_address')), + 'order.billing_address_id = billing_address.entity_id', + array('billing_name' => 'IF(billing_address.entity_id IS NOT NULL, CONCAT(billing_address.firstname, \' \', billing_address.lastname), NULL)') +); + +$installer->run($select->crossUpdateFromSelect(array('e'=>$installer->getTable('sales_flat_order_grid')))); + +// Invoice and Creditmemo grid +$select->reset(); +$select->join( + array('order' => $installer->getTable('sales_flat_order')), + 'order.entity_id = e.order_id', + array('order_increment_id' => 'increment_id', 'order_created_at' => 'created_at') +); + +$select->joinLeft( + array('billing_address' => $installer->getTable('sales_flat_order_address')), + 'order.billing_address_id = billing_address.entity_id', + array('billing_name' => 'IF(billing_address.entity_id IS NOT NULL, CONCAT(billing_address.firstname, \' \', billing_address.lastname), NULL)') +); + +$installer->run($select->crossUpdateFromSelect(array('e'=>$installer->getTable('sales_flat_creditmemo_grid')))); +$installer->run($select->crossUpdateFromSelect(array('e'=>$installer->getTable('sales_flat_invoice_grid')))); + +// Shipment grid +$select->reset(); +$select->join( + array('order' => $installer->getTable('sales_flat_order')), + 'order.entity_id = e.order_id', + array('order_increment_id' => 'increment_id', 'order_created_at' => 'created_at') +); + +$select->joinLeft( + array('shipping_address' => $installer->getTable('sales_flat_order_address')), + 'order.shipping_address_id = shipping_address.entity_id', + array('shipping_name' => 'IF(shipping_address.entity_id IS NOT NULL, CONCAT(shipping_address.firstname, \' \', shipping_address.lastname), NULL)') +); + +$installer->run($select->crossUpdateFromSelect(array('e'=>$installer->getTable('sales_flat_shipment_grid')))); + +$constraints = array( + 'sales_flat_order' => array( + 'customer' => array('customer_id', 'customer_entity', 'entity_id', 'set null'), + 'store' => array('store_id', 'core_store', 'store_id', 'set null'), + ), + 'sales_flat_order_grid' => array( + 'parent' => array('entity_id', 'sales_flat_order', 'entity_id'), + 'customer' => array('customer_id', 'customer_entity', 'entity_id', 'set null'), + 'store' => array('store_id', 'core_store', 'store_id', 'set null'), + ), + 'sales_flat_order_item' => array( + 'parent' => array('order_id', 'sales_flat_order', 'entity_id'), + 'store' => array('store_id', 'core_store', 'store_id', 'set null') + ), + 'sales_flat_order_address' => array( + 'parent' => array('parent_id', 'sales_flat_order', 'entity_id'), + ), + 'sales_flat_order_payment' => array( + 'parent' => array('parent_id', 'sales_flat_order', 'entity_id'), + ), + 'sales_flat_order_status_history' => array( + 'parent' => array('parent_id', 'sales_flat_order', 'entity_id'), + ), + 'sales_flat_shipment' => array( + 'parent' => array('order_id', 'sales_flat_order', 'entity_id'), + 'store' => array('store_id', 'core_store', 'store_id', 'set null') + ), + 'sales_flat_shipment_grid' => array( + 'parent' => array('entity_id', 'sales_flat_shipment', 'entity_id'), + 'store' => array('store_id', 'core_store', 'store_id', 'set null') + ), + 'sales_flat_shipment_track' => array( + 'parent' => array('parent_id', 'sales_flat_shipment', 'entity_id'), + ), + 'sales_flat_shipment_item' => array( + 'parent' => array('parent_id', 'sales_flat_shipment', 'entity_id'), + ), + 'sales_flat_shipment_comment' => array( + 'parent' => array('parent_id', 'sales_flat_shipment', 'entity_id'), + ), + 'sales_flat_invoice' => array( + 'parent' => array('order_id', 'sales_flat_order', 'entity_id'), + 'store' => array('store_id', 'core_store', 'store_id', 'set null') + ), + 'sales_flat_invoice_grid' => array( + 'parent' => array('entity_id', 'sales_flat_invoice', 'entity_id'), + 'store' => array('store_id', 'core_store', 'store_id', 'set null') + ), + 'sales_flat_invoice_item' => array( + 'parent' => array('parent_id', 'sales_flat_invoice', 'entity_id'), + ), + 'sales_flat_invoice_comment' => array( + 'parent' => array('parent_id', 'sales_flat_invoice', 'entity_id'), + ), + 'sales_flat_creditmemo' => array( + 'parent' => array('order_id', 'sales_flat_order', 'entity_id'), + 'store' => array('store_id', 'core_store', 'store_id', 'set null') + ), + 'sales_flat_creditmemo_grid' => array( + 'parent' => array('entity_id', 'sales_flat_creditmemo', 'entity_id'), + 'store' => array('store_id', 'core_store', 'store_id', 'set null') + ), + 'sales_flat_creditmemo_item' => array( + 'parent' => array('parent_id', 'sales_flat_creditmemo', 'entity_id'), + ), + 'sales_flat_creditmemo_comment' => array( + 'parent' => array('parent_id', 'sales_flat_creditmemo', 'entity_id'), + ), + 'sales_payment_transaction' => array( + 'parent' => array('parent_id', 'sales_payment_transaction', 'transaction_id'), + 'order' => array('order_id', 'sales_flat_order', 'entity_id'), + 'payment' => array('payment_id', 'sales_flat_order_payment', 'entity_id'), + ) +); + +foreach ($constraints as $table => $list) { + foreach ($list as $code => $constraint) { + $constraint[1] = $installer->getTable($constraint[1]); + array_unshift($constraint, $installer->getTable($table)); + array_unshift($constraint, strtoupper($table . '_' . $code)); + + call_user_func_array(array($installer->getConnection(), 'addConstraint'), $constraint); + } +} + +/** + * Add additional columns for order aggregation table + */ +$table = $installer->getTable('sales_order_aggregated_created'); +$installer->run('TRUNCATE TABLE ' . $installer->getConnection()->quoteIdentifier($table)); +$installer->getConnection()->addColumn($table, 'base_tax_invoiced_amount', 'decimal(12,4) NOT NULL DEFAULT \'0.0000\''); +$installer->getConnection()->addColumn($table, 'base_tax_canceled_amount', 'decimal(12,4) NOT NULL DEFAULT \'0.0000\''); +$installer->getConnection()->addColumn($table, 'base_tax_refunded_amount', 'decimal(12,4) NOT NULL DEFAULT \'0.0000\''); + +$installer->getConnection()->addColumn($table, 'base_subtotal_invoiced_amount', 'decimal(12,4) NOT NULL DEFAULT \'0.0000\''); +$installer->getConnection()->addColumn($table, 'base_subtotal_refunded_amount', 'decimal(12,4) NOT NULL DEFAULT \'0.0000\''); +$installer->getConnection()->addColumn($table, 'base_subtotal_canceled_amount', 'decimal(12,4) NOT NULL DEFAULT \'0.0000\''); + +$installer->getConnection()->addColumn($table, 'base_discount_invoiced_amount', 'decimal(12,4) NOT NULL DEFAULT \'0.0000\''); +$installer->getConnection()->addColumn($table, 'base_discount_canceled_amount', 'decimal(12,4) NOT NULL DEFAULT \'0.0000\''); +$installer->getConnection()->addColumn($table, 'base_discount_refunded_amount', 'decimal(12,4) NOT NULL DEFAULT \'0.0000\''); + +$installer->getConnection()->addColumn($table, 'base_shipping_invoiced_amount', 'decimal(12,4) NOT NULL DEFAULT \'0.0000\''); +$installer->getConnection()->addColumn($table, 'base_shipping_canceled_amount', 'decimal(12,4) NOT NULL DEFAULT \'0.0000\''); +$installer->getConnection()->addColumn($table, 'base_shipping_refunded_amount', 'decimal(12,4) NOT NULL DEFAULT \'0.0000\''); +$installer->getConnection()->addColumn($table, 'base_shipping_discount_amount', 'decimal(12,4) NOT NULL DEFAULT \'0.0000\''); +$installer->getConnection()->addColumn($table, 'base_shipping_tax_amount', 'decimal(12,4) NOT NULL DEFAULT \'0.0000\''); +$installer->getConnection()->addColumn($table, 'base_shipping_tax_refunded_amount', 'decimal(12,4) NOT NULL DEFAULT \'0.0000\''); + +$flag = Mage::getModel('reports/flag') + ->setReportFlagCode(Mage_Reports_Model_Flag::REPORT_ORDER_FLAG_CODE) + ->loadSelf(); + +if($flag->getId()) { + $flag->delete(); +} + + +$select = $installer->getConnection()->select(); +$select->from($installer->getTable('sales/order_item'), array( + 'total_item_count' => 'COUNT(item_id)', + 'entity_id' => 'order_id')) + ->where('parent_item_id IS NULL') + ->group(array('order_id')); + +$temporaryTable = 'tmp_sales_order_item_count_' . md5(uniqid('order_item_count')); + +$installer->getConnection()->query('CREATE TEMPORARY TABLE ' . $installer->getConnection()->quoteIdentifier($temporaryTable) . ' ' . $select->assemble()); + +$select->reset() + ->join(array('items_count_table'=>$temporaryTable), 'items_count_table.entity_id = order_table.entity_id', array( + 'total_item_count'=>'total_item_count' + )); + +$installer->getConnection()->query($select->crossUpdateFromSelect(array('order_table' => $installer->getTable('sales/order')))); +$installer->getConnection()->query('DROP TEMPORARY TABLE ' . $temporaryTable); + + +// Remove previous tables +$tablesToDrop = array( + 'sales_order_entity_decimal', + 'sales_order_entity_datetime', + 'sales_order_entity_int', + 'sales_order_entity_text', + 'sales_order_entity_varchar', + 'sales_order_entity', + 'sales_order_decimal', + 'sales_order_datetime', + 'sales_order_int', + 'sales_order_text', + 'sales_order_varchar', + 'sales_order' +); + +foreach ($tablesToDrop as $table) { + $table = $installer->getTable($table); + if (!$installer->tableExists($table)) { + continue; + } + $installer->getConnection()->query( + 'DROP TABLE ' . $installer->getConnection()->quoteIdentifier($table) + ); +} + +$installer->endSetup(); diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php new file mode 100644 index 0000000000..c6d83e9243 --- /dev/null +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php @@ -0,0 +1,35 @@ +getConnection()->addColumn($installer->getTable('sales_flat_order_grid'), 'updated_at', 'datetime default NULL'); +$installer->getConnection()->addKey($installer->getTable('sales_flat_order_grid'), 'IDX_UPDATED_AT' ,'updated_at'); +$installer->run(" + UPDATE {$installer->getTable('sales_flat_order_grid')} AS g + JOIN {$installer->getTable('sales_flat_order')} AS o ON g.entity_id=o.entity_id + SET g.updated_at=o.updated_at +"); diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.1-1.4.0.2.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.1-1.4.0.2.php new file mode 100644 index 0000000000..b720b38e82 --- /dev/null +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.1-1.4.0.2.php @@ -0,0 +1,33 @@ +getConnection()->addKey($installer->getTable('sales_flat_order'), 'IDX_UPDATED_AT', 'updated_at'); + +$installer->getConnection()->addKey($installer->getTable('sales_flat_shipment'), 'IDX_CREATED_AT', 'created_at'); +$installer->getConnection()->addKey($installer->getTable('sales_flat_shipment'), 'IDX_UPDATED_AT', 'updated_at'); diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.2-1.4.0.3.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.2-1.4.0.3.php new file mode 100644 index 0000000000..7d174d9c5f --- /dev/null +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.2-1.4.0.3.php @@ -0,0 +1,70 @@ +getConnection()->addColumn($installer->getTable('sales/order'), 'hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/order'), 'base_hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/order'), 'shipping_hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/order'), 'base_shipping_hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/order'), 'hidden_tax_invoiced', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/order'), 'base_hidden_tax_invoiced', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/order'), 'hidden_tax_refunded', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/order'), 'base_hidden_tax_refunded', 'decimal(12,4) NULL'); + +$installer->getConnection()->addColumn($installer->getTable('sales/order_item'), 'hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/order_item'), 'base_hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/order_item'), 'hidden_tax_invoiced', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/order_item'), 'base_hidden_tax_invoiced', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/order_item'), 'hidden_tax_refunded', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/order_item'), 'base_hidden_tax_refunded', 'decimal(12,4) NULL'); + +$installer->getConnection()->addColumn($installer->getTable('sales/invoice'), 'hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/invoice'), 'base_hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/invoice'), 'shipping_hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/invoice'), 'base_shipping_hidden_tax_amount', 'decimal(12,4) NULL'); + +$installer->getConnection()->addColumn($installer->getTable('sales/invoice_item'), 'hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/invoice_item'), 'base_hidden_tax_amount', 'decimal(12,4) NULL'); + +$installer->getConnection()->addColumn($installer->getTable('sales/creditmemo'), 'hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/creditmemo'), 'base_hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/creditmemo'), 'shipping_hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/creditmemo'), 'base_shipping_hidden_tax_amount', 'decimal(12,4) NULL'); + +$installer->getConnection()->addColumn($installer->getTable('sales/creditmemo_item'), 'hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/creditmemo_item'), 'base_hidden_tax_amount', 'decimal(12,4) NULL'); + +$installer->getConnection()->addColumn($installer->getTable('sales/quote_address'), 'hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/quote_address'), 'base_hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/quote_address'), 'shipping_hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/quote_address'), 'base_shipping_hidden_tax_amount', 'decimal(12,4) NULL'); + +$installer->getConnection()->addColumn($installer->getTable('sales/quote_address_item'), 'hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/quote_address_item'), 'base_hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/quote_item'), 'hidden_tax_amount', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/quote_item'), 'base_hidden_tax_amount', 'decimal(12,4) NULL'); + diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.3-1.4.0.4.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.3-1.4.0.4.php new file mode 100644 index 0000000000..21d994331a --- /dev/null +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.3-1.4.0.4.php @@ -0,0 +1,69 @@ +getConnection()->addKey($installer->getTable('sales/order_item'), 'IDX_PRODUCT_ID', 'product_id'); + +foreach (array('daily', 'monthly', 'yearly') as $frequency) { + $tableName = $installer->getTable('sales/bestsellers_aggregated_' . $frequency); + + $installer->run(" + CREATE TABLE `{$tableName}` ( + `id` int(11) unsigned NOT NULL auto_increment, + `period` date NOT NULL DEFAULT '0000-00-00', + `store_id` smallint(5) unsigned NULL DEFAULT NULL, + `product_id` int(10) unsigned NULL DEFAULT NULL, + `product_name` varchar(255) NOT NULL DEFAULT '', + `product_price` decimal(12,4) NOT NULL DEFAULT '0', + `qty_ordered` decimal(12,4) NOT NULL DEFAULT '0.0000', + `rating_pos` smallint(5) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `UNQ_PERIOD_STORE_PRODUCT` (`period`, `store_id`, `product_id`), + KEY `IDX_STORE_ID` (`store_id`), + KEY `IDX_PRODUCT_ID` (`product_id`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + "); + + $installer->getConnection()->addConstraint( + 'PRODUCT_ORDERED_AGGREGATED_' . strtoupper($frequency) . '_STORE_ID', + $tableName, + 'store_id', + $installer->getTable('core/store'), + 'store_id', + 'SET NULL' + ); + + $installer->getConnection()->addConstraint( + 'PRODUCT_ORDERED_AGGREGATED_' . strtoupper($frequency) . '_PRODUCT_ID', + $tableName, + 'product_id', + $installer->getTable('catalog/product'), + 'entity_id', + 'SET NULL' + ); +} diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.4-1.4.0.5.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.4-1.4.0.5.php new file mode 100644 index 0000000000..15d06a5626 --- /dev/null +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.4-1.4.0.5.php @@ -0,0 +1,39 @@ +getConnection()->addColumn($installer->getTable('sales/order'), 'shipping_incl_tax', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/order'), 'base_shipping_incl_tax', 'decimal(12,4) NULL'); + +$installer->getConnection()->addColumn($installer->getTable('sales/invoice'), 'shipping_incl_tax', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/invoice'), 'base_shipping_incl_tax', 'decimal(12,4) NULL'); + +$installer->getConnection()->addColumn($installer->getTable('sales/creditmemo'), 'shipping_incl_tax', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/creditmemo'), 'base_shipping_incl_tax', 'decimal(12,4) NULL'); + +$installer->getConnection()->addColumn($installer->getTable('sales/quote_address'), 'shipping_incl_tax', 'decimal(12,4) NULL'); +$installer->getConnection()->addColumn($installer->getTable('sales/quote_address'), 'base_shipping_incl_tax', 'decimal(12,4) NULL'); diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.5-1.4.0.6.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.5-1.4.0.6.php new file mode 100644 index 0000000000..2214affa76 --- /dev/null +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.5-1.4.0.6.php @@ -0,0 +1,64 @@ +getConnection()->addColumn($installer->getTable('sales/shipping_aggregated_order'), + 'total_shipping_actual', "decimal(12,4) NOT NULL default '0.0000'"); + +$installer->getConnection()->addColumn($installer->getTable('sales/shipping_aggregated'), + 'total_shipping_actual', "decimal(12,4) NOT NULL default '0.0000'"); + +$installer->run(" +DROP TABLE `{$installer->getTable('sales/order_aggregated_created')}`; +CREATE TABLE `{$installer->getTable('sales/order_aggregated_created')}` ( + `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `period` DATE NOT NULL DEFAULT '0000-00-00', + `store_id` SMALLINT(5) UNSIGNED DEFAULT NULL, + `order_status` VARCHAR(50) NOT NULL DEFAULT '', + `orders_count` INT(11) NOT NULL DEFAULT '0', + `total_qty_ordered` DECIMAL(12,4) NOT NULL DEFAULT '0.0000', + `total_qty_invoiced` DECIMAL(12,4) NOT NULL DEFAULT '0.0000', + `total_income_amount` DECIMAL(12,4) NOT NULL DEFAULT '0.0000', + `total_revenue_amount` DECIMAL(12,4) NOT NULL DEFAULT '0.0000', + `total_profit_amount` DECIMAL(12,4) NOT NULL DEFAULT '0.0000', + `total_invoiced_amount` DECIMAL(12,4) NOT NULL DEFAULT '0.0000', + `total_canceled_amount` DECIMAL(12,4) NOT NULL DEFAULT '0.0000', + `total_paid_amount` DECIMAL(12,4) NOT NULL DEFAULT '0.0000', + `total_refunded_amount` DECIMAL(12,4) NOT NULL DEFAULT '0.0000', + `total_tax_amount` DECIMAL(12,4) NOT NULL DEFAULT '0.0000', + `total_tax_amount_actual` DECIMAL(12,4) NOT NULL DEFAULT '0.0000', + `total_shipping_amount` DECIMAL(12,4) NOT NULL DEFAULT '0.0000', + `total_shipping_amount_actual` DECIMAL(12,4) NOT NULL DEFAULT '0.0000', + `total_discount_amount` DECIMAL(12,4) NOT NULL DEFAULT '0.0000', + `total_discount_amount_actual` DECIMAL(12,4) NOT NULL DEFAULT '0.0000', + PRIMARY KEY (`id`), + UNIQUE KEY `UNQ_PERIOD_STORE_ORDER_STATUS` (`period`,`store_id`,`order_status`), + KEY `IDX_STORE_ID` (`store_id`), + CONSTRAINT `FK_SALES_ORDER_AGGREGATED_CREATED` FOREIGN KEY (`store_id`) REFERENCES `{$installer->getTable('core_store')}` (`store_id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=INNODB DEFAULT CHARSET=utf8; +"); diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.6-1.4.0.7.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.6-1.4.0.7.php new file mode 100644 index 0000000000..4c5dbb71d7 --- /dev/null +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.6-1.4.0.7.php @@ -0,0 +1,38 @@ +getTable('sales_flat_order_status_history'); +$installer->getConnection()->addColumn( + $orderHistoryTable, + 'is_visible_on_front', + "tinyint(1) UNSIGNED NOT NULL default '0' after `is_customer_notified`" +); +$installer->run("UPDATE {$orderHistoryTable} SET + is_visible_on_front = (is_customer_notified = 1 AND comment IS NOT NULL AND comment <> '');" +); diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.7-1.4.0.8.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.7-1.4.0.8.php new file mode 100644 index 0000000000..c6d432e421 --- /dev/null +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.7-1.4.0.8.php @@ -0,0 +1,38 @@ +getTable('sales/order'); + +$installer->run(" +UPDATE {$orderTable} SET + base_discount_canceled = (ABS(base_discount_amount) - IFNULL(base_discount_invoiced, 0)), + base_total_canceled = (base_subtotal_canceled + IFNULL(base_tax_canceled, 0) + IFNULL(base_shipping_canceled, 0) - IFNULL(ABS(base_discount_amount) - IFNULL(base_discount_invoiced, 0), 0)), + discount_canceled = (ABS(discount_amount) - IFNULL(discount_invoiced, 0)), + total_canceled = (subtotal_canceled + IFNULL(tax_canceled, 0) + IFNULL(shipping_canceled, 0) - IFNULL(ABS(discount_amount) - IFNULL(discount_invoiced, 0), 0)) +"); diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.8-1.4.0.15.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.8-1.4.0.15.php new file mode 100644 index 0000000000..cd982674f1 --- /dev/null +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.4.0.8-1.4.0.15.php @@ -0,0 +1,177 @@ +getTable('sales/order_grid'); +$orderTable = $installer->getTable('sales/order'); +$paymentTransactionTable = $installer->getTable('sales/payment_transaction'); +$profileTable = $installer->getTable('sales_recurring_profile'); +$orderItemTable = $installer->getTable('sales_flat_order_item'); +$flatOrderTable = $installer->getTable('sales_flat_order'); +$profileOrderTable = $installer->getTable('sales_recurring_profile_order'); +$customerEntityTable = $installer->getTable('customer_entity'); +$coreStoreTable = $installer->getTable('core_store'); +$billingAgreementTable = $installer->getTable('sales/billing_agreement'); +$billingAgreementOrderTable = $installer->getTable('sales/billing_agreement_order'); + +//------- +$installer->getConnection()->addColumn($orderGridTable, + 'store_name', 'varchar(255) null default null AFTER `store_id`'); + +$installer->run(" + UPDATE {$orderGridTable} AS og + INNER JOIN {$orderTable} AS o on (og.entity_id=o.entity_id) + SET + og.store_name = o.store_name +"); + +//------- +$installer->getConnection()->addColumn($paymentTransactionTable, + 'created_at', 'DATETIME NULL'); + +//------- +$this->getConnection()->addColumn($orderItemTable, 'is_nominal', 'int NOT NULL DEFAULT \'0\''); + +//------- +$installer->run(" + CREATE TABLE `{$billingAgreementTable}` ( + `agreement_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `customer_id` int(10) unsigned NOT NULL, + `method_code` varchar(32) NOT NULL, + `reference_id` varchar(32) NOT NULL, + `status` varchar(20) NOT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime DEFAULT NULL, + PRIMARY KEY (`agreement_id`), + KEY `IDX_CUSTOMER` (`customer_id`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$installer->getConnection()->addConstraint( + 'FK_BILLING_AGREEMENT_CUSTOMER', + $billingAgreementTable, + 'customer_id', + $installer->getTable('customer/entity'), + 'entity_id' + +); + +//------- +$installer->run(" + CREATE TABLE `{$billingAgreementOrderTable}` ( + `agreement_id` int(10) unsigned NOT NULL, + `order_id` int(10) unsigned NOT NULL, + UNIQUE KEY `UNQ_BILLING_AGREEMENT_ORDER` (`agreement_id`,`order_id`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$installer->getConnection()->addConstraint( + 'FK_BILLING_AGREEMENT_ORDER_AGREEMENT', + $billingAgreementOrderTable, + 'agreement_id', + $billingAgreementTable, + 'agreement_id' +); + +$installer->getConnection()->addConstraint( + 'FK_BILLING_AGREEMENT_ORDER_ORDER', + $billingAgreementOrderTable, + 'order_id', + $orderTable, + 'entity_id' +); + +//------- + +$this->run(" +CREATE TABLE `{$profileTable}` ( + `profile_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `state` varchar(20) NOT NULL, + `customer_id` int(10) unsigned DEFAULT NULL, + `store_id` smallint(5) unsigned DEFAULT NULL, + `method_code` varchar(32) NOT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime DEFAULT NULL, + `reference_id` varchar(32) DEFAULT NULL, + `subscriber_name` varchar(150) DEFAULT NULL, + `start_datetime` datetime NOT NULL, + `internal_reference_id` varchar(42) NOT NULL, + `schedule_description` varchar(255) NOT NULL, + `suspension_threshold` smallint(6) unsigned DEFAULT NULL, + `bill_failed_later` tinyint(1) unsigned NOT NULL DEFAULT '0', + `period_unit` varchar(20) NOT NULL, + `period_frequency` tinyint(3) unsigned DEFAULT NULL, + `period_max_cycles` tinyint(3) unsigned DEFAULT NULL, + `billing_amount` double(12,4) unsigned NOT NULL DEFAULT '0.0000', + `trial_period_unit` varchar(20) DEFAULT NULL, + `trial_period_frequency` tinyint(3) unsigned DEFAULT NULL, + `trial_period_max_cycles` tinyint(3) unsigned DEFAULT NULL, + `trial_billing_amount` double(12,4) unsigned DEFAULT NULL, + `currency_code` char(3) NOT NULL, + `shipping_amount` decimal(12,4) unsigned DEFAULT NULL, + `tax_amount` decimal(12,4) unsigned DEFAULT NULL, + `init_amount` decimal(12,4) unsigned DEFAULT NULL, + `init_may_fail` tinyint(1) unsigned NOT NULL DEFAULT '0', + `order_info` text NOT NULL, + `order_item_info` text NOT NULL, + `billing_address_info` text NOT NULL, + `shipping_address_info` text DEFAULT NULL, + `profile_vendor_info` text DEFAULT NULL, + `additional_info` text DEFAULT NULL, + PRIMARY KEY (`profile_id`), + UNIQUE KEY `UNQ_INTERNAL_REF_ID` (`internal_reference_id`), + KEY `IDX_RECURRING_PROFILE_CUSTOMER` (`customer_id`), + KEY `IDX_RECURRING_PROFILE_STORE` (`store_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + +$this->getConnection()->addConstraint('FK_RECURRING_PROFILE_CUSTOMER', $profileTable, 'customer_id', + $customerEntityTable, 'entity_id', 'SET NULL' +); + +$this->getConnection()->addConstraint('FK_RECURRING_PROFILE_STORE', $profileTable, 'store_id', + $coreStoreTable, 'store_id', 'SET NULL' +); + +$this->run(" +CREATE TABLE `{$profileOrderTable}` ( + `link_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `profile_id` int(10) unsigned NOT NULL DEFAULT '0', + `order_id` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`link_id`), + UNIQUE KEY `UNQ_PROFILE_ORDER` (`profile_id`,`order_id`), + KEY `IDX_ORDER` (`order_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$this->getConnection()->addConstraint('FK_RECURRING_PROFILE_ORDER_PROFILE', $profileOrderTable, 'profile_id', + $profileTable, 'profile_id' +); + +$this->getConnection()->addConstraint('FK_RECURRING_PROFILE_ORDER_ORDER', $profileOrderTable, 'order_id', + $flatOrderTable, 'entity_id' +); diff --git a/app/code/core/Mage/SalesRule/Exception.php b/app/code/core/Mage/SalesRule/Exception.php index 0a7ce3a6d4..9c122dd43f 100644 --- a/app/code/core/Mage/SalesRule/Exception.php +++ b/app/code/core/Mage/SalesRule/Exception.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/Helper/Data.php b/app/code/core/Mage/SalesRule/Helper/Data.php index a5d941ce66..fd43bfef7b 100644 --- a/app/code/core/Mage/SalesRule/Helper/Data.php +++ b/app/code/core/Mage/SalesRule/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/Model/Coupon.php b/app/code/core/Mage/SalesRule/Model/Coupon.php new file mode 100644 index 0000000000..004c07e8f4 --- /dev/null +++ b/app/code/core/Mage/SalesRule/Model/Coupon.php @@ -0,0 +1,78 @@ +_init('salesrule/coupon'); + } + + /** + * Processing object before save data + * + * @return Mage_Core_Model_Abstract + */ + protected function _beforeSave() + { + if (!$this->getRuleId() && $this->_rule instanceof Mage_SalesRule_Model_Rule) { + $this->setRuleId($this->_rule->getId()); + } + return parent::_beforeSave(); + } + + /** + * Set rule instance + * + * @param Mage_SalesRule_Model_Rule + * @return Mage_SalesRule_Model_Coupon + */ + public function setRule(Mage_SalesRule_Model_Rule $rule) + { + $this->_rule = $rule; + return $this; + } + + /** + * Load primary coupon for specified rule + * + * @param Mage_SalesRule_Model_Rule|int Rule + */ + public function loadPrimaryByRule($rule) + { + $this->getResource()->loadPrimaryByRule($this, $rule); + return $this; + } +} diff --git a/app/code/core/Mage/SalesRule/Model/Coupon/Codegenerator.php b/app/code/core/Mage/SalesRule/Model/Coupon/Codegenerator.php new file mode 100644 index 0000000000..acbcc2d934 --- /dev/null +++ b/app/code/core/Mage/SalesRule/Model/Coupon/Codegenerator.php @@ -0,0 +1,60 @@ +getAlphabet() ? $this->getAlphabet() : 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'); + $lengthMin = ($this->getLengthMin() ? $this->getLengthMin() : 16); + $lengthMax = ($this->getLengthMax() ? $this->getLengthMax() : 32); + $length = ($this->getLength() ? $this->getLength() : rand($lengthMin, $lengthMax)); + $result = ''; + $indexMax = strlen($alphabet) - 1; + for ($i = 0; $i < $length; $i++) { + $index = rand(0, $indexMax); + $result .= $alphabet{$index}; + } + return $result; + } + + /** + * Retrieve delimiter + * + * @return string + */ + public function getDelimiter() + { + return ($this->getData('delimiter') ? $this->getData('delimiter') : '-'); + } +} diff --git a/app/code/core/Mage/SalesRule/Model/Coupon/CodegeneratorInterface.php b/app/code/core/Mage/SalesRule/Model/Coupon/CodegeneratorInterface.php new file mode 100644 index 0000000000..5ae5b796dd --- /dev/null +++ b/app/code/core/Mage/SalesRule/Model/Coupon/CodegeneratorInterface.php @@ -0,0 +1,43 @@ +_init('salesrule/coupon', 'coupon_id'); + $this->addUniqueField(array( + 'field' => 'code', + 'title' => Mage::helper('salesRule')->__('Coupon with the same code') + )); + } + + /** + * Perform actions before object save + * + * @param Varien_Object $object + */ + public function _beforeSave(Mage_Core_Model_Abstract $object) + { + if (!$object->getExpirationDate()) { + $object->setExpirationDate(new Zend_Db_Expr('NULL')); + } else if ($object->getExpirationDate() instanceof Zend_Date) { + $object->setExpirationDate($object->getExpirationDate()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)); + } + + // maintain single primary coupon per rule + $object->setIsPrimary($object->getIsPrimary() ? 1 : null); + + return parent::_beforeSave($object); + } + + /** + * Load primary coupon (is_primary = 1) for specified rule + * + * @param Mage_SalesRule_Model_Coupon Coupon model + * @param Mage_SalesRule_Model_Rule|int Rule + */ + public function loadPrimaryByRule(Mage_SalesRule_Model_Coupon $object, $rule) + { + $read = $this->_getReadAdapter(); + + if ($rule instanceof Mage_SalesRule_Model_Rule) { + $ruleId = $rule->getId(); + } else { + $ruleId = (int)$rule; + } + + $select = $read->select()->from($this->getMainTable()) + ->where('rule_id=?', $ruleId) + ->where('is_primary=?', 1); + + $data = $read->fetchRow($select); + + if (!$data) { + return false; + } + + $object->setData($data); + + $this->_afterLoad($object); + return true; + } +} diff --git a/app/code/core/Mage/SalesRule/Model/Mysql4/Coupon/Collection.php b/app/code/core/Mage/SalesRule/Model/Mysql4/Coupon/Collection.php new file mode 100644 index 0000000000..57dd470d72 --- /dev/null +++ b/app/code/core/Mage/SalesRule/Model/Mysql4/Coupon/Collection.php @@ -0,0 +1,60 @@ +_init('salesrule/coupon'); + } + + /** + * Add rule to filter + * + * @param Mage_SalesRule_Model_Rule|int Rule + */ + public function addRuleToFilter($rule) + { + if ($rule instanceof Mage_SalesRule_Model_Rule) { + $ruleId = $rule->getId(); + } else { + $ruleId = (int)$rule; + } + $this->addFieldToFilter('rule_id', $ruleId); + } + + /** + * Add rule IDs to filter + * + * @param array Rule Ids + */ + public function addRuleIdsToFilter(array $ruleIds) + { + $this->addFieldToFilter('rule_id', array('in' => $ruleIds)); + } +} diff --git a/app/code/core/Mage/SalesRule/Model/Mysql4/Coupon/Usage.php b/app/code/core/Mage/SalesRule/Model/Mysql4/Coupon/Usage.php new file mode 100644 index 0000000000..335dead565 --- /dev/null +++ b/app/code/core/Mage/SalesRule/Model/Mysql4/Coupon/Usage.php @@ -0,0 +1,82 @@ +_init('salesrule/coupon_usage', ''); + } + + /** + * Increment times_used counter + * + * @param int Customer Id + * @param int Coupon Id + */ + public function updateCustomerCouponTimesUsed($customerId, $couponId) + { + $this->_getWriteAdapter()->insertOnDuplicate( + $this->getMainTable(), + array( + 'coupon_id' => $couponId, + 'customer_id' => $customerId, + 'times_used' => 1 + ), + array( + 'times_used' => new Zend_Db_Expr('times_used + 1') + ) + ); + } + + /** + * Load an object by customer_id & coupon_id + * + * @param Varien_Object Object to load data to + * @param int Customer Id + * @param int Coupon Id + * @return Mage_Core_Model_Mysql4_Abstract + */ + public function loadByCustomerCoupon(Varien_Object $object, $customerId, $couponId) + { + $read = $this->_getReadAdapter(); + if ($read && $couponId && $customerId) { + $select = $read->select() + ->from($this->getMainTable()) + ->where($this->getMainTable() . '.customer_id=?', $customerId) + ->where($this->getMainTable() . '.coupon_id=?', $couponId); + $data = $read->fetchRow($select); + if ($data) { + $object->setData($data); + } + } + if ($object instanceof Mage_Core_Model_Abstract) { + $this->_afterLoad($object); + } + return $this; + } +} diff --git a/app/code/core/Mage/SalesRule/Model/Mysql4/Report/Collection.php b/app/code/core/Mage/SalesRule/Model/Mysql4/Report/Collection.php index dd477d85ee..ce2980124b 100644 --- a/app/code/core/Mage/SalesRule/Model/Mysql4/Report/Collection.php +++ b/app/code/core/Mage/SalesRule/Model/Mysql4/Report/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -61,12 +61,15 @@ protected function _getSelectedColumns() if (!$this->isTotals() && !$this->isSubTotals()) { $this->_selectedColumns = array( - 'period' => $this->_periodFormat, + 'period' => $this->_periodFormat, 'coupon_code', - 'coupon_uses' => 'SUM(coupon_uses)', - 'subtotal_amount' => 'SUM(subtotal_amount)', - 'discount_amount' => 'SUM(discount_amount)', - 'total_amount' => 'SUM(total_amount)' + 'coupon_uses' => 'SUM(coupon_uses)', + 'subtotal_amount' => 'SUM(subtotal_amount)', + 'discount_amount' => 'SUM(discount_amount)', + 'total_amount' => 'SUM(total_amount)', + 'subtotal_amount_actual' => 'SUM(subtotal_amount_actual)', + 'discount_amount_actual' => 'SUM(discount_amount_actual)', + 'total_amount_actual' => 'SUM(total_amount_actual)', ); } @@ -89,17 +92,14 @@ protected function _getSelectedColumns() protected function _initSelect() { $this->getSelect()->from($this->getResource()->getMainTable() , $this->_getSelectedColumns()); - if (!$this->isTotals() && !$this->isSubTotals()) { + if ($this->isSubTotals()) { + $this->getSelect()->group($this->_periodFormat); + } else if (!$this->isTotals()) { $this->getSelect()->group(array( $this->_periodFormat, 'coupon_code' )); } - if ($this->isSubTotals()) { - $this->getSelect()->group(array( - $this->_periodFormat - )); - } return $this; } diff --git a/app/code/core/Mage/SalesRule/Model/Mysql4/Report/Rule.php b/app/code/core/Mage/SalesRule/Model/Mysql4/Report/Rule.php new file mode 100644 index 0000000000..f11ca1b77b --- /dev/null +++ b/app/code/core/Mage/SalesRule/Model/Mysql4/Report/Rule.php @@ -0,0 +1,154 @@ +_setResource('salesrule'); + } + + + /** + * Aggregate Coupons data + * + * @param mixed $from + * @param mixed $to + * @return Mage_SalesRule_Model_Mysql4_Report_Rule + */ + public function aggregate($from = null, $to = null) + { + // convert input dates to UTC to be comparable with DATETIME fields in DB + $from = $this->_dateToUtc($from); + $to = $this->_dateToUtc($to); + + $this->_checkDates($from, $to); + $this->_aggregateByOrderCreatedAt($from, $to); + $this->_setFlagData(Mage_Reports_Model_Flag::REPORT_COUPONS_FLAG_CODE); + return $this; + } + + /** + * Aggregate coupons reports by order created at as range + * + * @param mixed $from + * @param mixed $to + * @return Mage_SalesRule_Model_Mysql4_Report_Rule + */ + protected function _aggregateByOrderCreatedAt($from, $to) + { + $table = $this->getTable('salesrule/coupon_aggregated'); + $sourceTable = $this->getTable('sales/order'); + $this->_getWriteAdapter()->beginTransaction(); + + try { + if ($from !== null || $to !== null) { + $subSelect = $this->_getTableDateRangeSelect($sourceTable, 'created_at', 'updated_at', $from, $to); + } else { + $subSelect = null; + } + + $this->_clearTableByDateRange($table, $from, $to, $subSelect); + + $columns = array( + // convert dates from UTC to current admin timezone + 'period' => "DATE(CONVERT_TZ(created_at, '+00:00', '" . $this->_getStoreTimezoneUtcOffset() . "'))", + 'store_id' => 'store_id', + 'order_status' => 'status', + 'coupon_code' => 'coupon_code', + 'coupon_uses' => 'COUNT(`entity_id`)', + 'subtotal_amount' => 'SUM((`base_subtotal` - IFNULL(`base_subtotal_canceled`, 0)) * `base_to_global_rate`)', + 'discount_amount' => 'SUM((`base_discount_amount` - IFNULL(`base_discount_canceled`, 0)) * `base_to_global_rate`)', + 'total_amount' => 'SUM((`base_subtotal` - IFNULL(`base_subtotal_canceled`, 0) - IFNULL(`base_discount_amount` - IFNULL(`base_discount_canceled`, 0), 0)) * `base_to_global_rate`)', + 'subtotal_amount_actual' => 'SUM((`base_subtotal_invoiced` - IFNULL(`base_subtotal_refunded`, 0)) * `base_to_global_rate`)', + 'discount_amount_actual' => 'SUM((`base_discount_invoiced` - IFNULL(`base_discount_refunded`, 0)) * `base_to_global_rate`)', + 'total_amount_actual' => 'SUM((`base_subtotal_invoiced` - IFNULL(`base_subtotal_refunded`, 0) - IFNULL(`base_discount_invoiced` - IFNULL(`base_discount_refunded`, 0), 0)) * `base_to_global_rate`)', + ); + + $select = $this->_getWriteAdapter()->select(); + $select->from($sourceTable, $columns) + ->where('coupon_code <> ?', ''); + + if ($subSelect !== null) { + $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'created_at')); + } + + $select->group(array( + 'period', + 'store_id', + 'order_status', + 'coupon_code' + )); + + $select->having('coupon_uses > 0'); + + $this->_getWriteAdapter()->query($select->insertFromSelect($table, array_keys($columns))); + + $select->reset(); + + $columns = array( + 'period' => 'period', + 'store_id' => new Zend_Db_Expr('0'), + 'order_status' => 'order_status', + 'coupon_code' => 'coupon_code', + 'coupon_uses' => 'SUM(`coupon_uses`)', + 'subtotal_amount' => 'SUM(`subtotal_amount`)', + 'discount_amount' => 'SUM(`discount_amount`)', + 'total_amount' => 'SUM(`total_amount`)', + 'subtotal_amount_actual' => 'SUM(`subtotal_amount_actual`)', + 'discount_amount_actual' => 'SUM(`discount_amount_actual`)', + 'total_amount_actual' => 'SUM(`total_amount_actual`)', + ); + + $select + ->from($table, $columns) + ->where('store_id <> 0'); + + if ($subSelect !== null) { + $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'period')); + } + + $select->group(array( + 'period', + 'order_status', + 'coupon_code' + )); + + $this->_getWriteAdapter()->query($select->insertFromSelect($table, array_keys($columns))); + } catch (Exception $e) { + $this->_getWriteAdapter()->rollBack(); + throw $e; + } + + $this->_getWriteAdapter()->commit(); + return $this; + } +} diff --git a/app/code/core/Mage/SalesRule/Model/Mysql4/Report/Updatedat/Collection.php b/app/code/core/Mage/SalesRule/Model/Mysql4/Report/Updatedat/Collection.php index 8afc4b2e0f..30cbbcc750 100644 --- a/app/code/core/Mage/SalesRule/Model/Mysql4/Report/Updatedat/Collection.php +++ b/app/code/core/Mage/SalesRule/Model/Mysql4/Report/Updatedat/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -31,12 +31,63 @@ * @package Mage_SalesRule * @author Magento Core Team */ -class Mage_SalesRule_Model_Mysql4_Report_Updatedat_Collection extends Mage_SalesRule_Model_Mysql4_Report_Collection +class Mage_SalesRule_Model_Mysql4_Report_Updatedat_Collection extends Mage_Sales_Model_Mysql4_Report_Order_Updatedat_Collection { - public function __construct() + protected $_selectedColumns = array( + 'store_id' => 'e.store_id', + 'order_status' => 'e.status', + 'coupon_code' => 'e.coupon_code', + 'coupon_uses' => 'COUNT(e.`entity_id`)', + 'subtotal_amount' => 'SUM((e.`base_subtotal` - IFNULL(e.`base_subtotal_canceled`, 0)) * e.`base_to_global_rate`)', + 'discount_amount' => 'SUM((e.`base_discount_amount` - IFNULL(e.`base_discount_canceled`, 0)) * e.`base_to_global_rate`)', + 'total_amount' => 'SUM((e.`base_subtotal` - IFNULL(e.`base_subtotal_canceled`, 0) - IFNULL(e.`base_discount_amount` - IFNULL(e.`base_discount_canceled`, 0), 0)) * e.`base_to_global_rate`)', + 'subtotal_amount_actual' => 'SUM((e.`base_subtotal_invoiced` - IFNULL(e.`base_subtotal_refunded`, 0)) * e.`base_to_global_rate`)', + 'discount_amount_actual' => 'SUM((e.`base_discount_invoiced` - IFNULL(e.`base_discount_refunded`, 0)) * e.`base_to_global_rate`)', + 'total_amount_actual' => 'SUM((e.`base_subtotal_invoiced` - IFNULL(e.`base_subtotal_refunded`, 0) - IFNULL(e.`base_discount_invoiced` - IFNULL(e.`base_discount_refunded`, 0), 0)) * e.`base_to_global_rate`)', + ); + + /** + * Add selected data + * + * @return Mage_SalesRule_Model_Mysql4_Report_Updatedat_Collection + */ + protected function _initSelect() { - $this->setModel('adminhtml/report_item'); - $this->_resource = Mage::getResourceModel('sales/report')->init('salesrule/coupon_aggregated_order'); - $this->setConnection($this->getResource()->getReadConnection()); + if ($this->_inited) { + return $this; + } + + $columns = $this->_getSelectedColumns(); + if ($this->isTotals() || $this->isSubTotals()) { + unset($columns['coupon_code']); + } + + $this->getSelect() + ->from(array('e' => $this->getResource()->getMainTable()), $columns) + ->where('e.coupon_code <> ?', ''); + + $this->_applyStoresFilter(); + $this->_applyOrderStatusFilter(); + + if ($this->_to !== null) { + $this->getSelect()->where('DATE(e.updated_at) <= DATE(?)', $this->_to); + } + if ($this->_from !== null) { + $this->getSelect()->where('DATE(e.updated_at) >= DATE(?)', $this->_from); + } + + if ($this->isSubTotals()) { + $this->getSelect()->group($this->_periodFormat); + } else if (!$this->isTotals()) { + $this->getSelect()->group(array( + $this->_periodFormat, + 'coupon_code' + )); + } + + $this->getSelect()->having('coupon_uses > 0'); + + $this->_inited = true; + return $this; } } diff --git a/app/code/core/Mage/SalesRule/Model/Mysql4/Rule.php b/app/code/core/Mage/SalesRule/Model/Mysql4/Rule.php index dccaaa0ebb..cf2e0bcc59 100644 --- a/app/code/core/Mage/SalesRule/Model/Mysql4/Rule.php +++ b/app/code/core/Mage/SalesRule/Model/Mysql4/Rule.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -127,221 +127,4 @@ public function getStoreLabel($ruleId, $storeId) ->order('store_id DESC'); return $this->_getReadAdapter()->fetchOne($select); } - - /** - * Aggregate Coupons data - * - * @param mixed $from - * @param mixed $to - * @return Mage_SalesRule_Model_Mysql4_Rule - */ - public function aggregate($from = null, $to = null) - { - if (!is_null($from)) { - $from = $this->formatDate($from); - } - if (!is_null($to)) { - $from = $this->formatDate($to); - } - - $this->_aggregateByOrderCreatedAt($from, $to); - $this->_aggregateByOrderUpdatedAt($from, $to); - - $reportsFlagModel = Mage::getModel('reports/flag'); - $reportsFlagModel->setReportFlagCode(Mage_Reports_Model_Flag::REPORT_COUPNS_FLAG_CODE); - $reportsFlagModel->loadSelf(); - $reportsFlagModel->save(); - - return $this; - } - - protected function _aggregateByOrderCreatedAt($from, $to) - { - try { - $tableName = $this->getTable('salesrule/coupon_aggregated'); - $writeAdapter = $this->_getWriteAdapter(); - - $writeAdapter->beginTransaction(); - - if (is_null($from) && is_null($to)) { - $writeAdapter->query("TRUNCATE TABLE {$tableName}"); - } else { - $where = (!is_null($from)) ? "so.updated_at >= '{$from}'" : ''; - if (!is_null($to)) { - $where .= (!empty($where)) ? " AND so.updated_at <= '{$to}'" : "so.updated_at <= '{$to}'"; - } - - $subQuery = $writeAdapter->select(); - $subQuery->from(array('so' => $this->getTable('sales/order')), array('DISTINCT DATE(so.created_at)')) - ->where($where); - - $deleteCondition = 'DATE(period) IN (' . new Zend_Db_Expr($subQuery) . ')'; - $writeAdapter->delete($tableName, $deleteCondition); - } - - $columns = array( - 'period' => "DATE(created_at)", - 'store_id' => 'store_id', - 'order_status' => 'status', - 'coupon_code' => 'coupon_code', - 'coupon_uses' => 'COUNT(`entity_id`)', - 'subtotal_amount' => 'SUM(`base_subtotal` * `base_to_global_rate`)', - 'discount_amount' => 'SUM(`base_discount_amount` * `base_to_global_rate`)', - 'total_amount' => 'SUM((`base_subtotal` - `base_discount_amount`) * `base_to_global_rate`)' - ); - - $select = $writeAdapter->select()->from($this->getTable('sales/order'), $columns); - - if (!is_null($from) || !is_null($to)) { - $select->where("DATE(created_at) IN(?)", new Zend_Db_Expr($subQuery)); - } - - $select->where("coupon_code <> ''"); - - $select->group(array( - "DATE(created_at)", - 'store_id', - 'status', - 'coupon_code' - )); - - $select->having('coupon_uses > 0'); - - $writeAdapter->query(" - INSERT INTO `{$tableName}` (" . implode(',', array_keys($columns)) . ") {$select} - "); - - $select = $writeAdapter->select(); - - $columns = array( - 'period' => 'period', - 'store_id' => new Zend_Db_Expr('0'), - 'order_status' => 'order_status', - 'coupon_code' => 'coupon_code', - 'coupon_uses' => 'SUM(`coupon_uses`)', - 'subtotal_amount' => 'SUM(`subtotal_amount`)', - 'discount_amount' => 'SUM(`discount_amount`)', - 'total_amount' => 'SUM(`total_amount`)' - ); - - $select - ->from($tableName, $columns) - ->where("store_id <> 0"); - - if (!is_null($from) || !is_null($to)) { - $select->where("DATE(period) IN(?)", new Zend_Db_Expr($subQuery)); - } - - $select->group(array( - 'period', - 'order_status', - 'coupon_code' - )); - - $writeAdapter->query(" - INSERT INTO `{$tableName}` (" . implode(',', array_keys($columns)) . ") {$select} - "); - } catch (Exception $e) { - $writeAdapter->rollBack(); - throw $e; - } - - $writeAdapter->commit(); - return $this; - } - - protected function _aggregateByOrderUpdatedAt($from, $to) - { - try { - $tableName = $this->getTable('salesrule/coupon_aggregated_order'); - $writeAdapter = $this->_getWriteAdapter(); - - $writeAdapter->beginTransaction(); - - if (is_null($from) && is_null($to)) { - $writeAdapter->query("TRUNCATE TABLE {$tableName}"); - } else { - $where = (!is_null($from)) ? "so.updated_at >= '{$from}'" : ''; - if (!is_null($to)) { - $where .= (!empty($where)) ? " AND so.updated_at <= '{$to}'" : "so.updated_at <= '{$to}'"; - } - - $subQuery = $writeAdapter->select(); - $subQuery->from(array('so' => $this->getTable('sales/order')), array('DISTINCT DATE(so.created_at)')) - ->where($where); - - $deleteCondition = 'DATE(period) IN (' . new Zend_Db_Expr($subQuery) . ')'; - $writeAdapter->delete($tableName, $deleteCondition); - } - - $columns = array( - 'period' => "DATE(updated_at)", - 'store_id' => 'store_id', - 'order_status' => 'status', - 'coupon_code' => 'coupon_code', - 'coupon_uses' => 'COUNT(`entity_id`)', - 'subtotal_amount' => 'SUM(`base_subtotal` * `base_to_global_rate`)', - 'discount_amount' => 'SUM(`base_discount_amount` * `base_to_global_rate`)', - 'total_amount' => 'SUM((`base_subtotal` - `base_discount_amount`) * `base_to_global_rate`)' - ); - - $select = $writeAdapter->select()->from($this->getTable('sales/order'), $columns); - - if (!is_null($from) || !is_null($to)) { - $select->where("DATE(updated_at) IN(?)", new Zend_Db_Expr($subQuery)); - } - - $select->where("coupon_code <> ''"); - - $select->group(array( - "DATE(updated_at)", - 'store_id', - 'status', - 'coupon_code' - )); - - $select->having('coupon_uses > 0'); - - $writeAdapter->query(" - INSERT INTO `{$tableName}` (" . implode(',', array_keys($columns)) . ") {$select} - "); - - $select = $writeAdapter->select(); - - $columns = array( - 'period' => 'period', - 'store_id' => new Zend_Db_Expr('0'), - 'order_status' => 'order_status', - 'coupon_code' => 'coupon_code', - 'coupon_uses' => 'SUM(`coupon_uses`)', - 'subtotal_amount' => 'SUM(`subtotal_amount`)', - 'discount_amount' => 'SUM(`discount_amount`)', - 'total_amount' => 'SUM(`total_amount`)' - ); - - $select - ->from($tableName, $columns) - ->where("store_id <> 0"); - - if (!is_null($from) || !is_null($to)) { - $select->where("DATE(period) IN(?)", new Zend_Db_Expr($subQuery)); - } - - $select->group(array( - 'period', - 'order_status', - 'coupon_code' - )); - - $writeAdapter->query(" - INSERT INTO `{$tableName}` (" . implode(',', array_keys($columns)) . ") {$select} - "); - } catch (Exception $e) { - $writeAdapter->rollBack(); - throw $e; - } - - $writeAdapter->commit(); - return $this; - } } diff --git a/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Collection.php b/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Collection.php index 816cbb94d7..87fa51b90d 100644 --- a/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Collection.php +++ b/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,7 +29,6 @@ class Mage_SalesRule_Model_Mysql4_Rule_Collection extends Mage_Core_Model_Mysql4 { protected function _construct() { - parent::_construct(); $this->_init('salesrule/rule'); } @@ -39,15 +38,27 @@ public function setValidationFilter($websiteId, $customerGroupId, $couponCode='' $now = Mage::getModel('core/date')->date('Y-m-d'); } - $this->addBindParam('coupon_code', $couponCode); $this->getSelect()->where('is_active=1'); $this->getSelect()->where('find_in_set(?, website_ids)', (int)$websiteId); $this->getSelect()->where('find_in_set(?, customer_group_ids)', (int)$customerGroupId); - if (empty($couponCode)) { - $this->getSelect()->where("coupon_code is null or coupon_code=''"); - } - else { - $this->getSelect()->where("coupon_code is null or coupon_code='' or coupon_code=:coupon_code"); + + if ($couponCode) { + $this->getSelect()->joinLeft( + array('extra_coupon' => $this->getTable('salesrule/coupon')), + 'extra_coupon.rule_id = main_table.rule_id AND extra_coupon.is_primary IS NULL', + array() + ); + $this->getSelect()->group('main_table.rule_id'); + $this->getSelect()->where('' + . $this->getSelect()->getAdapter()->quoteInto(' main_table.coupon_type <> ?', Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC) + . $this->getSelect()->getAdapter()->quoteInto(' OR primary_coupon.code = ?', $couponCode) + ); + $this->getSelect()->having('' + . $this->getSelect()->getAdapter()->quoteInto(' main_table.coupon_type <> ?', Mage_SalesRule_Model_Rule::COUPON_TYPE_AUTO) + . $this->getSelect()->getAdapter()->quoteInto(' OR FIND_IN_SET(?, GROUP_CONCAT(extra_coupon.code))', $couponCode) + ); + } else { + $this->getSelect()->where('main_table.coupon_type = ?', Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON); } $this->getSelect()->where('from_date is null or from_date<=?', $now); $this->getSelect()->where('to_date is null or to_date>=?', $now); @@ -76,4 +87,21 @@ public function addWebsiteFilter($websiteIds) } return $this; } + + /** + * Init collection select + * + * @return unknown + */ + public function _initSelect() + { + parent::_initSelect(); + $this->getSelect() + ->joinLeft( + array('primary_coupon' => $this->getTable('salesrule/coupon')), + 'main_table.rule_id = primary_coupon.rule_id AND primary_coupon.is_primary = 1', + array('code') + ); + return $this; + } } diff --git a/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Customer.php b/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Customer.php index 3c2d3b3e6b..a433fb9e60 100644 --- a/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Customer.php +++ b/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Customer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Customer/Collection.php b/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Customer/Collection.php index beb70171b0..fc1b4e3653 100644 --- a/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Customer/Collection.php +++ b/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Customer/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Product.php b/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Product.php index 1b0a720dc3..a12ad83832 100644 --- a/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Product.php +++ b/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Product/Collection.php b/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Product/Collection.php index c5a555ea9a..809587a613 100644 --- a/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Product/Collection.php +++ b/app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Product/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/Model/Observer.php b/app/code/core/Mage/SalesRule/Model/Observer.php index 3fde1ad95c..668e286a10 100644 --- a/app/code/core/Mage/SalesRule/Model/Observer.php +++ b/app/code/core/Mage/SalesRule/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -100,6 +100,18 @@ public function sales_order_afterPlace($observer) } } } + + $coupon = Mage::getModel('salesrule/coupon'); + /** @var Mage_SalesRule_Model_Coupon */ + $coupon->load($order->getCouponCode(), 'code'); + if ($coupon->getId()) { + $coupon->setTimesUsed($coupon->getTimesUsed() + 1); + $coupon->save(); + if ($customerId) { + $couponUsage = Mage::getResourceModel('salesrule/coupon_usage'); + $couponUsage->updateCustomerCouponTimesUsed($customerId, $coupon->getId()); + } + } } /** @@ -113,7 +125,7 @@ public function aggregateSalesReportCouponsData($schedule) Mage::app()->getLocale()->emulate(0); $currentDate = Mage::app()->getLocale()->date(); $date = $currentDate->subHour(25); - Mage::getResourceModel('salesrule/rule')->aggregate($date); + Mage::getResourceModel('salesrule/report_rule')->aggregate($date); Mage::app()->getLocale()->revert(); return $this; } diff --git a/app/code/core/Mage/SalesRule/Model/Quote/Discount.php b/app/code/core/Mage/SalesRule/Model/Quote/Discount.php index de74df6589..5ae2ac42b2 100644 --- a/app/code/core/Mage/SalesRule/Model/Quote/Discount.php +++ b/app/code/core/Mage/SalesRule/Model/Quote/Discount.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -52,7 +52,7 @@ public function collect(Mage_Sales_Model_Quote_Address $address) $quote = $address->getQuote(); $store = Mage::app()->getStore($quote->getStoreId()); - $items = $address->getAllItems(); + $items = $this->_getAddressItems($address); if (!count($items)) { return $this; } diff --git a/app/code/core/Mage/SalesRule/Model/Quote/Freeshipping.php b/app/code/core/Mage/SalesRule/Model/Quote/Freeshipping.php index 2f931a6444..f934e0a7a6 100644 --- a/app/code/core/Mage/SalesRule/Model/Quote/Freeshipping.php +++ b/app/code/core/Mage/SalesRule/Model/Quote/Freeshipping.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -53,8 +53,7 @@ public function collect(Mage_Sales_Model_Quote_Address $address) $store = Mage::app()->getStore($quote->getStoreId()); $address->setFreeShipping(0); - $items = $address->getAllItems(); - + $items = $this->_getAddressItems($address); if (!count($items)) { return $this; } diff --git a/app/code/core/Mage/SalesRule/Model/Quote/Nominal/Discount.php b/app/code/core/Mage/SalesRule/Model/Quote/Nominal/Discount.php new file mode 100644 index 0000000000..ecbca23052 --- /dev/null +++ b/app/code/core/Mage/SalesRule/Model/Quote/Nominal/Discount.php @@ -0,0 +1,60 @@ +getAllNominalItems(); + } +} diff --git a/app/code/core/Mage/SalesRule/Model/Rule.php b/app/code/core/Mage/SalesRule/Model/Rule.php index d2c63637a4..dbd4ed570c 100644 --- a/app/code/core/Mage/SalesRule/Model/Rule.php +++ b/app/code/core/Mage/SalesRule/Model/Rule.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -30,6 +30,15 @@ class Mage_SalesRule_Model_Rule extends Mage_Rule_Model_Rule const FREE_SHIPPING_ITEM = 1; const FREE_SHIPPING_ADDRESS = 2; + const COUPON_TYPE_NO_COUPON = 1; + const COUPON_TYPE_SPECIFIC = 2; + const COUPON_TYPE_AUTO = 3; + + /** + * @var Mage_SalesRule_Model_Coupon_CodegeneratorInterface + */ + protected static $_couponCodeGenerator; + /** * Prefix of model events names * @@ -48,6 +57,27 @@ class Mage_SalesRule_Model_Rule extends Mage_Rule_Model_Rule protected $_labels = array(); + /** + * Rule's primary coupon + * + * @var Mage_SalesRule_Model_Coupon + */ + protected $_primaryCoupon; + + /** + * Rule's subordinate coupons + * + * @var array of Mage_SalesRule_Model_Coupon + */ + protected $_coupons; + + /** + * Coupon types cache for lazy getter + * + * @var array + */ + protected $_couponTypes; + protected function _construct() { parent::_construct(); @@ -56,37 +86,53 @@ protected function _construct() } /** - * Check unique coupon code before saving and clear coupon related cache + * Set code generator instance for auto generated coupons * - * @return Mage_SalesRule_Model_Rule + * @return Mage_SalesRule_Model_Coupon_CodegeneratorInterface */ - protected function _beforeSave() + public static function getCouponCodeGenerator() { - $coupon = $this->getCouponCode(); - if($coupon) { - $this->getResource()->addUniqueField(array( - 'field' => 'coupon_code', - 'title' => Mage::helper('salesRule')->__('Coupon with the same code') - )); - Mage::app()->cleanCache('salesrule_coupon_'.md5($coupon)); - } else { - $this->getResource()->resetUniqueField(); + if (!self::$_couponCodeGenerator) { + return Mage::getSingleton('salesrule/coupon_codegenerator', array('length' => 16)); } - return parent::_beforeSave(); + return self::$_couponCodeGenerator; } /** - * Delete rule coupon code related cache + * Set code generator instance for auto generated coupons * - * @return Mage_SalesRule_Model_Rule + * @param Mage_SalesRule_Model_Coupon_CodegeneratorInterface */ - protected function _beforeDelete() + public static function setCouponCodeGenerator(Mage_SalesRule_Model_Coupon_CodegeneratorInterface $codeGenerator) { - $coupon = $this->getCouponCode(); - if ($coupon) { - Mage::app()->cleanCache('salesrule_coupon_'.$coupon); + self::$_couponCodeGenerator = $codeGenerator; + } + + /** + * Retrieve rule's primary coupon + * + * @return Mage_SalesRule_Model_Coupon + */ + public function getPrimaryCoupon() + { + if ($this->_primaryCoupon === null) { + $this->_primaryCoupon = Mage::getModel('salesrule/coupon'); + $this->_primaryCoupon->loadPrimaryByRule($this->getId()); + $this->_primaryCoupon->setRule($this)->setIsPrimary(true); } - return parent::_beforeDelete(); + return $this->_primaryCoupon; + } + + /** + * Processing object after load data + * + * @return Mage_Core_Model_Abstract + */ + protected function _afterLoad() + { + $this->setCouponCode($this->getPrimaryCoupon()->getCode()); + $this->setUsesPerCoupon($this->getPrimaryCoupon()->getUsageLimit()); + return parent::_afterLoad(); } public function getConditionsInstance() @@ -160,7 +206,7 @@ public function getResourceCollection() } /** - * Save rula labels after rule save + * Save rule labels after rule save * * @return Mage_SalesRule_Model_Rule */ @@ -169,6 +215,17 @@ protected function _afterSave() if ($this->hasStoreLabels()) { $this->_getResource()->saveStoreLabels($this->getId(), $this->getStoreLabels()); } + $couponCode = trim($this->getCouponCode()); + if ($couponCode && $this->getCouponType() == self::COUPON_TYPE_SPECIFIC) { + $this->getPrimaryCoupon() + ->setCode($couponCode) + ->setUsageLimit($this->getUsesPerCoupon() ? $this->getUsesPerCoupon() : null) + ->setUsagePerCustomer($this->getUsesPerCustomer() ? $this->getUsesPerCustomer() : null) + ->setExpirationDate($this->getToDate()) + ->save(); + } else { + $this->getPrimaryCoupon()->delete(); + } return parent::_afterSave(); } @@ -208,4 +265,91 @@ public function getStoreLabels() } return $this->_getData('store_labels'); } + + /** + * Retrieve subordinate coupons + * + * @return array of Mage_SalesRule_Model_Coupon + */ + public function getCoupons() + { + if ($this->_coupons === null) { + $collection = Mage::getResourceModel('salesrule/coupon_collection'); + /** @var Mage_SalesRule_Model_Mysql4_Coupon_Collection */ + $collection->addRuleToFilter($this); + $this->_coupons = $collection->getItems(); + } + return $this->_coupons; + } + + /** + * Retrieve coupon types + * + * @return array + */ + public function getCouponTypes() + { + if ($this->_couponTypes === null) { + $this->_couponTypes = array( + Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON => Mage::helper('salesrule')->__('No Coupon'), + Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC => Mage::helper('salesrule')->__('Specific Coupon'), + ); + $transport = new Varien_Object(array('coupon_types' => $this->_couponTypes, 'is_coupon_type_auto_visible' => false)); + Mage::dispatchEvent('salesrule_rule_get_coupon_types', array('transport' => $transport)); + $this->_couponTypes = $transport->getCouponTypes(); + if ($transport->getIsCouponTypeAutoVisible()) { + $this->_couponTypes[Mage_SalesRule_Model_Rule::COUPON_TYPE_AUTO] = Mage::helper('salesrule')->__('Auto'); + } + } + return $this->_couponTypes; + } + + /** + * Acquire coupon instance + * + * @param bool Whether or not to save newly created coupon + * @param int Number of attempts to save newly created coupon + * @return Mage_SalesRule_Model_Coupon|null + */ + public function acquireCoupon($saveNewlyCreated = true, $saveAttemptCount = 10) + { + if ($this->getCouponType() == self::COUPON_TYPE_NO_COUPON) { + return null; + } + if ($this->getCouponType() == self::COUPON_TYPE_SPECIFIC) { + return $this->getPrimaryCoupon(); + } + /** @var Mage_SalesRule_Model_Coupon $coupon */ + $coupon = Mage::getModel('salesrule/coupon'); + $coupon->setRule($this)->setIsPrimary(false); + $coupon->setUsageLimit($this->getUsesPerCoupon() ? $this->getUsesPerCoupon() : null) + ->setUsagePerCustomer($this->getUsesPerCustomer() ? $this->getUsesPerCustomer() : null) + ->setExpirationDate($this->getToDate()); + + $couponCode = self::getCouponCodeGenerator()->generateCode(); + $coupon->setCode($couponCode); + $ok = false; + if (!$saveNewlyCreated) { + $ok = true; + } else if ($this->getId()) { + for ($attemptNum = 0; $attemptNum < $saveAttemptCount; $attemptNum++) { + try { + $coupon->save(); + } catch (Exception $e) { + if ($e instanceof Mage_Core_Exception || $coupon->getId()) { + throw $e; + } + $coupon->setCode($couponCode . self::getCouponCodeGenerator()->getDelimiter() . sprintf('%04u', rand(0, 9999))); + continue; + } + $ok = true; + break; + } + } + if (!$ok) { + Mage::throwException(Mage::helper('salesrule')->__('Can\'t acquire coupon.')); + } + + return $coupon; + } } diff --git a/app/code/core/Mage/SalesRule/Model/Rule/Action/Collection.php b/app/code/core/Mage/SalesRule/Model/Rule/Action/Collection.php index be69ca9ffb..7eb9fcdc78 100644 --- a/app/code/core/Mage/SalesRule/Model/Rule/Action/Collection.php +++ b/app/code/core/Mage/SalesRule/Model/Rule/Action/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/Model/Rule/Action/Product.php b/app/code/core/Mage/SalesRule/Model/Rule/Action/Product.php index d3c368d7cb..c95b07a658 100644 --- a/app/code/core/Mage/SalesRule/Model/Rule/Action/Product.php +++ b/app/code/core/Mage/SalesRule/Model/Rule/Action/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -30,7 +30,7 @@ class Mage_SalesRule_Model_Rule_Action_Product extends Mage_Rule_Model_Action_Ab public function loadAttributeOptions() { $this->setAttributeOption(array( - 'rule_price'=>Mage::helper('salesrule')->__('Special price'), + 'rule_price'=>Mage::helper('salesrule')->__('Special Price'), )); return $this; } diff --git a/app/code/core/Mage/SalesRule/Model/Rule/Condition/Address.php b/app/code/core/Mage/SalesRule/Model/Rule/Condition/Address.php index a9a2fcd360..d1efbfd147 100644 --- a/app/code/core/Mage/SalesRule/Model/Rule/Condition/Address.php +++ b/app/code/core/Mage/SalesRule/Model/Rule/Condition/Address.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/Model/Rule/Condition/Combine.php b/app/code/core/Mage/SalesRule/Model/Rule/Condition/Combine.php index 395affef89..7d7fb60965 100644 --- a/app/code/core/Mage/SalesRule/Model/Rule/Condition/Combine.php +++ b/app/code/core/Mage/SalesRule/Model/Rule/Condition/Combine.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product.php b/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product.php index adc9ef83f1..4a6eeff7f0 100644 --- a/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product.php +++ b/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Combine.php b/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Combine.php index d4f451e206..c8a119c4cf 100644 --- a/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Combine.php +++ b/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Combine.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Found.php b/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Found.php index 03c7391acc..3776602546 100644 --- a/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Found.php +++ b/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Found.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php b/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php index 2a5e18cc7d..ce769b7017 100644 --- a/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php +++ b/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/Model/Rule/Customer.php b/app/code/core/Mage/SalesRule/Model/Rule/Customer.php index eadee6b176..57d2820d44 100644 --- a/app/code/core/Mage/SalesRule/Model/Rule/Customer.php +++ b/app/code/core/Mage/SalesRule/Model/Rule/Customer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/Model/Rule/Product.php b/app/code/core/Mage/SalesRule/Model/Rule/Product.php index 97f774bac8..9842cef9b1 100644 --- a/app/code/core/Mage/SalesRule/Model/Rule/Product.php +++ b/app/code/core/Mage/SalesRule/Model/Rule/Product.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/Model/Validator.php b/app/code/core/Mage/SalesRule/Model/Validator.php index 6d6b3571dd..bc6d084a9a 100644 --- a/app/code/core/Mage/SalesRule/Model/Validator.php +++ b/app/code/core/Mage/SalesRule/Model/Validator.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -125,14 +125,33 @@ protected function _canProcessRule($rule, $address) { if (!$rule->hasIsValid()) { /** - * too many times used in general + * check per coupon usage limit */ - if ($rule->getUsesPerCoupon() && ($rule->getTimesUsed() >= $rule->getUsesPerCoupon())) { - $rule->setIsValid(false); - return false; + $couponCode = $address->getQuote()->getCouponCode(); + if ($couponCode) { + $coupon = Mage::getModel('salesrule/coupon'); + $coupon->load($couponCode, 'code'); + if ($coupon->getId()) { + // check entire usage limit + if ($coupon->getUsageLimit() && $coupon->getTimesUsed() >= $coupon->getUsageLimit()) { + $rule->setIsValid(false); + return false; + } + // check per customer usage limit + $customerId = $address->getQuote()->getCustomerId(); + if ($customerId && $coupon->getUsagePerCustomer()) { + $couponUsage = new Varien_Object(); + Mage::getResourceModel('salesrule/coupon_usage')->loadByCustomerCoupon( + $couponUsage, $customerId, $coupon->getId()); + if ($couponUsage->getCouponId() && $couponUsage->getTimesUsed() >= $coupon->getUsagePerCustomer()) { + $rule->setIsValid(false); + return false; + } + } + } } /** - * too many times used for this customer + * check per rule usage limit */ $ruleId = $rule->getId(); if ($ruleId && $rule->getUsesPerCustomer()) { @@ -366,9 +385,7 @@ public function process(Mage_Sales_Model_Quote_Item_Abstract $item) $appliedRuleIds[$rule->getRuleId()] = $rule->getRuleId(); - if ($rule->getCouponCode() && ( strtolower($rule->getCouponCode()) == strtolower($this->getCouponCode()))) { - $address->setCouponCode($this->getCouponCode()); - } + $this->_maintainAddressCouponCode($address, $rule); $this->_addDiscountDescription($address, $rule); if ($rule->getStopRulesProcessing()) { break; @@ -447,9 +464,7 @@ public function processShippingAmount(Mage_Sales_Model_Quote_Address $address) $address->setBaseShippingDiscountAmount($baseDiscountAmount); $appliedRuleIds[$rule->getRuleId()] = $rule->getRuleId(); - if ($rule->getCouponCode() && ( strtolower($rule->getCouponCode()) == strtolower($this->getCouponCode()))) { - $address->setCouponCode($this->getCouponCode()); - } + $this->_maintainAddressCouponCode($address, $rule); $this->_addDiscountDescription($address, $rule); if ($rule->getStopRulesProcessing()) { break; @@ -475,6 +490,21 @@ public function mergeIds($a1, $a2, $asString=true) return $a; } + /** + * Retrieve subordinate coupon IDs + * + * @return array + */ + protected function _maintainAddressCouponCode($address, $rule) + { + foreach ($rule->getCoupons() as $coupon) { + if (strtolower($coupon->getCode()) == strtolower($this->getCouponCode())) { + $address->setCouponCode($this->getCouponCode()); + break; + } + } + } + /** * Add rule discount description label to address object * @@ -489,8 +519,8 @@ protected function _addDiscountDescription($address, $rule) $label = ''; if ($ruleLabel) { $label = $ruleLabel; - } elseif ($rule->getCouponCode()) { - $label = $rule->getCouponCode(); + } else if ($address->getCouponCode()) { + $label = $address->getCouponCode(); } if (!empty($label)) { @@ -512,6 +542,7 @@ public function prepareDescription($address, $separator=', ') $description = $address->getDiscountDescriptionArray(); if (is_array($description) && !empty($description)) { + $description = array_unique($description); $description = implode($separator, $description); } else { $description = ''; diff --git a/app/code/core/Mage/SalesRule/etc/adminhtml.xml b/app/code/core/Mage/SalesRule/etc/adminhtml.xml index ebebb71726..7383f133af 100644 --- a/app/code/core/Mage/SalesRule/etc/adminhtml.xml +++ b/app/code/core/Mage/SalesRule/etc/adminhtml.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/SalesRule/etc/config.xml b/app/code/core/Mage/SalesRule/etc/config.xml index 2a2c26f4f1..c3b64c0033 100644 --- a/app/code/core/Mage/SalesRule/etc/config.xml +++ b/app/code/core/Mage/SalesRule/etc/config.xml @@ -21,14 +21,14 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - 0.7.12 + 1.4.0.0.4 @@ -48,6 +48,8 @@ salesrule
        salesrule_customer
        + salesrule_coupon
        + salesrule_coupon_usage
        coupon_aggregated
        @@ -88,7 +90,7 @@ salesrule/quote_freeshipping subtotal - shipping + tax_subtotal,shipping salesrule/quote_discount @@ -96,6 +98,12 @@ grand_total + + + salesrule/quote_nominal_discount + 550 + +
        @@ -122,7 +130,7 @@ - + diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-install-0.7.0.php index 3383fe7ae1..100da10d8a 100644 --- a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-install-0.7.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-install-1.4.0.0.0.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-install-1.4.0.0.0.php new file mode 100644 index 0000000000..78d448c59c --- /dev/null +++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-install-1.4.0.0.0.php @@ -0,0 +1,140 @@ +startSetup(); + +$installer->run(" + +CREATE TABLE `{$installer->getTable('salesrule')}` ( + `rule_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL DEFAULT '', + `description` text NOT NULL, + `from_date` date DEFAULT '0000-00-00', + `to_date` date DEFAULT '0000-00-00', + `coupon_code` varchar(255) DEFAULT NULL, + `uses_per_coupon` int(11) NOT NULL DEFAULT '0', + `uses_per_customer` int(11) NOT NULL DEFAULT '0', + `customer_group_ids` varchar(255) NOT NULL DEFAULT '', + `is_active` tinyint(1) NOT NULL DEFAULT '0', + `conditions_serialized` mediumtext NOT NULL, + `actions_serialized` mediumtext NOT NULL, + `stop_rules_processing` tinyint(1) NOT NULL DEFAULT '1', + `is_advanced` tinyint(3) unsigned NOT NULL DEFAULT '1', + `product_ids` text, + `sort_order` int(10) unsigned NOT NULL DEFAULT '0', + `simple_action` varchar(32) NOT NULL DEFAULT '', + `discount_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `discount_qty` decimal(12,4) unsigned DEFAULT NULL, + `discount_step` int(10) unsigned NOT NULL, + `simple_free_shipping` tinyint(1) unsigned NOT NULL DEFAULT '0', + `apply_to_shipping` tinyint(1) unsigned NOT NULL DEFAULT '0', + `times_used` int(11) unsigned NOT NULL DEFAULT '0', + `is_rss` tinyint(4) NOT NULL DEFAULT '0', + `website_ids` text, + PRIMARY KEY (`rule_id`), + KEY `sort_order` (`is_active`,`sort_order`,`to_date`,`from_date`) +) ENGINE=InnoDB AUTO_INCREMENT=125 DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('salesrule_customer')}` ( + `rule_customer_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `rule_id` int(10) unsigned NOT NULL DEFAULT '0', + `customer_id` int(10) unsigned NOT NULL DEFAULT '0', + `times_used` smallint(11) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`rule_customer_id`), + KEY `rule_id` (`rule_id`, `customer_id`), + KEY `customer_id` (`customer_id`, `rule_id`), + CONSTRAINT `FK_salesrule_customer_id` FOREIGN KEY (`customer_id`) + REFERENCES `{$installer->getTable('customer_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `FK_salesrule_customer_rule` FOREIGN KEY (`rule_id`) + REFERENCES `{$installer->getTable('salesrule')}` (`rule_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=46 DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('salesrule_label')}` ( + `label_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `rule_id` int(10) unsigned NOT NULL, + `store_id` smallint(5) unsigned NOT NULL, + `label` varchar(255) DEFAULT NULL, + PRIMARY KEY (`label_id`), + UNIQUE KEY `IDX_RULE_STORE` (`rule_id`,`store_id`), + KEY `FK_SALESRULE_LABEL_STORE` (`store_id`), + KEY `FK_SALESRULE_LABEL_RULE` (`rule_id`), + CONSTRAINT `FK_SALESRULE_LABEL_RULE` FOREIGN KEY (`rule_id`) + REFERENCES `{$installer->getTable('salesrule')}` (`rule_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `FK_SALESRULE_LABEL_STORE` FOREIGN KEY (`store_id`) + REFERENCES `{$installer->getTable('core_store')}` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('coupon_aggregated')}` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `period` date NOT NULL DEFAULT '0000-00-00', + `store_id` smallint(5) unsigned DEFAULT NULL, + `order_status` varchar(50) NOT NULL DEFAULT '', + `coupon_code` varchar(50) NOT NULL DEFAULT '', + `coupon_uses` int(11) NOT NULL DEFAULT '0', + `subtotal_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `discount_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `total_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + PRIMARY KEY (`id`), + UNIQUE KEY `UNQ_COUPON_AGGREGATED_PSOC` (`period`,`store_id`,`order_status`,`coupon_code`), + KEY `IDX_STORE_ID` (`store_id`), + CONSTRAINT `FK_SALESTRULE_COUPON_AGGREGATED_STORE` FOREIGN KEY (`store_id`) + REFERENCES `{$installer->getTable('core_store')}` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$installer->getTable('coupon_aggregated_order')}` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `period` date NOT NULL DEFAULT '0000-00-00', + `store_id` smallint(5) unsigned DEFAULT NULL, + `order_status` varchar(50) NOT NULL DEFAULT '', + `coupon_code` varchar(50) NOT NULL DEFAULT '', + `coupon_uses` int(11) NOT NULL DEFAULT '0', + `subtotal_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `discount_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + `total_amount` decimal(12,4) NOT NULL DEFAULT '0.0000', + PRIMARY KEY (`id`), + UNIQUE KEY `UNQ_COUPON_AGGREGATED_ORDER_PSOC` (`period`,`store_id`,`order_status`,`coupon_code`), + KEY `IDX_STORE_ID` (`store_id`), + CONSTRAINT `FK_SALESTRULE_COUPON_AGGREGATED_ORDER_STORE` FOREIGN KEY (`store_id`) + REFERENCES `{$installer->getTable('core_store')}` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +/** + * add attributes discount_description, shipping_discount_amount, base_shipping_discount_amount + */ +$installer->addAttribute('quote_address', 'discount_description', array('type'=>'varchar')); +$installer->addAttribute('quote_address', 'shipping_discount_amount', array('type'=>'decimal')); +$installer->addAttribute('quote_address', 'base_shipping_discount_amount', array('type'=>'decimal')); + + +$installer->addAttribute('order', 'discount_description', array('type'=>'varchar')); +$installer->addAttribute('order', 'shipping_discount_amount', array('type'=>'decimal')); +$installer->addAttribute('order', 'base_shipping_discount_amount', array('type'=>'decimal')); + +$installer->endSetup(); diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.0-0.7.1.php index 95fdfdeb52..1341215bbd 100644 --- a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.1-0.7.2.php index 4395216e49..e46ab46bfd 100644 --- a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.10-0.7.11.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.10-0.7.11.php index b113415d93..0d549a1530 100644 --- a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.10-0.7.11.php +++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.10-0.7.11.php @@ -20,16 +20,24 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; /* @var $installer Mage_Sales_Model_Mysql4_Setup */ $installer->startSetup(); + + +/* + * @deprecated since 1.4 Sales no more eav, moving attributes from eav to flat table, + * already done in sales upgrade + * + $orderEntityType = $installer->getEntityType('order'); $orderEntityTypeId = $orderEntityType['entity_type_id']; + $attribute = $installer->getAttribute($orderEntityTypeId, 'coupon_code'); $installer->getConnection()->addColumn($this->getTable('sales/order'), $attribute['attribute_code'], "varchar(255) NULL DEFAULT NULL"); @@ -38,7 +46,7 @@ $installer->getConnection()->beginTransaction(); $installer->run(" - UPDATE {$this->getTable('sales/order')} AS o, {$this->getTable('sales/order')}_{$attribute['backend_type']} AS od + UPDATE {$this->getTable('sales/order')} AS o, {$this->getTable('sales/order')}_varchar AS od SET o.{$attribute['attribute_code']} = od.value WHERE od.entity_id = o.entity_id AND od.attribute_id = {$attribute['attribute_id']} @@ -60,6 +68,7 @@ $installer->getConnection()->dropColumn($this->getTable('sales/order'), $attribute['attribute_code']); throw $e; } +*/ $installer->run(" CREATE TABLE `{$installer->getTable('salesrule/coupon_aggregated')}` ( @@ -95,17 +104,17 @@ $installer->getConnection()->addConstraint( 'FK_SALESTRULE_COUPON_AGGREGATED_ORDER_STORE', - $this->getTable('salesrule/coupon_aggregated_order'), + $this->getTable('salesrule/coupon_aggregated_order'), 'store_id', - $this->getTable('core_store'), + $this->getTable('core_store'), 'store_id' ); $installer->getConnection()->addConstraint( 'FK_SALESTRULE_COUPON_AGGREGATED_STORE', - $this->getTable('salesrule/coupon_aggregated'), + $this->getTable('salesrule/coupon_aggregated'), 'store_id', - $this->getTable('core_store'), + $this->getTable('core_store'), 'store_id' ); diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.11-0.7.12.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.11-0.7.12.php index e14ccb46ff..cbe3a7f2ee 100644 --- a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.11-0.7.12.php +++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.11-0.7.12.php @@ -20,12 +20,18 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +/** + * @deprecated since 1.4 field already changed to varchar 255 default null in sales upgrade to 1.4 + */ + $installer = $this; /* @var $installer Mage_Sales_Model_Mysql4_Setup */ $installer->startSetup(); -$installer->getConnection()->changeColumn($this->getTable('sales/order'), 'coupon_code', 'coupon_code', 'varchar(255) DEFAULT NULL'); + +// $installer->getConnection()->changeColumn($this->getTable('sales_order'), 'coupon_code', 'coupon_code', 'varchar(255) DEFAULT NULL'); + $installer->endSetup(); diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.2-0.7.3.php index 8187b0dc05..ba2a8e766d 100644 --- a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.2-0.7.3.php +++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.2-0.7.3.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.3-0.7.4.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.3-0.7.4.php index dc4ef8a20a..62227aa9a1 100644 --- a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.3-0.7.4.php +++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.3-0.7.4.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.4-0.7.5.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.4-0.7.5.php index 36ab405574..d4c7d60b5a 100644 --- a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.4-0.7.5.php +++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.4-0.7.5.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.5-0.7.6.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.5-0.7.6.php index 31091c2d31..f21f027fcc 100644 --- a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.5-0.7.6.php +++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.5-0.7.6.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.6-0.7.7.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.6-0.7.7.php index c349fdad3a..8b6250d049 100644 --- a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.6-0.7.7.php +++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.6-0.7.7.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.7-0.7.8.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.7-0.7.8.php index 06e1cc7b95..b153ed227c 100644 --- a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.7-0.7.8.php +++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.7-0.7.8.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.8-0.7.9.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.8-0.7.9.php index 0ea2c14624..6cdaad2041 100644 --- a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.8-0.7.9.php +++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.8-0.7.9.php @@ -20,12 +20,13 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -$installer = $this; /* @var $installer Mage_Sales_Model_Mysql4_Setup */ +$installer = $this; + $installer->getConnection()->addColumn( $this->getTable('salesrule'), 'apply_to_shipping', @@ -39,10 +40,24 @@ `store_id` smallint(5) unsigned NOT NULL, `label` varchar(255) DEFAULT NULL, PRIMARY KEY (`label_id`), - UNIQUE KEY `IDX_RULE_STORE` (`rule_id`,`store_id`), - KEY `FK_SALESRULE_LABEL_STORE` (`store_id`), - KEY `FK_SALESRULE_LABEL_RULE` (`rule_id`), - CONSTRAINT `FK_SALESRULE_LABEL_RULE` FOREIGN KEY (`rule_id`) REFERENCES `{$this->getTable('salesrule')}` (`rule_id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `FK_SALESRULE_LABEL_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$this->getTable('core/store')}` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE + UNIQUE KEY `UNQ_RULE_STORE` (`rule_id`,`store_id`), + KEY `IDX_STORE_ID` (`store_id`), + KEY `IDX_RULE_ID` (`rule_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; "); + +$installer->getConnection()->addConstraint( + 'SALESRULE_LABEL_RULE', + $this->getTable('salesrule/label'), + 'rule_id', + $this->getTable('salesrule'), + 'rule_id' +); + +$installer->getConnection()->addConstraint( + 'SALESRULE_LABEL_STORE', + $this->getTable('salesrule/label'), + 'store_id', + $this->getTable('core/store'), + 'store_id' +); diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.9-0.7.10.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.9-0.7.10.php index 117a5065be..a5c7d68f2b 100644 --- a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.9-0.7.10.php +++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.9-0.7.10.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_SalesRule - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-1.4.0.0.0-1.4.0.0.1.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-1.4.0.0.0-1.4.0.0.1.php new file mode 100644 index 0000000000..36c6937335 --- /dev/null +++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-1.4.0.0.0-1.4.0.0.1.php @@ -0,0 +1,103 @@ +getTable('salesrule/rule'); +$tableSalesruleCustomer = $installer->getTable('salesrule/rule_customer'); +$tableSalesruleCoupon = $installer->getTable('salesrule/coupon'); +$tableSalesruleCouponUsage = $installer->getTable('salesrule/coupon_usage'); +$tableCustomerEntity = $installer->getTable('customer/entity'); + +$connection = $installer->getConnection(); +/* @var $connection Varien_Db_Adapter_Pdo_Mysql */ + +$installer->run(" +CREATE TABLE `{$tableSalesruleCoupon}` ( + `coupon_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `rule_id` int(10) unsigned NOT NULL, + `code` varchar(255) NOT NULL, + `usage_limit` int(10) unsigned DEFAULT NULL, + `usage_per_customer` int(10) unsigned DEFAULT NULL, + `times_used` int(10) unsigned NOT NULL DEFAULT '0', + `expiration_date` datetime DEFAULT NULL, + `is_primary` tinyint(1) unsigned DEFAULT NULL, + PRIMARY KEY (`coupon_id`), + UNIQUE KEY `UNQ_COUPON_CODE` (`code`), + UNIQUE KEY `UNQ_RULE_MAIN_COUPON` (`rule_id`, `is_primary`), + KEY `FK_SALESRULE_COUPON_RULE_ID_SALESRULE` (`rule_id`), + CONSTRAINT `FK_SALESRULE_COUPON_RULE_ID_SALESRULE` FOREIGN KEY (`rule_id`) REFERENCES `{$tableSalesrule}` (`rule_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `{$tableSalesruleCouponUsage}` ( + `coupon_id` int(10) unsigned NOT NULL, + `customer_id` int(10) unsigned NOT NULL, + `times_used` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`coupon_id`, `customer_id`), + KEY `FK_SALESRULE_COUPON_CUSTOMER_COUPON_ID_CUSTOMER_ENTITY` (`coupon_id`), + KEY `FK_SALESRULE_COUPON_CUSTOMER_CUSTOMER_ID_CUSTOMER_ENTITY` (`customer_id`), + CONSTRAINT `FK_SALESRULE_COUPON_CUSTOMER_COUPON_ID_CUSTOMER_ENTITY` FOREIGN KEY (`coupon_id`) REFERENCES `{$tableSalesruleCoupon}` (`coupon_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `FK_SALESRULE_COUPON_CUSTOMER_CUSTOMER_ID_CUSTOMER_ENTITY` FOREIGN KEY (`customer_id`) REFERENCES `{$tableCustomerEntity}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO `{$tableSalesruleCoupon}` ( + rule_id +, code +, usage_limit +, usage_per_customer +, times_used +, is_primary +) +SELECT + rule_id +, coupon_code +, uses_per_coupon +, uses_per_customer +, times_used +, 1 +FROM `{$tableSalesrule}` +WHERE + coupon_code <> ''; + +INSERT INTO `{$tableSalesruleCouponUsage}` ( + coupon_id +, customer_id +, times_used +) +SELECT + coupon.coupon_id +, customer.customer_id +, customer.times_used +FROM `{$tableSalesruleCoupon}` coupon +JOIN `{$tableSalesruleCustomer}` customer ON( + customer.rule_id = coupon.rule_id +); + +ALTER TABLE `{$tableSalesrule}` + DROP COLUMN `coupon_code`, + DROP COLUMN `uses_per_coupon`; +"); diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-1.4.0.0.1-1.4.0.0.2.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-1.4.0.0.1-1.4.0.0.2.php new file mode 100644 index 0000000000..cd65fee188 --- /dev/null +++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-1.4.0.0.1-1.4.0.0.2.php @@ -0,0 +1,60 @@ +getTable('salesrule/rule'); +$tableSalesruleCoupon = $installer->getTable('salesrule/coupon'); + +$connection = $installer->getConnection(); +/** @var $connection Varien_Db_Adapter_Pdo_Mysql */ + +$connection->addColumn( + $tableSalesrule, + 'coupon_type', + 'smallint unsigned NOT NULL DEFAULT "' . Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON . '"' +); + +/** + * UPDATE coupon_type to specific in rules with primary coupon + * Always come to ON DUPLICATE KEY UPDATE section of INSERT statement + */ +$installer->run(" +INSERT `{$tableSalesrule}`( + rule_id, /* PRIMARY KEY */ + /* columns with no default value to prevent warnings */ + description, conditions_serialized, actions_serialized, discount_step +) +SELECT DISTINCT + rule_id, /* make sure PRIMARY KEY is DUPLICATED */ + '', '', '', 0 +FROM `{$tableSalesruleCoupon}` +WHERE + is_primary IS NOT NULL /* is_primary = 1 */ +ON DUPLICATE KEY UPDATE + coupon_type = '" . Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC . "'; +"); diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-1.4.0.0.2-1.4.0.0.3.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-1.4.0.0.2-1.4.0.0.3.php new file mode 100644 index 0000000000..11f8517afb --- /dev/null +++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-1.4.0.0.2-1.4.0.0.3.php @@ -0,0 +1,37 @@ +startSetup(); + +$installer->getConnection() + ->modifyColumn($installer->getTable('salesrule'), + 'customer_group_ids', + 'TEXT'); + +$installer->endSetup(); diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-1.4.0.0.3-1.4.0.0.4.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-1.4.0.0.3-1.4.0.0.4.php new file mode 100644 index 0000000000..978a3e9049 --- /dev/null +++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-1.4.0.0.3-1.4.0.0.4.php @@ -0,0 +1,37 @@ +getConnection()->addColumn($installer->getTable('salesrule/coupon_aggregated'), + 'subtotal_amount_actual', "decimal(12,4) NOT NULL default '0.0000'"); + +$installer->getConnection()->addColumn($installer->getTable('salesrule/coupon_aggregated'), + 'discount_amount_actual', "decimal(12,4) NOT NULL default '0.0000'"); + +$installer->getConnection()->addColumn($installer->getTable('salesrule/coupon_aggregated'), + 'total_amount_actual', "decimal(12,4) NOT NULL default '0.0000'"); diff --git a/app/code/core/Mage/Sendfriend/Block/Send.php b/app/code/core/Mage/Sendfriend/Block/Send.php index 40a0644d80..338ad149db 100644 --- a/app/code/core/Mage/Sendfriend/Block/Send.php +++ b/app/code/core/Mage/Sendfriend/Block/Send.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sendfriend - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sendfriend/Helper/Data.php b/app/code/core/Mage/Sendfriend/Helper/Data.php index fc0bb6fb0e..9c8475e2a0 100644 --- a/app/code/core/Mage/Sendfriend/Helper/Data.php +++ b/app/code/core/Mage/Sendfriend/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sendfriend - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sendfriend/Model/Mysql4/Sendfriend.php b/app/code/core/Mage/Sendfriend/Model/Mysql4/Sendfriend.php index 0e23a43401..a27595fd32 100644 --- a/app/code/core/Mage/Sendfriend/Model/Mysql4/Sendfriend.php +++ b/app/code/core/Mage/Sendfriend/Model/Mysql4/Sendfriend.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sendfriend - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sendfriend/Model/Mysql4/Sendfriend/Collection.php b/app/code/core/Mage/Sendfriend/Model/Mysql4/Sendfriend/Collection.php index 383d04007d..ca8cf0e85c 100644 --- a/app/code/core/Mage/Sendfriend/Model/Mysql4/Sendfriend/Collection.php +++ b/app/code/core/Mage/Sendfriend/Model/Mysql4/Sendfriend/Collection.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sendfriend - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sendfriend/Model/Mysql4/Setup.php b/app/code/core/Mage/Sendfriend/Model/Mysql4/Setup.php index 47df5c4196..254aef8b8a 100644 --- a/app/code/core/Mage/Sendfriend/Model/Mysql4/Setup.php +++ b/app/code/core/Mage/Sendfriend/Model/Mysql4/Setup.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sendfriend - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sendfriend/Model/Observer.php b/app/code/core/Mage/Sendfriend/Model/Observer.php index 2892c5df0b..df4dc1a04e 100644 --- a/app/code/core/Mage/Sendfriend/Model/Observer.php +++ b/app/code/core/Mage/Sendfriend/Model/Observer.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sendfriend - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/app/code/core/Mage/Sendfriend/Model/Sendfriend.php b/app/code/core/Mage/Sendfriend/Model/Sendfriend.php index 63b3da77f2..ffc2ddf436 100644 --- a/app/code/core/Mage/Sendfriend/Model/Sendfriend.php +++ b/app/code/core/Mage/Sendfriend/Model/Sendfriend.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sendfriend - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -159,34 +159,34 @@ public function validate() $name = $this->getSender()->getName(); if (empty($name)) { - $errors[] = Mage::helper('sendfriend')->__('Sender name can\'t be empty'); + $errors[] = Mage::helper('sendfriend')->__('The sender name cannot be empty.'); } $email = $this->getSender()->getEmail(); if (empty($email) OR !Zend_Validate::is($email, 'EmailAddress')) { - $errors[] = Mage::helper('sendfriend')->__('Invalid sender email'); + $errors[] = Mage::helper('sendfriend')->__('Invalid sender email.'); } $message = $this->getSender()->getMessage(); if (empty($message)) { - $errors[] = Mage::helper('sendfriend')->__('Message can\'t be empty'); + $errors[] = Mage::helper('sendfriend')->__('The message cannot be empty.'); } if (!$this->getRecipients()->getEmails()) { - $errors[] = Mage::helper('sendfriend')->__('You have to specify at least one recipient'); + $errors[] = Mage::helper('sendfriend')->__('At least one recipient must be specified.'); } // validate recipients email addresses foreach ($this->getRecipients()->getEmails() as $email) { if (!Zend_Validate::is($email, 'EmailAddress')) { - $errors[] = Mage::helper('sendfriend')->__('You input invalid email address for recipient'); + $errors[] = Mage::helper('sendfriend')->__('An invalid email address for recipient was entered.'); break; } } $maxRecipients = $this->getMaxRecipients(); if (count($this->getRecipients()->getEmails()) > $maxRecipients) { - $errors[] = Mage::helper('sendfriend')->__('You cannot send more than %d emails at a time', $this->getMaxRecipients()); + $errors[] = Mage::helper('sendfriend')->__('No more than %d emails can be sent at a time.', $this->getMaxRecipients()); } if (empty($errors)) { @@ -217,7 +217,7 @@ public function getCookie() { $cookie = $this->_getData('_cookie'); if (!$cookie instanceof Mage_Core_Model_Cookie) { - Mage::throwException(Mage::helper('sendfriend')->__('Please define correct Cookie instance')); + Mage::throwException(Mage::helper('sendfriend')->__('Please define a correct Cookie instance.')); } return $cookie; } @@ -339,7 +339,7 @@ public function getProduct() { $product = $this->_getData('_product'); if (!$product instanceof Mage_Catalog_Model_Product) { - Mage::throwException(Mage::helper('sendfriend')->__('Please define correct Product instance')); + Mage::throwException(Mage::helper('sendfriend')->__('Please define a correct Product instance.')); } return $product; } @@ -353,7 +353,7 @@ public function getProduct() public function setSender($sender) { if (!is_array($sender)) { - Mage::helper('sendfriend')->__('Invalid Sender information'); + Mage::helper('sendfriend')->__('Invalid Sender Information'); } return $this->setData('_sender', new Varien_Object($sender)); @@ -369,7 +369,7 @@ public function getSender() { $sender = $this->_getData('_sender'); if (!$sender instanceof Varien_Object) { - Mage::throwException(Mage::helper('sendfriend')->__('Please define correct Sender information')); + Mage::throwException(Mage::helper('sendfriend')->__('Please define the correct Sender information.')); } return $sender; } diff --git a/app/code/core/Mage/Sendfriend/controllers/ProductController.php b/app/code/core/Mage/Sendfriend/controllers/ProductController.php index 8b338b8017..4a71dbdd7a 100644 --- a/app/code/core/Mage/Sendfriend/controllers/ProductController.php +++ b/app/code/core/Mage/Sendfriend/controllers/ProductController.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Sendfriend - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -121,7 +121,7 @@ public function sendAction() if ($model->getMaxSendsToFriend()) { Mage::getSingleton('catalog/session')->addNotice( - $this->__('You cannot send more than %d times in an hour', $model->getMaxSendsToFriend()) + $this->__('The messages cannot be sent more than %d times in an hour', $model->getMaxSendsToFriend()) ); } @@ -176,7 +176,7 @@ public function sendmailAction() $validate = $model->validate(); if ($validate === true) { $model->send(); - Mage::getSingleton('catalog/session')->addSuccess($this->__('Link to a friend was sent.')); + Mage::getSingleton('catalog/session')->addSuccess($this->__('The link to a friend was sent.')); $this->_redirectSuccess($product->getProductUrl()); return; } @@ -187,7 +187,7 @@ public function sendmailAction() } } else { - Mage::getSingleton('catalog/session')->addError($this->__('Some problems with data.')); + Mage::getSingleton('catalog/session')->addError($this->__('There were some problems with the data.')); } } } @@ -196,7 +196,7 @@ public function sendmailAction() } catch (Exception $e) { Mage::getSingleton('catalog/session') - ->addException($e, $this->__('Some emails was not sent')); + ->addException($e, $this->__('Some emails were not sent.')); } // save form data diff --git a/app/code/core/Mage/Sendfriend/etc/config.xml b/app/code/core/Mage/Sendfriend/etc/config.xml index 6a3239a1b4..d205730f97 100644 --- a/app/code/core/Mage/Sendfriend/etc/config.xml +++ b/app/code/core/Mage/Sendfriend/etc/config.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Sendfriend - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> diff --git a/app/code/core/Mage/Sendfriend/etc/system.xml b/app/code/core/Mage/Sendfriend/etc/system.xml index ad0b90082a..8bc6e2d43a 100644 --- a/app/code/core/Mage/Sendfriend/etc/system.xml +++ b/app/code/core/Mage/Sendfriend/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Sendfriend - * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) + * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -37,7 +37,7 @@ 1 - + text 1 1 @@ -54,7 +54,7 @@ 1