From 5022ee2f66c3100d12ff71e65d22ff0eee1179a9 Mon Sep 17 00:00:00 2001 From: Achim Rosenhagen Date: Wed, 20 May 2015 21:59:37 +0200 Subject: [PATCH] switch to Ffuenf_DeleteOrder integrate test-suite --- .gitignore | 2 + .scrutinizer.yml | 246 ++++++++++++++++++ .travis.yml | 53 ++-- CHANGELOG.md | 8 + LICENSE.md | 21 ++ README.md | 93 +++++-- .../Block/Adminhtml/Sales/Order/Grid.php | 16 -- .../community/EM/DeleteOrder/Helper/Data.php | 28 -- .../EM/DeleteOrder/Test/Helper/Data.php | 24 -- .../Data/fixtures/testIsExtensionActive.yaml | 2 - .../Adminhtml/Sales/OrderController.php | 147 ----------- .../community/EM/DeleteOrder/etc/config.xml | 60 ----- .../community/EM/DeleteOrder/etc/system.xml | 29 --- .../Block/Adminhtml/Sales/Order/Grid.php | 36 +++ .../local/Ffuenf/DeleteOrder/Helper/Core.php | 46 ++++ .../local/Ffuenf/DeleteOrder/Helper/Data.php | 42 +++ .../Ffuenf/DeleteOrder/Test/Helper/Data.php | 39 +++ .../Test/Helper/Data/fixtures/shared.yaml | 2 + .../Adminhtml/Sales/OrderController.php | 167 ++++++++++++ .../local/Ffuenf/DeleteOrder/etc/config.xml | 60 +++++ .../local/Ffuenf/DeleteOrder/etc/system.xml | 55 ++++ app/etc/config.xml | 48 ---- app/etc/modules/EM_DeleteOrder.xml | 9 - app/etc/modules/Ffuenf_DeleteOrder.xml | 27 ++ composer.json | 27 +- modman | 4 +- package.xml | 76 ------ uninstall.sql | 3 + 28 files changed, 870 insertions(+), 500 deletions(-) create mode 100644 .gitignore create mode 100755 .scrutinizer.yml create mode 100755 CHANGELOG.md create mode 100644 LICENSE.md delete mode 100755 app/code/community/EM/DeleteOrder/Block/Adminhtml/Sales/Order/Grid.php delete mode 100755 app/code/community/EM/DeleteOrder/Helper/Data.php delete mode 100755 app/code/community/EM/DeleteOrder/Test/Helper/Data.php delete mode 100755 app/code/community/EM/DeleteOrder/Test/Helper/Data/fixtures/testIsExtensionActive.yaml delete mode 100755 app/code/community/EM/DeleteOrder/controllers/Adminhtml/Sales/OrderController.php delete mode 100755 app/code/community/EM/DeleteOrder/etc/config.xml delete mode 100755 app/code/community/EM/DeleteOrder/etc/system.xml create mode 100755 app/code/local/Ffuenf/DeleteOrder/Block/Adminhtml/Sales/Order/Grid.php create mode 100644 app/code/local/Ffuenf/DeleteOrder/Helper/Core.php create mode 100755 app/code/local/Ffuenf/DeleteOrder/Helper/Data.php create mode 100755 app/code/local/Ffuenf/DeleteOrder/Test/Helper/Data.php create mode 100755 app/code/local/Ffuenf/DeleteOrder/Test/Helper/Data/fixtures/shared.yaml create mode 100755 app/code/local/Ffuenf/DeleteOrder/controllers/Adminhtml/Sales/OrderController.php create mode 100755 app/code/local/Ffuenf/DeleteOrder/etc/config.xml create mode 100755 app/code/local/Ffuenf/DeleteOrder/etc/system.xml delete mode 100755 app/etc/config.xml delete mode 100755 app/etc/modules/EM_DeleteOrder.xml create mode 100755 app/etc/modules/Ffuenf_DeleteOrder.xml delete mode 100644 package.xml create mode 100755 uninstall.sql diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0ff3989 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vagrant +travis_key_chunk.sh \ No newline at end of file diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100755 index 0000000..a4229a3 --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,246 @@ +before_commands: + - git clone https://github.com/magento-ecg/coding-standard ../magento-ecg/ +imports: + - php + - javascript +tools: + php_sim: true + php_pdepend: true + php_analyzer: true + external_code_coverage: false + php_code_sniffer: + config: + standard: Zend + include_standards: + - ../magento-ecg/ +checks: + php: + align_assignments: false + argument_type_checks: true + assignment_of_null_return: true + avoid_aliased_php_functions: true + avoid_conflicting_incrementers: true + avoid_corrupting_byteorder_marks: true + avoid_duplicate_types: true + avoid_entity_manager_injection: true + avoid_fixme_comments: true + avoid_length_functions_in_loops: true + avoid_multiple_statements_on_same_line: true + avoid_superglobals: true + avoid_tab_indentation: true + avoid_todo_comments: true + avoid_unnecessary_concatenation: true + avoid_usage_of_logical_operators: true + avoid_useless_overridden_methods: true + closure_use_modifiable: true + closure_use_not_conflicting: true + code_rating: true + deadlock_detection_in_loops: true + deprecated_code_usage: true + duplication: true + encourage_postdec_operator: true + encourage_single_quotes: true + ensure_lower_case_builtin_functions: true + fix_doc_comments: true + fix_identation_4spaces: true + fix_linefeed: true + fix_php_opening_tag: true + fix_use_statements: + remove_unused: true + preserve_multiple: false + preserve_blanklines: false + order_alphabetically: true + foreach_traversable: true + foreach_usable_as_reference: true + function_body_start_on_new_line: true + function_in_camel_caps: true + lowercase_basic_constants: true + lowercase_php_keywords: true + method_calls_on_non_object: true + missing_arguments: true + more_specific_types_in_doc_comments: true + naming_conventions: + local_variable: '(^[a-z][a-zA-Z0-9]*$|^this$|^i$)' + abstract_class_name: ^Abstract|Factory$|_Abstract$ + utility_class_name: 'Utils?$' + constant_name: '^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$' + property_name: '(^[a-z][a-zA-Z0-9]*$)' + method_name: '^((?:[a-z]|__)[a-zA-Z0-9]*|_construct|_prepareCollection|_prepareColumns|_isAllowed)$' + parameter_name: '(^[a-z][a-zA-Z0-9]*$)' + interface_name: '^[A-Z][a-zA-Z0-9]*_?Interface$' + type_name: '^[A-Z][a-zA-Z0-9_]*$' + exception_name: '^[A-Z][a-zA-Z0-9]*Exception$' + isser_method_name: '^(?:is|has|should|may|supports|persist)' + no_commented_out_code: true + no_duplicate_arguments: true + no_else_if_statements: true + no_empty_statements: true + no_error_suppression: true + no_eval: true + no_global_keyword: true + no_mixed_inline_html: true + non_commented_empty_catch_block: true + no_non_implemented_abstract_methods: true + no_property_on_interface: true + no_short_open_tag: true + no_space_after_cast: true + no_space_around_object_operator: true + no_space_before_semicolon: true + no_space_inside_cast_operator: true + no_trailing_whitespace: true + no_underscore_prefix_in_methods: true + no_underscore_prefix_in_properties: true + no_unnecessary_final_modifier: true + no_unnecessary_function_call_in_for_loop: true + no_unnecessary_if: true + one_class_per_file: true + optional_parameters_at_the_end: true + overriding_private_members: true + param_doc_comment_if_not_inferrable: true + parameter_doc_comments: true + parameter_non_unique: true + parameters_in_camelcaps: true + php5_style_constructor: true + phpunit_assertions: true + precedence_in_conditions: true + precedence_mistakes: true + prefer_sapi_constant: true + prefer_while_loop_over_for_loop: true + properties_in_camelcaps: true + psr2_class_declaration: true + psr2_control_structure_declaration: true + psr2_switch_declaration: true + remove_extra_empty_lines: true + remove_php_closing_tag: true + remove_trailing_whitespace: true + require_braces_around_control_structures: true + require_php_tag_first: true + require_scope_for_methods: true + require_scope_for_properties: true + return_doc_comment_if_not_inferrable: true + return_doc_comments: true + scope_indentation: + spaces_per_level: '4' + security_vulnerabilities: true + side_effects_or_types: true + simplify_boolean_return: true + single_namespace_per_use: true + spacing_around_conditional_operators: true + spacing_around_non_conditional_operators: true + spacing_of_function_arguments: true + sql_injection_vulnerabilities: true + switch_fallthrough_commented: true + symfony_request_injection: true + too_many_arguments: true + unreachable_code: true + unused_methods: true + unused_parameters: true + unused_properties: true + unused_variables: true + uppercase_constants: true + useless_calls: true + use_self_instead_of_fqcn: true + use_statement_alias_conflict: true + variable_existence: true + verify_access_scope_valid: true + verify_argument_usable_as_reference: true + verify_property_names: true + no_goto: true + newline_at_end_of_file: true + fix_line_ending: true + avoid_perl_style_comments: true + javascript: + yoda: + setting: 'Disallow Yoda Conditions' + wrap_regex: true + wrap_iife: true + vars_on_top: true + valid_typeof: true + valid_jsdoc: true + use_isnan: true + space_return_throw_case: true + radix: true + one_var: true + no_wrap_func: true + no_with: true + no_void: true + no_use_before_define: true + no_unused_vars: true + no_unused_expressions: true + no_unreachable: true + no_underscore_dangle: true + no_undefined: true + no_undef_init: true + no_undef: true + no_trailing_spaces: true + no_sparse_arrays: true + no_space_before_semi: true + no_shadow_restricted_names: true + no_shadow: true + no_sequences: true + no_self_compare: true + no_script_url: true + no_return_assign: true + no_reserved_keys: true + no_redeclare: true + no_proto: true + no_process_exit: true + no_process_env: true + no_octal_escape: true + no_octal: true + no_obj_calls: true + no_new_wrappers: true + no_new_require: true + no_new_func: true + no_nested_ternary: true + no_new: true + no_negated_in_lhs: true + no_native_reassign: true + no_multi_str: true + no_mixed_spaces_and_tabs: true + no_loop_func: true + no_lonely_if: true + no_lone_blocks: true + no_labels: true + no_label_var: true + no_iterator: true + no_irregular_whitespace: true + no_invalid_regexp: true + no_inner_declarations: true + no_implied_eval: true + no_func_assign: true + no_floating_decimal: true + no_fallthrough: true + no_extra_strict: true + no_extra_boolean_cast: true + no_extra_bind: true + no_ex_assign: true + no_eval: true + no_eq_null: true + no_empty_label: true + no_empty_class: true + no_empty: true + no_dupe_keys: true + no_div_regex: true + camelcase: true + block_scoped_var: true + comma_style: + style: 'At the end of the line' + curly: true + dot_notation: true + eol_last: true + new_parens: true + no_alert: true + no_caller: true + no_catch_shadow: true + no_console: true + no_comma_dangle: true + no_constant_condition: true + no_debugger: true + no_delete_var: true + +coding_style: + php: + spaces: + other: + after_type_cast: false \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index acdf790..3f138d5 100755 --- a/.travis.yml +++ b/.travis.yml @@ -1,40 +1,21 @@ language: php - -php: - - 5.3 - - 5.4 - - 5.5 - sudo: false - +php: +- 5.3 +- 5.4 +- 5.5 +- 5.6 +- hhvm +matrix: + allow_failures: + - php: 5.6 + - php: hhvm env: - - MAGENTO_VERSION="1.5.0.1" - - MAGENTO_VERSION="1.6.0.0" - - MAGENTO_VERSION="1.6.1.0" - - MAGENTO_VERSION="1.6.2.0" - - MAGENTO_VERSION="1.7.0.0" - - MAGENTO_VERSION="1.7.0.1" - - MAGENTO_VERSION="1.7.0.2" - - MAGENTO_VERSION="1.8.0.0" - - MAGENTO_VERSION="1.8.1.0" - - MAGENTO_VERSION="1.9.0.0" - - MAGENTO_VERSION="1.9.0.1" - - MAGENTO_VERSION="1.9.1.0" - -before_script: - - mkdir magento/ - - git clone https://github.com/netz98/n98-magerun ./n98-magerun/ - - git clone git://github.com/EcomDev/MageCI.git ./mageci/ - - ./mageci/bin/mage-ci install magento $MAGENTO_VERSION magento_test -c -t -r http://mage-ci.ecomdev.org - - composer update - - git clone git://github.com/EcomDev/EcomDev_PHPUnit.git -b dev ./phpunit/ - - CURR_DIR=$(pwd) - - wget https://raw.githubusercontent.com/colinmollenhour/modman/master/modman -O ./mageci/bin/modman - - chmod +x ./mageci/bin/modman - - ./mageci/bin/mage-ci install-module magento $CURR_DIR/phpunit - - ./mageci/bin/mage-ci install-module magento $CURR_DIR - - composer install --dev - - cd magento - + matrix: + - MAGENTO_VERSION=magento-ce-1.9.1.1 + - MAGENTO_VERSION=magento-ce-1.8.1.0 + - MAGENTO_VERSION=magento-ce-1.7.0.2 + - MAGENTO_VERSION=magento-ce-1.6.2.0 script: - - ../vendor/bin/phpunit --group EM_DeleteOrder \ No newline at end of file +- curl -sSL https://raw.githubusercontent.com/ffuenf/MageTestStand/master/setup.sh + | bash diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100755 index 0000000..0317acb --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,8 @@ +# CHANGELOG for Ffuenf_DeleteOrder + +This file is used to list changes made in each version of Ffuenf_DeleteOrder. + +## 2.0.0 (May 20, 2015) + +* switch to Ffuenf_DeleteOrder +* integrate test-suite diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..9a73e5d --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Achim Rosenhagen (ffuenf) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 13f597f..cef902c 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,89 @@ -EM_DeleteOrder -============== -[![GitHub tag](http://img.shields.io/github/tag/ffuenf/EM_DeleteOrder.svg)][tag] -[![Build Status](http://img.shields.io/travis/ffuenf/EM_DeleteOrder.svg)][travis] +Ffuenf_DeleteOrder +================== +[![GitHub tag](https://img.shields.io/github/tag/ffuenf/Ffuenf_DeleteOrder.svg)][tag] +[![Build Status](https://img.shields.io/travis/ffuenf/Ffuenf_DeleteOrder.svg)][travis] +[![Code Climate](https://codeclimate.com/github/ffuenf/Ffuenf_DeleteOrder/badges/gpa.svg)][codeclimate_gpa] +[![Test Coverage](https://codeclimate.com/github/ffuenf/Ffuenf_DeleteOrder/badges/coverage.svg)][codeclimate_coverage] -[tag]: https://github.com/ffuenf/EM_DeleteOrder -[travis]: https://travis-ci.org/ffuenf/EM_DeleteOrder +[tag]: https://github.com/ffuenf/Ffuenf_DeleteOrder +[travis]: https://travis-ci.org/ffuenf/Ffuenf_DeleteOrder +[codeclimate_gpa]: https://codeclimate.com/github/ffuenf/Ffuenf_DeleteOrder +[codeclimate_coverage]: https://codeclimate.com/github/ffuenf/Ffuenf_DeleteOrder -Enhance Magento feature with ability to delete orders +This is a extension for Magento Community Edition that adds the ability to delete orders. -Support Forum: http://www.emthemes.com/forum/ -Magento Connect: http://www.magentocommerce.com/magento-connect/seamless-delete-order.html +Platform +-------- +The following versions are supported and tested: -Basic modification ------------------- +* Magento Community Edition 1.6.2.0 +* Magento Community Edition 1.7.0.2 +* Magento Community Edition 1.8.1.0 +* Magento Community Edition 1.9.1.1 -added modman config for standard magento installation +Other versions are assumed to work. +Installation +------------ -Authors -------- +Use [modman](https://github.com/colinmollenhour/modman) to install: +``` +modman init +modman clone https://github.com/ffuenf/Ffuenf_DeleteOrder +``` + +Deinstallation +-------------- + +Use [modman](https://github.com/colinmollenhour/modman) to clear all files and symlinks: +``` +modman clean Ffuenf_DeleteOrder +``` +see `uninstall.sql` to clear all entries of this extension from your database. -**tvlgiao (EMThemes)** +Development +----------- +1. Fork the repository from GitHub. +2. Clone your fork to your local machine: -+ http://www.emthemes.com + $ git clone https://github.com/USER/Ffuenf_DeleteOrder +3. Create a git branch -License + $ git checkout -b my_bug_fix + +4. Make your changes/patches/fixes, committing appropriately +5. Push your changes to GitHub +6. Open a Pull Request + +Credits ------- -GNU/GPL \ No newline at end of file +* [tvlgiao (EMThemes)](http://www.emthemes.com) + +License and Author +------------------ + +- Author:: Achim Rosenhagen () +- Copyright:: 2015, ffuenf + +The MIT License (MIT) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/app/code/community/EM/DeleteOrder/Block/Adminhtml/Sales/Order/Grid.php b/app/code/community/EM/DeleteOrder/Block/Adminhtml/Sales/Order/Grid.php deleted file mode 100755 index 70f7f70..0000000 --- a/app/code/community/EM/DeleteOrder/Block/Adminhtml/Sales/Order/Grid.php +++ /dev/null @@ -1,16 +0,0 @@ -getMassactionBlock()->addItem('delete_order', array( - 'label'=> Mage::helper('sales')->__('Delete order'), - 'url' => $this->getUrl('*/sales_order/deleteorder'), - )); - } - return $retValue; - } -} diff --git a/app/code/community/EM/DeleteOrder/Helper/Data.php b/app/code/community/EM/DeleteOrder/Helper/Data.php deleted file mode 100755 index ca76fe9..0000000 --- a/app/code/community/EM/DeleteOrder/Helper/Data.php +++ /dev/null @@ -1,28 +0,0 @@ -bExtensionActive === null) { - $this->bExtensionActive = Mage::getStoreConfigFlag(self::CONFIG_EXTENSION_ACTIVE); - } - return $this->bExtensionActive; - } -} \ No newline at end of file diff --git a/app/code/community/EM/DeleteOrder/Test/Helper/Data.php b/app/code/community/EM/DeleteOrder/Test/Helper/Data.php deleted file mode 100755 index 328fec0..0000000 --- a/app/code/community/EM/DeleteOrder/Test/Helper/Data.php +++ /dev/null @@ -1,24 +0,0 @@ -assertTrue( - Mage::helper('em_deleteorder')->isExtensionActive(), - 'Extension is not active please check config' - ); - } -} \ No newline at end of file diff --git a/app/code/community/EM/DeleteOrder/Test/Helper/Data/fixtures/testIsExtensionActive.yaml b/app/code/community/EM/DeleteOrder/Test/Helper/Data/fixtures/testIsExtensionActive.yaml deleted file mode 100755 index f7a70e0..0000000 --- a/app/code/community/EM/DeleteOrder/Test/Helper/Data/fixtures/testIsExtensionActive.yaml +++ /dev/null @@ -1,2 +0,0 @@ -config: - default/system/em_deleteorder/enable: 1 \ No newline at end of file diff --git a/app/code/community/EM/DeleteOrder/controllers/Adminhtml/Sales/OrderController.php b/app/code/community/EM/DeleteOrder/controllers/Adminhtml/Sales/OrderController.php deleted file mode 100755 index 50afd24..0000000 --- a/app/code/community/EM/DeleteOrder/controllers/Adminhtml/Sales/OrderController.php +++ /dev/null @@ -1,147 +0,0 @@ -getConnection('core_write'); - $orderIds = $this->getRequest()->getPost('order_ids'); - $rsc_tbl = $coreWrite->fetchCol('show tables'); - $quoteId = ''; - - $tbl_sales_flat_order = $coreResource->getTableName('sales_flat_order'); - $tbl_sales_flat_creditmemo_comment = $coreResource->getTableName('sales_flat_creditmemo_comment'); - $tbl_sales_flat_creditmemo_item = $coreResource->getTableName('sales_flat_creditmemo_item'); - $tbl_sales_flat_creditmemo = $coreResource->getTableName('sales_flat_creditmemo'); - $tbl_sales_flat_creditmemo_grid = $coreResource->getTableName('sales_flat_creditmemo_grid'); - $tbl_sales_flat_invoice_comment = $coreResource->getTableName('sales_flat_invoice_comment'); - $tbl_sales_flat_invoice_item = $coreResource->getTableName('sales_flat_invoice_item'); - $tbl_sales_flat_invoice = $coreResource->getTableName('sales_flat_invoice'); - $tbl_sales_flat_invoice_grid = $coreResource->getTableName('sales_flat_invoice_grid'); - $tbl_sales_flat_quote_address_item = $coreResource->getTableName('sales_flat_quote_address_item'); - $tbl_sales_flat_quote_item_option = $coreResource->getTableName('sales_flat_quote_item_option'); - $tbl_sales_flat_quote = $coreResource->getTableName('sales_flat_quote'); - $tbl_sales_flat_quote_address = $coreResource->getTableName('sales_flat_quote_address'); - $tbl_sales_flat_quote_item = $coreResource->getTableName('sales_flat_quote_item'); - $tbl_sales_flat_quote_payment = $coreResource->getTableName('sales_flat_quote_payment'); - $tbl_sales_flat_quote_shipping_rate = $coreResource->getTableName('sales_flat_quote_shipping_rate'); - $tbl_sales_flat_shipment_comment = $coreResource->getTableName('sales_flat_shipment_comment'); - $tbl_sales_flat_shipment_item = $coreResource->getTableName('sales_flat_shipment_item'); - $tbl_sales_flat_shipment_track = $coreResource->getTableName('sales_flat_shipment_track'); - $tbl_sales_flat_shipment = $coreResource->getTableName('sales_flat_shipment'); - $tbl_sales_flat_shipment_grid = $coreResource->getTableName('sales_flat_shipment_grid'); - $tbl_sales_flat_order_address = $coreResource->getTableName('sales_flat_order_address'); - $tbl_sales_flat_order_item = $coreResource->getTableName('sales_flat_order_item'); - $tbl_sales_flat_order_payment = $coreResource->getTableName('sales_flat_order_payment'); - $tbl_sales_flat_order_status_history = $coreResource->getTableName('sales_flat_order_status_history'); - $tbl_sales_flat_order_grid = $coreResource->getTableName('sales_flat_order_grid'); - $tbl_log_quote = $coreResource->getTableName('log_quote'); - $rsc_tbl_l = $coreWrite->fetchCol('SHOW TABLES LIKE ?', '%'.$tbl_log_quote); - $tbl_sales_order_tax = $coreResource->getTableName('sales_order_tax'); - - if (!empty($orderIds)) { - foreach ($orderIds as $orderId) { - $orderId = (int)$orderId; - $order = Mage::getModel('sales/order')->load($orderId); - if($order->increment_id) { - $incId = (int)$order->increment_id; - if (in_array($tbl_sales_flat_order, $rsc_tbl)) { - $rs1 = $coreWrite->fetchAll('SELECT quote_id FROM `'.$tbl_sales_flat_order.'` WHERE entity_id='.$orderId); - $quoteId = (int)$rs1[0]['quote_id']; - } - $coreWrite->raw_query('SET FOREIGN_KEY_CHECKS=1'); - if (in_array($tbl_sales_flat_creditmemo_comment, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_creditmemo_comment.'` WHERE parent_id IN (SELECT entity_id FROM `'.$tbl_sales_flat_creditmemo.'` WHERE order_id='.$orderId.')'); - } - if (in_array('sales_flat_creditmemo_item', $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_creditmemo_item.'` WHERE parent_id IN (SELECT entity_id FROM `'.$tbl_sales_flat_creditmemo.'` WHERE order_id='.$orderId.')'); - } - if (in_array($tbl_sales_flat_creditmemo, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_creditmemo.'` WHERE order_id='.$orderId); - } - if (in_array($tbl_sales_flat_creditmemo_grid, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_creditmemo_grid.'` WHERE order_id='.$orderId); - } - if (in_array($tbl_sales_flat_invoice_comment, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_invoice_comment.'` WHERE parent_id IN (SELECT entity_id FROM `'.$tbl_sales_flat_invoice.'` WHERE order_id='.$orderId.')'); - } - if (in_array($tbl_sales_flat_invoice_item, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_invoice_item.'` WHERE parent_id IN (SELECT entity_id FROM `'.$tbl_sales_flat_invoice.'` WHERE order_id='.$orderId.')'); - } - if (in_array($tbl_sales_flat_invoice, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_invoice.'` WHERE order_id='.$orderId); - } - if (in_array($tbl_sales_flat_invoice_grid, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_invoice_grid.'` WHERE order_id='.$orderId); - } - if ($quoteId) { - if (in_array($tbl_sales_flat_quote_address_item, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_quote_address_item.'` WHERE parent_item_id IN (SELECT address_id FROM `'.$tbl_sales_flat_quote_address.'` WHERE quote_id='.$quoteId.')'); - } - if (in_array($tbl_sales_flat_quote_shipping_rate, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_quote_shipping_rate.'` WHERE address_id IN (SELECT address_id FROM `'.$tbl_sales_flat_quote_address.'` WHERE quote_id='.$quoteId.')'); - } - if (in_array($tbl_sales_flat_quote_item_option, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_quote_item_option.'` WHERE item_id IN (SELECT item_id FROM `'.$tbl_sales_flat_quote_item.'` WHERE quote_id='.$quoteId.')'); - } - if (in_array($tbl_sales_flat_quote, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_quote.'` WHERE entity_id='.$quoteId); - } - if (in_array($tbl_sales_flat_quote_address, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_quote_address.'` WHERE quote_id='.$quoteId); - } - if (in_array($tbl_sales_flat_quote_item, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_quote_item.'` WHERE quote_id='.$quoteId); - } - if (in_array('sales_flat_quote_payment', $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_quote_payment.'` WHERE quote_id='.$quoteId); - } - } - if (in_array($tbl_sales_flat_shipment_comment, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_shipment_comment.'` WHERE parent_id IN (SELECT entity_id FROM `'.$tbl_sales_flat_shipment.'` WHERE order_id='.$orderId.')'); - } - if (in_array($tbl_sales_flat_shipment_item, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_shipment_item.'` WHERE parent_id IN (SELECT entity_id FROM `'.$tbl_sales_flat_shipment.'` WHERE order_id='.$orderId.')'); - } - if (in_array($tbl_sales_flat_shipment_track, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_shipment_track.'` WHERE order_id IN (SELECT entity_id FROM `'.$tbl_sales_flat_shipment.'` WHERE parent_id='.$orderId.')'); - } - if (in_array($tbl_sales_flat_shipment, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_shipment.'` WHERE order_id='.$orderId); - } - if (in_array($tbl_sales_flat_shipment_grid, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_shipment_grid.'` WHERE order_id='.$orderId); - } - if (in_array($tbl_sales_flat_order, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_order.'` WHERE entity_id='.$orderId); - } - if (in_array($tbl_sales_flat_order_address, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_order_address.'` WHERE parent_id='.$orderId); - } - if (in_array($tbl_sales_flat_order_item, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_order_item.'` WHERE order_id='.$orderId); - } - if (in_array($tbl_sales_flat_order_payment, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_order_payment.'` WHERE parent_id='.$orderId); - } - if (in_array($tbl_sales_flat_order_status_history, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_order_status_history.'` WHERE parent_id='.$orderId); - } - if ($incId && in_array($tbl_sales_flat_order_grid, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_order_grid.'` WHERE increment_id='.$incId); - } - if (in_array($tbl_sales_order_tax, $rsc_tbl)) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_order_tax.'` WHERE order_id='.$orderId); - } - if ($quoteId && $rsc_tbl_l) { - $coreWrite->raw_query('DELETE FROM `'.$tbl_log_quote.'` WHERE quote_id='.$quoteId); - } - $coreWrite->raw_query('SET FOREIGN_KEY_CHECKS=1'); - } - } - $this->_getSession()->addSuccess($this->__('Order(s) deleted.')); - } else { - $this->_getSession()->addError($this->__('Order(s) error.')); - } - $this->_redirect('*/*/'); - } -} diff --git a/app/code/community/EM/DeleteOrder/etc/config.xml b/app/code/community/EM/DeleteOrder/etc/config.xml deleted file mode 100755 index c817542..0000000 --- a/app/code/community/EM/DeleteOrder/etc/config.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - 1.0.0 - - - - - - EM_DeleteOrder_Helper - - - - - - /emadmin/adminhtml_sales_order/ - - - - - - EM_DeleteOrder_Block_Adminhtml_Sales_Order_Grid - - - - - - - - admin - - EM_DeleteOrder - emadmin - - - - - - EM_DeleteOrder_Adminhtml - - - - - - - - - 0 - - - - - - - - - - - diff --git a/app/code/community/EM/DeleteOrder/etc/system.xml b/app/code/community/EM/DeleteOrder/etc/system.xml deleted file mode 100755 index 5f9f0ff..0000000 --- a/app/code/community/EM/DeleteOrder/etc/system.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - text - 900 - 1 - 0 - 0 - - - - select - adminhtml/system_config_source_yesno - 1 - 1 - 0 - 0 - - - - - - - - \ No newline at end of file diff --git a/app/code/local/Ffuenf/DeleteOrder/Block/Adminhtml/Sales/Order/Grid.php b/app/code/local/Ffuenf/DeleteOrder/Block/Adminhtml/Sales/Order/Grid.php new file mode 100755 index 0000000..29d8cbf --- /dev/null +++ b/app/code/local/Ffuenf/DeleteOrder/Block/Adminhtml/Sales/Order/Grid.php @@ -0,0 +1,36 @@ + + * @copyright Copyright (c) 2015 ffuenf (http://www.ffuenf.de) + * @license http://opensource.org/licenses/mit-license.php MIT License +*/ + +class Ffuenf_DeleteOrder_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid +{ + + /** + * Adding Delete Order Mass Action + */ + protected function _prepareMassaction() + { + $retValue = parent::_prepareMassaction(); + if ( Mage::helper('ffuenf_deleteorder')->isExtensionActive()) { + $this->getMassactionBlock()->addItem('delete_order', array( + 'label'=> Mage::helper('sales')->__('Delete order'), + 'url' => $this->getUrl('*/sales_order/deleteorder'), + )); + } + return $retValue; + } +} diff --git a/app/code/local/Ffuenf/DeleteOrder/Helper/Core.php b/app/code/local/Ffuenf/DeleteOrder/Helper/Core.php new file mode 100644 index 0000000..8285ee2 --- /dev/null +++ b/app/code/local/Ffuenf/DeleteOrder/Helper/Core.php @@ -0,0 +1,46 @@ + + * @copyright Copyright (c) 2015 ffuenf (http://www.ffuenf.de) + * @license http://opensource.org/licenses/mit-license.php MIT License +*/ + +class Ffuenf_DeleteOrder_Helper_Core extends Mage_Core_Helper_Abstract +{ + /** + * Get a store flag value and set to against the object + * + * @param string $sStoreFlagPath + * @param string $sStoreFlagAttribute + * @return bool + */ + public function getStoreFlag($sStoreFlagPath, $sStoreFlagAttribute) + { + return (bool)$this->getStoreConfig($sStoreFlagPath, $sStoreFlagAttribute); + } + /** + * Get a store config value and set against the object + * + * @param string $sStoreConfigPath + * @param string $sStoreConfigAttribute + * @return string + */ + public function getStoreConfig($sStoreConfigPath, $sStoreConfigAttribute) + { + if ($this->$sStoreConfigAttribute === null) { + $this->$sStoreConfigAttribute = Mage::getStoreConfig($sStoreConfigPath); + } + return $this->$sStoreConfigAttribute; + } +} \ No newline at end of file diff --git a/app/code/local/Ffuenf/DeleteOrder/Helper/Data.php b/app/code/local/Ffuenf/DeleteOrder/Helper/Data.php new file mode 100755 index 0000000..5229f72 --- /dev/null +++ b/app/code/local/Ffuenf/DeleteOrder/Helper/Data.php @@ -0,0 +1,42 @@ + + * @copyright Copyright (c) 2015 ffuenf (http://www.ffuenf.de) + * @license http://opensource.org/licenses/mit-license.php MIT License +*/ + +class Ffuenf_DeleteOrder_Helper_Data extends Ffuenf_Pagespeed_Helper_Core +{ + /** + * Path for the config for extension active status + */ + const CONFIG_EXTENSION_ACTIVE = 'deleteorder/general/enabled'; + + /** + * Variable for if the extension is active + * + * @var bool + */ + protected $bExtensionActive; + + /** + * Check to see if the extension is active + * + * @return bool + */ + public function isExtensionActive() + { + return $this->getStoreFlag(self::CONFIG_EXTENSION_ACTIVE, 'bExtensionActive'); + } +} \ No newline at end of file diff --git a/app/code/local/Ffuenf/DeleteOrder/Test/Helper/Data.php b/app/code/local/Ffuenf/DeleteOrder/Test/Helper/Data.php new file mode 100755 index 0000000..728895e --- /dev/null +++ b/app/code/local/Ffuenf/DeleteOrder/Test/Helper/Data.php @@ -0,0 +1,39 @@ + + * @copyright Copyright (c) 2015 ffuenf (http://www.ffuenf.de) + * @license http://opensource.org/licenses/mit-license.php MIT License +*/ + +/** + * @see Ffuenf_DeleteOrder_Helper_Data + * + * @loadSharedFixture shared + */ +class Ffuenf_DeleteOrder_Test_Helper_Data extends EcomDev_PHPUnit_Test_Case +{ + /** + * Tests is extension active + * + * @test + * @covers Ffuenf_DeleteOrder_Helper_Data::isExtensionActive + */ + public function testIsExtensionActive() + { + $this->assertTrue( + Mage::helper('ffuenf_deleteorder')->isExtensionActive(), + 'Extension is not active please check config' + ); + } +} \ No newline at end of file diff --git a/app/code/local/Ffuenf/DeleteOrder/Test/Helper/Data/fixtures/shared.yaml b/app/code/local/Ffuenf/DeleteOrder/Test/Helper/Data/fixtures/shared.yaml new file mode 100755 index 0000000..1b2b430 --- /dev/null +++ b/app/code/local/Ffuenf/DeleteOrder/Test/Helper/Data/fixtures/shared.yaml @@ -0,0 +1,2 @@ +config: + default/deleteorder/general/enabled: 1 \ No newline at end of file diff --git a/app/code/local/Ffuenf/DeleteOrder/controllers/Adminhtml/Sales/OrderController.php b/app/code/local/Ffuenf/DeleteOrder/controllers/Adminhtml/Sales/OrderController.php new file mode 100755 index 0000000..310fa82 --- /dev/null +++ b/app/code/local/Ffuenf/DeleteOrder/controllers/Adminhtml/Sales/OrderController.php @@ -0,0 +1,167 @@ + + * @copyright Copyright (c) 2015 ffuenf (http://www.ffuenf.de) + * @license http://opensource.org/licenses/mit-license.php MIT License +*/ + +require_once 'Mage/Adminhtml/controllers/Sales/OrderController.php'; + +class Ffuenf_DeleteOrder_Adminhtml_Sales_OrderController extends Mage_Adminhtml_Sales_OrderController +{ + + public function deleteorderAction() + { + $coreResource = Mage::getSingleton('core/resource'); + $coreWrite = $coreResource->getConnection('core_write'); + $orderIds = $this->getRequest()->getPost('order_ids'); + $rsc_tbl = $coreWrite->fetchCol('show tables'); + $quoteId = ''; + $tbl_sales_flat_order = $coreResource->getTableName('sales_flat_order'); + $tbl_sales_flat_creditmemo_comment = $coreResource->getTableName('sales_flat_creditmemo_comment'); + $tbl_sales_flat_creditmemo_item = $coreResource->getTableName('sales_flat_creditmemo_item'); + $tbl_sales_flat_creditmemo = $coreResource->getTableName('sales_flat_creditmemo'); + $tbl_sales_flat_creditmemo_grid = $coreResource->getTableName('sales_flat_creditmemo_grid'); + $tbl_sales_flat_invoice_comment = $coreResource->getTableName('sales_flat_invoice_comment'); + $tbl_sales_flat_invoice_item = $coreResource->getTableName('sales_flat_invoice_item'); + $tbl_sales_flat_invoice = $coreResource->getTableName('sales_flat_invoice'); + $tbl_sales_flat_invoice_grid = $coreResource->getTableName('sales_flat_invoice_grid'); + $tbl_sales_flat_quote_address_item = $coreResource->getTableName('sales_flat_quote_address_item'); + $tbl_sales_flat_quote_item_option = $coreResource->getTableName('sales_flat_quote_item_option'); + $tbl_sales_flat_quote = $coreResource->getTableName('sales_flat_quote'); + $tbl_sales_flat_quote_address = $coreResource->getTableName('sales_flat_quote_address'); + $tbl_sales_flat_quote_item = $coreResource->getTableName('sales_flat_quote_item'); + $tbl_sales_flat_quote_payment = $coreResource->getTableName('sales_flat_quote_payment'); + $tbl_sales_flat_quote_shipping_rate = $coreResource->getTableName('sales_flat_quote_shipping_rate'); + $tbl_sales_flat_shipment_comment = $coreResource->getTableName('sales_flat_shipment_comment'); + $tbl_sales_flat_shipment_item = $coreResource->getTableName('sales_flat_shipment_item'); + $tbl_sales_flat_shipment_track = $coreResource->getTableName('sales_flat_shipment_track'); + $tbl_sales_flat_shipment = $coreResource->getTableName('sales_flat_shipment'); + $tbl_sales_flat_shipment_grid = $coreResource->getTableName('sales_flat_shipment_grid'); + $tbl_sales_flat_order_address = $coreResource->getTableName('sales_flat_order_address'); + $tbl_sales_flat_order_item = $coreResource->getTableName('sales_flat_order_item'); + $tbl_sales_flat_order_payment = $coreResource->getTableName('sales_flat_order_payment'); + $tbl_sales_flat_order_status_history = $coreResource->getTableName('sales_flat_order_status_history'); + $tbl_sales_flat_order_grid = $coreResource->getTableName('sales_flat_order_grid'); + $tbl_log_quote = $coreResource->getTableName('log_quote'); + $rsc_tbl_l = $coreWrite->fetchCol('SHOW TABLES LIKE ?', '%'.$tbl_log_quote); + $tbl_sales_order_tax = $coreResource->getTableName('sales_order_tax'); + + if (!empty($orderIds)) { + foreach ($orderIds as $orderId) { + $orderId = (int)$orderId; + $order = Mage::getModel('sales/order')->load($orderId); + if($order->increment_id) { + $incId = (int)$order->increment_id; + if (in_array($tbl_sales_flat_order, $rsc_tbl)) { + $rs1 = $coreWrite->fetchAll('SELECT quote_id FROM `'.$tbl_sales_flat_order.'` WHERE entity_id='.$orderId); + $quoteId = (int)$rs1[0]['quote_id']; + } + $coreWrite->raw_query('SET FOREIGN_KEY_CHECKS=1'); + if (in_array($tbl_sales_flat_creditmemo_comment, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_creditmemo_comment.'` WHERE parent_id IN (SELECT entity_id FROM `'.$tbl_sales_flat_creditmemo.'` WHERE order_id='.$orderId.')'); + } + if (in_array('sales_flat_creditmemo_item', $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_creditmemo_item.'` WHERE parent_id IN (SELECT entity_id FROM `'.$tbl_sales_flat_creditmemo.'` WHERE order_id='.$orderId.')'); + } + if (in_array($tbl_sales_flat_creditmemo, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_creditmemo.'` WHERE order_id='.$orderId); + } + if (in_array($tbl_sales_flat_creditmemo_grid, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_creditmemo_grid.'` WHERE order_id='.$orderId); + } + if (in_array($tbl_sales_flat_invoice_comment, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_invoice_comment.'` WHERE parent_id IN (SELECT entity_id FROM `'.$tbl_sales_flat_invoice.'` WHERE order_id='.$orderId.')'); + } + if (in_array($tbl_sales_flat_invoice_item, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_invoice_item.'` WHERE parent_id IN (SELECT entity_id FROM `'.$tbl_sales_flat_invoice.'` WHERE order_id='.$orderId.')'); + } + if (in_array($tbl_sales_flat_invoice, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_invoice.'` WHERE order_id='.$orderId); + } + if (in_array($tbl_sales_flat_invoice_grid, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_invoice_grid.'` WHERE order_id='.$orderId); + } + if ($quoteId) { + if (in_array($tbl_sales_flat_quote_address_item, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_quote_address_item.'` WHERE parent_item_id IN (SELECT address_id FROM `'.$tbl_sales_flat_quote_address.'` WHERE quote_id='.$quoteId.')'); + } + if (in_array($tbl_sales_flat_quote_shipping_rate, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_quote_shipping_rate.'` WHERE address_id IN (SELECT address_id FROM `'.$tbl_sales_flat_quote_address.'` WHERE quote_id='.$quoteId.')'); + } + if (in_array($tbl_sales_flat_quote_item_option, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_quote_item_option.'` WHERE item_id IN (SELECT item_id FROM `'.$tbl_sales_flat_quote_item.'` WHERE quote_id='.$quoteId.')'); + } + if (in_array($tbl_sales_flat_quote, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_quote.'` WHERE entity_id='.$quoteId); + } + if (in_array($tbl_sales_flat_quote_address, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_quote_address.'` WHERE quote_id='.$quoteId); + } + if (in_array($tbl_sales_flat_quote_item, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_quote_item.'` WHERE quote_id='.$quoteId); + } + if (in_array('sales_flat_quote_payment', $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_quote_payment.'` WHERE quote_id='.$quoteId); + } + } + if (in_array($tbl_sales_flat_shipment_comment, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_shipment_comment.'` WHERE parent_id IN (SELECT entity_id FROM `'.$tbl_sales_flat_shipment.'` WHERE order_id='.$orderId.')'); + } + if (in_array($tbl_sales_flat_shipment_item, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_shipment_item.'` WHERE parent_id IN (SELECT entity_id FROM `'.$tbl_sales_flat_shipment.'` WHERE order_id='.$orderId.')'); + } + if (in_array($tbl_sales_flat_shipment_track, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_shipment_track.'` WHERE order_id IN (SELECT entity_id FROM `'.$tbl_sales_flat_shipment.'` WHERE parent_id='.$orderId.')'); + } + if (in_array($tbl_sales_flat_shipment, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_shipment.'` WHERE order_id='.$orderId); + } + if (in_array($tbl_sales_flat_shipment_grid, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_shipment_grid.'` WHERE order_id='.$orderId); + } + if (in_array($tbl_sales_flat_order, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_order.'` WHERE entity_id='.$orderId); + } + if (in_array($tbl_sales_flat_order_address, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_order_address.'` WHERE parent_id='.$orderId); + } + if (in_array($tbl_sales_flat_order_item, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_order_item.'` WHERE order_id='.$orderId); + } + if (in_array($tbl_sales_flat_order_payment, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_order_payment.'` WHERE parent_id='.$orderId); + } + if (in_array($tbl_sales_flat_order_status_history, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_order_status_history.'` WHERE parent_id='.$orderId); + } + if ($incId && in_array($tbl_sales_flat_order_grid, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_flat_order_grid.'` WHERE increment_id='.$incId); + } + if (in_array($tbl_sales_order_tax, $rsc_tbl)) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_sales_order_tax.'` WHERE order_id='.$orderId); + } + if ($quoteId && $rsc_tbl_l) { + $coreWrite->raw_query('DELETE FROM `'.$tbl_log_quote.'` WHERE quote_id='.$quoteId); + } + $coreWrite->raw_query('SET FOREIGN_KEY_CHECKS=1'); + } + } + $this->_getSession()->addSuccess($this->__('Order(s) deleted.')); + } else { + $this->_getSession()->addError($this->__('Order(s) error.')); + } + $this->_redirect('*/*/'); + } +} diff --git a/app/code/local/Ffuenf/DeleteOrder/etc/config.xml b/app/code/local/Ffuenf/DeleteOrder/etc/config.xml new file mode 100755 index 0000000..a844cdf --- /dev/null +++ b/app/code/local/Ffuenf/DeleteOrder/etc/config.xml @@ -0,0 +1,60 @@ + + + + + 2.0.0 + + + + + + Ffuenf_DeleteOrder_Helper + + + + + + /deleteorder/adminhtml_sales_order/ + + + + + + Ffuenf_DeleteOrder_Block_Adminhtml_Sales_Order_Grid + + + + + + + + admin + + Ffuenf_DeleteOrder + deleteorder + + + + + + Ffuenf_DeleteOrder_Adminhtml + + + + + + + + + 0 + + + + + + + + + + + diff --git a/app/code/local/Ffuenf/DeleteOrder/etc/system.xml b/app/code/local/Ffuenf/DeleteOrder/etc/system.xml new file mode 100755 index 0000000..639ecb4 --- /dev/null +++ b/app/code/local/Ffuenf/DeleteOrder/etc/system.xml @@ -0,0 +1,55 @@ + + + + + + + 508 + + + + + ffuenf + + 10 + 1 + 1 + 1 + + + + 1000 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 10 + 1 + + + + + + + \ No newline at end of file diff --git a/app/etc/config.xml b/app/etc/config.xml deleted file mode 100755 index 4605ff2..0000000 --- a/app/etc/config.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - 1.0.0 - - - - - - - /emadmin/adminhtml_sales_order/ - - - - - - EM_DeleteOrder_Block_Adminhtml_Sales_Order_Grid - - - - - - - - admin - - EM_DeleteOrder - emadmin - - - - - - EM_DeleteOrder_Adminhtml - - - - - - - - - - - - - diff --git a/app/etc/modules/EM_DeleteOrder.xml b/app/etc/modules/EM_DeleteOrder.xml deleted file mode 100755 index f97448e..0000000 --- a/app/etc/modules/EM_DeleteOrder.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - true - community - - - diff --git a/app/etc/modules/Ffuenf_DeleteOrder.xml b/app/etc/modules/Ffuenf_DeleteOrder.xml new file mode 100755 index 0000000..9085010 --- /dev/null +++ b/app/etc/modules/Ffuenf_DeleteOrder.xml @@ -0,0 +1,27 @@ + + + + + + true + local + + + \ No newline at end of file diff --git a/composer.json b/composer.json index a0e6a6a..396d0aa 100755 --- a/composer.json +++ b/composer.json @@ -1,13 +1,20 @@ { - "name": "ffuenf/EM_DeleteOrder", - "license": "OSL-3.0", + "name": "Ffuenf/Ffuenf_DeleteOrder", + "license": "MIT", + "description": "Enhance Magento feature with ability to delete orders", + "authors": [ + { + "name": "Achim Rosenhagen", + "email": "a.rosenhagen@ffuenf.de" + } + ], "type": "magento-module", "require": { - "magento-hackathon/magento-composer-installer": "*", + "aoepeople/composer-installers": "*", "colinmollenhour/modman": "*" }, "require-dev": { - "phpunit/phpunit": "3.7.*" + "phpunit/phpunit": "4.*" }, "repositories": [ { @@ -16,6 +23,16 @@ } ], "extra": { - "magento-root-dir": "./magento/" + "magento-root-dir": "./magento/", + "map": [ + [ + "app/code/local/Ffuenf/DeleteOrder", + "app/code/local/Ffuenf/DeleteOrder" + ], + [ + "app/etc/modules/Ffuenf_DeleteOrder.xml", + "app/etc/modules/Ffuenf_DeleteOrder.xml" + ] + ] } } \ No newline at end of file diff --git a/modman b/modman index 4415f19..35b72e8 100644 --- a/modman +++ b/modman @@ -1,2 +1,2 @@ -app/code/community/EM/DeleteOrder app/code/community/EM/DeleteOrder -app/etc/modules/EM_DeleteOrder.xml app/etc/modules/EM_DeleteOrder.xml \ No newline at end of file +app/code/local/Ffuenf/DeleteOrder app/code/local/Ffuenf/DeleteOrder +app/etc/modules/Ffuenf_DeleteOrder.xml app/etc/modules/Ffuenf_DeleteOrder.xml \ No newline at end of file diff --git a/package.xml b/package.xml deleted file mode 100644 index f9a60b1..0000000 --- a/package.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - EM_DeleteOrder - connect.magentocommerce.com/community - Enhance Magento feature with ability to delete orders - Enhance Magento feature with ability to delete orders - - EMThemes - tvlgiao - tvlgiao@gmail.com - yes - - 2011-03-07 - - - 1.0.5 - 1.0 - - - stable - stable - - GNU/GPL - Version 1.0.5: -- Support delete non-numeric order number. - -Version 1.0.4: -- Refactor directory structure. -- Fix bug not work if tables have prefix. -- Fix bug not work if backend url is not admin/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5.2 - 6.0 - - - 1.6.2 - - - - - diff --git a/uninstall.sql b/uninstall.sql new file mode 100755 index 0000000..ad6b739 --- /dev/null +++ b/uninstall.sql @@ -0,0 +1,3 @@ +-- add table prefix if you have one +DELETE FROM core_config_data WHERE path like 'deleteorder/%'; +DELETE FROM core_resource WHERE code = 'deleteorder_setup'; \ No newline at end of file